@tivio/sdk-react 2.4.1 → 2.4.2-alpha

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 CHANGED
@@ -1,6 +1,76 @@
1
1
  # @tivio/sdk-react
2
2
 
3
- See changelog [here](./doc/changelog.md)
3
+ ## Changelog
4
+ * UNRELEASED
5
+ * patch: fix peerDependency declaration for react, react-dom
6
+ * major: TivioProvider requires deviceCapabilities
7
+ * major: TivioProvider requires currency
8
+ * minor: add voucher support (see usePurchaseSubscription and useTransactionPayment hooks)
9
+ * minor: device limit support
10
+ * minor: drm (Widevine, PlayReady) support
11
+ * minor: watermarking support
12
+ * minor: add useSearch hook
13
+ * patch: price on video is 0 when purchased
14
+ * v2.4.2
15
+ * patch: added back changelog
16
+ * v2.4.1
17
+ * patch: improved doc about player wrapper
18
+ * v2.4.0
19
+ * patch: improved Player wrapper types
20
+ * minor: added Tivio DOM events `tivio_key_input_handling_change`, `tivio_context_switch` and `tivio_request_goto`
21
+ * 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)
22
+ * patch: added support for browsers that do not implement [indexedDB API](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API)
23
+ * v2.3.4
24
+ * patch: fix of usePurchaseSubscription not reactive
25
+ * v2.3.3
26
+ * patch: fix of useUser not updating
27
+ * v2.3.2
28
+ * patch: next app doesn't fail anymore due to "self is not defined"
29
+ * v2.3.1
30
+ * patch: fix of @tivio/common dependency
31
+ * v2.3.0
32
+ * minor: add useTaggedVideos that allows to fetch videos with given tags
33
+ * minor: add option to fetch tags (on hook useItemsInRow), useVideo always fetching videos tags
34
+ * v2.2.1
35
+ * patch: disable Sentry when no config is supplied to `TivioProvider`
36
+ * v2.2.0
37
+ * patch: reduced bundle size
38
+ * 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 }`
39
+ * v2.1.5
40
+ * patch fix of `useVideosInSection` hook (fetching video's monetizations)
41
+ * v2.1.4
42
+ * patch: fix re-rendering of `useAd` during non-skippable ads (requires core-react-dom@2.1.9)
43
+ * v2.1.3
44
+ * patch: fix changelog
45
+ * v2.1.2
46
+ * patch: Fixed exported types
47
+ * v2.1.1
48
+ * patch: TivioWidget now correctly reports `false` via `onEnabled` callback when in invalid internal state
49
+ * v2.1.0
50
+ * patch: fix of useItemsInRow hook
51
+ * patch: fix of useScreen hook
52
+ * add: useRowsInScreen hook
53
+ * v2.0.3
54
+ * patch: fix of useItemsInRow hook
55
+ * v2.0.2
56
+ * patch: screen and row IDs fixed
57
+ * `TivioBundle.subscriptions.subscribeToItemsInRow` now accepts user-defined ID via studio.tiv.io
58
+ * `TivioBundle.subscriptions.subscribeToScreen` now accepts user-defined ID via studio.tiv.io
59
+ * `Screen` and `Row` types returned by `useScreen()` return their user-defined IDs (`.id`) correctly
60
+ * v2.0.1
61
+ * no changes
62
+ * v2.0.0
63
+ * major: video.channelId can now be `string | null` used to be `string`
64
+ * minor: added data API and hooks for screens (screens, rows of screen and row items)
65
+ * hooks: `useScreen()`, `useItemsInRow()`
66
+ * api: `TivioBundle.subscriptions.subscribeToScreen`, `TivioBundle.subscriptions.subscribeToItemsInRow`
67
+ * v1.3.6
68
+ * ?
69
+ * v1.3.5
70
+ * minor: added WebPlayer props (canReplay, showMarkers, customShortcuts, enableKeyboardShortcuts, source.poster)
71
+ * v1.3.4
72
+ * ...
73
+
4
74
 
5
75
  ## Installation
6
76
 
@@ -179,11 +249,11 @@ function CustomPlayer() {
179
249
 
180
250
  ``` javascript
