@tivio/sdk-react 3.1.4-alpha → 3.2.2

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,4 @@
1
- import { Currency, QerkoCancellationInfo, ROW_ITEM_TYPES, SubscribeToTaggedVideos, Tag, TilePropsPartial, 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';
@@ -43,7 +43,7 @@ declare type InternalConfig = {
43
43
  error: string | null;
44
44
  }>;
45
45
  fetchPackage: FetchPackage;
46
- language?: string;
46
+ language?: Language;
47
47
  LoaderComponent?: ComponentType;
48
48
  logger?: Logger | null;
49
49
  pubSub: PubSub;
@@ -54,6 +54,10 @@ declare type InternalConfig = {
54
54
  sdkVersion: string;
55
55
  secret: string | null;
56
56
  verbose?: boolean;
57
+ /**
58
+ * @private
59
+ */
60
+ forceCloudFnResolver?: boolean;
57
61
  };
58
62
  declare type Events = {
59
63
  'on-ready': RemoteBundleState;
@@ -63,7 +67,7 @@ interface PubSub {
63
67
  publish: <K extends keyof Events>(triggerName: K, payload: Events[K]) => Empty;
64
68
  subscribe: <K extends keyof Events>(triggerName: K, onMessage: (data: Events[K]) => Empty) => Disposer;
65
69
  }
66
- declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'capabilitiesOptions' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose'> & {
70
+ declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'capabilitiesOptions' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose' | 'forceCloudFnResolver'> & {
67
71
  deviceCapabilities: PlayerCapability[] | 'auto';
68
72
  /**
69
73
  * @private
@@ -194,10 +198,14 @@ interface TivioAuth {
194
198
  signOut: () => Promise<void>;
195
199
  createFreePurchase: (monetizationId: string) => Promise<void>;
196
200
  }
197
- interface RouterOverridesContextState {
201
+ export interface RouterOverrides {
198
202
  goToPlayer: (videoId: string, type: ROW_ITEM_TYPES, rowId?: string) => void;
199
203
  goToTagPage: (tagId: string) => void;
200
204
  goToLoginScreen: () => void;
205
+ goBack: () => void;
206
+ }
207
+ export interface RouterOverridesContextState {
208
+ routerOverrides: RouterOverrides;
201
209
  }
202
210
  declare type TivioComponents = {
203
211
  AdIndicationButtonWeb: React.ReactNode;
@@ -206,6 +214,9 @@ declare type TivioComponents = {
206
214
  Provider: React.ComponentType<RemoteProviderProps>;
207
215
  Recommendation: React.ReactNode;
208
216
  SkipButtonWeb: React.ReactNode;
217
+ /**
218
+ * @deprecated will be removed in in @tivio/sdk-react@4
219
+ */
209
220
  VideoAdBanner: React.ReactNode;
210
221
  WebPlayer: React.ComponentType<WebPlayerProps>;
211
222
  Widget: React.ComponentType<TivioWidgetProps>;
@@ -224,7 +235,10 @@ declare type TivioComponents = {
224
235
  CustomerScreen: React.ComponentType<{
225
236
  screenId: string;
226
237
  }>;
227
- WebTagScreen: React.ReactNode;
238
+ WebTagScreen: React.ComponentType<{
239
+ tagId: string;
240
+ onError?: (error: Error) => void;
241
+ }>;
228
242
  WebRow: React.ReactNode;
229
243
  WebTile: React.ComponentType<{
230
244
  item?: Video | Tag;
@@ -254,6 +268,18 @@ declare type TivioHooks = {
254
268
  useAd: () => [(AdSource | null)];
255
269
  useAdSegment: () => AdSegment | null;
256
270
  useCancelSubscription: UseCancelSubscription;
271
+ useItemsInRow: (rowId: string, options: PaginationOptions) => {
272
+ pagination: PaginationInterface<ItemsInRow> | null;
273
+ error: Error | null;
274
+ };
275
+ useRowsInScreen: (screenId: string, options: PaginationOptions) => {
276
+ pagination: PaginationInterface<Row> | null;
277
+ error: Error | null;
278
+ };
279
+ useTaggedVideos: (tagIds: string[], options: SubscribeToItemsInRowOptions) => {
280
+ pagination: PaginationInterface<Video> | null;
281
+ error: Error | null;
282
+ };
257
283
  useSearch: UseSearch;
258
284
  useVoucher: (voucherId: string) => any;
259
285
  useLastVideoByWidgetId: (widgetId: string) => Video | null;
@@ -12,7 +12,15 @@ declare type RemoteProviderProps = {
12
12
  disableUnmounting?: boolean;
13
13
  language?: string;
14
14
  };
15
- declare type Language = 'cs' | 'en' | 'sk' | 'de' | 'pl';
15
+ declare enum Language {
16
+ CS = "cs",
17
+ DE = "de",
18
+ EN = "en",
19
+ FR = "fr",
20
+ PL = "pl",
21
+ SK = "sk",
22
+ SP = "sp"
23
+ }
16
24
  declare type User = {
17
25
  purchases: Purchase[];
18
26
  purchasedVods: Purchase[];
@@ -173,4 +181,5 @@ declare type TivioSources = {
173
181
  VodExternalSource: any;
174
182
  VodTivioSource: any;
175
183
  };
176
- export type { RemoteProviderProps, WebPlayerProps, Marker, BetOffer, Purchase, Chapter, Language, Widget, Channel, Section, Video, TivioSources, UserData, User, Monetization, VodTivioSourcePojo, ChannelSourcePojo, };
184
+ export type { RemoteProviderProps, WebPlayerProps, Marker, BetOffer, Purchase, Chapter, Widget, Channel, Section, Video, TivioSources, UserData, User, Monetization, VodTivioSourcePojo, ChannelSourcePojo, };
185
+ export { Language };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "3.1.4-alpha",
3
+ "version": "3.2.2",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -14,6 +14,8 @@
14
14
  "start": "yarn ts-node ./scripts/start.ts",
15
15
  "test": "jest --config=./jest.config.js --coverage",
16
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",
17
19
  "publish:alpha": "npm publish --tag alpha",
18
20
  "check:cycles": "npx madge --circular src/**/*"
19
21
  },
@@ -25,7 +27,7 @@
25
27
  "@material-ui/core": "^4.11.2",
26
28
  "@material-ui/icons": "^4.11.2",
27
29
  "@sentry/browser": "^6.1.0",
28
- "@tivio/common": "*",
30
+ "@tivio/common": "1.1.78",
29
31
  "firebase": "^8.2.3",
30
32
  "formik": "^2.2.7",
31
33
  "i18next": "^19.8.4",