@tivio/sdk-react 9.1.6 → 9.2.0-alpha.0

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 { ComponentType } from 'react';
1
+ import type { ComponentType } from 'react';
2
2
  import type dayjs from 'dayjs';
3
3
  import { DocumentReference } from '@firebase/firestore-types';
4
4
  import type duration from 'dayjs/plugin/duration';
@@ -480,6 +480,7 @@ declare interface ArticleDocumentSerialized {
480
480
  monetizations?: TileMonetizationData[];
481
481
  seriesPath?: string;
482
482
  blocks: ArticleBlockField[] | undefined;
483
+ externalUrl?: string;
483
484
  }
484
485
 
485
486
  export declare interface ArticleMetadata {
@@ -492,6 +493,7 @@ export declare interface ArticleTileSpecificData {
492
493
  assets?: AssetsField;
493
494
  description?: Translation;
494
495
  monetizations?: TileMonetizationData[];
496
+ externalUrl?: string;
495
497
  }
496
498
 
497
499
  /**
@@ -1062,10 +1064,9 @@ export declare const createPubSub: () => PubSub;
1062
1064
  */
1063
1065
  export declare const createRemotePackageLoader: () => (secret: string, conf: InternalConfig, checkBundleCharCount?: boolean) => Promise<TivioBundle>;
1064
1066
 
1065
- /**
1066
- * @public
1067
- */
1068
- export declare const createUseRemoteBundle: () => (conf: InternalConfig, checkBundleCharCount?: boolean) => RemoteBundleState;
1067
+ export declare const createTivio: () => (conf: SdkReactConfig) => Promise<RemoteBundleState>;
1068
+
1069
+ export declare const createUseRemoteBundle: () => (sdkReactConfig: SdkReactConfig, checkBundleCharCount?: boolean) => RemoteBundleState;
1069
1070
 
1070
1071
  export declare interface CreateUserPayload {
1071
1072
  displayName?: string;
@@ -1099,13 +1100,13 @@ export declare const CURRENCIES: string[];
1099
1100
  * Three upper-case letters according to ISO-4217.
1100
1101
  * @public
1101
1102
  */
1102
- export declare type Currency = 'CZK' | 'EUR' | 'USD';
1103
+ export declare type Currency = 'CZK' | 'EUR' | 'USD' | 'PLN';
1103
1104
 
1104
1105
  /**
1105
1106
  * Necessary because keys in cloud function config cannot contain upper-case letters.
1106
1107
  * Has to be in sync with {@link Currency}.
1107
1108
  */
1108
- export declare type CurrencyLowerCase = 'czk' | 'eur' | 'usd';
1109
+ export declare type CurrencyLowerCase = 'czk' | 'eur' | 'usd' | 'pln';
1109
1110
 
1110
1111
  export declare interface CurrentQuestion {
1111
1112
  id: string;
@@ -1244,6 +1245,19 @@ export declare interface Customizations {
1244
1245
  color: string;
1245
1246
  };
1246
1247
  };
1248
+ BackgroundBlurBanner?: {
1249
+ playVideoButton?: {
1250
+ backgroundColor?: string;
1251
+ color?: string;
1252
+ };
1253
+ logo?: {
1254
+ height: string;
1255
+ width: string;
1256
+ };
1257
+ description?: {
1258
+ fontSize?: string;
1259
+ };
1260
+ };
1247
1261
  Row: {
1248
1262
  /**
1249
1263
  * Customizations of Banner component that is used as Row on Customer screen (e.g. WebBannerData)
@@ -2026,6 +2040,8 @@ export declare interface GetViewAnalyticsResponse {
2026
2040
 
2027
2041
  export declare type GetViewsAnalyticsRequest = GetBaseAnalyticsRequest;
2028
2042
 
2043
+ export declare let globalSdkReactConfig: SdkReactConfig | undefined;
2044
+
2029
2045
  /**
2030
2046
  * @public
2031
2047
  */
@@ -2453,6 +2469,7 @@ export declare interface LinkedVideo {
2453
2469
  | 'COMPOSED_PIP' | 'MATRIX';
2454
2470
  name?: string;
2455
2471
  color?: string;
2472
+ language?: LangCode;
2456
2473
  }
2457
2474
 
2458
2475
  /**
@@ -3098,6 +3115,9 @@ export declare interface OrganizationSettingsField extends OrganizationResponsiv
3098
3115
  tagModal?: {
3099
3116
  hideTitle?: boolean;
3100
3117
  };
3118
+ seriesModal?: {
3119
+ hideHeader?: boolean;
3120
+ };
3101
3121
  };
3102
3122
  voucher?: VoucherPageConfiguration;
3103
3123
  }
@@ -3464,6 +3484,18 @@ export declare interface PlayerError {
3464
3484
  timestamp: number;
3465
3485
  }
3466
3486
 
3487
+ /**
3488
+ * @public
3489
+ */
3490
+ export declare type PlayerEvent = {
3491
+ name: PlayerEventName;
3492
+ };
3493
+
3494
+ /**
3495
+ * @public
3496
+ */
3497
+ export declare type PlayerEventName = `${PlayerWrapperEvents}`;
3498
+
3467
3499
  /**
3468
3500
  * @public
3469
3501
  */
@@ -3591,7 +3623,6 @@ export declare interface PlayerSourceInterface<T extends NonAdSourceType = NonAd
3591
3623
  pauseReactions(): void;
3592
3624
  correctStartPosition(): Promise<void | null>;
3593
3625
  setCanSeek(canSeek: boolean): void;
3594
- getOffset(): number;
3595
3626
  getSeekingMatrixPreviewByTime(timeMs: number, offsetIndex?: number): SeekingMatrix | null;
3596
3627
  originalOptions: Record<string, any>;
3597
3628
  start?: Date;
@@ -3660,11 +3691,20 @@ export declare interface PlayerWrapper {
3660
3691
  * Pause video
3661
3692
  */
3662
3693
  pause: () => void;
3694
+ ad: AdSourceInterface | null;
3695
+ adMetadata: AdMetadata | null;
3696
+ adSegment: AdSegment | null;
3697
+ availableLanguages: LangCode[] | null;
3698
+ canReplay: boolean;
3699
+ currentSecondarySource: Video | null;
3700
+ currentTime: number;
3663
3701
  /**
3664
3702
  * Currently playing source
3665
3703
  */
3666
3704
  source: PlayerSource | null;
3705
+ seekInterceptor: SeekInterceptor;
3667
3706
  events: EmitterInterface;
3707
+ event: PlayerEvent | null;
3668
3708
  /**
3669
3709
  * Register a low level player that implements player methods, like play video, change volume, etc.
3670
3710
  */
@@ -3672,12 +3712,30 @@ export declare interface PlayerWrapper {
3672
3712
  /**
3673
3713
  * duration of current source in ms (both setter and getter)
3674
3714
  */
3675
- durationMs: number | null;
3715
+ durationMs: number;
3716
+ intro: {
3717
+ marker: any;
3718
+ skip: () => void;
3719
+ } | null;
3720
+ isBuffering: boolean;
3721
+ isCurrentTimeLive: boolean;
3722
+ isLiveSeekingEnabled: boolean;
3723
+ isMuted: boolean;
3676
3724
  isPlaybackStarted?: boolean;
3677
3725
  isPaused: boolean;
3678
3726
  isPlaying: boolean;
3679
3727
  isIdle: boolean;
3728
+ language: LangCode | null;
3729
+ nextRecommendedVideo: Video | null;
3730
+ prerollCheck: PrerollCheck;
3731
+ previousSource: PlayerSource | null;
3732
+ progress: number | null;
3733
+ progressMetadata: ProgressMetadata;
3734
+ requestedSource: PlayerSource | null;
3735
+ secondaryVideos: Video[] | null;
3680
3736
  error: PlayerError | null;
3737
+ state: PlayerState;
3738
+ volume: number;
3681
3739
  playbackError: PlayerError | null;
3682
3740
  canPlay: boolean;
3683
3741
  /**
@@ -3694,6 +3752,8 @@ export declare interface PlayerWrapper {
3694
3752
  * set volume to value between 0,1
3695
3753
  */
3696
3754
  setVolume: (volume: number) => void;
3755
+ changeLanguage: (langCode: LangCode) => Promise<void>;
3756
+ changeToFallbackSource: () => Promise<void>;
3697
3757
  /**
3698
3758
  * change volume by value between -1,1
3699
3759
  */
@@ -3701,7 +3761,52 @@ export declare interface PlayerWrapper {
3701
3761
  setMuted: (muted: boolean) => void;
3702
3762
  setCanPlay: (canPlay: boolean) => void;
3703
3763
  toggleMuted: () => void;
3764
+ getQualities: () => Track[];
3765
+ playNativeImaAd: (url: string) => void;
3766
+ playSourceAfterAdsRun: () => void;
3767
+ putAd: (ad: AdSourceInterface) => void;
3768
+ putAdMetadata: (ad: AdSourceInterface) => void;
3769
+ reportLoadError: (error: Error) => void;
3770
+ reportStateChanged: (state: PlayerState) => void;
3771
+ reportTimeProgress: (ms: number) => void;
3772
+ reportPlaybackCancelled: () => void;
3773
+ reportPlaybackError: (error: Error) => void;
3774
+ reportPlaybackEnded: () => void;
3704
3775
  resetErrors(): void;
3776
+ seekToPercent: (percentage: number) => void;
3777
+ seekToInternal: (ms: number) => void;
3778
+ seekToLive: () => void;
3779
+ seekToLiveInternal: () => void;
3780
+ setIsBuffering: (isBuffering: boolean) => void;
3781
+ setIsCasting: (isCasting: boolean) => void;
3782
+ skipAd: () => void;
3783
+ skipAllAds: () => void;
3784
+ switchSecondarySource: (activeVideoId?: string) => Promise<void>;
3785
+ }
3786
+
3787
+ /**
3788
+ * @public
3789
+ */
3790
+ export declare enum PlayerWrapperEvents {
3791
+ 'playback_cancelled' = "playback_cancelled",
3792
+ /**
3793
+ * Triggered when content video or ad finished playing until the end
3794
+ */
3795
+ 'playback_ended' = "playback_ended",
3796
+ /**
3797
+ * Triggered when both content video and all its associated ads finished playing until the end.
3798
+ * Or in case of postroll, when content video finished playing unit the end and all postroll
3799
+ * ads either finished / failed or were skipped.
3800
+ */
3801
+ 'video_unit_ended' = "video_unit_ended",
3802
+ /**
3803
+ * Pause was triggered
3804
+ */
3805
+ 'pause_triggered' = "pause_triggered",
3806
+ /**
3807
+ * Un-pause was triggered
3808
+ */
3809
+ 'unpause_triggered' = "unpause_triggered"
3705
3810
  }
3706
3811
 
3707
3812
  /**
@@ -3717,6 +3822,18 @@ export declare enum PlayerWrapperEventType {
3717
3822
  */
3718
3823
  export declare type PlayerWrapperEventTypeType = `${PlayerWrapperEventType}`;
3719
3824
 
3825
+ /**
3826
+ * @public
3827
+ */
3828
+ /**
3829
+ * A promise that ads will be loaded. Resolves to the first ad source,
3830
+ * other ads are linked to it via `ad.next` attribute.
3831
+ *
3832
+ * In case preroll is not configured or no ad
3833
+ * manages to load successfully, resolves to null.
3834
+ */
3835
+ export declare type PrerollCheck = (source: PlayerSource) => Promise<AdSourceInterface | null>;
3836
+
3720
3837
  export declare enum primaPlusMonetizationLevel {
3721
3838
  light = "z7soJTA2dYSxnOOJw7B0",
3722
3839
  premium = "kwfM0D7Vzv5wfLf5go8o",
@@ -3799,6 +3916,18 @@ export declare type ProfileSurvey = {
3799
3916
  age?: AgeRange;
3800
3917
  };
3801
3918
 
3919
+ /**
3920
+ * @public
3921
+ */
3922
+ export declare interface ProgressMetadata {
3923
+ currentTimeMs: number;
3924
+ durationMs: number;
3925
+ percent: number;
3926
+ remainingMs: number;
3927
+ type: 'original' | 'cutout';
3928
+ cutout?: Cutout;
3929
+ }
3930
+
3802
3931
  /**
3803
3932
  * @public
3804
3933
  */
@@ -4434,10 +4563,11 @@ declare type Relationship = {
4434
4563
  * @public
4435
4564
  */
4436
4565
  export declare type RemoteBundleState = {
4437
- config: InternalConfig;
4438
- error: string | null;
4439
4566
  state: 'loading' | 'error' | 'ready';
4440
- } & Nullable<TivioBundle>;
4567
+ error: string | null;
4568
+ config: InternalConfig;
4569
+ settings: Settings;
4570
+ } & Omit<Partial<TivioJsBundleExposedApi>, 'createPlayerWrapper'> & Nullable<TivioBundle>;
4441
4571
 
4442
4572
  export declare interface RemoteControlGenerateSourceResponse {
4443
4573
  sessionId?: string;
@@ -4456,7 +4586,6 @@ export declare interface RemoteControlGetSourceUrlPayload {
4456
4586
  * @public
4457
4587
  */
4458
4588
  export declare interface RemoteControllerProps {
4459
- video: Video;
4460
4589
  className?: string;
4461
4590
  }
4462
4591
 
@@ -4541,6 +4670,8 @@ export declare interface RenderConditionValue {
4541
4670
  subscriptionRefs?: any[];
4542
4671
  }
4543
4672
 
4673
+ export declare const renderWebPlayer: (container: HTMLElement, props: WebPlayerProps) => void;
4674
+
4544
4675
  /**
4545
4676
  * Make all attributes in given type required, non-nullable and defined.
4546
4677
  * e.g. will make `{ attribute?: string | null }` to be `{ attribute: string }`
@@ -4765,6 +4896,14 @@ export declare type RowInScreen = {
4765
4896
  * Setting for decided whether to hide title in the tiles/banners
4766
4897
  */
4767
4898
  hideTitle?: boolean;
4899
+ /**
4900
+ * Link to external URL
4901
+ */
4902
+ externalUrl?: string;
4903
+ /**
4904
+ * Title of Play button
4905
+ */
4906
+ playButtonTitle?: Translation;
4768
4907
  };
4769
4908
 
4770
4909
  /**
@@ -5032,6 +5171,26 @@ export declare interface SeekingMatrixTemplate {
5032
5171
  interval: number;
5033
5172
  }
5034
5173
 
5174
+ export declare interface SeekInterceptionResult {
5175
+ position: number | null;
5176
+ didChangePosition: boolean;
5177
+ priority: number;
5178
+ }
5179
+
5180
+ /**
5181
+ * @public
5182
+ */
5183
+ export declare interface SeekInterceptor {
5184
+ addInterceptor(interceptor: SeekInterceptorFunction, callback?: SeekInterceptorCallback): void;
5185
+ applyInterceptors(currentPosition: number, seekPosition: number): SeekInterceptionResult;
5186
+ callCallbacksAfterInterception(): void;
5187
+ removeInterceptor(interceptor: SeekInterceptorFunction): void;
5188
+ }
5189
+
5190
+ export declare type SeekInterceptorCallback = (requestedSeekPosition: number) => void;
5191
+
5192
+ export declare type SeekInterceptorFunction = (currentPosition: number, seekPosition: number) => SeekInterceptionResult;
5193
+
5035
5194
  export declare enum SemanticDate {
5036
5195
  YESTERDAY = "Yesterday",
5037
5196
  TODAY = "Today",
@@ -5101,6 +5260,13 @@ export declare interface SetCustomClaimsRequest {
5101
5260
  organizationId: string;
5102
5261
  }
5103
5262
 
5263
+ export declare const setSdkReactConfig: (tivioConfig: SdkReactConfig) => void;
5264
+
5265
+ declare type Settings = {
5266
+ onSetUser: (handler: (userId: string, userPayload: UserPayload) => void) => void;
5267
+ setUser: (userId: string, userPayload: UserPayload) => void;
5268
+ };
5269
+
5104
5270
  /**
5105
5271
  * Used for entities, that can be global (e.g. asset presets, tag types).
5106
5272
  * Non-global is stored under organizations (in sub-collection), and shown for organization's users and super-admin.
@@ -5822,7 +5988,7 @@ export declare type TivioGetters = {
5822
5988
  * @returns {Promise<Monetization[] | undefined>} organization subscriptions or undefined if organization does not exists
5823
5989
  */
5824
5990
  getSubscriptions: () => Promise<Monetization[] | undefined>;
5825
- };
5991
+ } | null;
5826
5992
  /**
5827
5993
  * Get video by its id.
5828
5994
  * @param videoId - video id
@@ -6028,7 +6194,7 @@ export declare type TivioJsBundleExposedApi = {
6028
6194
  * @param id - player wrapper id
6029
6195
  * @returns {Player} player wrapper instance
6030
6196
  */
6031
- getPlayerWrapper: (id: string) => Player;
6197
+ getPlayerWrapper: (id: string) => PlayerWrapper;
6032
6198
  /**
6033
6199
  * Get tv channel by its id.
6034
6200
  * @param tvChannelId - tv channel id
@@ -6064,18 +6230,17 @@ export declare interface TivioPlayerWrapper {
6064
6230
  /**
6065
6231
  * @public
6066
6232
  */
6067
- export declare const TivioProvider: React_2.FC<TivioProviderProps>;
6233
+ export declare const TivioProvider: (props: TivioProviderProps) => React_2.JSX.Element;
6068
6234
 
6069
6235
  /**
6070
6236
  * @public
6071
6237
  */
6072
- export declare type TivioProviderProps = {
6238
+ export declare interface TivioProviderProps extends React_2.PropsWithChildren {
6073
6239
  /**
6074
6240
  * This prop must be set only once and not change value afterwards
6075
6241
  */
6076
6242
  conf: SdkReactConfig | undefined | null;
6077
- children: React_2.ReactNode;
6078
- };
6243
+ }
6079
6244
 
6080
6245
  /**
6081
6246
  * @public
@@ -6104,7 +6269,7 @@ export declare type TivioReactBundle = {
6104
6269
  internal: TivioInternalBundle;
6105
6270
  analytics: TivioAnalytics;
6106
6271
  destroy: () => Promise<void>;
6107
- } & Pick<TivioSetters, 'setBundleVersion' | 'setUser' | 'setLanguage' | 'setStorageManager'>;
6272
+ } & Pick<TivioSetters, 'setBundleVersion' | 'setUser' | 'setLanguage' | 'setStorageManager'> & Omit<Partial<TivioJsBundleExposedApi>, 'createPlayerWrapper'>;
6108
6273
 
6109
6274
  /**
6110
6275
  * @public
@@ -7081,6 +7246,8 @@ export declare interface Video extends RowItem, MonetizableItem, ReactableConten
7081
7246
  initApplication: () => Promise<void>;
7082
7247
  init: () => Promise<void>;
7083
7248
  progress?: number;
7249
+ purchasableMonetizationPurchase: Purchase | null;
7250
+ purchaseByVideoId: Purchase | null;
7084
7251
  backgroundBlurBannerMobile?: string | null;
7085
7252
  isWatched?: boolean;
7086
7253
  pgRating?: string;
@@ -7088,6 +7255,8 @@ export declare interface Video extends RowItem, MonetizableItem, ReactableConten
7088
7255
  publishedStatus?: PublishedStatus;
7089
7256
  widgetPaths?: string[];
7090
7257
  forcedCapabilities: PlayerCapability[] | null;
7258
+ mainLinkedVideoId?: string;
7259
+ getLinkedVideoIdByLanguage: (lang: LangCode) => string | undefined;
7091
7260
  }
7092
7261
 
7093
7262
  /**
@@ -7385,10 +7554,10 @@ export declare interface VodTivioSourceInterface extends PlayerSourceInterface<S
7385
7554
  canWatchOnDevice: boolean;
7386
7555
  isAvailable: boolean;
7387
7556
  availability: ContentAvailability | null;
7388
- managementUrl?: string;
7389
7557
  video: Video;
7390
7558
  clone: (params?: Partial<VodTivioSourceParams>) => VodTivioSourceInterface;
7391
7559
  sessionType?: VideoSourceField['sessionType'];
7560
+ sessionId?: string;
7392
7561
  }
7393
7562
 
7394
7563
  /**
@@ -7400,12 +7569,6 @@ export declare interface VodTivioSourceParams extends PlayerSourceParams<SourceT
7400
7569
  language?: LangCode;
7401
7570
  drm?: Drm;
7402
7571
  ignoreWatchPosition?: boolean;
7403
- /**
7404
- * URL for source modification for user (e.g. add PIP window to livestream).
7405
- * TODO mb move to PlayerSourceParams
7406
- * TODO: Remove managementUrl
7407
- */
7408
- managementUrl?: string;
7409
7572
  /**
7410
7573
  * Session ID for authentication and optionally controlling the cameras
7411
7574
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "9.1.6",
3
+ "version": "9.2.0-alpha.0",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -38,7 +38,7 @@
38
38
  "@material-ui/core": "^4.11.2",
39
39
  "@material-ui/icons": "^4.11.2",
40
40
  "@sentry/browser": "^6.1.0",
41
- "@tivio/common": "1.1.128",
41
+ "@tivio/common": "1.1.129",
42
42
  "dayjs": "^1.11.0",
43
43
  "es7-object-polyfill": "^1.0.1",
44
44
  "firebase": "8.10.1",