@tivio/sdk-react 3.5.1 → 3.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/README.md +11 -2
  2. package/README.md.bak +11 -2
  3. package/dist/index.d.ts +1729 -21
  4. package/dist/index.js +1 -1
  5. package/package.json +10 -7
  6. package/dist/components/ContextProvider.d.ts +0 -7
  7. package/dist/components/PlayerProvider.d.ts +0 -19
  8. package/dist/components/TivioProvider.d.ts +0 -16
  9. package/dist/components/TivioWidget.d.ts +0 -7
  10. package/dist/components/TivioWidgetError.d.ts +0 -10
  11. package/dist/components/TivioWidgetLoader.d.ts +0 -6
  12. package/dist/components/TvTivioProvider.d.ts +0 -7
  13. package/dist/components/context/ChannelsContext.d.ts +0 -6
  14. package/dist/components/context/RowItemsContext.d.ts +0 -7
  15. package/dist/components/context/ScreensContext.d.ts +0 -6
  16. package/dist/components/context/SectionsContext.d.ts +0 -6
  17. package/dist/components/context/VideosContext.d.ts +0 -6
  18. package/dist/components/context/index.d.ts +0 -5
  19. package/dist/components/context/types.d.ts +0 -27
  20. package/dist/components/hooks/contentHooks.d.ts +0 -68
  21. package/dist/components/hooks/index.d.ts +0 -22
  22. package/dist/components/hooks/playerHooks.d.ts +0 -28
  23. package/dist/components/hooks/useApplyInviteCode.d.ts +0 -17
  24. package/dist/components/hooks/useCancelSubscription.d.ts +0 -2
  25. package/dist/components/hooks/useError.d.ts +0 -9
  26. package/dist/components/hooks/useFreePurchase.d.ts +0 -4
  27. package/dist/components/hooks/useIsMonetizationPurchased.d.ts +0 -3
  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 -14
  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 -5
  42. package/dist/components/hooks/useVoucher.d.ts +0 -42
  43. package/dist/components/hooks/useWatchWithoutAdsOffer.d.ts +0 -4
  44. package/dist/config.d.ts +0 -20
  45. package/dist/info.d.ts +0 -2
  46. package/dist/services/bundleLoader.d.ts +0 -15
  47. package/dist/services/bundlePromise.d.ts +0 -7
  48. package/dist/services/dependencyResolver.d.ts +0 -24
  49. package/dist/services/gdpr.d.ts +0 -1
  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 -444
  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 -174
  63. package/doc/changelog.md +0 -0
