@tivio/sdk-react 3.2.2 → 3.2.5

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/dist/info.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const logInfo: () => void;
2
+ export { logInfo };
@@ -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 { InternalConfig, RemoteBundleState, TivioBundle } from 'src/types/bundle.types';
5
+ import type { InternalConfig, RemoteBundleState, TivioBundle } from '../types/bundle.types';
6
6
  /**
7
7
  * @throws if fetch fails
8
8
  */
@@ -13,4 +13,3 @@ declare const fetchBundle: (secret: string, conf: InternalConfig) => Promise<str
13
13
  declare const createRemotePackageLoader: () => (secret: string, conf: InternalConfig) => Promise<TivioBundle>;
14
14
  declare const createUseRemoteBundle: () => (conf: InternalConfig) => RemoteBundleState;
15
15
  export { fetchBundle, createRemotePackageLoader, createUseRemoteBundle, };
16
- export type { RemoteBundleState, };
@@ -1,5 +1,5 @@
1
1
  import { TivioBundle } from '../types/bundle.types';
2
- import type { RemoteBundleState } from './bundleLoader';
2
+ import type { RemoteBundleState } from '../types/bundle.types';
3
3
  export declare let tivioBundle: TivioBundle | null;
4
4
  /**
5
5
  * rejects when bundle is not available
@@ -1,4 +1,4 @@
1
- import { Currency, ItemsInRow, PaginationInterface, PaginationOptions, QerkoCancellationInfo, Row, ROW_ITEM_TYPES, SubscribeToItemsInRowOptions, SubscribeToTaggedVideos, Tag, TilePropsPartial, UseCancelSubscription } from '@tivio/common';
1
+ import { Currency, ItemsInRow, PaginationInterface, PaginationOptions, QerkoCancellationInfo, Row, ROW_ITEM_TYPES, SubscribeToItemsInRowOptions, SubscribeToTaggedVideos, Tag, TilePropsPartial, UseCancelSubscription, CUSTOMER_BUILD, PLATFORM, WebRowProps } from '@tivio/common';
2
2
  import { ComponentType } from 'react';
3
3
  import { Logger } from '../services/logger';
4
4
  import { FetchPackage } from '../services/packageLoader';
@@ -24,6 +24,10 @@ declare type InternalConfig = {
24
24
  */
25
25
  bundleUrlOverride?: string;
26
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
+ */
27
31
  deviceCapabilities: PlayerCapability[];
28
32
  /**
29
33
  * Additional options for deviceCapabilities
@@ -239,7 +243,7 @@ declare type TivioComponents = {
239
243
  tagId: string;
240
244
  onError?: (error: Error) => void;
241
245
  }>;
242
- WebRow: React.ReactNode;
246
+ WebRow: React.ComponentType<WebRowProps>;
243
247
  WebTile: React.ComponentType<{
244
248
  item?: Video | Tag;
245
249
  } & TilePropsPartial>;
@@ -272,6 +276,12 @@ declare type TivioHooks = {
272
276
  pagination: PaginationInterface<ItemsInRow> | null;
273
277
  error: Error | null;
274
278
  };
279
+ usePurchaseRecovery: () => {
280
+ purchaseRecoveryResult?: string;
281
+ loading: boolean;
282
+ error?: any;
283
+ purchaseRecovery: (monetizationId: string) => void;
284
+ };
275
285
  useRowsInScreen: (screenId: string, options: PaginationOptions) => {
276
286
  pagination: PaginationInterface<Row> | null;
277
287
  error: Error | null;
@@ -281,12 +291,25 @@ declare type TivioHooks = {
281
291
  error: Error | null;
282
292
  };
283
293
  useSearch: UseSearch;
294
+ useVideo: (videoId: string) => {
295
+ data: Video | null;
296
+ error: string | null;
297
+ };
284
298
  useVoucher: (voucherId: string) => any;
299
+ /**
300
+ * @deprecated will be removed in version
301
+ */
285
302
  useLastVideoByWidgetId: (widgetId: string) => Video | null;
