@tivio/sdk-react 3.0.0 → 3.1.3

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.
@@ -1,4 +1,7 @@
1
1
  import { TivioBundle } from '../types/bundle.types';
2
2
  import type { RemoteBundleState } from './bundleLoader';
3
3
  export declare let tivioBundle: TivioBundle | null;
4
+ /**
5
+ * rejects when bundle is not available
6
+ */
4
7
  export declare const bundlePromise: Promise<RemoteBundleState>;
@@ -0,0 +1,2 @@
1
+ import type { UserPayload } from '../types/bundle.types';
2
+ export declare const setUser: (userId: string, payload: UserPayload) => Promise<void>;
@@ -3,11 +3,11 @@
3
3
  * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
4
  */
5
5
  /**
6
- * The settings can be called before Tivio is loaded.
7
- * So this package is responsible for settings from the beginning of the life cycle.
6
+ * @deprecated TIV-994 in favour of setUser from libs/sdk-react/src/services/login.ts
8
7
  */
9
- import { InternalConfig } from '../types/bundle.types';
10
- export declare const createSettings: (conf: InternalConfig) => {
11
- onSetUser: (handler: (userId: string, userPayload: unknown) => void) => void;
12
- setUser: (userId: string, userPayload: unknown) => void;
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
13
  };
@@ -8,8 +8,10 @@ import type { AdSource, PlayerWrapper } from './customPlayer.types';
8
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
- onSetUser: (handler: (userId: string, userPayload: unknown) => void) => void;
12
- setUser: (userId: string, userPayload: unknown) => void;
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>;
13
15
  };
14
16
  interface PlayerCapability {
15
17
  codec: 'h264' | 'h265';
@@ -52,6 +54,12 @@ interface PubSub {
52
54
  }
53
55
  declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose'> & {
54
56
  deviceCapabilities: PlayerCapability[] | 'auto';
57
+ /**
58
+ * @private
59
+ * Run HTML, CSS and JS feature support check
60
+ * TODO TIV-1030 use this config in core-react-dom
61
+ */
62
+ runFeatureSupportCheck?: boolean;
55
63
  };
56
64
  declare type TivioSubscriptions = {
57
65
  subscribeToUser: (cb: (error: string | null, user: User | null) => void) => void;
@@ -199,8 +207,28 @@ declare type TivioComponents = {
199
207
  }>;
200
208
  TvApp: React.ComponentType<TvAppProps>;
201
209
  };
210
+ declare type AdSegment = {
211
+ id: string;
212
+ /**
213
+ * @deprecated alias to secondsToEnd * 1000
214
+ */
215
+ remainingMs: number;
216
+ secondsToEnd: number;
217
+ secondsToSkippable: number | null;
218
+ canSeek: boolean;
219
+ /**
220
+ * true if is skippable and skip countdown has passed
221
+ */
222
+ canSkip: boolean;
223
+ /**
224
+ * true ad if is skippable after some skipDelayMs (if it is skippable, skipDelayMs is defined)
225
+ */
226
+ isSkippable: boolean;
227
+ skip: () => any;
228
+ };
202
229
  declare type TivioHooks = {
203
230
  useAd: () => [(AdSource | null)];
231
+ useAdSegment: () => AdSegment | null;
204
232
  useCancelSubscription: UseCancelSubscription;
205
233
  useSearch: UseSearch;
206
234
  useVoucher: (voucherId: string) => any;
@@ -210,6 +238,7 @@ declare type TivioHooks = {
210
238
  showPurchaseDialog: () => void;
211
239
  };
212
240
  };
241
+ export declare type UserPayload = Record<string, any>;
213
242
  declare type TivioBundle = {
214
243
  components: TivioComponents;
215
244
  getters: TivioGetters;
@@ -224,7 +253,7 @@ declare type TivioBundle = {
224
253
  }) => Promise<QerkoPaymentInfo>;
225
254
  cancelSubscriptionWithQerko: (subscriptionId: string) => Promise<QerkoCancellationInfo>;
226
255
  setLanguage: (language: Language) => void;
