@tivio/sdk-react 3.3.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ export declare const showGdprConsentPreferences: () => Promise<void>;
@@ -5,5 +5,5 @@ import type { UserPayload } from '../types/bundle.types';
5
5
  * Sign in - setUser('userID', { token: 'xxx' })
6
6
  * Sign out - setUser(null)
7
7
  */
8
- declare const setUser: (userId: string | null, payload: UserPayload) => Promise<void>;
8
+ declare const setUser: (userId: string | null, payload?: UserPayload | undefined) => Promise<void>;
9
9
  export { setUser };
@@ -1,11 +1,11 @@
1
- import { Currency, ItemsInRow, PaginationInterface, PaginationOptions, QerkoCancellationInfo, Row, ROW_ITEM_TYPES, SubscribeToItemsInRowOptions, SubscribeToTaggedVideos, Tag, TilePropsPartial, UseCancelSubscription, CUSTOMER_BUILD, PLATFORM, WebRowProps } 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,13 +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
- goToPlayer: (videoId: string, type: ROW_ITEM_TYPES, rowId?: string) => void;
220
+ goToVideoDetailPage: (videoId: string) => void;
221
+ goToSeriesDetailPage: (tagId: string) => void;
212
222
  goToTagPage: (tagId: string) => void;
213
223
  goToLoginScreen: () => void;
214
224
  goBack: () => void;
225
+ goLivePlayer: (videoId: string) => void;
226
+ goVodPlayer: (tvChannelId: string) => void;
215
227
  }
