@tivio/sdk-react 3.5.2 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/README.md.bak +6 -3
- package/dist/index.d.ts +1729 -21
- package/dist/index.js +1 -2
- package/package.json +10 -7
- package/dist/components/ContextProvider.d.ts +0 -7
- package/dist/components/PlayerProvider.d.ts +0 -19
- package/dist/components/TivioProvider.d.ts +0 -16
- package/dist/components/TivioWidget.d.ts +0 -7
- package/dist/components/TivioWidgetError.d.ts +0 -10
- package/dist/components/TivioWidgetLoader.d.ts +0 -6
- package/dist/components/TvTivioProvider.d.ts +0 -7
- package/dist/components/context/ChannelsContext.d.ts +0 -6
- package/dist/components/context/RowItemsContext.d.ts +0 -7
- package/dist/components/context/ScreensContext.d.ts +0 -6
- package/dist/components/context/SectionsContext.d.ts +0 -6
- package/dist/components/context/VideosContext.d.ts +0 -6
- package/dist/components/context/index.d.ts +0 -5
- package/dist/components/context/types.d.ts +0 -27
- package/dist/components/hooks/contentHooks.d.ts +0 -68
- package/dist/components/hooks/index.d.ts +0 -22
- package/dist/components/hooks/playerHooks.d.ts +0 -28
- package/dist/components/hooks/useApplyInviteCode.d.ts +0 -17
- package/dist/components/hooks/useCancelSubscription.d.ts +0 -2
- package/dist/components/hooks/useError.d.ts +0 -9
- package/dist/components/hooks/useFreePurchase.d.ts +0 -4
- package/dist/components/hooks/useIsMonetizationPurchased.d.ts +0 -3
- package/dist/components/hooks/useItemsInRow.d.ts +0 -11
- package/dist/components/hooks/useLastVideoByWidgetId.d.ts +0 -5
- package/dist/components/hooks/useOrganizationSubscriptions.d.ts +0 -3
- package/dist/components/hooks/usePurchaseRecovery.d.ts +0 -14
- package/dist/components/hooks/usePurchaseSubscription.d.ts +0 -4
- package/dist/components/hooks/usePurchasesWithVideos.d.ts +0 -7
- package/dist/components/hooks/useRowsInScreen.d.ts +0 -6
- package/dist/components/hooks/useScreen.d.ts +0 -10
- package/dist/components/hooks/useScreens.d.ts +0 -5
- package/dist/components/hooks/useSearch.d.ts +0 -8
- package/dist/components/hooks/useTaggedVideos.d.ts +0 -11
- package/dist/components/hooks/useTivio.d.ts +0 -3
- package/dist/components/hooks/useTransactionPayment.d.ts +0 -5
- package/dist/components/hooks/useUser.d.ts +0 -5
- package/dist/components/hooks/useVoucher.d.ts +0 -42
- package/dist/components/hooks/useWatchWithoutAdsOffer.d.ts +0 -4
- package/dist/config.d.ts +0 -20
- package/dist/index.js.LICENSE.txt +0 -335
- package/dist/info.d.ts +0 -2
- package/dist/services/bundleLoader.d.ts +0 -15
- package/dist/services/bundlePromise.d.ts +0 -7
- package/dist/services/dependencyResolver.d.ts +0 -24
- package/dist/services/gdpr.d.ts +0 -1
- package/dist/services/localFetch/coreReactDomDist.d.ts +0 -1
- package/dist/services/localFetch/none.d.ts +0 -1
- package/dist/services/logger.d.ts +0 -26
- package/dist/services/login.d.ts +0 -9
- package/dist/services/packageLoader.d.ts +0 -6
- package/dist/services/pubSub.d.ts +0 -13
- package/dist/services/sentry.d.ts +0 -4
- package/dist/services/settings.d.ts +0 -13
- package/dist/types/bundle.types.d.ts +0 -444
- package/dist/types/common.d.ts +0 -6
- package/dist/types/config.types.d.ts +0 -0
- package/dist/types/customPlayer.types.d.ts +0 -171
- package/dist/types/types.d.ts +0 -174
@@ -1,444 +0,0 @@
|
|
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, };
|
package/dist/types/common.d.ts
DELETED
File without changes
|
@@ -1,171 +0,0 @@
|
|
1
|
-
import { Empty } from './common';
|
2
|
-
export declare type ChannelSource = {
|
3
|
-
new (uri: string, originalOptions: Record<string, any>, channelName: string, programName: string, programDescription: string, from: Date, to: Date): ChannelSource;
|
4
|
-
description: string;
|
5
|
-
name: string;
|
6
|
-
uri: string;
|
7
|
-
from: Date;
|
8
|
-
channelName: string;
|
9
|
-
to: Date;
|
10
|
-
type: 'channel';
|
11
|
-
watchWithoutAdsRecommendation: {
|
12
|
-
showPurchaseDialog: () => void;
|
13
|
-
} | null;
|
14
|
-
};
|
15
|
-
export declare type AdSource = {
|
16
|
-
new (uri: string, name: string, description: string, skipDelayMs: number | null, adDurationMs: number, trackingContext?: any, // internal Tivio types
|
17
|
-
adMarker?: any, // internal Tivio types
|
18
|
-
packInfo?: any, // internal Tivio types
|
19
|
-
provider?: any): AdSource;
|
20
|
-
description: string;
|
21
|
-
name: string;
|
22
|
-
uri: string;
|
23
|
-
durationMs: number;
|
24
|
-
skipDelayMs: number | null;
|
25
|
-
type: 'ad';
|
26
|
-
/**
|
27
|
-
* true if is skippable and skip countdown has passed
|
28
|
-
*/
|
29
|
-
canSkip: boolean;
|
30
|
-
/**
|
31
|
-
* true ad if is skippable after some skipDelayMs (if it is skippable, skipDelayMs is defined)
|
32
|
-
*/
|
33
|
-
isSkippable: boolean;
|
34
|
-
/**
|
35
|
-
* Skip ad. Only works when canSkip is true
|
36
|
-
*/
|
37
|
-
skip: () => void;
|
38
|
-
/**
|
39
|
-
* Order in ad break (ad break is a group of ads played right after each other)
|
40
|
-
*/
|
41
|
-
order: number;
|
42
|
-
/**
|
43
|
-
* Total number of ads in ad break (ad break is a group of ads played right after each other)
|
44
|
-
*/
|
45
|
-
totalCount: number;
|
46
|
-
secondsToEnd: number;
|
47
|
-
secondsToSkippable: number | null;
|
48
|
-
};
|
49
|
-
export declare type VodTivioSource = {
|
50
|
-
new (uri: string, videoId: string, name: string, description: string, adMonetizationId?: string): VodTivioSource;
|
51
|
-
type: 'vod_tivio';
|
52
|
-
description: string;
|
53
|
-
name: string;
|
54
|
-
uri: string;
|
55
|
-
};
|
56
|
-
export declare type VodExternalSource = {
|
57
|
-
new (uri: string, monetizationId: string, name: string, description: string, originalOptions: Record<string, any>): VodTivioSource;
|
58
|
-
type: 'vod_external';
|
59
|
-
description: string;
|
60
|
-
name: string;
|
61
|
-
uri: string;
|
62
|
-
};
|
63
|
-
export declare type InputSource = AdSource | ChannelSource | VodTivioSource | VodExternalSource;
|
64
|
-
declare type PlayerState = 'playing' | 'paused' | 'idle';
|
65
|
-
export interface PlayerInterface {
|
66
|
-
pause: () => void;
|
67
|
-
/**
|
68
|
-
* unpause
|
69
|
-
*/
|
70
|
-
play: () => void;
|
71
|
-
/**
|
72
|
-
* @param {number} ms - milliseconds relative to start of video (relative to 0 ms)
|
73
|
-
* or in case of TV programs relative to start of the program (relative to source.from ms)
|
74
|
-
*/
|
75
|
-
seekTo: (ms: number) => void;
|
76
|
-
/**
|
77
|
-
* Source to be passed to player.
|
78
|
-
*
|
79
|
-
* Depending on autoplay settings it should either start playing
|
80
|
-
* immediately or just be loaded by player and stay paused.
|
81
|
-
*/
|
82
|
-
setSource: (source: InputSource | null) => void;
|
83
|
-
/**
|
84
|
-
* volume in [0,1]
|
85
|
-
*/
|
86
|
-
setVolume?: (volume: number) => void;
|
87
|
-
mute?: () => void;
|
88
|
-
/**
|
89
|
-
* restore volume to previous value
|
90
|
-
*/
|
91
|
-
unmute?: () => void;
|
92
|
-
}
|
93
|
-
export declare type PlayerWrapper = {
|
94
|
-
/**
|
95
|
-
* Report that playback of video has finished
|
96
|
-
*/
|
97
|
-
onPlaybackEnded: () => void;
|
98
|
-
/**
|
99
|
-
* Report video progress in milliseconds
|
100
|
-
*/
|
101
|
-
onTimeChanged: (ms: number) => void;
|
102
|
-
/**
|
103
|
-
* Report that video state changed
|
104
|
-
*/
|
105
|
-
onStateChanged: (state: PlayerState) => void;
|
106
|
-
/**
|
107
|
-
* Send source to Tivio
|
108
|
-
*/
|
109
|
-
onSourceChanged: (source: InputSource | null) => void;
|
110
|
-
/**
|
111
|
-
* Report that video failed to load (never started playing)
|
112
|
-
*/
|
113
|
-
onLoadError: (error: Error) => void;
|
114
|
-
/**
|
115
|
-
* Report that video failed during playback (successfully loaded and then failed, e.g. part of stream is invalid)
|
116
|
-
*/
|
117
|
-
onError: (error: Error) => void;
|
118
|
-
/**
|
119
|
-
* Unpause video
|
120
|
-
*/
|
121
|
-
play: () => void;
|
122
|
-
/**
|
123
|
-
* Pause video
|
124
|
-
*/
|
125
|
-
pause: () => void;
|
126
|
-
/**
|
127
|
-
* Currently playing source
|
128
|
-
*/
|
129
|
-
source: InputSource | null;
|
130
|
-
events: {
|
131
|
-
isSupported: (even: string) => boolean;
|
132
|
-
addListener: <T = any>(event: string, cb: (value: T) => Empty) => void;
|
133
|
-
removeListener: <T = any>(event: string, cb: (value: T) => Empty) => void;
|
134
|
-
removeAllListeners: () => void;
|
135
|
-
};
|
136
|
-
/**
|
137
|
-
* Register a low level player that implements player methods, like play video, change volume, etc.
|
138
|
-
*/
|
139
|
-
register: (playerInterface: PlayerInterface) => void;
|
140
|
-
/**
|
141
|
-
* duration of current source in ms (both setter and getter)
|
142
|
-
*/
|
143
|
-
durationMs: number | null;
|
144
|
-
isPlaybackStarted: boolean;
|
145
|
-
isPaused: boolean;
|
146
|
-
isPlaying: boolean;
|
147
|
-
isIdle: boolean;
|
148
|
-
error: Error | null;
|
149
|
-
/**
|
150
|
-
* Replay the video that finished playback
|
151
|
-
*/
|
152
|
-
replay: () => void;
|
153
|
-
/**
|
154
|
-
* Retry to play a video that failed to start playing (e.g. due to a network error)
|
155
|
-
*/
|
156
|
-
retry: () => void;
|
157
|
-
togglePlayPause: () => void;
|
158
|
-
seekTo: (ms: number) => void;
|
159
|
-
/**
|
160
|
-
* set volume to value between 0,1
|
161
|
-
*/
|
162
|
-
setVolume: (volume: number) => void;
|
163
|
-
/**
|
164
|
-
* change volume by value between -1,1
|
165
|
-
*/
|
166
|
-
changeVolumeBy: (volume: number) => void;
|
167
|
-
setMuted: (muted: boolean) => void;
|
168
|
-
toggleMuted: () => void;
|
169
|
-
};
|
170
|
-
export declare type UsePlayerEvent = <T = any>(eventName: string) => T | null;
|
171
|
-
export {};
|