@tivio/sdk-react 3.2.0 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
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 { InternalConfig, RemoteBundleState, TivioBundle } from '../types/bundle.types';
6
6
  /**
7
7
  * @throws if fetch fails
8
8
  */
@@ -1,4 +1,4 @@
1
- import { Currency, QerkoCancellationInfo, ROW_ITEM_TYPES, SubscribeToTaggedVideos, TileProps, UseCancelSubscription } from '@tivio/common';
1
+ import { Currency, ItemsInRow, PaginationInterface, PaginationOptions, QerkoCancellationInfo, Row, ROW_ITEM_TYPES, SubscribeToItemsInRowOptions, SubscribeToTaggedVideos, Tag, TilePropsPartial, UseCancelSubscription } 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
@@ -54,6 +58,10 @@ declare type InternalConfig = {
54
58
  sdkVersion: string;
55
59
  secret: string | null;
56
60
  verbose?: boolean;
61
+ /**
62
+ * @private
63
+ */
64
+ forceCloudFnResolver?: boolean;
57
65
  };
58
66
  declare type Events = {
59
67
  'on-ready': RemoteBundleState;
@@ -63,7 +71,7 @@ interface PubSub {
63
71
  publish: <K extends keyof Events>(triggerName: K, payload: Events[K]) => Empty;
64
72
  subscribe: <K extends keyof Events>(triggerName: K, onMessage: (data: Events[K]) => Empty) => Disposer;
65
73
  }
66
- declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'capabilitiesOptions' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose'> & {
74
+ declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'capabilitiesOptions' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose' | 'forceCloudFnResolver'> & {
67
75
  deviceCapabilities: PlayerCapability[] | 'auto';
68
76
  /**
69
77
  * @private
@@ -194,9 +202,14 @@ interface TivioAuth {
194
202
  signOut: () => Promise<void>;
195
203
  createFreePurchase: (monetizationId: string) => Promise<void>;
196
204
  }
197
- interface TileActionProps {
198
- goToPlayer?: (videoId: string, type: ROW_ITEM_TYPES, rowId?: string) => void;
199
- goToLoginScreen?: () => void;
205
+ export interface RouterOverrides {
206
+ goToPlayer: (videoId: string, type: ROW_ITEM_TYPES, rowId?: string) => void;
207
+ goToTagPage: (tagId: string) => void;
208
+ goToLoginScreen: () => void;
209
+ goBack: () => void;
210
+ }
211
+ export interface RouterOverridesContextState {
212
+ routerOverrides: RouterOverrides;
200
213
  }
201
214
  declare type TivioComponents = {
202
215
  AdIndicationButtonWeb: React.ReactNode;
@@ -205,6 +218,9 @@ declare type TivioComponents = {
205
218
  Provider: React.ComponentType<RemoteProviderProps>;
206
219
  Recommendation: React.ReactNode;
207
220
  SkipButtonWeb: React.ReactNode;
221
+ /**
222
+ * @deprecated will be removed in in @tivio/sdk-react@4
223
+ */
208
224
  VideoAdBanner: React.ReactNode;
209
225
  WebPlayer: React.ComponentType<WebPlayerProps>;
210
226
  Widget: React.ComponentType<TivioWidgetProps>;
@@ -222,9 +238,15 @@ declare type TivioComponents = {
222
238
  TvApp: React.ComponentType<TvAppProps>;
223
239
  CustomerScreen: React.ComponentType<{
224
240
  screenId: string;
225
- } & TileActionProps>;
226
- Row: React.ReactNode;
227
- AppTile: React.ComponentType<TileProps>;
241
+ }>;
242
+ WebTagScreen: React.ComponentType<{
243
+ tagId: string;
244
+ onError?: (error: Error) => void;
245
+ }>;
246
+ WebRow: React.ReactNode;
247
+ WebTile: React.ComponentType<{
248
+ item?: Video | Tag;
249
+ } & TilePropsPartial>;
228
250
  FeatureSupportCheck: React.ComponentType<{}>;
229
251
  };
