@tivio/sdk-react 3.0.0 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,10 +1,20 @@
1
1
  # @tivio/sdk-react
2
2
 
3
3
  ## Changelog
4
+
4
5
  * UNRELEASED
5
- *
6
+ * v3.1.3
7
+ * patch: Hotfix made sure disabled Tivio does not break React Native
8
+ * v3.1.2
9
+ * patch: Allow `conf` prop of `TivioProvider` to be `null` or `undefined` in order to turn off Tivio
10
+ * v3.1.1
11
+ * patch: fixed `setUser()` crash when bundle fails to load
12
+ * v3.1.0
13
+ * patch: `useAdSegment()` now returns null if no monetization is configured, ad segments are not managed in that situation
14
+ * minor: enriched `AdSegment` type from `useAdSegment()`
15
+ * minor: Added `setUser()` function for login and logout
6
16
  * v3.0.0
7
- * minor: Added hook useWatchWithoutAdsOffer to trigger purchase dialog to "watch without ads", if available
17
+ * minor: Added hook `useWatchWithoutAdsOffer` to trigger purchase dialog to "watch without ads", if available
8
18
  * patch: fix peerDependency declaration for react, react-dom
9
19
  * major: TivioProvider requires deviceCapabilities
10
20
  * major: TivioProvider requires currency
@@ -104,9 +114,24 @@ function App({children}) {
104
114
  }
105
115
  ```
106
116
 
107
- ### Usage with authorization
117
+ ## Authentication
118
+
119
+ A logged-in user can access more features, such as making purchases. In order to authenticate a user with Tivio, use the `setUser()` method.
120
+
121
+ Verification of the user against 3rd party auth servers is implemented per customer.
122
+
123
+ ```typescript
124
+ import { setUser } from '@tivio/sdk-react'
125
+
126
+ // Log in
108
127
 
