@tivio/sdk-react 3.5.0 → 3.5.1

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