@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 +73 -3
- package/dist/components/TivioProvider.d.ts +1 -1
- package/dist/components/hooks/index.d.ts +2 -0
- package/dist/components/hooks/useLastVideoByWidgetId.d.ts +2 -0
- package/dist/components/hooks/usePurchaseSubscription.d.ts +2 -1
- package/dist/components/hooks/useTransactionPayment.d.ts +8 -1
- package/dist/components/hooks/useVoucher.d.ts +12 -0
- package/dist/config.d.ts +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/types/bundle.types.d.ts +33 -18
- package/doc/changelog.md +0 -59
- package/package.json +5 -5
@@ -1,39 +1,46 @@
|
|
1
|
-
import { SubscribeToTaggedVideos, UseCancelSubscription } from '@tivio/common';
|
1
|
+
import { Currency, SubscribeToTaggedVideos, UseCancelSubscription } from '@tivio/common';
|
2
2
|
import { ComponentType } from 'react';
|
3
3
|
import { Logger } from '../services/logger';
|
4
4
|
import { FetchPackage } from '../services/packageLoader';
|
5
5
|
import { Disposer, Empty, Nullable } from './common';
|
6
6
|
import { Channel, Language, RemoteProviderProps, Section, TivioSources, TivioWidgetProps, UserData, WebPlayerProps, Widget } from './types';
|
7
7
|
import type { AdSource, PlayerWrapper } from './customPlayer.types';
|
8
|
-
import type { Monetization, QerkoPaymentInfo, Screen, SubscribeToItemsInRow, SubscribeToRowsInScreen, SubscribeToScreen, TvAppProps,
|
8
|
+
import type { Monetization, Purchase, QerkoPaymentInfo, Screen, SubscribeToItemsInRow, SubscribeToRowsInScreen, SubscribeToScreen, TvAppProps, User, UseSearch, Video } from '@tivio/common';
|
9
9
|
import type React from 'react';
|
10
10
|
declare type Settings = {
|
11
11
|
onSetUser: (handler: (userId: string, userPayload: unknown) => void) => void;
|
12
12
|
setUser: (userId: string, userPayload: unknown) => void;
|
13
13
|
};
|
14
|
+
interface PlayerCapability {
|
15
|
+
codec: 'h264' | 'h265';
|
16
|
+
encryption: 'fairplay' | 'none' | 'playready' | 'widevine';
|
17
|
+
protocol: 'dash' | 'hls';
|
18
|
+
}
|
14
19
|
declare type InternalConfig = {
|
15
|
-
enable?: boolean;
|
16
|
-
secret: string | null;
|
17
|
-
verbose?: boolean;
|
18
|
-
/**
|
19
|
-
* @private URL of resolver. Resolver is a script used to fetch remove code bundle
|
20
|
-
*/
|
21
|
-
resolverUrl: string;
|
22
20
|
/**
|
23
21
|
* @private URL of remote code bundle to be fetched directly (without using resolver)
|
24
22
|
*/
|
25
23
|
bundleUrlOverride?: string;
|
24
|
+
currency: Currency;
|
25
|
+
deviceCapabilities: PlayerCapability[];
|
26
26
|
disableUnmounting?: boolean;
|
27
|
-
|
28
|
-
|
29
|
-
pubSub: PubSub;
|
30
|
-
LoaderComponent?: ComponentType;
|
27
|
+
enable?: boolean;
|
28
|
+
enableSentry?: boolean;
|
31
29
|
ErrorComponent?: ComponentType<{
|
32
30
|
error: string | null;
|
33
31
|
}>;
|
32
|
+
fetchPackage: FetchPackage;
|
34
33
|
language?: string;
|
34
|
+
LoaderComponent?: ComponentType;
|
35
|
+
logger?: Logger | null;
|
36
|
+
pubSub: PubSub;
|
37
|
+
/**
|
38
|
+
* @private URL of resolver. Resolver is a script used to fetch remove code bundle
|
39
|
+
*/
|
40
|
+
resolverUrl: string;
|
35
41
|
sdkVersion: string;
|
36
|
-
|
42
|
+
secret: string | null;
|
43
|
+
verbose?: boolean;
|
37
44
|
};
|
38
45
|
declare type Events = {
|
39
46
|
'on-ready': RemoteBundleState;
|
@@ -43,7 +50,9 @@ interface PubSub {
|
|
43
50
|
publish: <K extends keyof Events>(triggerName: K, payload: Events[K]) => Empty;
|
44
51
|
subscribe: <K extends keyof Events>(triggerName: K, onMessage: (data: Events[K]) => Empty) => Disposer;
|
45
52
|
}
|
46
|
-
declare type Config = Pick<InternalConfig, '
|
53
|
+
declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose'> & {
|
54
|
+
deviceCapabilities: PlayerCapability[] | 'auto';
|
55
|
+
};
|
47
56
|
declare type TivioSubscriptions = {
|
48
57
|
subscribeToUser: (cb: (error: string | null, user: User | null) => void) => void;
|
49
58
|
/**
|
@@ -194,6 +203,8 @@ declare type TivioHooks = {
|
|
194
203
|
useAd: () => [(AdSource | null)];
|
195
204
|
useCancelSubscription: UseCancelSubscription;
|
196
205
|
useSearch: UseSearch;
|
206
|
+
useVoucher: (voucherId: string) => any;
|
207
|
+
useLastVideoByWidgetId: (widgetId: string) => Video | null;
|
197
208
|
};
|
198
209
|
declare type TivioBundle = {
|
199
210
|
components: TivioComponents;
|
@@ -201,8 +212,12 @@ declare type TivioBundle = {
|
|
201
212
|
auth: TivioAuth;
|
202
213
|
hooks: TivioHooks;
|
203
214
|
init: (config: Config) => void | Promise<void>;
|
204
|
-
purchaseVideoWithQerko: (videoId: string, monetizationId: string
|
205
|
-
|
215
|
+
purchaseVideoWithQerko: (videoId: string, monetizationId: string, voucher?: {
|
216
|
+
expirationDate: Date;
|
217
|
+
}) => Promise<QerkoPaymentInfo>;
|
218
|
+
purchaseSubscriptionWithQerko: (monetizationId: string, voucher?: {
|
219
|
+
expirationDate: Date;
|
220
|
+
}) => Promise<QerkoPaymentInfo>;
|
206
221
|
setLanguage: (language: Language) => void;
|
207
222
|
setUser: (userId: string, userPayload?: unknown) => void;
|
208
223
|
sources: TivioSources;
|
@@ -217,4 +232,4 @@ declare type RemoteBundleState = {
|
|
217
232
|
settings: Settings;
|
218
233
|
state: 'loading' | 'error' | 'ready';
|
219
234
|
} & Nullable<TivioBundle>;
|
220
|
-
export type { RemoteBundleState, Config, Settings, InternalConfig, TivioBundle, TivioBundleFile, TivioHooks, TivioComponents, TivioAuth, TivioGetters, TivioSubscriptions, Events, PubSub, };
|
235
|
+
export type { RemoteBundleState, Config, Settings, InternalConfig, TivioBundle, TivioBundleFile, TivioHooks, TivioComponents, TivioAuth, TivioGetters, TivioSubscriptions, Events, PubSub, PlayerCapability, Currency, };
|
package/doc/changelog.md
CHANGED
@@ -1,59 +0,0 @@
|
|
1
|
-
## Changelog
|
2
|
-
* Unreleased
|
3
|
-
* v2.4.1
|
4
|
-
* patch: improved doc about player wrapper
|
5
|
-
* v2.4.0
|
6
|
-
* patch: improved Player wrapper types
|
7
|
-
* minor: added Tivio DOM events `tivio_key_input_handling_change`, `tivio_context_switch` and `tivio_request_goto`
|
8
|
-
* 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)
|
9
|
-
* patch: added support for browsers that do not implement [indexedDB API](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API)
|
10
|
-
* v2.3.4
|
11
|
-
* patch: fix of usePurchaseSubscription not reactive
|
12
|
-
* v2.3.3
|
13
|
-
* patch: fix of useUser not updating
|
14
|
-
* v2.3.2
|
15
|
-
* patch: next app doesn't fail anymore due to "self is not defined"
|
16
|
-
* v2.3.1
|
17
|
-
* patch: fix of @tivio/common dependency
|
18
|
-
* v2.3.0
|
19
|
-
* minor: add useTaggedVideos that allows to fetch videos with given tags
|
20
|
-
* minor: add option to fetch tags (on hook useItemsInRow), useVideo always fetching videos tags
|
21
|
-
* v2.2.1
|
22
|
-
* patch: disable Sentry when no config is supplied to `TivioProvider`
|
23
|
-
* v2.2.0
|
24
|
-
* patch: reduced bundle size
|
25
|
-
* 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 }`
|
26
|
-
* v2.1.5
|
27
|
-
* patch fix of `useVideosInSection` hook (fetching video's monetizations)
|
28
|
-
* v2.1.4
|
29
|
-
* patch: fix re-rendering of `useAd` during non-skippable ads (requires core-react-dom@2.1.9)
|
30
|
-
* v2.1.3
|
31
|
-
* patch: fix changelog
|
32
|
-
* v2.1.2
|
33
|
-
* patch: Fixed exported types
|
34
|
-
* v2.1.1
|
35
|
-
* patch: TivioWidget now correctly reports `false` via `onEnabled` callback when in invalid internal state
|
36
|
-
* v2.1.0
|
37
|
-
* patch: fix of useItemsInRow hook
|
38
|
-
* patch: fix of useScreen hook
|
39
|
-
* add: useRowsInScreen hook
|
40
|
-
* v2.0.3
|
41
|
-
* patch: fix of useItemsInRow hook
|
42
|
-
* v2.0.2
|
43
|
-
* patch: screen and row IDs fixed
|
44
|
-
* `TivioBundle.subscriptions.subscribeToItemsInRow` now accepts user-defined ID via studio.tiv.io
|
45
|
-
* `TivioBundle.subscriptions.subscribeToScreen` now accepts user-defined ID via studio.tiv.io
|
46
|
-
* `Screen` and `Row` types returned by `useScreen()` return their user-defined IDs (`.id`) correctly
|
47
|
-
* v2.0.1
|
48
|
-
* no changes
|
49
|
-
* v2.0.0
|
50
|
-
* major: video.channelId can now be `string | null` used to be `string`
|
51
|
-
* minor: added data API and hooks for screens (screens, rows of screen and row items)
|
52
|
-
* hooks: `useScreen()`, `useItemsInRow()`
|
53
|
-
* api: `TivioBundle.subscriptions.subscribeToScreen`, `TivioBundle.subscriptions.subscribeToItemsInRow`
|
54
|
-
* v1.3.6
|
55
|
-
* ?
|
56
|
-
* v1.3.5
|
57
|
-
* minor: added WebPlayer props (canReplay, showMarkers, customShortcuts, enableKeyboardShortcuts, source.poster)
|
58
|
-
* v1.3.4
|
59
|
-
* ...
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tivio/sdk-react",
|
3
|
-
"version": "2.4.
|
3
|
+
"version": "2.4.2-alpha",
|
4
4
|
"main": "dist/index.js",
|
5
5
|
"typings": "dist/index.d.ts",
|
6
6
|
"source": "src/index.ts",
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"start": "yarn ts-node ./scripts/start.ts",
|
15
15
|
"test": "jest --config=./jest.config.js --coverage",
|
16
16
|
"clean": "rm -rf dist",
|
17
|
-
"prepublishOnly": "yarn && yarn ts-node ./scripts/prepublish.ts
|
17
|
+
"prepublishOnly": "yarn && yarn run build && yarn ts-node ./scripts/prepublish.ts",
|
18
18
|
"postpublish": "yarn ts-node ./scripts/postpublish.ts",
|
19
19
|
"publish:alpha": "npm publish --tag alpha",
|
20
20
|
"check:cycles ": "npx madge --circular src/**/*"
|
@@ -27,18 +27,16 @@
|
|
27
27
|
"@material-ui/core": "^4.11.2",
|
28
28
|
"@material-ui/icons": "^4.11.2",
|
29
29
|
"@sentry/browser": "^6.1.0",
|
30
|
-
"@tivio/common": "1.1.
|
30
|
+
"@tivio/common": "1.1.68",
|
31
31
|
"firebase": "^8.2.3",
|
32
32
|
"formik": "^2.2.7",
|
33
33
|
"i18next": "^19.8.4",
|
34
34
|
"mobx-react": "^7.1.0",
|
35
35
|
"mobx": "^6.0.4",
|
36
|
-
"react-dom": "^17.0.2",
|
37
36
|
"react-i18next": "^9.0.10",
|
38
37
|
"react-router-dom": "^5.2.0",
|
39
38
|
"react-spring": "^9.2.4",
|
40
39
|
"react-virtualized": "^9.22.3",
|
41
|
-
"react": "^17.0.2",
|
42
40
|
"styled-components": "^5.2.1",
|
43
41
|
"yup": "^0.32.9"
|
44
42
|
},
|
@@ -64,6 +62,8 @@
|
|
64
62
|
"jest-fetch-mock": "^3.0.3",
|
65
63
|
"madge": "^5.0.1",
|
66
64
|
"node-fetch": "^2.6.1",
|
65
|
+
"react": "^17.0.2",
|
66
|
+
"react-dom": "^17.0.2",
|
67
67
|
"stream-browserify": "^3.0.0",
|
68
68
|
"timers-browserify": "^2.0.12",
|
69
69
|
"ts-jest": "^26.4.4",
|