109
- // TODO
128
+ // Payload is specific per customer
129
+ // A common use-case is sending an auth token inside the payload, which Tivio can use to verify the user
130
+ await setUser('userId', { token: 'xxx'})
131
+
132
+ // Log out
133
+ await setUser('userId', null)
134
+ ```
110
135
 
111
136
  ## Tivio widget
112
137
 
package/README.md.bak ADDED
@@ -0,0 +1,515 @@
1
+ # @tivio/sdk-react
2
+
3
+ ## Changelog
4
+
5
+ * UNRELEASED
6
+ * v3.1.3
7
+ * patch: Hotfix made sure disabled Tivio does not break React Native
8
+ * internal: Fixed conf.bundleUrlOverride error handling
9
+ * v3.1.2
10
+ * patch: Allow `conf` prop of `TivioProvider` to be `null` or `undefined` in order to turn off Tivio
11
+ * internal: Added `runFeatureSupportCheck` to `TivioProvider`
12
+ * v3.1.1
13
+ * patch: fixed `setUser()` crash when bundle fails to load
14
+ * v3.1.0
15
+ * internal: refactored `useAd`, `useAdSegment`
16
+ * patch: `useAdSegment()` now returns null if no monetization is configured, ad segments are not managed in that situation
17
+ * internal: fixed refactored `setUser()`
18
+ * minor: enriched `AdSegment` type from `useAdSegment()`
19
+ * minor: Added `setUser()` function for login and logout
20
+ * v3.0.0
21
+ * minor: Added hook `useWatchWithoutAdsOffer` to trigger purchase dialog to "watch without ads", if available
22
+ * patch: fix peerDependency declaration for react, react-dom
23
+ * major: TivioProvider requires deviceCapabilities
24
+ * major: TivioProvider requires currency
25
+ * minor: add voucher support (see usePurchaseSubscription and useTransactionPayment hooks)
26
+ * minor: device limit support
27
+ * minor: drm (Widevine, PlayReady) support
28
+ * minor: watermarking support
29
+ * minor: add useSearch hook
30
+ * patch: price on video is 0 when purchased
31
+ * v2.4.2
32
+ * patch: added back changelog
33
+ * v2.4.1
34
+ * patch: improved doc about player wrapper
35
+ * v2.4.0
36
+ * patch: improved Player wrapper types
37
+ * minor: added Tivio DOM events `tivio_key_input_handling_change`, `tivio_context_switch` and `tivio_request_goto`
38
+ * patch: added support for remote code on browsers that do not implement [indexedDB API](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API)
39
+ * patch: added support for browsers that do not implement [indexedDB API](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API)
40
+ * v2.3.4
41
+ * patch: fix of usePurchaseSubscription not reactive
42
+ * v2.3.3
43
+ * patch: fix of useUser not updating
44
+ * v2.3.2
45
+ * patch: next app doesn't fail anymore due to "self is not defined"
46
+ * v2.3.1
47
+ * patch: fix of @tivio/common dependency
48
+ * v2.3.0
49
+ * minor: add useTaggedVideos that allows to fetch videos with given tags
50
+ * minor: add option to fetch tags (on hook useItemsInRow), useVideo always fetching videos tags
51
+ * v2.2.1
52
+ * patch: disable Sentry when no config is supplied to `TivioProvider`
53
+ * v2.2.0
54
+ * patch: reduced bundle size
55
+ * minor: disable Sentry when no config is supplied to `TivioProvider` or when Tivio is disabled `{ enable: false }`, or when Sentry is disabled via config `{ enableSentry: false }`
56
+ * v2.1.5
57
+ * patch fix of `useVideosInSection` hook (fetching video's monetizations)
58
+ * v2.1.4
59
+ * patch: fix re-rendering of `useAd` during non-skippable ads (requires core-react-dom@2.1.9)
60
+ * v2.1.3
61
+ * patch: fix changelog
62
+ * v2.1.2
63
+ * patch: Fixed exported types
64
+ * v2.1.1
65
+ * patch: TivioWidget now correctly reports `false` via `onEnabled` callback when in invalid internal state
66
+ * v2.1.0
67
+ * patch: fix of useItemsInRow hook
68
+ * patch: fix of useScreen hook
69
+ * add: useRowsInScreen hook
70
+ * v2.0.3
71
+ * patch: fix of useItemsInRow hook
72
+ * v2.0.2
73
+ * patch: screen and row IDs fixed
74
+ * `TivioBundle.subscriptions.subscribeToItemsInRow` now accepts user-defined ID via studio.tiv.io
75
+ * `TivioBundle.subscriptions.subscribeToScreen` now accepts user-defined ID via studio.tiv.io
76
+ * `Screen` and `Row` types returned by `useScreen()` return their user-defined IDs (`.id`) correctly
77
+ * v2.0.1
78
+ * no changes
79
+ * v2.0.0
80
+ * major: video.channelId can now be `string | null` used to be `string`
81
+ * minor: added data API and hooks for screens (screens, rows of screen and row items)
82
+ * hooks: `useScreen()`, `useItemsInRow()`
83
+ * api: `TivioBundle.subscriptions.subscribeToScreen`, `TivioBundle.subscriptions.subscribeToItemsInRow`
84
+ * v1.3.6
85
+ * ?
86
+ * v1.3.5
87
+ * minor: added WebPlayer props (canReplay, showMarkers, customShortcuts, enableKeyboardShortcuts, source.poster)
88
+ * v1.3.4
89
+ * ...
90
+
91
+
92
+ ## Installation
93
+
94
+ Install @tivio/sdk-react along with its peer dependencies
95
+ ```sh
96
+ npm i react@17 react-dom@17 @tivio/sdk-react
97
+ # or
98
+ yarn add react@17 react-dom@17 @tivio/sdk-react
99
+ ```
100
+
101
+ ## Initialization
102
+
103
+ Put Tivio Provider at the top level of your application:
104
+
105
+ ``` javascript
106
+ import { TivioProvider } from '@tivio/sdk-react'
107
+
108
+ const config = {
109
+ secret: 'XXXXXXXXXX',
110
+ }
111
+
112
+ function App({children}) {
113
+ return (
114
+ <TivioProvider conf={config}>
115
+ {children}
116
+ </TivioProvider>
117
+ )
118
+ }
119
+ ```
120
+
121
+ ## Authentication
122
+
123
+ A logged-in user can access more features, such as making purchases. In order to authenticate a user with Tivio, use the `setUser()` method.
124
+
125
+ Verification of the user against 3rd party auth servers is implemented per customer.
126
+
127
+ ```typescript
128
+ import { setUser } from '@tivio/sdk-react'
129
+
130
+ // Log in
131
+
132
+ // Payload is specific per customer
133
+ // A common use-case is sending an auth token inside the payload, which Tivio can use to verify the user
134
+ await setUser('userId', { token: 'xxx'})
135
+
136
+ // Log out
137
+ await setUser('userId', null)
138
+ ```
139
+
140
+ ## Tivio widget
141
+
142
+ Tivio widget is the main Tivio component which shows the widget and provides access to its channels, sections and videos.
143
+ Usage is very simple (be sure to set `id` to the widget ID you have configured in [Tivio Studio](https://studio.tiv.io/)):
144
+
145
+ ``` javascript
146
+ import { TivioWidget } from '@tivio/sdk-react'
147
+
148
+ function Screen() {
149
+ return (
150
+ <TivioWidget id="theWidgetId" />
151
+ )
152
+ }
153
+ ```
154
+
155
+ ### Usage with smart TV navigation (focus control)
156
+
157
+ ``` javascript
158
+ import { TivioWidget, TivioWidgetRef } from '@tivio/sdk-react'
159
+
160
+ function Screen() {
161
+ const ref = useRef<TivioWidgetRef>(null)
162
+
163
+ return (
164
+ <TivioWidget id="theWidgetId" ref={ref} onBlur={() => {/* widget lost focus */}}/>
165
+ <div>
166
+ <button onClick={() => ref.current?.focus({ x: 100 })}>Focus</button>
167
+ <button onClick={() => ref.current?.unfocus()}>Unfocus</button>
168
+ </div>
169
+ )
170
+ }
171
+ ```
172
+
173
+ ## Player wrapper
174
+
175
+ Player wrapper is the way how you can enhance your video player with Tivio features, such Tivio Ads. In order to start using Tivio player wrapper, wrap your player methods with PlayerWrapper, start using PlayerWrapper's methods instead of them to control your playback and start sending player events to Tivio PlayerWrapper.
176
+
177
+ ### Wrap your player methods with Tivio player wrapper
178
+
179
+ ``` javascript
180
+ import { useTivioReadyData } from '@tivio/sdk-react'
181
+
182
+ function CustomPlayer() {
183
+ const tivioData = useTivioReadyData()
184
+
185
+ useEffect(() => {
186
+ if (tivioData) {
187
+ // If your app uses multiple player instances, use different Tivio player wrapper for each
188
+ // distinguished by playerWrapperId
189
+ const playerWrapper = tivio.getPlayerWrapper({ playerWrapperId: 'PLAYER_1' })
190
+
191
+ // Pass your player methods to Tivio player wrapper
192
+ playerWrapper.register({
193
+ play: () => {
194
+ // Un-pause your player
195
+ },
196
+ pause: () => {
197
+ // Pause your player
198
+ },
199
+ seekTo: (ms: number) => {
200
+ // Seek to position in milliseconds using your player
201
+ },
202
+ setSource: (videoSource: InputSource) => {
203
+ // Send this video source to your player to load it
204
+ },
205
+ })
206
+ }
207
+ }, [tivioData])
208
+ }
209
+ ```
210
+
211
+ ### Start using Tivio player wrapper methods to control playback
212
+
213
+ ``` javascript
214
+ // Channel source metadata, such as channel name, epg start and epg end are necessary
215
+ // for TV ad segment detection and application of ad strategies
216
+ const source = new ChannelSource(
217
+ 'https://channel_prima_hd.m3u8',
218
+ {
219
+ // here put any additional metadata, for your use.
220
+ // This object will not be touched by Tivio
221
+ },
222
+ // channel name
223
+ // can also be prima hd, prima_hd, prima, Prima, PRIMA, etc.
224
+ // we will normalize it to snake case and add '_hd' if necessary
225
+ 'Prima HD',
226
+ // program name
227
+ 'Dr. House',
228
+ // description (optional)
229
+ 'Episode about Dr. House being awesome',
230
+ // EPG start
231
+ new Date('2021-12-10T12:00:00'),
232
+ // EPG end
233
+ new Date('2021-12-10T13:40:00'),
234
+ )
235
+
236
+ // Send source to player
237
+ playerWrapper.onSourceChanged(source)
238
+
239
+ // Un-pause player
240
+ playerWrapper.play()
241
+
242
+ // Pause player
243
+ playerWrapper.pause()
244
+ }
245
+ ```
246
+
247
+ ### Start reporting player events to Tivio
248
+
249
+ ``` javascript
250
+ // Report that source is playing
251
+ playerWrapper.onStateChanged('playing')
252
+
253
+ // Report that source is paused
254
+ playerWrapper.onStateChanged('paused')
255
+
256
+ // Report that source stopped playing
257
+ playerWrapper.onPlaybackEnded()
258
+ playerWrapper.onStateChanged('idle')
259
+
260
+ // Report video progress
261
+ playerWrapper.onTimeChanged(ms)
262
+ }
263
+ ```
264
+
265
+ ### Start reporting playback-related errors to Tivio
266
+
267
+ ``` javascript
268
+ // Report that video failed to load (e.g. due to a wrong URI)
269
+ playerWrapper.onLoadError(new Error('video failed to load'))
270
+
271
+ // Report that video failed during playback (e.g. due to bad connection, corrupted chunks of stream video etc.)
272
+ // This type of error may be auto-recoverable
273
+ playerWrapper.onError(new Error('playback error'))
274
+ }
275
+ ```
276
+
277
+ ## Tivio DOM events
278
+
279
+ `TivioWidget` triggers these events on `window.document`.
280
+
281
+ 1. To instruct the parent app to navigate to and focus a specific TivioWidget (e.g. after going back from a Tivio screen)
282
+
283
+ ```typescript
284
+ document.addEventListener("tivio_request_goto", e => {
285
+ e.detail.widgetId; // string - Tivio widget ID to go navigate to in UI
286
+ });
287
+ ```
288
+ 2. To notify the parent app about context switch, i.e. where is the user located or what is he focusing
289
+
290
+ ```typescript
291
+ document.addEventListener("tivio_context_switch", e => {
292
+ e.detail.context; // 'tivio' | 'parent' - where is the user located? - in Tivio or in parent app
293
+
294
+ // For context Tivio there are additional fields
295
+ e.detail.context; // 'tivio'
296
+ e.detail.contextLocation; // 'route' | 'overlay' | 'widget' - where in Tivio is the user located?
297
+ // - on a Tivio route, in parent app but looking at a full screen Tivio overlay,
298
+ // or in parent app and focus is on a Tivio widget
299
+
300
+ // For context Tivio contextLocation 'widget' there is an additional field of widget ID
301
+ e.detail.widgetId; // string - which Tivio widget is focused right now
302
+ });
303
+ ```
304
+ 3. To notify the parent app about whether it should be handling key input from RC (TV remote) or not. When inputHandler is 'tivio', the parent app should stop reacting to key input, when inputHandler is 'parent' the parent app should start reacting again.
305
+
306
+ ```typescript
307
+ document.addEventListener("tivio_key_input_handling_change", e => {
308
+ e.detail.inputHandler; // 'tivio' | 'parent' - who should be handling RC input? - Tivio or parent app
309
+ });
310
+ ```
311
+
312
+ ## Data hooks
313
+
314
+ If you don't want to use TivioWidget, you can implement your own UI using React data hooks.
315
+
316
+ ### useWidget hook
317
+
318
+ Gets Widget object and subscribes to its changes.
319
+
320
+ ``` javascript
321
+ /**
322
+ * Use widget
323
+ * @param widgetId - widget id
324
+ */
325
+ useWidget: (widgetId: string) => {
326
+ error: string | null;
327
+ data: Widget | null;
328
+ }
329
+ ```
330
+
331
+ ### useChannel hook
332
+
333
+ Gets Channel object and subscribes to its changes.
334
+
335
+ ``` javascript
336
+ /**
337
+ * Use channel
338
+ * @param channelId - channel id
339
+ */
340
+ useChannel: (channelId: string) => {
341
+ error: string | null;
342
+ data: Channel | null;
343
+ }
344
+ ```
345
+
346
+ ### useSection hook
347
+
348
+ Gets Section object and subscribes to its changes.
349
+
350
+ ``` javascript
351
+ /**
352
+ * Use section
353
+ * @param sectionId - section id
354
+ */
355
+ useSection: (sectionId: string) => {
356
+ error: string | null;
357
+ data: Section | null;
358
+ }
359
+ ```
360
+
361
+ ### useVideo hook
362
+
363
+ Gets Video object and subscribes to its changes.
364
+
365
+ ``` javascript
366
+ /**
367
+ * Use video
368
+ * @param videoId - video id
369
+ */
370
+ useVideo: (videoId: string) => {
371
+ error: string | null;
372
+ data: Video | null;
373
+ }
374
+ ```
375
+
376
+ ### useChannelsInWidget hook
377
+
378
+ Gets array of Channel objects and subscribes to their changes. It is possible to use `hasNextPage` and `fetchMore`
379
+ for pagination (returned in `data` object).
380
+
381
+ ``` javascript
382
+ /**
383
+ * Use channels in widget
384
+ * @param widgetId - widget id
385
+ * @param [limit] - channels count, defaults to 10
386
+ */
387
+ useChannelsInWidget: (widgetId: string, limit?: number) => {
388
+ error: string | null;
389
+ data: PaginationData<Channel> | null;
390
+ }
391
+ ```
392
+
393
+ ### useSectionsInChannel hook
394
+
395
+ Gets array of Section objects and subscribes to their changes. It is possible to use `hasNextPage` and `fetchMore`
396
+ for pagination (returned in `data` object).
397
+
398
+ ``` javascript
399
+ /**
400
+ * Use section in channel
401
+ * @param channelId - channel id
402
+ * @param [limit] - sections count, defaults to 10
403
+ */
404
+ useSectionsInChannel: (channelId: string, limit?: number) => {
405
+ error: string | null;
406
+ data: PaginationData<Section> | null;
407
+ }
408
+ ```
409
+
410
+ ### useVideosInSection hook
411
+
412
+ Gets array of Video objects and subscribes to their changes. It is possible to use `hasNextPage` and `fetchMore`
413
+ for pagination (returned in `data` object).
414
+
415
+ ``` javascript
416
+ /**
417
+ * Use videos in section
418
+ * @param sectionId - section id
419
+ * @param [limit] - videos count, defaults to 10
420
+ */
421
+ useVideosInSection: (sectionId: string, limit?: number) => {
422
+ error: string | null;
423
+ data: PaginationData<Video> | null;
424
+ }
425
+ ```
426
+
427
+ ### useScreen hook
428
+ Gets Screen object and subscribes to its changes.
429
+
430
+ ```ts
431
+ /**
432
+ * Hook to fetch an app screen
433
+ * @param screenId - screen ID configured via studio.tiv.io
434
+ */
435
+ useScreen: (screenId: string) => {
436
+ error: Error | null
437
+ data: Screen | null
438
+ }
439
+
440
+ // Example:
441
+ // Screens with their screenIds are configured via studio.tiv.io
442
+ const screenId = '890sdfvxoi'
443
+ const { error, data } = useScreen(screenId)
444
+
445
+ if (data) {
446
+ const screenName = data.name
447
+ const screenRows = data.rows
448
+ // ...
449
+ }
450
+ ```
451
+
452
+ ### useItemsInRow hook
453
+
454
+ Gets array of Video or Tag objects for a specified row. It is possible to use
455
+ `hasNextPage` and `fetchMore` for pagination (returned in `data` object).
456
+
457
+ *(Note: Does not subscribe to changes in video objects, in order to refresh data it is necessary to reload the app.)*
458
+
459
+ ```ts
460
+ /**
461
+ * Hook to fetch row items for rows received from `useScreen()`
462
+ * @param id - row ID configured via studio.tiv.io
463
+ * @param options.limit - items limit
464
+ * @param options.noLimit - disable/enable pagination (will fetch all items)
465
+ * @param options.fecthTags - disable/enable tags fetching
466
+ */
467
+ useItemsInRow: (id: string, options: {limit?: number, noLimit?: boolean, fecthTags?: boolean}) => {
468
+ error: Error | null
469
+ data: PaginationData<Video | Tag> | null
470
+ isLoading: boolean
471
+ }
472
+
473
+ // Example:
474
+ // Rows and their row ID can be loaded using useScreen() hook
475
+ const Row = ({ id }: { id: string}) => {
476
+ const rowData = useItemsInRow(id, 10)
477
+
478
+ return <div>
479
+ <div>Row id: {id}</div>
480
+ Count: ({rowData.data?.items.length})
481
+ <div>
482
+ {rowData.isLoading && <div>Loading...</div>}
483
+ {rowData.data?.items.map(item => (
484
+ <div>
485
+ <div>{item.name}</div>
486
+ <img src={item.cover} alt={item.name} />
487
+ </div>
488
+ ))}
489
+ </div>
490
+ <button onClick={() => rowData.data?.fetchMore()}>more</button>
491
+ </div>
492
+ }
493
+ ```
494
+
495
+ ### useTaggedItems hook
496
+
497
+ Allows to fetch videos with given tags.
498
+
499
+ ```ts
500
+ /**
501
+ * Hook to fetch row items for rows received from `useScreen()`
502
+ * @param id - row ID configured via studio.tiv.io
503
+ * @param options.limit - items limit
504
+ * @param options.noLimit - disable/enable pagination (will fetch all items)
505
+ * @param options.fecthTags - disable/enable tags fetching
506
+ */
507
+ useTaggedItems: (tagIds: string[], {limit?: number, noLimit?: boolean, fecthTags?: boolean}) => {
508
+ error: Error | null
509
+ data: PaginationData<Video> | null
510
+ }
511
+
512
+
513
+ # Deprecations
514
+ - Video.url will be removed in version 3.0.0, use Video.uri attribute instead
515
+ - Video.cover will be removed in version 3.0.0, use Video.assets attribute instead
@@ -9,7 +9,7 @@ export declare type TivioProviderProps = {
9
9
  /**
10
10
  * This prop must be set only once and not change value afterwards
11
11
  */
12
- conf: Config;
12
+ conf: Config | undefined | null;
13
13
  children: React.ReactNode;
14
14
  };
