@tivio/sdk-react 3.3.2 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import * as materialUiCore from '@material-ui/core';
6
6
  import * as materialUiIcons from '@material-ui/icons';
7
+ import * as dayjs from 'dayjs';
7
8
  import firebase from 'firebase/app';
8
9
  import 'firebase/auth';
9
10
  import 'firebase/firestore';
@@ -19,6 +20,5 @@ import * as reactSpring from 'react-spring';
19
20
  import * as reactVirtualized from 'react-virtualized';
20
21
  import * as styledComponents from 'styled-components';
21
22
  import * as yup from 'yup';
22
- import * as moment from 'moment';
23
- export declare type SharedDependency = typeof react | typeof reactDom | typeof mobx | typeof styledComponents | typeof firebase | typeof materialUiCore | typeof materialUiIcons | typeof formik | typeof i18Next | typeof reactI18Next | typeof reactRouterDom | typeof reactVirtualized | typeof reactSpring | typeof yup | typeof moment | typeof mobxReact | null;
23
+ export declare type SharedDependency = typeof react | typeof reactDom | typeof mobx | typeof styledComponents | typeof firebase | typeof materialUiCore | typeof materialUiIcons | typeof formik | typeof i18Next | typeof reactI18Next | typeof reactRouterDom | typeof reactVirtualized | typeof reactSpring | typeof yup | typeof dayjs | typeof mobxReact | null;
24
24
  export declare const resolveShared: (name: string) => SharedDependency;
@@ -0,0 +1 @@
1
+ export declare const showGdprConsentPreferences: () => Promise<void>;
@@ -1,11 +1,11 @@
1
- import { Currency, ItemsInRow, PaginationInterface, PaginationOptions, QerkoCancellationInfo, Row, ROW_ITEM_TYPES, SubscribeToItemsInRowOptions, SubscribeToTaggedVideos, Tag, TilePropsPartial, UseCancelSubscription, CUSTOMER_BUILD, PLATFORM, WebRowProps, WebSeriesDetailScreenProps } from '@tivio/common';
1
+ import { Currency, ItemsInRow, PaginationInterface, PaginationOptions, QerkoCancellationInfo, Row, SubscribeToItemsInRowOptions, SubscribeToTaggedVideos, Tag, TilePropsPartial, UseCancelSubscription, CUSTOMER_BUILD, PLATFORM, WebRowProps, WebSeriesDetailScreenProps, AuthOverlayState, CreateUserWithEmailAndPassword, UseChannelSource } 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
- import { Channel, Language, RemoteProviderProps, Section, TivioSources, TivioWidgetProps, UserData, WebPlayerProps, Widget } from './types';
6
+ import { Channel, LangCode, RemoteProviderProps, Section, TivioSources, TivioWidgetProps, WebPlayerProps, Widget } from './types';
7
7
  import type { AdSource, PlayerWrapper } from './customPlayer.types';
8
- import type { Monetization, Purchase, QerkoPaymentInfo, Screen, SubscribeToItemsInRow, SubscribeToRowsInScreen, SubscribeToScreen, TvAppProps, User, UseSearch, Video } from '@tivio/common';
8
+ import type { Monetization, Purchase, QerkoPaymentInfo, Screen, SubscribeToItemsInRow, SubscribeToRowsInScreen, SubscribeToScreen, TvAppProps, User, UseSearch, UseTvChannel, Video } from '@tivio/common';
9
9
  import type React from 'react';
10
10
  declare type Settings = {
11
11
  /**
@@ -47,7 +47,7 @@ declare type InternalConfig = {
47
47
  error: string | null;
48
48
  }>;
49
49
  fetchPackage: FetchPackage;
50
- language?: Language;
50
+ language?: LangCode;
51
51
  LoaderComponent?: ComponentType;
52
52
  logger?: Logger | null;
53
53
  pubSub: PubSub;
@@ -71,6 +71,11 @@ interface PubSub {
71
71
  publish: <K extends keyof Events>(triggerName: K, payload: Events[K]) => Empty;
72
72
  subscribe: <K extends keyof Events>(triggerName: K, onMessage: (data: Events[K]) => Empty) => Disposer;
73
73
  }
74
+ export interface GenericOnCallError {
75
+ code: string;
76
+ message?: string;
77
+ details?: string[];
78
+ }
74
79
  declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'capabilitiesOptions' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose' | 'forceCloudFnResolver'> & {
75
80
  deviceCapabilities: PlayerCapability[] | 'auto';
76
81
  /**
@@ -196,7 +201,7 @@ interface TivioAuth {
196
201
  * @param email
197
202
  * @param password
198
203
  */
199
- createUserWithEmailAndPassword: (email: string, password: string, userData?: UserData) => Promise<void>;
204
+ createUserWithEmailAndPassword: CreateUserWithEmailAndPassword;
200
205
  /**
201
206
  * Sign in the user and starts listening on his purchases
202
207
  * @param email
@@ -205,15 +210,20 @@ interface TivioAuth {
205
210
  signInWithEmailAndPassword: (email: string, password: string) => Promise<void>;
206
211
  initializeUser: () => Promise<void>;
207
212
  signOut: () => Promise<void>;
213
+ /**
214
+ * Used for reset forgotten password by user
215
+ */
216
+ resetPassword: (email: string) => Promise<void>;
208
217
  createFreePurchase: (monetizationId: string) => Promise<void>;
209
218
  }