216
228
  export interface RouterOverridesContextState {
217
229
  routerOverrides: RouterOverrides;
@@ -248,6 +260,9 @@ declare type TivioComponents = {
248
260
  tagId: string;
249
261
  onError?: (error: Error) => void;
250
262
  }>;
263
+ WebSearchScreen: React.ComponentType<{
264
+ searchQuery?: string;
265
+ }>;
251
266
  WebRow: React.ComponentType<WebRowProps>;
252
267
  WebTile: React.ComponentType<{
253
268
  item?: Video | Tag;
@@ -284,7 +299,7 @@ declare type TivioHooks = {
284
299
  usePurchaseRecovery: () => {
285
300
  purchaseRecoveryResult?: string;
286
301
  loading: boolean;
287
- error?: any;
302
+ error?: GenericOnCallError;
288
303
  purchaseRecovery: (monetizationId: string) => void;
289
304
  };
290
305
  useRowsInScreen: (screenId: string, options: PaginationOptions) => {
@@ -312,8 +327,9 @@ declare type TivioHooks = {
312
327
  useApplyInviteCode: () => {
313
328
  applyInviteCodeResult?: boolean;
314
329
  loading: boolean;
315
- error?: any;
330
+ error?: GenericOnCallError;
316
331
  applyInviteCode: (code: string) => void;
332
+ inviteCodeReset: () => void;
317
333
  };
318
334
  };
319
335
  export declare type UserPayload = Record<string, any>;
@@ -330,8 +346,9 @@ declare type TivioBundle = {
330
346
  expirationDate: Date;
331
347
  }) => Promise<QerkoPaymentInfo>;
332
348
  cancelSubscriptionWithQerko: (subscriptionId: string) => Promise<QerkoCancellationInfo>;
333
- setLanguage: (language: Language) => void;
334
- setUser: (userId: string | null, userPayload: UserPayload) => Promise<void>;
349
+ setLanguage: (language: LangCode) => void;
350
+ setUser: (userId: string | null, userPayload?: UserPayload) => Promise<void>;
351
+ showConsentPreferences: () => void;
335
352
  sources: TivioSources;
336
353
  subscriptions: TivioSubscriptions;
337
354
  internal: {
@@ -341,11 +358,14 @@ declare type TivioBundle = {
341
358
  };
342
359
  };
343
360
  declare type TivioInternalComponents = {
344
- CustomButton: React.ComponentType;
345
- WebLandingScreen: React.ComponentType;
361
+ PrimaryButton: React.ComponentType;
362
+ WebLandingScreen: React.ComponentType<{
363
+ logo?: string;
364
+ }>;
346
365
  WebVideoScreen: React.ComponentType<{
347
366
  videoId: string;
348
367
  }>;
368
+ WebSeriesDetailScreen: React.ComponentType<WebSeriesDetailScreenProps>;
349
369
  };
350
370
  declare type TivioInternalHooks = {
351
371
  useAuthOverlay: () => AuthOverlayState;
@@ -357,9 +377,16 @@ declare type TivioInternalHooks = {
357
377
  useOrganizationSubscriptions: () => {
358
378
  subscriptions: Monetization[];
359
379
  };
380
+ useIsMonetizationPurchased: () => {
381
+ isOneOfSubscriptionPurchased: (subscriptionIds: string[]) => boolean;
382
+ };
383
+ useReferralInfo: any;
384
+ useTvChannel: UseTvChannel;
385
+ useChannelSource: UseChannelSource;
360
386
  useUser: () => {
361
387
  user: User | null;
362
388
  error: string | null;
389
+ isInitialized: boolean;
363
390
  };
364
391
  };
365
392
  declare type TivioInternalProviders = {
@@ -381,12 +408,6 @@ declare type TivioInternalProviders = {
381
408
  declare type TivioBundleFile = {
382
409
  Tivio: TivioBundle;
383
410
  };
384
- declare type AuthOverlayType = 'login' | 'registration' | 'closed';
385
- interface AuthOverlayState {
386
- type: AuthOverlayType;
387
- closeAuthOverlay: () => void;
388
- openAuthOverlay: (type: AuthOverlayType) => void;
389
- }
390
411
  interface SubscriptionOverlayData {
391
412
  subscriptions?: Monetization[];
392
413
  onPurchase?: () => void;
@@ -420,4 +441,4 @@ declare type RemoteBundleState = {
420
441
  declare type NewVoucher = {
421
442
  expirationDate: Date | number;
422
443
  };
423
- 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.0",
3
+ "version": "3.4.0",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -15,6 +15,7 @@
15
15
  "start": "yarn ts-node ./scripts/start.ts",
16
16
  "test": "jest --config=./jest.config.js --coverage",
17
17
  "clean": "rm -rf dist",
18
+ "prepublishOnly": "yarn && yarn run build && yarn ts-node ./scripts/prepublish.ts",
18
19
  "postpublish": "yarn ts-node ./scripts/postpublish.ts",
19
20
  "publish:alpha": "npm publish --tag alpha",
20
21
  "check:cycles": "npx madge --circular src/**/*"
@@ -27,7 +28,7 @@
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.82",
31
+ "@tivio/common": "1.1.86",
31
32
  "es7-object-polyfill": "^1.0.1",
32
33
  "firebase": "^8.2.3",
33
34
  "formik": "^2.2.7",
@@ -50,14 +51,14 @@
50
51
  "@types/jest": "^26.0.15",
51
52
  "@types/node": "^12.0.0",
52
53
  "@types/node-fetch": "^2.5.8",
53
- "@types/react": "^17.0.0",
54
- "@types/react-dom": "^17.0.0",
54
+ "@types/react": "^17.0.13",
55
+ "@types/react-dom": "^17.0.2",
55
56
  "@types/react-router-dom": "^5.1.6",
56
57
  "@types/react-virtualized": "^9.21.13",
57
58
  "@types/styled-components": "^5.1.7",
58
59
  "@typescript-eslint/eslint-plugin": "^4.14.0",
59
60
  "@typescript-eslint/parser": "^4.14.2",
60
- "dotenv": "^8.2.0",
61
+ "dotenv": "^9.0.0",
61
62
  "eslint": "^7.19.0",
62
63
  "fork-ts-checker-webpack-plugin": "^7.0.0",
63
64
  "jest": "^27.0.1",
@@ -72,9 +73,6 @@
72
73
  "ts-jest": "^26.4.4",
73
74
  "typescript": "^4.1.3",
74
75
  "web-vitals": "^1.0.1",
75
- "webpack": "^5.15.0",
76
- "webpack-cli": "^4.4.0",
77
- "webpack-merge": "^5.7.3",
78
76
  "yargs": "17"
79
77
  }
80
78
  }