package/dist/index.d.ts CHANGED
@@ -1,21 +1,1729 @@
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';
21
- export { showGdprConsentPreferences } from './services/gdpr';
1
+ import { ComponentType } from 'react';
2
+ import { default as firebase_2 } from 'firebase';
3
+ import type { default as firebase_3 } from 'firebase/app';
4
+ import { FunctionComponentElement } from 'react';
5
+ import { OrderByDirection } from '@firebase/firestore-types';
6
+ import { default as React_2 } from 'react';
7
+ import { WhereFilterOp } from '@firebase/firestore-types';
8
+
9
+ declare type AdSegment = {
10
+ id: string;
11
+ /**
12
+ * @deprecated alias to secondsToEnd * 1000
13
+ */
14
+ remainingMs: number;
15
+ secondsToEnd: number;
16
+ secondsToSkippable: number | null;
17
+ canSeek: boolean;
18
+ /**
19
+ * true if is skippable and skip countdown has passed
20
+ */
21
+ canSkip: boolean;
22
+ /**
23
+ * true ad if is skippable after some skipDelayMs (if it is skippable, skipDelayMs is defined)
24
+ */
25
+ isSkippable: boolean;
26
+ skip: () => any;
27
+ };
28
+
29
+ export declare type AdSource = {
30
+ new (uri: string, name: string, description: string, skipDelayMs: number | null, adDurationMs: number, trackingContext?: any, // internal Tivio types
31
+ adMarker?: any, // internal Tivio types
32
+ packInfo?: any, // internal Tivio types
33
+ provider?: any): AdSource;
34
+ description: string;
35
+ name: string;
36
+ uri: string;
37
+ durationMs: number;
38
+ skipDelayMs: number | null;
39
+ type: 'ad';
40
+ /**
41
+ * true if is skippable and skip countdown has passed
42
+ */
43
+ canSkip: boolean;
44
+ /**
45
+ * true ad if is skippable after some skipDelayMs (if it is skippable, skipDelayMs is defined)
46
+ */
47
+ isSkippable: boolean;
48
+ /**
49
+ * Skip ad. Only works when canSkip is true
50
+ */
51
+ skip: () => void;
52
+ /**
53
+ * Order in ad break (ad break is a group of ads played right after each other)
54
+ */
55
+ order: number;
56
+ /**
57
+ * Total number of ads in ad break (ad break is a group of ads played right after each other)
58
+ */
59
+ totalCount: number;
60
+ secondsToEnd: number;
61
+ secondsToSkippable: number | null;
62
+ };
63
+
64
+ /**
65
+ * Index names in Algolia search engine.
66
+ *
67
+ * @public
68
+ */
69
+ export declare enum ALGOLIA_INDEX_NAME {
70
+ VIDEOS = "videos",
71
+ VIDEOSDESC = "videos_created_desc",
72
+ TAGS = "tags",
73
+ TV_CHANNELS = "tvChannels",
74
+ USERS = "users"
75
+ }
76
+
77
+ declare interface Asset {
78
+ background: string;
79
+ }
80
+
81
+ declare type Assets = {
82
+ [assetName: string]: ScalableAsset;
83
+ };
84
+
85
+ declare type AuthOverlayPayload = {
86
+ prefilledData?: {
87
+ email: string;
88
+ };
89
+ /**
90
+ * "Goto" function (see router.utils.ts) to run after the overlay is closed. Null if no redirect is required.
91
+ * Defaults to homepage.
92
+ */
93
+ redirectAfterSubmit?: ((...args: any[]) => void) | null;
94
+ };
95
+
96
+ declare type AuthOverlayState = {
97
+ type: AuthOverlayType;
98
+ closeAuthOverlay: () => void;
99
+ openAuthOverlay: (type: AuthOverlayType, payload?: AuthOverlayPayload) => void;
100
+ payload?: AuthOverlayPayload | null;
101
+ };
102
+
103
+ declare type AuthOverlayType = 'login' | 'registration' | 'closed' | 'reset-password';
104
+
105
+ declare interface AvailableSeason {
106
+ seasonNumber: number;
107
+ }
108
+
109
+ export declare type BadRequestError = Error & {
110
+ details?: {
111
+ reason?: 'DOES_NOT_EXIST' | 'EXPIRED' | 'ALREADY_USED';
112
+ };
113
+ };
114
+
115
+ export declare type BetOffer = {
116
+ betService: string;
117
+ league: string;
118
+ odds: {
119
+ winner: string;
120
+ rate: number;
121
+ }[];
122
+ sport: string;
123
+ opponent1: string;
124
+ opponent2: string;
125
+ time: Date;
126
+ };
127
+
128
+ /**
129
+ * rejects when bundle is not available
130
+ */
131
+ export declare const bundlePromise: Promise<RemoteBundleState>;
132
+
133
+ export declare type Channel = {
134
+ id: string;
135
+ name: string;
136
+ header: string;
137
+ headerLogo: string;
138
+ recentVideos: Video[];
139
+ };
140
+
141
+ declare interface Channel_2 {
142
+ }
143
+
144
+ export declare const ChannelsContext: React_2.Context<DataState<Channel_2>>;
145
+
146
+ export declare type ChannelSource = {
147
+ new (uri: string, originalOptions: Record<string, any>, channelName: string, programName: string, programDescription: string, from: Date, to: Date): ChannelSource;
148
+ description: string;
149
+ name: string;
150
+ uri: string;
151
+ from: Date;
152
+ channelName: string;
153
+ to: Date;
154
+ type: 'channel';
155
+ watchWithoutAdsRecommendation: {
156
+ showPurchaseDialog: () => void;
157
+ } | null;
158
+ };
159
+
160
+ declare interface ChannelSource_2 {
161
+ type: 'ChannelSource';
162
+ uri: string;
163
+ originalOptions: any;
164
+ channelName: string;
165
+ programName: string;
166
+ programDescription: string;
167
+ from: Date;
168
+ to: Date;
169
+ poster?: string;
170
+ }
171
+
172
+ export declare interface ChannelSourcePojo {
173
+ type: 'ChannelSource';
174
+ uri: string;
175
+ originalOptions: any;
176
+ channelName: string;
177
+ programName: string;
178
+ programDescription: string;
179
+ from: Date;
180
+ to: Date;
181
+ poster?: string;
182
+ }
183
+
184
+ export declare type Chapter = any;
185
+
186
+ export declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'capabilitiesOptions' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose' | 'forceCloudFnResolver'> & {
187
+ deviceCapabilities: PlayerCapability[] | 'auto';
188
+ /**
189
+ * @private
190
+ * Run HTML, CSS and JS feature support check
191
+ */
192
+ runFeatureSupportCheck?: boolean;
193
+ };
194
+
195
+ declare type CoverPadding = {
196
+ top?: number;
197
+ bottom?: number;
198
+ left?: number;
199
+ right?: number;
200
+ };
201
+
202
+ export declare const createPubSub: () => PubSub;
203
+
204
+ /**
205
+ * Fetch & load CommonJS remote module.
206
+ */
207
+ export declare const createRemotePackageLoader: () => (secret: string, conf: InternalConfig) => Promise<TivioBundle>;
208
+
209
+ export declare const createUseRemoteBundle: () => (conf: InternalConfig) => RemoteBundleState;
210
+
211
+ declare type CreateUserWithEmailAndPassword = (email: string, password: string, username?: string, referralToken?: string) => Promise<string | null>;
212
+
213
+ export declare type Currency = 'CZK' | 'EUR' | 'USD';
214
+
215
+ export declare enum CUSTOMER_BUILD {
216
+ OKTAGON = "OKTAGON",
217
+ JOJ = "JOJ",
218
+ MALL = "MALL",
219
+ GARAZ = "GARAZ",
220
+ U_KULATEHO_STOLU = "U_KULATEHO_STOLU",
221
+ INVESTOREES = "INVESTOREES"
222
+ }
223
+
224
+ declare interface DataState<T> {
225
+ data: {
226
+ [key: string]: HookData<T>;
227
+ };
228
+ setData: (key: string, data: HookData<T>) => void;
229
+ }
230
+
231
+ declare type DefaultOrderByField = 'created';
232
+
233
+ declare type DetailedPrice = {
234
+ amount: number;
235
+ currency: Currency;
236
+ frequency?: MONETIZATION_FREQUENCY;
237
+ };
238
+
239
+ export declare type Disposer = () => void;
240
+
241
+ declare type Disposer_2 = () => void;
242
+
243
+ declare type DocumentOptions = Partial<{
244
+ lazyLoading: boolean;
245
+ subscribeOnChanges: boolean;
246
+ }>;
247
+
248
+ export declare type Empty = void | Promise<void> | undefined | Promise<undefined>;
249
+
250
+ export declare type Events = {
251
+ 'on-ready': RemoteBundleState;
252
+ 'on-error': Error;
253
+ };
254
+
255
+ export declare type ExternalTvConfig = {
256
+ logo: string;
257
+ };
258
+
259
+ /**
260
+ * @throws if fetch fails
261
+ */
262
+ export declare const fetchBundle: (secret: string, conf: InternalConfig) => Promise<string>;
263
+
264
+ /**
265
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
266
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
267
+ */
268
+ declare type FetchPackage = (url: string) => Promise<string>;
269
+
270
+ export declare interface GenericOnCallError {
271
+ code: string;
272
+ message?: string;
273
+ details?: string[];
274
+ }
275
+
276
+ /**
277
+ * Share singleton instance
278
+ */
279
+ export declare const getPubSub: () => PubSub;
280
+
281
+ declare interface HookData<T> {
282
+ data: PaginationData<T> | null;
283
+ error: Error | null;
284
+ isLoading: boolean;
285
+ }
286
+
287
+ export declare type InputSource = AdSource | ChannelSource | VodTivioSource | VodExternalSource;
288
+
289
+ export declare type InternalConfig = {
290
+ /**
291
+ * @private URL of remote code bundle to be fetched directly (without using resolver)
292
+ */
293
+ bundleUrlOverride?: string;
294
+ currency: Currency;
295
+ /**
296
+ * Tells Tivio which technologies/protocols etc. is the device capable to play.
297
+ * If not provided, Tivio will try to guess it (based on the browser).
298
+ */
299
+ deviceCapabilities: PlayerCapability[];
300
+ /**
301
+ * Additional options for deviceCapabilities
302
+ */
303
+ capabilitiesOptions?: {
304
+ /**
305
+ * Should the player prefer HTTP sources instead HTTPs if they are available.
306
+ * This can be used on platforms that support mixed content but do not support
307
+ * specific HTTPS certificates. (e.g. certificates from Letsencrypt not supported on LG TVs)
308
+ */
309
+ preferHttp?: boolean;
310
+ };
311
+ disableUnmounting?: boolean;
312
+ enable?: boolean;
313
+ enableSentry?: boolean;
314
+ ErrorComponent?: ComponentType<{
315
+ error: string | null;
316
+ }>;
317
+ fetchPackage: FetchPackage;
318
+ language?: LangCode;
319
+ LoaderComponent?: ComponentType;
320
+ logger?: Logger | null;
321
+ pubSub: PubSub;
322
+ /**
323
+ * @private URL of resolver. Resolver is a script used to fetch remove code bundle
324
+ */
325
+ resolverUrl: string;
326
+ sdkVersion: string;
327
+ secret: string | null;
328
+ verbose?: boolean;
329
+ /**
330
+ * @private
331
+ */
332
+ forceCloudFnResolver?: boolean;
333
+ };
334
+
335
+ declare interface IntroMarker {
336
+ marker: Marker;
337
+ skip: () => void;
338
+ }
339
+
340
+ declare type ItemsInRow = Tag | Video | TvChannel;
341
+
342
+ /**
343
+ * Enum of all supported languages codes as in ISO 639-1
344
+ */
345
+ export declare enum LangCode {
346
+ CS = "cs",
347
+ DE = "de",
348
+ EN = "en",
349
+ FR = "fr",
350
+ PL = "pl",
351
+ SK = "sk",
352
+ SP = "sp"
353
+ }
354
+
355
+ declare type LinkedVideo = {
356
+ video: Video;
357
+ type: 'CUT' | 'TRAILER' | 'BONUS' | 'CHILD';
358
+ };
359
+
360
+ declare interface Logger {
361
+ /** important messages */
362
+ warn(...data: LoggerArgs): void;
363
+ /** errors */
364
+ error(...data: LoggerArgs): void;
365
+ /** critical errors */
366
+ exception(...data: LoggerArgs): void;
367
+ /** metrics */
368
+ info(...data: LoggerArgs): void;
369
+ /** non-production messages */
370
+ debug(...data: LoggerArgs): void;
371
+ }
372
+
373
+ /**
374
+ * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
375
+ * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
376
+ */
377
+ declare type LoggerArgs = any[];
378
+
379
+ export declare type Marker = {
380
+ id: string;
381
+ type: string;
382
+ from: Date;
383
+ to: Date;
384
+ count?: number;
385
+ fromMs?: number;
386
+ toMs?: number;
387
+ };
388
+
389
+ export declare interface Monetization {
390
+ id: string;
391
+ price?: string | number;
392
+ type?: MonetizationType;
393
+ frequency?: MONETIZATION_FREQUENCY;
394
+ name?: string;
395
+ description?: string;
396
+ benefits?: Translation[];
397
+ localizedBenefits?: string[];
398
+ }
399
+
400
+ declare enum MONETIZATION_FREQUENCY {
401
+ ONE_TIME_PAYMENT = "ONE_TIME_PAYMENT",
402
+ DAILY = "DAILY",
403
+ WEEKLY = "WEEKLY",
404
+ MONTHLY = "MONTHLY",
405
+ ANNUALLY = "ANNUALLY"
406
+ }
407
+
408
+ declare type MonetizationType = 'advertisement' | 'transaction' | 'subscription';
409
+
410
+ /**
411
+ * TODO: Duplicate, because we can't import types from core-js.
412
+ */
413
+ export declare type NewVoucher = {
414
+ expirationDate: Date | number;
415
+ };
416
+
417
+ export declare type Nullable<T> = {
418
+ [P in keyof T]: T[P] | null;
419
+ };
420
+
421
+ declare interface OrderBy {
422
+ field: string;
423
+ directionStr?: OrderByDirection;
424
+ }
425
+
426
+ declare type PaginationData<T> = {
427
+ items: T[];
428
+ hasNextPage: boolean;
429
+ fetchMore: Function;
430
+ };
431
+
432
+ declare type PaginationInterface<Entity> = {
433
+ items: Entity[];
434
+ fetchMore: () => void;
435
+ hasNextPage?: boolean;
436
+ loading?: boolean;
437
+ };
438
+
439
+ declare type PaginationOptions = Partial<{
440
+ limit: number;
441
+ noLimit: boolean;
442
+ }>;
443
+
444
+ export declare enum PLATFORM {
445
+ MOBILE = "MOBILE",
446
+ WEB = "WEB",
447
+ TV = "TV"
448
+ }
449
+
450
+ export declare interface PlayerCapability {
451
+ codec: 'h264' | 'h265';
452
+ encryption: 'fairplay' | 'none' | 'playready' | 'widevine';
453
+ protocol: 'dash' | 'hls';
454
+ }
455
+
456
+ export declare interface PlayerInterface {
457
+ pause: () => void;
458
+ /**
459
+ * unpause
460
+ */
461
+ play: () => void;
462
+ /**
463
+ * @param {number} ms - milliseconds relative to start of video (relative to 0 ms)
464
+ * or in case of TV programs relative to start of the program (relative to source.from ms)
465
+ */
466
+ seekTo: (ms: number) => void;
467
+ /**
468
+ * Source to be passed to player.
469
+ *
470
+ * Depending on autoplay settings it should either start playing
471
+ * immediately or just be loaded by player and stay paused.
472
+ */
473
+ setSource: (source: InputSource | null) => void;
474
+ /**
475
+ * volume in [0,1]
476
+ */
477
+ setVolume?: (volume: number) => void;
478
+ mute?: () => void;
479
+ /**
480
+ * restore volume to previous value
481
+ */
482
+ unmute?: () => void;
483
+ }
484
+
485
+ export declare const PlayerProvider: ({ children, playerWrapperId, }: PlayerProviderProps) => FunctionComponentElement<PlayerProviderProps>;
486
+
487
+ export declare type PlayerProviderProps = {
488
+ children: React_2.ReactNode;
489
+ playerWrapperId?: string;
490
+ };
491
+
492
+ declare type PlayerState = 'playing' | 'paused' | 'idle';
493
+
494
+ export declare type PlayerWrapper = {
495
+ /**
496
+ * Report that playback of video has finished
497
+ */
498
+ onPlaybackEnded: () => void;
499
+ /**
500
+ * Report video progress in milliseconds
501
+ */
502
+ onTimeChanged: (ms: number) => void;
503
+ /**
504
+ * Report that video state changed
505
+ */
506
+ onStateChanged: (state: PlayerState) => void;
507
+ /**
508
+ * Send source to Tivio
509
+ */
510
+ onSourceChanged: (source: InputSource | null) => void;
511
+ /**
512
+ * Report that video failed to load (never started playing)
513
+ */
514
+ onLoadError: (error: Error) => void;
515
+ /**
516
+ * Report that video failed during playback (successfully loaded and then failed, e.g. part of stream is invalid)
517
+ */
518
+ onError: (error: Error) => void;
519
+ /**
520
+ * Unpause video
521
+ */
522
+ play: () => void;
523
+ /**
524
+ * Pause video
525
+ */
526
+ pause: () => void;
527
+ /**
528
+ * Currently playing source
529
+ */
530
+ source: InputSource | null;
531
+ events: {
532
+ isSupported: (even: string) => boolean;
533
+ addListener: <T = any>(event: string, cb: (value: T) => Empty) => void;
534
+ removeListener: <T = any>(event: string, cb: (value: T) => Empty) => void;
535
+ removeAllListeners: () => void;
536
+ };
537
+ /**
538
+ * Register a low level player that implements player methods, like play video, change volume, etc.
539
+ */
540
+ register: (playerInterface: PlayerInterface) => void;
541
+ /**
542
+ * duration of current source in ms (both setter and getter)
543
+ */
544
+ durationMs: number | null;
545
+ isPlaybackStarted: boolean;
546
+ isPaused: boolean;
547
+ isPlaying: boolean;
548
+ isIdle: boolean;
549
+ error: Error | null;
550
+ /**
551
+ * Replay the video that finished playback
552
+ */
553
+ replay: () => void;
554
+ /**
555
+ * Retry to play a video that failed to start playing (e.g. due to a network error)
556
+ */
557
+ retry: () => void;
558
+ togglePlayPause: () => void;
559
+ seekTo: (ms: number) => void;
560
+ /**
561
+ * set volume to value between 0,1
562
+ */
563
+ setVolume: (volume: number) => void;
564
+ /**
565
+ * change volume by value between -1,1
566
+ */
567
+ changeVolumeBy: (volume: number) => void;
568
+ setMuted: (muted: boolean) => void;
569
+ toggleMuted: () => void;
570
+ };
571
+
572
+ export declare interface PubSub {
573
+ publish: <K extends keyof Events>(triggerName: K, payload: Events[K]) => Empty;
574
+ subscribe: <K extends keyof Events>(triggerName: K, onMessage: (data: Events[K]) => Empty) => Disposer;
575
+ }
576
+
577
+ export declare type Purchase = {
578
+ isPurchased: boolean;
579
+ monetizationId: string;
580
+ videoId: string;
581
+ status: string;
582
+ video: Video | null;
583
+ };
584
+
585
+ declare type Purchase_2 = {
586
+ id: string;
587
+ isPurchased: boolean;
588
+ monetizationRef: firebase_3.firestore.DocumentReference | null;
589
+ monetization: PurchaseMonetization | null;
590
+ monetizationId: string | null;
591
+ type: MonetizationType | null;
592
+ videoId: string | null;
593
+ status: PurchaseStatus | null;
594
+ video: Video | null;
595
+ videoRef: firebase_3.firestore.DocumentReference | null;
596
+ expirationDate: Date | null;
597
+ isExpired: boolean;
598
+ voucherId?: string;
599
+ };
600
+
601
+ declare type PurchaseMonetization = {
602
+ currency: Currency;
603
+ period: number;
604
+ price: number;
605
+ type: MonetizationType;
606
+ title: string;
607
+ frequency: MONETIZATION_FREQUENCY | null;
608
+ /**
609
+ * If set, purchase (subscription) activated by voucher will stay valid for this amount of seconds.
610
+ * Otherwise, purchase will be valid for one "monetization frequency" period.
611
+ */
612
+ voucherPurchaseDuration?: number;
613
+ };
614
+
615
+ declare enum PurchaseStatus {
616
+ NEW = "NEW",
617
+ PAID = "PAID",
618
+ CANCELLED = "CANCELLED",
619
+ ERROR = "ERROR"
620
+ }
621
+
622
+ export declare interface QerkoCancellationInfo {
623
+ purchaseId: string;
624
+ status: PurchaseStatus;
625
+ }
626
+
627
+ export declare interface QerkoData {
628
+ monetization: Monetization;
629
+ video?: Video;
630
+ onPurchase?: () => void;
631
+ onClose?: () => void;
632
+ }
633
+
634
+ export declare interface QerkoOverlayState {
635
+ data: QerkoData | null;
636
+ openQerkoOverlay: ((data: QerkoData) => void);
637
+ closeQerkoOverlay: () => void;
638
+ }
639
+
640
+ export declare interface QerkoPaymentInfo {
641
+ webPaymentGatewayLink: string;
642
+ gatewayUri: string;
643
+ paymentQRCodeUri: string;
644
+ purchaseId: string;
645
+ currency: string;
646
+ amount: number;
647
+ monetizationType: MonetizationType;
648
+ recovery?: boolean;
649
+ monetizationFrequency: MONETIZATION_FREQUENCY;
650
+ }
651
+
652
+ declare interface QerkoTransaction {
653
+ paymentInfo: QerkoPaymentInfo | null;
654
+ paymentError: string | null;
655
+ paymentStatus: string | null;
656
+ getPaymentInfo: () => Promise<void>;
657
+ voucherId?: string;
658
+ }
659
+
660
+ export declare type RemoteBundleState = {
661
+ config: InternalConfig;
662
+ error: string | null;
663
+ settings: Settings;
664
+ state: 'loading' | 'error' | 'ready';
665
+ } & Nullable<TivioBundle>;
666
+
667
+ export declare type RemoteProviderProps = {
668
+ disableUnmounting?: boolean;
669
+ language?: string;
670
+ };
671
+
672
+ export declare interface RouterOverrides {
673
+ goToVideoDetailPage: (videoId: string) => void;
674
+ goToSeriesDetailPage: (tagId: string) => void;
675
+ goToTagPage: (tagId: string) => void;
676
+ goToLoginScreen: () => void;
677
+ goBack: () => void;
678
+ goLivePlayer: (videoId: string) => void;
679
+ goVodPlayer: (tvChannelId: string) => void;
680
+ }
681
+
682
+ export declare interface RouterOverridesContextState {
683
+ routerOverrides: RouterOverrides;
684
+ }
685
+
686
+ declare interface Row {
687
+ id: string;
688
+ rowId: string;
689
+ name: string;
690
+ description?: string;
691
+ itemComponent: RowItemComponent;
692
+ rowComponent: RowComponent;
693
+ assets: Assets;
694
+ type: ScreenRowType;
695
+ }
696
+
697
+ export declare enum ROW_ITEM_TYPES {
698
+ VIDEO = "VIDEO",
699
+ TAG = "TAG",
700
+ TV_CHANNEL = "TV_CHANNEL"
701
+ }
702
+
703
+ declare enum RowComponent {
704
+ ROW = "ROW",
705
+ BANNER = "BANNER"
706
+ }
707
+
708
+ declare interface RowItem extends RowItemAssets {
709
+ itemType: ROW_ITEM_TYPES;
710
+ name?: string;
711
+ description?: string;
712
+ assets: Assets | null;
713
+ }
714
+
715
+ declare interface RowItemAssets {
716
+ landscape?: string | null;
717
+ portrait?: string | null;
718
+ circled?: string | null;
719
+ banner?: string | null;
720
+ }
721
+
722
+ declare enum RowItemComponent {
723
+ ROW_ITEM_PORTRAIT = "ROW_ITEM_PORTRAIT",
724
+ ROW_ITEM_LANDSCAPE = "ROW_ITEM_LANDSCAPE",
725
+ ROW_ITEM_CIRCLED = "ROW_ITEM_CIRCLED"
726
+ }
727
+
728
+ declare type ScalableAsset = {
729
+ '@1': Asset;
730
+ '@2'?: Asset;
731
+ '@3'?: Asset;
732
+ };
733
+
734
+ declare interface Screen_2 {
735
+ id: string;
736
+ name: string;
737
+ description?: string;
738
+ assets: Assets;
739
+ rows: Row[];
740
+ }
741
+
742
+ declare type ScreenOptions = Partial<{
743
+ language: LangCode;
744
+ initRows: boolean;
745
+ }> & DocumentOptions;
746
+
747
+ declare type ScreenRowType = 'filter' | 'custom' | 'continueToWatch' | 'favourites';
748
+
749
+ export declare type Section = {
750
+ id: string;
751
+ name: string;
752
+ channel: Channel;
753
+ videos: Video[];
754
+ };
755
+
756
+ declare interface Section_2 {
757
+ }
758
+
759
+ export declare const SectionsContext: React_2.Context<DataState<Section_2>>;
760
+
761
+ export declare type Settings = {
762
+ /**
763
+ * @deprecated TIV-994 in favour of setUser from libs/sdk-react/src/services/login.ts
764
+ */
765
+ setUser: (userId: string, userPayload: unknown) => Promise<void>;
766
+ };
767
+
768
+ /**
769
+ * Set user to sign in/out.
770
+ *
771
+ * Sign in - setUser('userID', { token: 'xxx' })
772
+ * Sign out - setUser(null)
773
+ */
774
+ export declare const setUser: (userId: string | null, payload?: UserPayload | undefined) => Promise<void>;
775
+
776
+ export declare const showGdprConsentPreferences: () => Promise<void>;
777
+
778
+ declare type SubscribeToItemsInRow = (rowId: string, cb: (error: Error | null, data: PaginationInterface<ItemsInRow> | null) => void, options?: SubscribeToItemsInRowOptions) => Disposer_2;
779
+
780
+ declare type SubscribeToItemsInRowOptions = Partial<{
781
+ fetchTags: boolean;
782
+ }> & PaginationOptions;
783
+
784
+ declare type SubscribeToRowsInScreen = (screenId: string, cb: (error: Error | null, data: PaginationInterface<Row> | null) => void, options?: PaginationOptions) => Disposer_2;
785
+
786
+ declare type SubscribeToScreen = (screenId: string, cb: (error: Error | null, data: Screen_2 | null) => void, options?: ScreenOptions) => Disposer_2;
787
+
788
+ declare type SubscribeToTaggedVideos = (tagIds: string[], cb: (error: Error | null, data: PaginationInterface<Video> | null) => void, options?: SubscribeToTaggedVideosOptions) => Disposer_2;
789
+
790
+ declare type SubscribeToTaggedVideosOptions = SubscribeToItemsInRowOptions & {
791
+ orderBy?: (Omit<OrderBy, 'field'> & {
792
+ field: TaggedVideosOrderByField;
793
+ })[];
794
+ where?: WhereFilter[];
795
+ };
796
+
797
+ declare type SubscriptionInfo = {
798
+ type: 'subscription';
799
+ name: string;
800
+ benefits: string[];
801
+ frequency: string;
802
+ };
803
+
804
+ export declare interface SubscriptionOverlayData {
805
+ subscriptions?: Monetization[];
806
+ onPurchase?: () => void;
807
+ onClose?: () => void;
808
+ }
809
+
810
+ export declare type SubscriptionOverlayState = {
811
+ data: SubscriptionOverlayData | null;
812
+ closeSubscriptionOverlay: () => void;
813
+ openSubscriptionOverlay: (data: SubscriptionOverlayData) => void;
814
+ };
815
+
816
+ declare interface Tag extends RowItem {
817
+ id: string;
818
+ tagId: string;
819
+ type?: string | null;
820
+ metadata?: any[];
821
+ color?: string;
822
+ detailBanner?: string;
823
+ availableSeasons?: AvailableSeason[];
824
+ isFavorite: boolean;
825
+ addToFavorites: () => void;
826
+ removeFromFavorites: () => void;
827
+ }
828
+
829
+ declare type TaggedVideosOrderByField = 'seasonNumber' | 'episodeNumber' | 'contentType' | DefaultOrderByField;
830
+
831
+ declare type TileProps = {
832
+ cover: string;
833
+ isLoading: boolean;
834
+ bottomLabel: string;
835
+ bottomLabelAreaHeight: number;
836
+ innerLabel: string;
837
+ duration: string;
838
+ price: string | null;
839
+ focused: boolean;
840
+ onClick?: () => void;
841
+ hoverable: boolean;
842
+ overlay: boolean;
843
+ coverPadding: CoverPadding;
844
+ variant: RowItemComponent;
845
+ coverWidth: number;
846
+ progress?: number;
847
+ time?: string;
848
+ logo?: string;
849
+ coverHeight: number;
850
+ /**
851
+ * Margin of inner TileContainer.
852
+ * Now used for backward compatibility for WebTileGrid. Consider to use it other way.
853
+ */
854
+ containerMargin?: number | string;
855
+ };
856
+
857
+ declare type TilePropsPartial = Partial<TileProps>;
858
+
859
+ export declare interface TivioAuth {
860
+ changePassword: (newPassword: string) => Promise<void>;
861
+ changeUserPhoto(file: File): Promise<void>;
862
+ removeUserPhoto(): Promise<void>;
863
+ getPurchasedVodsWithInitializedVideos: () => Promise<Purchase_2[]>;
864
+ /**
865
+ * @param email
866
+ * @param password
867
+ */
868
+ createUserWithEmailAndPassword: CreateUserWithEmailAndPassword;
869
+ /**
870
+ * Sign in the user and starts listening on his purchases
871
+ * @param email
872
+ * @param password
873
+ */
874
+ signInWithEmailAndPassword: (email: string, password: string) => Promise<void>;
875
+ initializeUser: () => Promise<void>;
876
+ signOut: () => Promise<void>;
877
+ /**
878
+ * Used for reset forgotten password by user
879
+ */
880
+ resetPassword: (email: string) => Promise<void>;
881
+ createFreePurchase: (monetizationId: string) => Promise<void>;
882
+ }
883
+
884
+ export declare type TivioBundle = {
885
+ components: TivioComponents;
886
+ getters: TivioGetters;
887
+ auth: TivioAuth;
888
+ hooks: TivioHooks;
889
+ init: (config: Config) => void | Promise<void>;
890
+ purchaseVideoWithQerko: (videoId: string, monetizationId: string, voucher?: {
891
+ expirationDate: Date;
892
+ }) => Promise<QerkoPaymentInfo>;
893
+ purchaseSubscriptionWithQerko: (monetizationId: string, voucher?: {
894
+ expirationDate: Date;
895
+ }) => Promise<QerkoPaymentInfo>;
896
+ cancelSubscriptionWithQerko: (subscriptionId: string) => Promise<QerkoCancellationInfo>;
897
+ setLanguage: (language: LangCode) => void;
898
+ setUser: (userId: string | null, userPayload?: UserPayload) => Promise<void>;
899
+ showConsentPreferences: () => void;
900
+ sources: TivioSources;
901
+ subscriptions: TivioSubscriptions;
902
+ internal: {
903
+ components: TivioInternalComponents;
904
+ hooks: TivioInternalHooks;
905
+ providers: TivioInternalProviders;
906
+ };
907
+ };
908
+
909
+ export declare type TivioBundleFile = {
910
+ Tivio: TivioBundle;
911
+ };
912
+
913
+ export declare type TivioComponents = {
914
+ AdIndicationButtonWeb: React_2.ReactNode;
915
+ Markers: React_2.ReactNode;
916
+ PlayerDataContext: React_2.ReactNode;
917
+ Provider: React_2.ComponentType<RemoteProviderProps>;
918
+ Recommendation: React_2.ReactNode;
919
+ SkipButtonWeb: React_2.ReactNode;
920
+ /**
921
+ * @deprecated will be removed in in @tivio/sdk-react@4
922
+ */
923
+ VideoAdBanner: React_2.ReactNode;
924
+ WebPlayer: React_2.ComponentType<WebPlayerProps>;
925
+ Widget: React_2.ComponentType<TivioWidgetProps>;
926
+ TvPlayer: React_2.ComponentType<WebPlayerProps>;
927
+ PlayerDataContextProvider: React_2.ComponentType<{
928
+ id: string;
929
+ }>;
930
+ SkipButtonTv: React_2.ComponentType<{
931
+ Button: React_2.ComponentType;
932
+ Label: React_2.ComponentType;
933
+ Container: React_2.ComponentType;
934
+ onStarted?: () => any;
935
+ onEnded?: () => any;
936
+ }>;
937
+ TvApp: React_2.ComponentType<TvAppProps>;
938
+ CustomerScreen: React_2.ComponentType<{
939
+ screenId: string;
940
+ }>;
941
+ WebTagScreen: React_2.ComponentType<{
942
+ tagId: string;
943
+ onError?: (error: Error) => void;
944
+ }>;
945
+ WebSearchScreen: React_2.ComponentType<{
946
+ searchQuery?: string;
947
+ }>;
948
+ WebRow: React_2.ComponentType<WebRowProps>;
949
+ WebTile: React_2.ComponentType<{
950
+ item?: Video | Tag;
951
+ } & TilePropsPartial>;
952
+ FeatureSupportCheck: React_2.ComponentType<{}>;
953
+ };
954
+
955
+ export declare const TivioContext: React_2.Context<RemoteBundleState | null>;
956
+
957
+ export declare type TivioGetters = {
958
+ isTivioLoaded: (cb: (isLoaded: boolean) => void) => boolean;
959
+ isSignedIn: () => boolean;
960
+ /**
961
+ * Get channel by its id.
962
+ * @param channelId - channel id
963
+ * @returns {Promise<Channel | null>} channel or null if channel does not exists
964
+ */
965
+ getChannelById: (channelId: string) => Promise<Channel | null>;
966
+ /**
967
+ * Get (or create) player wrapper instance
968
+ * @param opt - player getter options
969
+ * @returns {PlayerWrapper} player wrapper instance
970
+ */
971
+ getPlayerWrapper: (opt: {
972
+ playerWrapperId?: string;
973
+ }) => PlayerWrapper;
974
+ getOrganizationScreens: () => Promise<Screen_2[]>;
975
+ getOrganizationSubscriptions: () => Promise<Monetization[] | undefined>;
976
+ /**
977
+ * Get section by its id.
978
+ * @param sectionId - section id
979
+ * @returns {Promise<{section: Section, channel: Channel} | null>} section and channel or null if channel or section does not exists
980
+ */
981
+ getSectionById: (sectionId: string) => Promise<Section | null>;
982
+ /**
983
+ * Get video by its id.
984
+ * @param videoId - video id
985
+ * @returns {Promise<Video | null>} video or null if video does not exists
986
+ */
987
+ getVideoById: (videoId: string) => Promise<Video | null>;
988
+ /**
989
+ * Get widget by its id.
990
+ * @param widgetId - widget id
991
+ * @returns {Promise<Widget | null>} widget or null if widget does not exists
992
+ */
993
+ getWidgetById: (widgetId: string) => Promise<Widget | null>;
994
+ /**
995
+ * Get player capabilities based on user's browser and OS as resolved by Tivio.
996
+ * @returns PlayerCapability[]
997
+ */
998
+ getPlayerCapabilities: () => PlayerCapability[];
999
+ };
1000
+
1001
+ export declare type TivioHooks = {
1002
+ useAd: () => [(AdSource | null)];
1003
+ useAdSegment: () => AdSegment | null;
1004
+ useCancelSubscription: UseCancelSubscription;
1005
+ useItemsInRow: (rowId: string, options: PaginationOptions) => {
1006
+ pagination: PaginationInterface<ItemsInRow> | null;
1007
+ error: Error | null;
1008
+ };
1009
+ usePurchaseRecovery: () => {
1010
+ purchaseRecoveryResult?: string;
1011
+ loading: boolean;
1012
+ error?: GenericOnCallError;
1013
+ purchaseRecovery: (monetizationId: string) => void;
1014
+ };
1015
+ useRowsInScreen: (screenId: string, options: PaginationOptions) => {
1016
+ pagination: PaginationInterface<Row> | null;
1017
+ error: Error | null;
1018
+ };
1019
+ useTaggedVideos: (tagIds: string[], options: SubscribeToItemsInRowOptions) => {
1020
+ pagination: PaginationInterface<Video> | null;
1021
+ error: Error | null;
1022
+ };
1023
+ useSearch: UseSearch;
1024
+ useVideo: (videoId: string) => {
1025
+ data: Video | null;
1026
+ error: string | null;
1027
+ };
1028
+ useVoucher: (voucherId: string) => any;
1029
+ /**
1030
+ * @deprecated will be removed in version
1031
+ */
1032
+ useLastVideoByWidgetId: (widgetId: string) => Video | null;
1033
+ useWatchWithoutAdsOffer: () => {
1034
+ canPurchaseWatchWithoutAds: boolean;
1035
+ showPurchaseDialog: () => void;
1036
+ };
1037
+ useApplyInviteCode: () => {
1038
+ applyInviteCodeResult?: boolean;
1039
+ loading: boolean;
1040
+ error?: GenericOnCallError;
1041
+ applyInviteCode: (code: string) => void;
1042
+ inviteCodeReset: () => void;
1043
+ };
1044
+ };
1045
+
1046
+ export declare type TivioInternalComponents = {
1047
+ PrimaryButton: React_2.ComponentType;
1048
+ WebLandingScreen: React_2.ComponentType<{
1049
+ logo?: string;
1050
+ }>;
1051
+ WebVideoScreen: React_2.ComponentType<{
1052
+ videoId: string;
1053
+ }>;
1054
+ WebSeriesDetailScreen: React_2.ComponentType<WebSeriesDetailScreenProps>;
1055
+ };
1056
+
1057
+ export declare type TivioInternalHooks = {
1058
+ useAuthOverlay: () => AuthOverlayState;
1059
+ useSubscriptionsOverlay: () => SubscriptionOverlayState;
1060
+ useQerkoOverlay: () => QerkoOverlayState;
1061
+ usePurchasesWithVideos: () => {
1062
+ purchases: Purchase_2[];
1063
+ };
1064
+ useOrganizationSubscriptions: () => {
1065
+ subscriptions: Monetization[];
1066
+ };
1067
+ useIsMonetizationPurchased: () => {
1068
+ isOneOfSubscriptionPurchased: (subscriptionIds: string[]) => boolean;
1069
+ };
1070
+ useReferralInfo: any;
1071
+ useTvChannel: UseTvChannel;
1072
+ useChannelSource: UseChannelSource;
1073
+ useUser: () => {
1074
+ user: User | null;
1075
+ error: string | null;
1076
+ isInitialized: boolean;
1077
+ };
1078
+ };
1079
+
1080
+ export declare type TivioInternalProviders = {
1081
+ AppThemeProvider: React_2.ComponentType;
1082
+ AuthOverlayContextProvider: React_2.ComponentType;
1083
+ CustomerProvider: React_2.ComponentType<{
1084
+ customer: CUSTOMER_BUILD;
1085
+ platform: PLATFORM;
1086
+ children: any;
1087
+ }>;
1088
+ ConfigProvider: React_2.ComponentType;
1089
+ UserContextProvider: React_2.ComponentType;
1090
+ SubscriptionOverlayContextProvider: React_2.ComponentType;
1091
+ QerkoOverlayContextProvider: React_2.ComponentType;
1092
+ PurchasesWithVideosContextProvider: React_2.ComponentType;
1093
+ OrganizationSubscriptionsContextProvider: React_2.ComponentType;
1094
+ RouterOverridesContextProvider: React_2.ComponentType<RouterOverridesContextState>;
1095
+ };
1096
+
1097
+ export declare const TivioProvider: React_2.FC<TivioProviderProps>;
1098
+
1099
+ export declare type TivioProviderProps = {
1100
+ /**
1101
+ * This prop must be set only once and not change value afterwards
1102
+ */
1103
+ conf: Config | undefined | null;
1104
+ children: React_2.ReactNode;
1105
+ };
1106
+
1107
+ export declare type TivioSources = {
1108
+ AdSource: any;
1109
+ ChannelSource: any;
1110
+ VodExternalSource: any;
1111
+ VodTivioSource: any;
1112
+ };
1113
+
1114
+ export declare type TivioSubscriptions = {
1115
+ subscribeToUser: (cb: (error: string | null, user: User | null) => void) => void;
1116
+ /**
1117
+ * Listen to widget changes.
1118
+ * @param widgetId - widget id
1119
+ * @param cb - callback on widget updates or on error
1120
+ */
1121
+ subscribeToWidget: (widgetId: string, cb: (error: Error | null, data: Widget | null, disposer?: Disposer) => void) => void;
1122
+ /**
1123
+ * Listen to channel changes.
1124
+ * @param channelId - channel id
1125
+ * @param cb - callback on channel updates or on error
1126
+ */
1127
+ subscribeToChannel: (channelId: string, cb: (error: Error | null, data: Channel | null) => void) => void;
1128
+ /**
1129
+ * Listen to section changes.
1130
+ * @param sectionId - section id
1131
+ * @param cb - callback on section updates or on error
1132
+ */
1133
+ subscribeToSection: (sectionId: string, cb: (error: Error | null, data: Section | null) => void) => void;
1134
+ /**
1135
+ * Listen to video changes.
1136
+ * @param videoId - video id
1137
+ * @param cb - callback on video updates or on error
1138
+ */
1139
+ subscribeToVideo: (videoId: string, cb: (error: Error | null, data: Video | null, disposer?: Disposer) => void) => void;
1140
+ /**
1141
+ * Listen to videos in section changes.
1142
+ * @param sectionId - section id
1143
+ * @param cb - callback on videos change or error
1144
+ * @param limit - videos count
1145
+ */
1146
+ subscribeToVideosInSection: (sectionId: string, cb: (error: null | Error, data: null | {
1147
+ videos: Video[];
1148
+ hasNextPage: boolean;
1149
+ }, fetchMore: null | ((count?: number) => void), isLoading: boolean) => void, limit?: number) => void;
1150
+ /**
1151
+ * Listen to section in channel changes
1152
+ * @param channelId - channel id
1153
+ * @param cb - callback on sections change or error
1154
+ * @param limit - sections count
1155
+ */
1156
+ subscribeToSectionsInChannel: (channelId: string, cb: (error: null | Error, data: null | {
1157
+ sections: Section[];
1158
+ hasNextPage: boolean;
1159
+ }, fetchMore: null | ((count?: number) => void), isLoading: boolean) => void, limit?: number) => void;
1160
+ /**
1161
+ * Listen to channels in widget changes
1162
+ * @param widgetId - widget id
1163
+ * @param cb - callback on channels change or error
1164
+ * @param limit - channels count
1165
+ */
1166
+ subscribeToChannelsInWidget: (widgetId: string, cb: (error: null | Error, data: null | {
1167
+ channels: Channel[];
1168
+ hasNextPage: boolean;
1169
+ }, fetchMore: null | ((count?: number) => void), isLoading: boolean) => void, limit?: number) => void;
1170
+ subscribeToScreen: SubscribeToScreen;
1171
+ subscribeToItemsInRow: SubscribeToItemsInRow;
1172
+ subscribeToRowsInScreen: SubscribeToRowsInScreen;
1173
+ subscribeToTaggedVideos: SubscribeToTaggedVideos;
1174
+ registerOverlayCallbacks: (callbacks: {
1175
+ onShow: () => void;
1176
+ onHide: () => void;
1177
+ }) => void;
1178
+ };
1179
+
1180
+ export declare const TivioWidget: React_2.ForwardRefExoticComponent<Pick<TivioWidgetProps, "id" | "onEnabled" | "onBlur"> & React_2.RefAttributes<TivioWidgetRef>>;
1181
+
1182
+ export declare const TivioWidgetError: React_2.FC<TivioWidgetErrorProps>;
1183
+
1184
+ declare type TivioWidgetErrorProps = {
1185
+ error: string | null;
1186
+ };
1187
+
1188
+ export declare const TivioWidgetLoader: React_2.FC;
1189
+
1190
+ export declare interface TivioWidgetProps {
1191
+ id: string;
1192
+ ref: React_2.MutableRefObject<TivioWidgetRef>;
1193
+ onEnabled?: (enabled: boolean) => any;
1194
+ onBlur?: (event: {
1195
+ key: string;
1196
+ width: number;
1197
+ x: number;
1198
+ }) => any;
1199
+ }
1200
+
1201
+ export declare interface TivioWidgetRef {
1202
+ focus: (args: {
1203
+ x?: number;
1204
+ }) => void;
1205
+ handleKey: (key: string) => ({
1206
+ handled: boolean;
1207
+ x: number;
1208
+ });
1209
+ unfocus: () => ({
1210
+ x: number;
1211
+ });
1212
+ }
1213
+
1214
+ declare type TransactionInfo = {
1215
+ type: 'transaction';
1216
+ name: string;
1217
+ videoId: string;
1218
+ cover: string;
1219
+ description: string;
1220
+ };
1221
+
1222
+ /**
1223
+ * Represents one string in every supported language mutation.
1224
+ */
1225
+ export declare type Translation = {
1226
+ [key in LangCode]: string;
1227
+ };
1228
+
1229
+ declare type TvAppProps = {
1230
+ customer: CUSTOMER_BUILD;
1231
+ };
1232
+
1233
+ declare interface TvChannel extends RowItem {
1234
+ name: string;
1235
+ id: string;
1236
+ path: string;
1237
+ itemType: ROW_ITEM_TYPES;
1238
+ country?: string;
1239
+ filters: string[];
1240
+ logo?: string;
1241
+ hls: string;
1242
+ dash: string;
1243
+ purchasableMonetization: any | null;
1244
+ price: number;
1245
+ }
1246
+
1247
+ export declare const TvTivioProvider: React_2.FC<TivioProviderProps>;
1248
+
1249
+ export declare const useAd: () => AdSource | null;
1250
+
1251
+ export declare const useAdSegment: () => {
1252
+ id: string;
1253
+ remainingMs: number;
1254
+ secondsToEnd: number;
1255
+ secondsToSkippable: number | null;
1256
+ canSeek: boolean;
1257
+ canSkip: boolean;
1258
+ isSkippable: boolean;
1259
+ skip: () => any;
1260
+ } | null;
1261
+
1262
+ /**
1263
+ * Is used to login user through different device in which user is already logged in.
1264
+ * (e.g. login in tv app through web app)
1265
+ *
1266
+ * @return applyInviteCodeResult - true if code was applied successfully, false otherwise.
1267
+ * loading - loading state
1268
+ * error - error in case request failure
1269
+ * applyInviteCode - function to apply invite code
1270
+ * inviteCodeReset - function to reset to initial state
1271
+ */
1272
+ export declare function useApplyInviteCode(): {
1273
+ applyInviteCodeResult?: boolean | undefined;
1274
+ loading: boolean;
1275
+ error?: GenericOnCallError | undefined;
1276
+ applyInviteCode: (code: string) => void;
1277
+ inviteCodeReset: () => void;
1278
+ };
1279
+
1280
+ export declare const useBetOffer: () => BetOffer | null;
1281
+
1282
+ declare type UseCancelSubscription = (subscriptionId: string) => {
1283
+ cancelSubscription: () => Promise<void>;
1284
+ cancellationInfo: QerkoCancellationInfo | null;
1285
+ error?: string | null;
1286
+ };
1287
+
1288
+ export declare const useCancelSubscription: UseCancelSubscription;
1289
+
1290
+ /**
1291
+ * Use channel
1292
+ * @param channelId - channel id
1293
+ */
1294
+ export declare const useChannel: (channelId: string) => {
1295
+ error: string | null;
1296
+ data: Channel | null;
1297
+ };
1298
+
1299
+ /**
1300
+ * Use channels in widget
1301
+ * @param widgetId - widget id
1302
+ * @param [limit] - channels count, defaults to 10
1303
+ */
1304
+ export declare const useChannelsInWidget: (widgetId: string, limit?: number) => {
1305
+ error: Error | null;
1306
+ data: PaginationData<Channel_2> | null;
1307
+ isLoading: boolean;
1308
+ };
1309
+
1310
+ declare type UseChannelSource = (tvChannelId: string) => {
1311
+ source: ChannelSource_2 | null;
1312
+ error: Error | null;
1313
+ };
1314
+
1315
+ export declare const useCurrentMarker: () => Marker | null;
1316
+
1317
+ export declare const useFreePurchase: () => {
1318
+ purchase: (monetizationId: string) => Promise<void>;
1319
+ };
1320
+
1321
+ export declare const useIntro: () => IntroMarker | null;
1322
+
1323
+ export declare const useIsLoaded: () => {
1324
+ isTivioLoaded: boolean;
1325
+ };
1326
+
1327
+ export declare const useIsMonetizationPurchased: () => {
1328
+ isOneOfSubscriptionPurchased: (subscriptionIds: string[]) => boolean;
1329
+ };
1330
+
1331
+ /**
1332
+ * Use row items
1333
+ * @param rowId - row ID
1334
+ * @param options - subscription options
1335
+ */
1336
+ export declare const useItemsInRow: (rowId: string, options?: SubscribeToItemsInRowOptions) => {
1337
+ pagination: PaginationInterface<ItemsInRow> | null;
1338
+ error: Error | null;
1339
+ };
1340
+
1341
+ /**
1342
+ * @deprecated will be removed in v4
1343
+ */
1344
+ export declare function useLastVideoByWidgetId(widgetId: string): Video | null;
1345
+
1346
+ export declare const useMarkers: () => Marker[] | null;
1347
+
1348
+ export declare const useOrganizationSubscriptions: () => {
1349
+ subscriptions: Monetization[];
1350
+ };
1351
+
1352
+ export declare type UsePlayerEvent = <T = any>(eventName: string) => T | null;
1353
+
1354
+ export declare const usePlayerEvent: UsePlayerEvent;
1355
+
1356
+ /**
1357
+ * Is used to mark purchase in recovery state as PAID.
1358
+ *
1359
+ * @return purchaseRecoveryResult - message describing result of the recovery
1360
+ * loading - loading state
1361
+ * error - error in case request failure
1362
+ * purchaseRecovery - functions to execute purchase recovery
1363
+ */
1364
+ export declare function usePurchaseRecovery(): {
1365
+ purchaseRecoveryResult?: string | undefined;
1366
+ loading: boolean;
1367
+ error?: GenericOnCallError | undefined;
1368
+ purchaseRecovery: (monetizationId: string) => void;
1369
+ };
1370
+
1371
+ export declare const usePurchaseSubscription: (monetizationId: string, voucher?: NewVoucher | undefined) => QerkoTransaction;
1372
+
1373
+ /**
1374
+ * Return purchases with initialized video (purchases[i].video not null)
1375
+ */
1376
+ export declare const usePurchasesWithVideos: () => {
1377
+ purchases: Purchase_2[];
1378
+ };
1379
+
1380
+ export declare type User = {
1381
+ purchases: Purchase_2[];
1382
+ allPurchases: Purchase_2[];
1383
+ purchasedVods: Purchase_2[];
1384
+ purchasedSubscriptions: Purchase_2[];
1385
+ isPurchasesInitialized: boolean;
1386
+ isSignedIn: boolean;
1387
+ email?: string;
1388
+ type?: UserType;
1389
+ photoURL: string | null;
1390
+ name?: string;
1391
+ authUserId?: string;
1392
+ favorites: any[];
1393
+ watchedPositions: any[];
1394
+ };
1395
+
1396
+ export declare const useRowsInScreen: (screenId: string, options?: PaginationOptions) => {
1397
+ pagination: PaginationInterface<Row> | null;
1398
+ error: Error | null;
1399
+ };
1400
+
1401
+ export declare type UserPayload = Record<string, any>;
1402
+
1403
+ declare enum UserType {
1404
+ ORGANIZATION_USER = "ORGANIZATION_USER",
1405
+ TIVIO_USER = "TIVIO_USER"
1406
+ }
1407
+
1408
+ /**
1409
+ * @deprecated
1410
+ *
1411
+ * Use app screen
1412
+ * @param screenId - screen ID
1413
+ * @param options - subscribe to screen options
1414
+ */
1415
+ export declare const useScreen: (screenId: string, options?: ScreenOptions | undefined) => never;
1416
+
1417
+ export declare const useScreens: () => {
1418
+ screens: Screen_2[];
1419
+ };
1420
+
1421
+ declare type UseSearch = <T extends ALGOLIA_INDEX_NAME>(indexName: T, options?: UseSearchOptions) => {
1422
+ search: (query: string) => void;
1423
+ pagination: PaginationInterface<UseSearchResult<T>> | null;
1424
+ error: Error | null;
1425
+ isLoading: boolean;
1426
+ lastQuery: string;
1427
+ };
1428
+
1429
+ /**
1430
+ * Full text search that returns entities based on search query.
1431
+ * @param indexName - index that search would be performed on ('videos', 'tags', etc.)
1432
+ * @param options - pagination options
1433
+ */
1434
+ export declare const useSearch: UseSearch;
1435
+
1436
+ declare type UseSearchOptions = PaginationOptions & Partial<{
1437
+ minQueryLength: number;
1438
+ }>;
1439
+
1440
+ declare type UseSearchResult<T extends ALGOLIA_INDEX_NAME> = T extends ALGOLIA_INDEX_NAME.VIDEOS ? Video : T extends ALGOLIA_INDEX_NAME.TAGS ? Tag : T extends ALGOLIA_INDEX_NAME.TV_CHANNELS ? TvChannel : unknown;
1441
+
1442
+ /**
1443
+ * Use section
1444
+ * @param sectionId - section id
1445
+ */
1446
+ export declare const useSection: (sectionId: string) => {
1447
+ error: string | null;
1448
+ data: Section | null;
1449
+ };
1450
+
1451
+ /**
1452
+ * Use section in channel
1453
+ * @param channelId - channel id
1454
+ * @param [limit] - sections count, defaults to 10
1455
+ */
1456
+ export declare const useSectionsInChannel: (channelId: string, limit?: number) => {
1457
+ error: Error | null;
1458
+ data: PaginationData<Section_2> | null;
1459
+ isLoading: boolean;
1460
+ };
1461
+
1462
+ export declare const useSeekState: () => boolean | null;
1463
+
1464
+ /**
1465
+ * Returns videos with given tag ids
1466
+ * @param tagIds - tag ids
1467
+ * @param options - subscription options
1468
+ */
1469
+ export declare const useTaggedVideos: (tagIds: string[], options?: SubscribeToItemsInRowOptions) => {
1470
+ pagination: PaginationInterface<Video> | null;
1471
+ error: Error | null;
1472
+ };
1473
+
1474
+ export declare const useTivioData: () => RemoteBundleState;
1475
+
1476
+ export declare const useTivioReadyData: () => RemoteBundleState | null;
1477
+
1478
+ export declare const useTransactionPayment: (videoId: string, monetizationId: string, voucher?: NewVoucher | undefined) => QerkoTransaction;
1479
+
1480
+ declare type UseTvChannel = (tvChannelId: string) => {
1481
+ tvChannel: TvChannel | null;
1482
+ error: Error | null;
1483
+ loading: boolean;
1484
+ };
1485
+
1486
+ export declare const useUser: () => {
1487
+ user: User | null;
1488
+ error: string | null;
1489
+ isInitialized: boolean;
1490
+ };
1491
+
1492
+ /**
1493
+ * Use video
1494
+ * @param videoId - video id
1495
+ */
1496
+ export declare const useVideo: (videoId?: string | undefined) => {
1497
+ data: Video | null;
1498
+ error: string | null;
1499
+ };
1500
+
1501
+ /**
1502
+ * Use videos in section
1503
+ * @param sectionId - section id
1504
+ * @param [limit] - videos count, defaults to 10
1505
+ */
1506
+ export declare const useVideosInSection: (sectionId?: string | undefined, limit?: number) => {
1507
+ error: Error | null;
1508
+ data: PaginationData<Video> | null;
1509
+ isLoading: boolean;
1510
+ };
1511
+
1512
+ export declare const useVoucher: (voucherId: string) => {
1513
+ activate: (() => Promise<void>) | null;
1514
+ voucher: Voucher | null;
1515
+ /**
1516
+ * You can check error.details if you need to know error type when you want your own error messages
1517
+ * (can be one of "DOES_NOT_EXIST", "EXPIRED" and "ALREADY_USED").
1518
+ */
1519
+ error: Error | BadRequestError | null;
1520
+ /**
1521
+ * True if voucher has been successfully activated in current session.
1522
+ */
1523
+ activationSuccess: boolean;
1524
+ };
1525
+
1526
+ export declare const useWatchWithoutAdsOffer: () => {
1527
+ canPurchaseWatchWithoutAds: boolean;
1528
+ showPurchaseDialog: () => void;
1529
+ };
1530
+
1531
+ /**
1532
+ * Use widget
1533
+ * @param widgetId - widget id
1534
+ */
1535
+ export declare const useWidget: (widgetId: string) => {
1536
+ error: string;
1537
+ widget: Widget | null;
1538
+ };
1539
+
1540
+ export declare interface Video extends RowItem {
1541
+ id: string;
1542
+ /**
1543
+ * @deprecated use assets instead
1544
+ */
1545
+ cover: string | null;
1546
+ created: Date;
1547
+ sectionId: string | null;
1548
+ channelId: string | null;
1549
+ /**
1550
+ * seconds
1551
+ */
1552
+ duration: number;
1553
+ path: string;
1554
+ tags: Tag[];
1555
+ image: string | null;
1556
+ isPlayable: boolean;
1557
+ monetizations: Monetization[];
1558
+ monetization: Monetization | undefined;
1559
+ transactionId?: string;
1560
+ transaction: Monetization | undefined;
1561
+ subscriptions: Monetization[];
1562
+ subscriptionIds: string[];
1563
+ isPlaylist: boolean;
1564
+ name: string;
1565
+ description?: string;
1566
+ price: number | null;
1567
+ detailedPrice: DetailedPrice | null;
1568
+ uri: string;
1569
+ url: string;
1570
+ adMonetizationId?: string;
1571
+ from?: Date;
1572
+ to?: Date;
1573
+ detailBanner?: string;
1574
+ linkedVideosRaw: any[];
1575
+ linkedVideos: LinkedVideo[];
1576
+ purchasableMonetization: any | null;
1577
+ contentType: VideoContentType | null;
1578
+ year?: number;
1579
+ episodeNumber?: number;
1580
+ seasonNumber?: number;
1581
+ getTagsOfType: (type: string) => Tag[];
1582
+ loadLinkedVideos: () => any;
1583
+ getLinkedVideos: (type: any) => any;
1584
+ trailer: Video | null;
1585
+ watchPosition: number | null;
1586
+ isFavorite: boolean;
1587
+ addToFavorites: () => void;
1588
+ removeFromFavorites: () => void;
1589
+ availability: VideoAvailabilityField | null;
1590
+ }
1591
+
1592
+ declare type VideoAvailabilityField = {
1593
+ from: firebase_2.firestore.Timestamp;
1594
+ to: firebase_2.firestore.Timestamp | null;
1595
+ manual: boolean;
1596
+ };
1597
+
1598
+ declare enum VideoContentType {
1599
+ /**
1600
+ * Default video content type
1601
+ */
1602
+ VIDEO = "VIDEO",
1603
+ FILM = "FILM",
1604
+ SERIES = "SERIES"
1605
+ }
1606
+
1607
+ declare type VideoPath = string;
1608
+
1609
+ export declare const VideosContext: React_2.Context<DataState<Video>>;
1610
+
1611
+ export declare type VodExternalSource = {
1612
+ new (uri: string, monetizationId: string, name: string, description: string, originalOptions: Record<string, any>): VodTivioSource;
1613
+ type: 'vod_external';
1614
+ description: string;
1615
+ name: string;
1616
+ uri: string;
1617
+ };
1618
+
1619
+ export declare type VodTivioSource = {
1620
+ new (uri: string, videoId: string, name: string, description: string, adMonetizationId?: string): VodTivioSource;
1621
+ type: 'vod_tivio';
1622
+ description: string;
1623
+ name: string;
1624
+ uri: string;
1625
+ };
1626
+
1627
+ export declare interface VodTivioSourcePojo {
1628
+ type: 'VodTivioSource';
1629
+ description: string;
1630
+ path: string;
1631
+ name: string;
1632
+ uri: string;
1633
+ poster?: string;
1634
+ adMonetizationId?: string;
1635
+ }
1636
+
1637
+ /**
1638
+ * TODO: Should be in core-js, we can't import types from it, though.
1639
+ */
1640
+ declare type Voucher = {
1641
+ activate: () => void;
1642
+ isUsed: boolean;
1643
+ isExpired: boolean;
1644
+ status: 'NEW' | 'USED';
1645
+ voucherInfo: SubscriptionInfo | TransactionInfo;
1646
+ };
1647
+
1648
+ export declare interface WebPlayerProps {
1649
+ id: string;
1650
+ source?: VodTivioSourcePojo | ChannelSourcePojo | VideoPath | null;
1651
+ onEnded?: () => any;
1652
+ /**
1653
+ * If this function is specified, then "Back" button is shown in top right corner.
1654
+ */
1655
+ onBack?: () => void;
1656
+ className?: string;
1657
+ /**
1658
+ * default false
1659
+ *
1660
+ * If you choose `autoplay` make sure that autoplay is allowed in the specific situation.
1661
+ * In some cases it may not be allowed, e.g. before the user interacted with the site, and the video
1662
+ * will stay paused.
1663
+ *
1664
+ * Source: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
1665
+ */
1666
+ autoplay?: boolean;
1667
+ /**
1668
+ * default false
1669
+ */
1670
+ canReplay?: boolean;
1671
+ /**
1672
+ * default false
1673
+ */
1674
+ showMarkers?: boolean;
1675
+ /**
1676
+ * number[] is array of keyboard event.which numeric codes
1677
+ * (see https://keycode.info/)
1678
+ */
1679
+ customShortcuts?: Partial<{
1680
+ toggleFullscreen: number[];
1681
+ togglePause: number[];
1682
+ toggleMute: number[];
1683
+ jumpForward: number[];
1684
+ jumpBack: number[];
1685
+ volumeUp: number[];
1686
+ volumeDown: number[];
1687
+ }>;
1688
+ /**
1689
+ * default true
1690
+ */
1691
+ enableKeyboardShortcuts?: boolean;
1692
+ onProgress?: (event: React_2.ChangeEvent<HTMLVideoElement>) => void;
1693
+ /**
1694
+ * @deprecated this callback is never called. Will be removed in @tivio/sdk-react version 4
1695
+ */
1696
+ onPlayerControllerCreated?: (playerController: any) => void;
1697
+ }
1698
+
1699
+ declare type WebRowProps = {
1700
+ items?: ItemsInRow[];
1701
+ variant?: RowItemComponent;
1702
+ rowName?: string;
1703
+ fetchMore?: () => void;
1704
+ onTileClick?: (item: ItemsInRow) => void;
1705
+ };
1706
+
1707
+ declare type WebSeriesDetailScreenProps = {
1708
+ tagId: string;
1709
+ };
1710
+
1711
+ declare interface WhereFilter {
1712
+ field: string;
1713
+ operator: WhereFilterOp;
1714
+ value: any;
1715
+ }
1716
+
1717
+ export declare type Widget = {
1718
+ id: string;
1719
+ channels: Channel[];
1720
+ isEnabled: boolean | null;
1721
+ name: string | null;
1722
+ recentVideos: Video[] | null;
1723
+ widgetId: string | null;
1724
+ lastVideo: Video | null;
1725
+ };
1726
+
1727
+ export declare function withPlayerContext(id: string): <P>(WrappedComponent: React_2.ComponentType<P>) => (props: P) => JSX.Element;
1728
+
1729
+ export { }