230
252
  declare type AdSegment = {
@@ -250,8 +272,29 @@ declare type TivioHooks = {
250
272
  useAd: () => [(AdSource | null)];
251
273
  useAdSegment: () => AdSegment | null;
252
274
  useCancelSubscription: UseCancelSubscription;
275
+ useItemsInRow: (rowId: string, options: PaginationOptions) => {
276
+ pagination: PaginationInterface<ItemsInRow> | null;
277
+ error: Error | null;
278
+ };
279
+ usePurchaseRecovery: () => {
280
+ purchaseRecoveryResult?: string;
281
+ loading: boolean;
282
+ error?: any;
283
+ purchaseRecovery: (monetizationId: string) => Promise<string>;
284
+ };
285
+ useRowsInScreen: (screenId: string, options: PaginationOptions) => {
286
+ pagination: PaginationInterface<Row> | null;
287
+ error: Error | null;
288
+ };
289
+ useTaggedVideos: (tagIds: string[], options: SubscribeToItemsInRowOptions) => {
290
+ pagination: PaginationInterface<Video> | null;
291
+ error: Error | null;
292
+ };
253
293
  useSearch: UseSearch;
254
294
  useVoucher: (voucherId: string) => any;
295
+ /**
296
+ * @deprecated will be removed in version
297
+ */
255
298
  useLastVideoByWidgetId: (widgetId: string) => Video | null;
256
299
  useWatchWithoutAdsOffer: () => {
257
300
  canPurchaseWatchWithoutAds: boolean;
@@ -277,11 +320,17 @@ declare type TivioBundle = {
277
320
  sources: TivioSources;
278
321
  subscriptions: TivioSubscriptions;
279
322
  internal: {
323
+ components: TivioInternalComponents;
280
324
  hooks: TivioInternalHooks;
281
325
  providers: TivioInternalProviders;
282
326
  };
283
327
  };
328
+ declare type TivioInternalComponents = {
329
+ CustomButton: React.ComponentType;
330
+ WebLandingScreen: React.ComponentType;
331
+ };
284
332
  declare type TivioInternalHooks = {
333
+ useAuthOverlay: () => AuthOverlayState;
285
334
  useSubscriptionsOverlay: () => SubscriptionOverlayState;
286
335
  useQerkoOverlay: () => QerkoOverlayState;
287
336
  usePurchasesWithVideos: () => {
@@ -297,16 +346,25 @@ declare type TivioInternalHooks = {
297
346
  };
298
347
  declare type TivioInternalProviders = {
299
348
  AppThemeProvider: React.ComponentType;
349
+ AuthOverlayContextProvider: React.ComponentType;
300
350
  CustomerProvider: React.ComponentType;
351
+ ConfigProvider: React.ComponentType;
301
352
  UserContextProvider: React.ComponentType;
302
353
  SubscriptionOverlayContextProvider: React.ComponentType;
303
354
  QerkoOverlayContextProvider: React.ComponentType;
304
355
  PurchasesWithVideosContextProvider: React.ComponentType;
305
356
  OrganizationSubscriptionsContextProvider: React.ComponentType;
357
+ RouterOverridesContextProvider: React.ComponentType<RouterOverridesContextState>;
306
358
  };
307
359
  declare type TivioBundleFile = {
308
360
  Tivio: TivioBundle;
309
361
  };
362
+ declare type AuthOverlayType = 'login' | 'registration' | 'closed';
363
+ interface AuthOverlayState {
364
+ type: AuthOverlayType;
365
+ closeAuthOverlay: () => void;
366
+ openAuthOverlay: (type: AuthOverlayType) => void;
367
+ }
310
368
  interface SubscriptionOverlayData {
311
369
  subscriptions?: Monetization[];
312
370
  onPurchase?: () => void;
@@ -334,4 +392,4 @@ declare type RemoteBundleState = {
334
392
  settings: Settings;
335
393
  state: 'loading' | 'error' | 'ready';
336
394
  } & Nullable<TivioBundle>;
337
- export type { RemoteBundleState, Config, Settings, InternalConfig, TivioBundle, TivioBundleFile, TivioHooks, TivioComponents, TivioAuth, TivioGetters, TivioSubscriptions, TivioInternalHooks, TivioInternalProviders, Events, PubSub, PlayerCapability, Currency, };
395
+ export type { RemoteBundleState, Config, Settings, InternalConfig, TivioBundle, TivioBundleFile, TivioHooks, TivioComponents, TivioAuth, TivioGetters, TivioSubscriptions, TivioInternalComponents, TivioInternalHooks, TivioInternalProviders, Events, PubSub, PlayerCapability, Currency, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "3.2.0",
3
+ "version": "3.2.3",
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.76",
31
+ "@tivio/common": "1.1.79",
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",
package/doc/changelog.md DELETED
File without changes