15
15
  declare const TivioContext: React.Context<RemoteBundleState | null>;
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
3
  * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
4
  */
5
- import type { AdSource, UsePlayerEvent } from '../../types/customPlayer.types';
5
+ import type { UsePlayerEvent } from '../../types/customPlayer.types';
6
6
  import type { BetOffer, Marker } from '../../types/types';
7
7
  export declare const usePlayerEvent: UsePlayerEvent;
8
8
  export declare const useMarkers: () => Marker[] | null;
@@ -12,12 +12,17 @@ interface IntroMarker {
12
12
  skip: () => void;
13
13
  }
14
14
  export declare const useIntro: () => IntroMarker | null;
15
- export declare const useAd: () => AdSource | null;
15
+ export declare const useAd: () => import("../../types/customPlayer.types").AdSource | null;
16
16
  export declare const useCurrentMarker: () => Marker | null;
17
17
  export declare const useSeekState: () => boolean | null;
18
- interface AdSegment {
18
+ export declare const useAdSegment: () => {
19
+ id: string;
19
20
  remainingMs: number;
21
+ secondsToEnd: number;
22
+ secondsToSkippable: number | null;
20
23
  canSeek: boolean;
21
- }
22
- export declare const useAdSegment: () => AdSegment | null;
24
+ canSkip: boolean;
25
+ isSkippable: boolean;
26
+ skip: () => any;
27
+ } | null;
23
28
  export {};
