@tivio/sdk-react 3.1.1 → 3.1.4-alpha2

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, SubscribeToTaggedVideos, UseCancelSubscription } from '@tivio/common';
1
+ import { Currency, QerkoCancellationInfo, ROW_ITEM_TYPES, 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';
@@ -25,6 +25,17 @@ declare type InternalConfig = {
25
25
  bundleUrlOverride?: string;
26
26
  currency: Currency;
27
27
  deviceCapabilities: PlayerCapability[];
28
+ /**
29
+ * Additional options for deviceCapabilities
30
+ */
31
+ capabilitiesOptions?: {
32
+ /**
33
+ * Should the player prefer HTTP sources instead HTTPs if they are available.
34
+ * This can be used on platforms that support mixed content but do not support
35
+ * specific HTTPS certificates. (e.g. certificates from Letsencrypt not supported on LG TVs)
36
+ */
37
+ preferHttp?: boolean;
38
+ };
28
39
  disableUnmounting?: boolean;
29
40
  enable?: boolean;
30
41
  enableSentry?: boolean;
@@ -52,8 +63,13 @@ interface PubSub {
52
63
  publish: <K extends keyof Events>(triggerName: K, payload: Events[K]) => Empty;
53
64
  subscribe: <K extends keyof Events>(triggerName: K, onMessage: (data: Events[K]) => Empty) => Disposer;
54
65
  }
55
- declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose'> & {
66
+ declare type Config = Pick<InternalConfig, 'bundleUrlOverride' | 'currency' | 'disableUnmounting' | 'capabilitiesOptions' | 'enable' | 'enableSentry' | 'ErrorComponent' | 'language' | 'LoaderComponent' | 'logger' | 'secret' | 'verbose'> & {
56
67
  deviceCapabilities: PlayerCapability[] | 'auto';
68
+ /**
69
+ * @private
70
+ * Run HTML, CSS and JS feature support check
71
+ */
72
+ runFeatureSupportCheck?: boolean;
57
73
  };
58
74
  declare type TivioSubscriptions = {
59
75
  subscribeToUser: (cb: (error: string | null, user: User | null) => void) => void;
@@ -178,6 +194,11 @@ interface TivioAuth {
178
194
  signOut: () => Promise<void>;
179
195
  createFreePurchase: (monetizationId: string) => Promise<void>;
180
196
  }
197
+ interface RouterOverridesContextState {
198
+ goToPlayer: (videoId: string, type: ROW_ITEM_TYPES, rowId?: string) => void;
199
+ goToTagPage: (tagId: string) => void;
200
+ goToLoginScreen: () => void;
201
+ }
181
202
  declare type TivioComponents = {
182
203
  AdIndicationButtonWeb: React.ReactNode;
183
204
  Markers: React.ReactNode;
@@ -200,6 +221,15 @@ declare type TivioComponents = {
200
221
  onEnded?: () => any;
201
222
  }>;
202
223
  TvApp: React.ComponentType<TvAppProps>;
224
+ CustomerScreen: React.ComponentType<{
225
+ screenId: string;
226
+ }>;
227
+ WebTagScreen: React.ReactNode;
228
+ WebRow: React.ReactNode;
229
+ WebTile: React.ComponentType<{
230
+ item?: Video | Tag;
231
+ } & TilePropsPartial>;
232
+ FeatureSupportCheck: React.ComponentType<{}>;
203
233
  };
204
234
  declare type AdSegment = {
205
235
  id: string;
@@ -250,14 +280,63 @@ declare type TivioBundle = {
250
280
  setUser: (userId: string, userPayload: UserPayload | null) => Promise<void>;
251
281
  sources: TivioSources;
252
282
  subscriptions: TivioSubscriptions;
283
+ internal: {
284
+ hooks: TivioInternalHooks;
285
+ providers: TivioInternalProviders;
286
+ };
287
+ };
288
+ declare type TivioInternalHooks = {
289
+ useSubscriptionsOverlay: () => SubscriptionOverlayState;
290
+ useQerkoOverlay: () => QerkoOverlayState;
291
+ usePurchasesWithVideos: () => {
292
+ purchases: Purchase[];
293
+ };
294
+ useOrganizationSubscriptions: () => {
295
+ subscriptions: Monetization[];
296
+ };
297
+ useUser: () => {
298
+ user: User | null;
299
+ error: string | null;
300
+ };
301
+ };
302
+ declare type TivioInternalProviders = {
303
+ AppThemeProvider: React.ComponentType;
304
+ CustomerProvider: React.ComponentType;
305
+ UserContextProvider: React.ComponentType;
306
+ SubscriptionOverlayContextProvider: React.ComponentType;
307
+ QerkoOverlayContextProvider: React.ComponentType;
308
+ PurchasesWithVideosContextProvider: React.ComponentType;
309
+ OrganizationSubscriptionsContextProvider: React.ComponentType;
310
+ RouterOverridesContextProvider: React.ComponentType<RouterOverridesContextState>;
253
311
  };
254
312
  declare type TivioBundleFile = {
255
313
  Tivio: TivioBundle;
256
314
  };
315
+ interface SubscriptionOverlayData {
316
+ subscriptions?: Monetization[];
317
+ onPurchase?: () => void;
318
+ onClose?: () => void;
319
+ }
320
+ declare type SubscriptionOverlayState = {
321
+ data: SubscriptionOverlayData | null;
322
+ closeSubscriptionOverlay: () => void;
323
+ openSubscriptionOverlay: (data: SubscriptionOverlayData) => void;
324
+ };
325
+ interface QerkoData {
326
+ monetization: Monetization;
327
+ video?: Video;
328
+ onPurchase?: () => void;
329
+ onClose?: () => void;
330
+ }
331
+ interface QerkoOverlayState {
332
+ data: QerkoData | null;
333
+ openQerkoOverlay: ((data: QerkoData) => void);
334
+ closeQerkoOverlay: () => void;
335
+ }
257
336
  declare type RemoteBundleState = {
258
337
  config: InternalConfig;
259
338
  error: string | null;
260
339
  settings: Settings;
261
340
  state: 'loading' | 'error' | 'ready';
262
341
  } & Nullable<TivioBundle>;
263
- export type { RemoteBundleState, Config, Settings, InternalConfig, TivioBundle, TivioBundleFile, TivioHooks, TivioComponents, TivioAuth, TivioGetters, TivioSubscriptions, Events, PubSub, PlayerCapability, Currency, };
342
+ export type { RemoteBundleState, Config, Settings, InternalConfig, TivioBundle, TivioBundleFile, TivioHooks, TivioComponents, TivioAuth, TivioGetters, TivioSubscriptions, 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.1.1",
3
+ "version": "3.1.4-alpha2",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -14,8 +14,6 @@
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",
19
17
  "publish:alpha": "npm publish --tag alpha",
20
18
  "check:cycles": "npx madge --circular src/**/*"
21
19
  },
@@ -27,7 +25,7 @@
27
25
  "@material-ui/core": "^4.11.2",
28
26
  "@material-ui/icons": "^4.11.2",
29
27
  "@sentry/browser": "^6.1.0",
30
- "@tivio/common": "1.1.72",
28
+ "@tivio/common": "*",
31
29
  "firebase": "^8.2.3",
32
30
  "formik": "^2.2.7",
33
31
  "i18next": "^19.8.4",
@@ -1,9 +0,0 @@
1
- import { Monetization } from '@tivio/common';
2
- import React from 'react';
3
- interface OrganizationSubscriptionsContextState {
4
- subscriptions: Monetization[];
5
- setSubscriptions: (subscriptions: Monetization[]) => void;
6
- }
7
- declare const OrganizationSubscriptionsContext: React.Context<OrganizationSubscriptionsContextState>;
8
- declare const OrganizationSubscriptionsContextProvider: React.FC;
9
- export { OrganizationSubscriptionsContextProvider, OrganizationSubscriptionsContext, };
@@ -1,9 +0,0 @@
1
- import { Purchase } from '@tivio/common';
2
- import React from 'react';
3
- interface PurchasesWithVideosContextState {
4
- purchases: Purchase[];
5
- setPurchases: (purchases: Purchase[]) => void;
6
- }
7
- declare const PurchasesWithVideosContext: React.Context<PurchasesWithVideosContextState>;
8
- declare const PurchasesWithVideosContextProvider: React.FC;
9
- export { PurchasesWithVideosContext, PurchasesWithVideosContextProvider, };
@@ -1,9 +0,0 @@
1
- import { User } from '@tivio/common';
2
- import React from 'react';
3
- interface UserContextState {
4
- user: User | null;
5
- setUser: (user: User) => void;
6
- }
7
- declare const UserContext: React.Context<UserContextState>;
8
- declare const UserContextProvider: React.FC;
9
- export { UserContextProvider, UserContext, };
@@ -1,3 +0,0 @@
1
- //! moment.js
2
-
3
- //! moment.js locale configuration