286
303
  useWatchWithoutAdsOffer: () => {
287
304
  canPurchaseWatchWithoutAds: boolean;
288
305
  showPurchaseDialog: () => void;
289
306
  };
307
+ useApplyInviteCode: () => {
308
+ applyInviteCodeResult?: boolean;
309
+ loading: boolean;
310
+ error?: any;
311
+ applyInviteCode: (code: string) => void;
312
+ };
290
313
  };
291
314
  export declare type UserPayload = Record<string, any>;
292
315
  declare type TivioBundle = {
@@ -307,11 +330,20 @@ declare type TivioBundle = {
307
330
  sources: TivioSources;
308
331
  subscriptions: TivioSubscriptions;
309
332
  internal: {
333
+ components: TivioInternalComponents;
310
334
  hooks: TivioInternalHooks;
311
335
  providers: TivioInternalProviders;
312
336
  };
313
337
  };
338
+ declare type TivioInternalComponents = {
339
+ CustomButton: React.ComponentType;
340
+ WebLandingScreen: React.ComponentType;
341
+ WebVideoScreen: React.ComponentType<{
342
+ videoId: string;
343
+ }>;
344
+ };
314
345
  declare type TivioInternalHooks = {
346
+ useAuthOverlay: () => AuthOverlayState;
315
347
  useSubscriptionsOverlay: () => SubscriptionOverlayState;
316
348
  useQerkoOverlay: () => QerkoOverlayState;
317
349
  usePurchasesWithVideos: () => {
@@ -327,7 +359,13 @@ declare type TivioInternalHooks = {
327
359
  };
328
360
  declare type TivioInternalProviders = {
329
361
  AppThemeProvider: React.ComponentType;
330
- CustomerProvider: React.ComponentType;
362
+ AuthOverlayContextProvider: React.ComponentType;
363
+ CustomerProvider: React.ComponentType<{
364
+ customer: CUSTOMER_BUILD;
365
+ platform: PLATFORM;
366
+ children: any;
367
+ }>;
368
+ ConfigProvider: React.ComponentType;
331
369
  UserContextProvider: React.ComponentType;
332
370
  SubscriptionOverlayContextProvider: React.ComponentType;
333
371
  QerkoOverlayContextProvider: React.ComponentType;
@@ -338,6 +376,12 @@ declare type TivioInternalProviders = {
338
376
  declare type TivioBundleFile = {
339
377
  Tivio: TivioBundle;
340
378
  };
379
+ declare type AuthOverlayType = 'login' | 'registration' | 'closed';
380
+ interface AuthOverlayState {
381
+ type: AuthOverlayType;
382
+ closeAuthOverlay: () => void;
383
+ openAuthOverlay: (type: AuthOverlayType) => void;
384
+ }
341
385
  interface SubscriptionOverlayData {
342
386
  subscriptions?: Monetization[];
343
387
  onPurchase?: () => void;
@@ -365,4 +409,4 @@ declare type RemoteBundleState = {
365
409
  settings: Settings;
366
410
  state: 'loading' | 'error' | 'ready';
367
411
  } & Nullable<TivioBundle>;
368
- export type { RemoteBundleState, Config, Settings, InternalConfig, TivioBundle, TivioBundleFile, TivioHooks, TivioComponents, TivioAuth, TivioGetters, TivioSubscriptions, TivioInternalHooks, TivioInternalProviders, Events, PubSub, PlayerCapability, Currency, };
412
+ export type { RemoteBundleState, Config, Settings, InternalConfig, TivioBundle, TivioBundleFile, TivioHooks, TivioComponents, TivioAuth, TivioGetters, TivioSubscriptions, TivioInternalComponents, TivioInternalHooks, TivioInternalProviders, Events, PubSub, PlayerCapability, Currency, AuthOverlayState, AuthOverlayType, SubscriptionOverlayData, SubscriptionOverlayState, QerkoData, QerkoOverlayState, };
@@ -5,8 +5,7 @@
5
5
  /**
6
6
  * Export public client side API
7
7
  */
8
- import { USER_TYPE } from '@tivio/common';
9
- import type { Monetization, Video } from '@tivio/common';
8
+ import type { Monetization, Video, User } from '@tivio/common';
10
9
  import type React from 'react';
11
10
  declare type RemoteProviderProps = {
12
11
  disableUnmounting?: boolean;
@@ -21,19 +20,6 @@ declare enum Language {
21
20
  SK = "sk",
22
21
  SP = "sp"
23
22
  }
24
- declare type User = {
25
- purchases: Purchase[];
26
- purchasedVods: Purchase[];
27
- purchasedSubscriptions: Purchase[];
28
- getPurchasedVodsWithInitializedVideos: () => Promise<Purchase[]>;
29
- isPurchasesInitialized: boolean;
30
- isSignedIn: boolean;
31
- email: string;
32
- type?: USER_TYPE;
33
- photoURL: string | null;
34
- name?: string;
35
- authUserId?: string;
36
- };
37
23
  interface UserData {
38
24
  name?: string;
39
25
  }
@@ -135,6 +121,10 @@ interface WebPlayerProps {
135
121
  id: string;
136
122
  source?: VodTivioSourcePojo | ChannelSourcePojo | VideoPath | null;
137
123
  onEnded?: () => any;
124
+ /**
125
+ * If this function is specified, then "Back" button is shown in top right corner.
126
+ */
127
+ onBack?: () => void;
138
128
  className?: string;
139
129
  /**
140
130
  * default false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "3.2.2",
3
+ "version": "3.2.5",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -11,6 +11,7 @@
11
11
  "scripts": {
12
12
  "build": "bash ./scripts/build_prod.sh",
13
13
  "build:dev": "bash ./scripts/build_dev.sh",
14
+ "build:local": "bash ./scripts/build_with_local_bundle.sh",
14
15
  "start": "yarn ts-node ./scripts/start.ts",
15
16
  "test": "jest --config=./jest.config.js --coverage",
16
17
  "clean": "rm -rf dist",
@@ -27,7 +28,8 @@
27
28
  "@material-ui/core": "^4.11.2",
28
29
  "@material-ui/icons": "^4.11.2",
29
30
  "@sentry/browser": "^6.1.0",
30
- "@tivio/common": "1.1.78",
31
+ "@tivio/common": "1.1.81",
32
+ "es7-object-polyfill": "^1.0.1",
31
33
  "firebase": "^8.2.3",
32
34
  "formik": "^2.2.7",
33
35
  "i18next": "^19.8.4",
@@ -38,6 +40,7 @@
38
40
  "react-spring": "^9.2.4",
39
41
  "react-virtualized": "^9.22.3",
40
42
  "styled-components": "^5.2.1",
43
+ "whatwg-fetch": "^3.6.2",
41
44
  "yup": "^0.32.9"
42
45
  },
43
46
  "devDependencies": {
@@ -57,6 +60,7 @@
57
60
  "@typescript-eslint/parser": "^4.14.2",
58
61
  "dotenv": "^8.2.0",
59
62
  "eslint": "^7.19.0",
63
+ "fork-ts-checker-webpack-plugin": "^7.0.0",
60
64
  "jest": "^27.0.1",
61
65
  "jest-cli": "^26.6.3",
62
66
  "jest-fetch-mock": "^3.0.3",
@@ -1,7 +0,0 @@
1
- export declare const getTizenApi: any;
2
- export declare const getTizenVersion: () => {
3
- version: string;
4
- major: number;
5
- minor: number;
6
- } | null;
7
- export declare const isTizenVersionGreaterThan: (minVersion: number) => boolean;