210
219
  export interface RouterOverrides {
211
- goToVideoDetailPage: (videoId: string, type: ROW_ITEM_TYPES, rowId?: string) => void;
220
+ goToVideoDetailPage: (videoId: string) => void;
212
221
  goToSeriesDetailPage: (tagId: string) => void;
213
- goToPlayer: (videoId: string, type: ROW_ITEM_TYPES, rowId?: string) => void;
214
222
  goToTagPage: (tagId: string) => void;
215
223
  goToLoginScreen: () => void;
216
224
  goBack: () => void;
225
+ goLivePlayer: (videoId: string) => void;
226
+ goVodPlayer: (tvChannelId: string) => void;
217
227
  }
218
228
  export interface RouterOverridesContextState {
219
229
  routerOverrides: RouterOverrides;
@@ -250,6 +260,9 @@ declare type TivioComponents = {
250
260
  tagId: string;
251
261
  onError?: (error: Error) => void;
252
262
  }>;
263
+ WebSearchScreen: React.ComponentType<{
264
+ searchQuery?: string;
265
+ }>;
253
266
  WebRow: React.ComponentType<WebRowProps>;
254
267
  WebTile: React.ComponentType<{
255
268
  item?: Video | Tag;
@@ -286,7 +299,7 @@ declare type TivioHooks = {
286
299
  usePurchaseRecovery: () => {
287
300
  purchaseRecoveryResult?: string;
288
301
  loading: boolean;
289
- error?: any;
302
+ error?: GenericOnCallError;
290
303
  purchaseRecovery: (monetizationId: string) => void;
291
304
  };
292
305
  useRowsInScreen: (screenId: string, options: PaginationOptions) => {
@@ -314,8 +327,9 @@ declare type TivioHooks = {
314
327
  useApplyInviteCode: () => {
315
328
  applyInviteCodeResult?: boolean;
316
329
  loading: boolean;
317
- error?: any;
330
+ error?: GenericOnCallError;
318
331
  applyInviteCode: (code: string) => void;
332
+ inviteCodeReset: () => void;
319
333
  };
320
334
  };
321
335
  export declare type UserPayload = Record<string, any>;
@@ -332,8 +346,9 @@ declare type TivioBundle = {
332
346
  expirationDate: Date;
333
347
  }) => Promise<QerkoPaymentInfo>;
334
348
  cancelSubscriptionWithQerko: (subscriptionId: string) => Promise<QerkoCancellationInfo>;
335
- setLanguage: (language: Language) => void;
349
+ setLanguage: (language: LangCode) => void;
336
350
  setUser: (userId: string | null, userPayload?: UserPayload) => Promise<void>;
351
+ showConsentPreferences: () => void;
337
352
  sources: TivioSources;
338
353
  subscriptions: TivioSubscriptions;
339
354
  internal: {
@@ -343,8 +358,10 @@ declare type TivioBundle = {
343
358
  };
344
359
  };
345
360
  declare type TivioInternalComponents = {
346
- CustomButton: React.ComponentType;
347
- WebLandingScreen: React.ComponentType;
361
+ PrimaryButton: React.ComponentType;
362
+ WebLandingScreen: React.ComponentType<{
363
+ logo?: string;
364
+ }>;
348
365
  WebVideoScreen: React.ComponentType<{
349
366
  videoId: string;
350
367
  }>;
@@ -360,9 +377,16 @@ declare type TivioInternalHooks = {
360
377
  useOrganizationSubscriptions: () => {
361
378
  subscriptions: Monetization[];
362
379
  };
380
+ useIsMonetizationPurchased: () => {
381
+ isOneOfSubscriptionPurchased: (subscriptionIds: string[]) => boolean;
382
+ };
383
+ useReferralInfo: any;
384
+ useTvChannel: UseTvChannel;
385
+ useChannelSource: UseChannelSource;
363
386
  useUser: () => {
364
387
  user: User | null;
365
388
  error: string | null;
389
+ isInitialized: boolean;
366
390
  };
367
391
  };
368
392
  declare type TivioInternalProviders = {
@@ -384,12 +408,6 @@ declare type TivioInternalProviders = {
384
408
  declare type TivioBundleFile = {
385
409
  Tivio: TivioBundle;
386
410
  };
387
- declare type AuthOverlayType = 'login' | 'registration' | 'closed';
388
- interface AuthOverlayState {
389
- type: AuthOverlayType;
390
- closeAuthOverlay: () => void;
391
- openAuthOverlay: (type: AuthOverlayType) => void;
392
- }
393
411
  interface SubscriptionOverlayData {
394
412
  subscriptions?: Monetization[];
395
413
  onPurchase?: () => void;
@@ -423,4 +441,4 @@ declare type RemoteBundleState = {
423
441
  declare type NewVoucher = {
424
442
  expirationDate: Date | number;
425
443
  };
426
- 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, NewVoucher, };
444
+ export type { RemoteBundleState, Config, Settings, InternalConfig, TivioBundle, TivioBundleFile, TivioHooks, TivioComponents, TivioAuth, TivioGetters, TivioSubscriptions, TivioInternalComponents, TivioInternalHooks, TivioInternalProviders, Events, PubSub, PlayerCapability, Currency, SubscriptionOverlayData, SubscriptionOverlayState, QerkoData, QerkoOverlayState, NewVoucher, };
@@ -11,7 +11,7 @@ declare type RemoteProviderProps = {
11
11
  disableUnmounting?: boolean;
12
12
  language?: string;
13
13
  };
14
- declare enum Language {
14
+ declare enum LangCode {
15
15
  CS = "cs",
16
16
  DE = "de",
17
17
  EN = "en",
@@ -20,9 +20,6 @@ declare enum Language {
20
20
  SK = "sk",
21
21
  SP = "sp"
22
22
  }
23
- interface UserData {
24
- name?: string;
25
- }
26
23
  declare type Widget = {
27
24
  id: string;
28
25
  channels: Channel[];
@@ -162,7 +159,9 @@ interface WebPlayerProps {
162
159
  */
163
160
  enableKeyboardShortcuts?: boolean;
164
161
  onProgress?: (event: React.ChangeEvent<HTMLVideoElement>) => void;
165
- onLoadedMetadata?: (event: React.ChangeEvent<HTMLVideoElement>) => void;
162
+ /**
163
+ * @deprecated this callback is never called. Will be removed in @tivio/sdk-react version 4
164
+ */
166
165
  onPlayerControllerCreated?: (playerController: any) => void;
167
166
  }
168
167
  declare type TivioSources = {
@@ -171,5 +170,5 @@ declare type TivioSources = {
171
170
  VodExternalSource: any;
172
171
  VodTivioSource: any;
173
172
  };
174
- export type { RemoteProviderProps, WebPlayerProps, Marker, BetOffer, Purchase, Chapter, Widget, Channel, Section, Video, TivioSources, UserData, User, Monetization, VodTivioSourcePojo, ChannelSourcePojo, };
175
- export { Language };
173
+ export type { RemoteProviderProps, WebPlayerProps, Marker, BetOffer, Purchase, Chapter, Widget, Channel, Section, Video, TivioSources, User, Monetization, VodTivioSourcePojo, ChannelSourcePojo, };
174
+ export { LangCode };
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "3.3.2",
3
+ "version": "3.5.1",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -28,7 +28,8 @@
28
28
  "@material-ui/core": "^4.11.2",
29
29
  "@material-ui/icons": "^4.11.2",
30
30
  "@sentry/browser": "^6.1.0",
31
- "@tivio/common": "1.1.83",
31
+ "@tivio/common": "1.1.88",
32
+ "dayjs": "^1.11.0",
32
33
  "es7-object-polyfill": "^1.0.1",
33
34
  "firebase": "^8.2.3",
34
35
  "formik": "^2.2.7",
@@ -51,14 +52,14 @@
51
52
  "@types/jest": "^26.0.15",
52
53
  "@types/node": "^12.0.0",
53
54
  "@types/node-fetch": "^2.5.8",
54
- "@types/react": "^17.0.0",
55
- "@types/react-dom": "^17.0.0",
55
+ "@types/react": "^17.0.13",
56
+ "@types/react-dom": "^17.0.2",
56
57
  "@types/react-router-dom": "^5.1.6",
57
58
  "@types/react-virtualized": "^9.21.13",
58
59
  "@types/styled-components": "^5.1.7",
59
60
  "@typescript-eslint/eslint-plugin": "^4.14.0",
60
61
  "@typescript-eslint/parser": "^4.14.2",
61
- "dotenv": "^8.2.0",
62
+ "dotenv": "^9.0.0",
62
63
  "eslint": "^7.19.0",
63
64
  "fork-ts-checker-webpack-plugin": "^7.0.0",
64
65
  "jest": "^27.0.1",
@@ -73,9 +74,6 @@
73
74
  "ts-jest": "^26.4.4",
74
75
  "typescript": "^4.1.3",
75
76
  "web-vitals": "^1.0.1",
76
- "webpack": "^5.15.0",
77
- "webpack-cli": "^4.4.0",
78
- "webpack-merge": "^5.7.3",
79
77
  "yargs": "17"
80
78
  }
81
79
  }
@@ -1,3 +0,0 @@
1
- //! moment.js
2
-
3
- //! moment.js locale configuration