181
251
  // Report that video failed to load (e.g. due to a wrong URI)
182
- playerWrapper.onLoadError(ms)
252
+ playerWrapper.onLoadError(new Error('video failed to load'))
183
253
 
184
254
  // Report that video failed during playback (e.g. due to bad connection, corrupted chunks of stream video etc.)
185
255
  // This type of error may be auto-recoverable
186
- playerWrapper.onError(ms)
256
+ playerWrapper.onError(new Error('playback error'))
187
257
  }
188
258
  ```
189
259
 
@@ -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;
13
13
  children: React.ReactNode;
14
14
  };
15
15
  declare const TivioContext: React.Context<RemoteBundleState | null>;
@@ -13,6 +13,8 @@ export * from './useOrganizationSubscriptions';
13
13
  export * from './usePurchasesWithVideos';
14
14
  export * from './useFreePurchase';
15
15
  export * from './useRowsInScreen';
16
+ export * from './useVoucher';
16
17
  export * from './useTivio';
17
18
  export * from './useOverlay';
18
19
  export * from './useWatchWithoutAds';
20
+ export * from './useLastVideoByWidgetId';
@@ -0,0 +1,2 @@
1
+ import { Video } from '@tivio/common';
2
+ export declare function useLastVideoByWidgetId(widgetId: string): Video | null;
@@ -1,3 +1,4 @@
1
1
  import { QerkoTransaction } from '@tivio/common';
2
- declare const usePurchaseSubscription: (monetizationId: string) => QerkoTransaction;
2
+ import { Voucher } from './useTransactionPayment';
3
+ declare const usePurchaseSubscription: (monetizationId: string, voucher?: Voucher | undefined) => QerkoTransaction;
3
4
  export { usePurchaseSubscription, };
@@ -1,3 +1,10 @@
1
1
  import { QerkoTransaction } from '@tivio/common';
2
- declare const useTransactionPayment: (videoId: string, monetizationId: string) => QerkoTransaction;
2
+ declare type Voucher = {
3
+ /**
4
+ * Voucher expiration date as a Date object or timestamp in ms.
5
+ */
6
+ expirationDate: Date | number;
7
+ };
8
+ declare const useTransactionPayment: (videoId: string, monetizationId: string, voucher?: Voucher | undefined) => QerkoTransaction;
3
9
  export { useTransactionPayment, };
10
+ export type { Voucher, };
@@ -0,0 +1,12 @@
1
+ declare type Voucher = {
2
+ activate: () => void;
3
+ isUsed: boolean;
4
+ isExpired: boolean;
5
+ status: 'NEW' | 'USED';
6
+ };
7
+ declare const useVoucher: (voucherId: string) => {
8
+ activate: (() => void) | null;
9
+ voucher: Voucher | null;
10
+ error: Error | null;
11
+ };
12
+ export { useVoucher, };
package/dist/config.d.ts CHANGED
@@ -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 { Config as ExternalConfig, InternalConfig } from './types/bundle.types';
5
+ import type { Config as ExternalConfig, InternalConfig } from './types/bundle.types';
6
6
  export declare const defaultConf: {
7
7
  secret: null;
8
8
  resolverUrl: string;
@@ -14,4 +14,4 @@ export declare const defaultConf: {
14
14
  error: string | null;
15
15
  }>;
16
16
  };
17
- export declare const createInternalConf: (conf: ExternalConfig | null) => InternalConfig;
17
+ export declare const createInternalConf: (conf: ExternalConfig) => InternalConfig;
package/dist/index.d.ts CHANGED
@@ -21,3 +21,5 @@ export { TivioComponents } from './types/bundle.types';
21
21
  export { TivioAuth } from './types/bundle.types';
22
22
  export { TivioGetters } from './types/bundle.types';
23
23
  export { TivioSubscriptions } from './types/bundle.types';
24
+ export { PlayerCapability } from './types/bundle.types';
25
+ export { Currency } from './types/bundle.types';