227
- setUser: (userId: string, userPayload?: unknown) => void;
256
+ setUser: (userId: string, userPayload: UserPayload | null) => Promise<void>;
228
257
  sources: TivioSources;
229
258
  subscriptions: TivioSubscriptions;
230
259
  };
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "3.0.0",
3
+ "version": "3.1.3",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -27,7 +27,7 @@
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.70",
30
+ "@tivio/common": "1.1.75",
31
31
  "firebase": "^8.2.3",
32
32
  "formik": "^2.2.7",
33
33
  "i18next": "^19.8.4",
package/package.json-e DELETED
@@ -1,77 +0,0 @@
1
- {
2
- "name": "@tivio/sdk-react",
3
- "version": "3.0.0",
4
- "main": "dist/index.js",
5
- "typings": "dist/index.d.ts",
6
- "source": "src/index.ts",
7
- "license": "SEE LICENSE IN LICENSE.md",
8
- "publishConfig": {
9
- "access": "public"
10
- },
11
- "scripts": {
12
- "build": "bash ./scripts/build_prod.sh",
13
- "build:dev": "bash ./scripts/build_dev.sh",
14
- "start": "yarn ts-node ./scripts/start.ts",
15
- "test": "jest --config=./jest.config.js --coverage",
16
- "clean": "rm -rf dist",
17
- "prepublishOnly": "yarn && yarn run build && yarn ts-node ./scripts/prepublish.ts",
18
- "postpublish": "yarn ts-node ./scripts/postpublish.ts",
19
- "publish:alpha": "npm publish --tag alpha",
20
- "check:cycles": "npx madge --circular src/**/*"
21
- },
22
- "peerDependencies": {
23
- "react": "^17.0.0",
24
- "react-dom": "^17.0.0"
25
- },
26
- "dependencies": {
27
- "@material-ui/core": "^4.11.2",
28
- "@material-ui/icons": "^4.11.2",
29
- "@sentry/browser": "^6.1.0",
30
- "@tivio/common": "*",
31
- "firebase": "^8.2.3",
32
- "formik": "^2.2.7",
33
- "i18next": "^19.8.4",
34
- "mobx": "^6.0.4",
35
- "mobx-react": "^7.1.0",
36
- "react-i18next": "^9.0.10",
37
- "react-router-dom": "^5.2.0",
38
- "react-spring": "^9.2.4",
39
- "react-virtualized": "^9.22.3",
40
- "styled-components": "^5.2.1",
41
- "yup": "^0.32.9"
42
- },
43
- "devDependencies": {
44
- "@testing-library/jest-dom": "^5.11.9",
45
- "@testing-library/react": "^11.2.3",
46
- "@testing-library/react-hooks": "^5.0.3",
47
- "@testing-library/user-event": "^12.1.10",
48
- "@types/jest": "^26.0.15",
49
- "@types/node": "^12.0.0",
50
- "@types/node-fetch": "^2.5.8",
51
- "@types/react": "^17.0.0",
52
- "@types/react-dom": "^17.0.0",
53
- "@types/react-router-dom": "^5.1.6",
54
- "@types/react-virtualized": "^9.21.13",
55
- "@types/styled-components": "^5.1.7",
56
- "@typescript-eslint/eslint-plugin": "^4.14.0",
57
- "@typescript-eslint/parser": "^4.14.2",
58
- "dotenv": "^8.2.0",
59
- "eslint": "^7.19.0",
60
- "jest": "^27.0.1",
61
- "jest-cli": "^26.6.3",
62
- "jest-fetch-mock": "^3.0.3",
63
- "madge": "^5.0.1",
64
- "node-fetch": "^2.6.1",
65
- "react": "^17.0.2",
66
- "react-dom": "^17.0.2",
67
- "stream-browserify": "^3.0.0",
68
- "timers-browserify": "^2.0.12",
69
- "ts-jest": "^26.4.4",
70
- "typescript": "^4.1.3",
71
- "web-vitals": "^1.0.1",
72
- "webpack": "^5.15.0",
73
- "webpack-cli": "^4.4.0",
74
- "webpack-merge": "^5.7.3",
75
- "yargs": "17"
76
- }
77
- }