@@ -1,4 +1,4 @@
1
1
  import { QerkoTransaction } from '@tivio/common';
2
- import { Voucher } from './useTransactionPayment';
3
- declare const usePurchaseSubscription: (monetizationId: string, voucher?: Voucher | undefined) => QerkoTransaction;
2
+ import { NewVoucher } from './useTransactionPayment';
3
+ declare const usePurchaseSubscription: (monetizationId: string, voucher?: NewVoucher | undefined) => QerkoTransaction;
4
4
  export { usePurchaseSubscription, };
@@ -1,10 +1,10 @@
1
1
  import { QerkoTransaction } from '@tivio/common';
2
- declare type Voucher = {
3
- /**
4
- * Voucher expiration date as a Date object or timestamp in ms.
5
- */
2
+ /**
3
+ * TODO: Duplicate, because we can't import types from core-js.
4
+ */
5
+ declare type NewVoucher = {
6
6
  expirationDate: Date | number;
7
7
  };
8
- declare const useTransactionPayment: (videoId: string, monetizationId: string, voucher?: Voucher | undefined) => QerkoTransaction;
8
+ declare const useTransactionPayment: (videoId: string, monetizationId: string, voucher?: NewVoucher | undefined) => QerkoTransaction;
9
9
  export { useTransactionPayment, };
10
- export type { Voucher, };
10
+ export type { NewVoucher, };
@@ -1,3 +1,6 @@
1
+ /**
2
+ * TODO: Should be in core-js, we can't import types from it, though.
3
+ */
1
4
  declare type Voucher = {
2
5
  activate: () => void;
3
6
  isUsed: boolean;
@@ -6,7 +9,7 @@ declare type Voucher = {
6
9
  voucherInfo: any;
7
10
  };
8
11
  declare const useVoucher: (voucherId: string) => {
9
- activate: (() => void) | null;
12
+ activate: (() => Promise<void>) | null;
10
13
  voucher: Voucher | null;
11
14
  error: Error | null;
12
15
  };
package/dist/config.d.ts CHANGED
@@ -3,9 +3,11 @@
3
3
  * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
4
  */
5
5
  import type { Config as ExternalConfig, InternalConfig } from './types/bundle.types';
6
+ import type { Currency } from '@tivio/common';
6
7
  export declare const defaultConf: {
7
8
  secret: null;
8
9
  resolverUrl: string;
10
+ currency: Currency;
9
11
  disableUnmounting: boolean;
10
12
  fetchPackage: import("./services/packageLoader").FetchPackage;
11
13
  pubSub: import("./types/bundle.types").PubSub;
@@ -14,4 +16,4 @@ export declare const defaultConf: {
14
16
  error: string | null;
15
17
  }>;
16
18
  };
17
- export declare const createInternalConf: (conf: ExternalConfig) => InternalConfig;
19
+ export declare const createInternalConf: (conf: ExternalConfig | undefined | null) => InternalConfig;
package/dist/index.d.ts CHANGED
@@ -23,3 +23,4 @@ export { TivioGetters } from './types/bundle.types';
23
23
  export { TivioSubscriptions } from './types/bundle.types';
24
24
  export { PlayerCapability } from './types/bundle.types';
25
25
  export { Currency } from './types/bundle.types';
26
+ export { setUser } from './services/login';