@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.
package/README.md CHANGED
@@ -5,11 +5,28 @@ above Tivio Studio. You can comfortably manage all you videos, settings such as
5
5
  settings in the administration of Tivio Studio while having the freedom to build your own application.
6
6
 
7
7
  ## Changelog
8
+ * 9.2.0-alpha.0
9
+ * minor: add renderWebPlayer method for rendering outside of React
10
+ * minor: "expose createTivio"
11
+
12
+ * 9.1.7
13
+ * patch: update remote controller component API
14
+
8
15
  * 9.1.6
9
16
  * minor: add remote controller
10
17
 
11
18
  * 9.1.5
12
19
  * patch: expose purchase loyalty points through types
20
+ * patch: enable setUser check
21
+
22
+ * 9.1.4
23
+ * patch: disable setUser check
24
+ * patch: rollback "add renderWebPlayer method for rendering outside of React"
25
+ * patch: rollback "expose createTivio"
26
+
27
+ * 9.1.3
28
+ * patch: add renderWebPlayer method for rendering outside of React
29
+ * patch: expose createTivio
13
30
 
14
31
  * 9.1.4
15
32
  * patch: disable setUser check
package/README.md.bak CHANGED
@@ -5,11 +5,28 @@ above Tivio Studio. You can comfortably manage all you videos, settings such as
5
5
  settings in the administration of Tivio Studio while having the freedom to build your own application.
6
6
 
7
7
  ## Changelog
8
+ * 9.2.0-alpha.0
9
+ * minor: add renderWebPlayer method for rendering outside of React
10
+ * minor: "expose createTivio"
11
+
12
+ * 9.1.7
13
+ * patch: update remote controller component API
14
+
8
15
  * 9.1.6
9
16
  * minor: add remote controller
10
17
 
11
18
  * 9.1.5
12
19
  * patch: expose purchase loyalty points through types
20
+ * patch: enable setUser check
21
+
22
+ * 9.1.4
23
+ * patch: disable setUser check
24
+ * patch: rollback "add renderWebPlayer method for rendering outside of React"
25
+ * patch: rollback "expose createTivio"
26
+
27
+ * 9.1.3
28
+ * patch: add renderWebPlayer method for rendering outside of React
29
+ * patch: expose createTivio
13
30
 
14
31
  * 9.1.4
15
32
  * patch: disable setUser check
package/dist/index.d.ts CHANGED
@@ -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
  /**
@@ -1034,10 +1036,9 @@ export declare const createPubSub: () => PubSub;
1034
1036
  */
1035
1037
  export declare const createRemotePackageLoader: () => (secret: string, conf: InternalConfig, checkBundleCharCount?: boolean) => Promise<TivioBundle>;
1036
1038
 
1037
- /**
1038
- * @public
1039
- */
1040
- export declare const createUseRemoteBundle: () => (conf: InternalConfig, checkBundleCharCount?: boolean) => RemoteBundleState;
1039
+ export declare const createTivio: () => (conf: SdkReactConfig) => Promise<RemoteBundleState>;
1040
+
1041
+ export declare const createUseRemoteBundle: () => (sdkReactConfig: SdkReactConfig, checkBundleCharCount?: boolean) => RemoteBundleState;
1041
1042
 
1042
1043
  export declare interface CreateUserPayload {
1043
1044
  displayName?: string;
@@ -1071,13 +1072,13 @@ export declare const CURRENCIES: string[];
1071
1072
  * Three upper-case letters according to ISO-4217.
1072
1073
  * @public
1073
1074
  */
1074
- export declare type Currency = 'CZK' | 'EUR' | 'USD';
1075
+ export declare type Currency = 'CZK' | 'EUR' | 'USD' | 'PLN';
1075
1076
 
1076
1077
  /**
1077
1078
  * Necessary because keys in cloud function config cannot contain upper-case letters.
1078
1079
  * Has to be in sync with {@link Currency}.
1079
1080
  */
1080
- export declare type CurrencyLowerCase = 'czk' | 'eur' | 'usd';
1081
+ export declare type CurrencyLowerCase = 'czk' | 'eur' | 'usd' | 'pln';
1081
1082
 
1082
1083
  export declare interface CurrentQuestion {
1083
1084
  id: string;
@@ -1787,6 +1788,8 @@ export declare interface GetViewAnalyticsResponse {
1787
1788
 
1788
1789
  export declare type GetViewsAnalyticsRequest = GetBaseAnalyticsRequest;
1789
1790
 
1791
+ export declare let globalSdkReactConfig: SdkReactConfig | undefined;
1792
+
1790
1793
  /**
1791
1794
  * @public
1792
1795
  */
@@ -2204,6 +2207,7 @@ export declare interface LinkedVideo {
2204
2207
  | 'COMPOSED_PIP' | 'MATRIX';
2205
2208
  name?: string;
2206
2209
  color?: string;
2210
+ language?: LangCode;
2207
2211
  }
2208
2212
 
2209
2213
  /**
@@ -2839,6 +2843,9 @@ export declare interface OrganizationSettingsField extends OrganizationResponsiv
2839
2843
  tagModal?: {
2840
2844
  hideTitle?: boolean;
2841
2845
  };
2846
+ seriesModal?: {
2847
+ hideHeader?: boolean;
2848
+ };
2842
2849
  };
2843
2850
  voucher?: VoucherPageConfiguration;
2844
2851
  }
@@ -3205,6 +3212,18 @@ export declare interface PlayerError {
3205
3212
  timestamp: number;
3206
3213
  }
3207
3214
 
3215
+ /**
3216
+ * @public
3217
+ */
3218
+ export declare type PlayerEvent = {
3219
+ name: PlayerEventName;
3220
+ };
3221
+
3222
+ /**
3223
+ * @public
3224
+ */
3225
+ export declare type PlayerEventName = `${PlayerWrapperEvents}`;
3226
+
3208
3227
  /**
3209
3228
  * @public
3210
3229
  */
@@ -3332,7 +3351,6 @@ export declare interface PlayerSourceInterface<T extends NonAdSourceType = NonAd
3332
3351
  pauseReactions(): void;
3333
3352
  correctStartPosition(): Promise<void | null>;
3334
3353
  setCanSeek(canSeek: boolean): void;
3335
- getOffset(): number;
3336
3354
  getSeekingMatrixPreviewByTime(timeMs: number, offsetIndex?: number): SeekingMatrix | null;
3337
3355
  originalOptions: Record<string, any>;
3338
3356
  start?: Date;
@@ -3401,11 +3419,20 @@ export declare interface PlayerWrapper {
3401
3419
  * Pause video
3402
3420
  */
3403
3421
  pause: () => void;
3422
+ ad: AdSourceInterface | null;
3423
+ adMetadata: AdMetadata | null;
3424
+ adSegment: AdSegment | null;
3425
+ availableLanguages: LangCode[] | null;
3426
+ canReplay: boolean;
3427
+ currentSecondarySource: Video | null;
3428
+ currentTime: number;
3404
3429
  /**
3405
3430
  * Currently playing source
3406
3431
  */
3407
3432
  source: PlayerSource | null;
3433
+ seekInterceptor: SeekInterceptor;
3408
3434
  events: EmitterInterface;
3435
+ event: PlayerEvent | null;
3409
3436
  /**
3410
3437
  * Register a low level player that implements player methods, like play video, change volume, etc.
3411
3438
  */
@@ -3413,12 +3440,30 @@ export declare interface PlayerWrapper {
3413
3440
  /**
3414
3441
  * duration of current source in ms (both setter and getter)
3415
3442
  */
3416
- durationMs: number | null;
3443
+ durationMs: number;
3444
+ intro: {
3445
+ marker: any;
3446
+ skip: () => void;
3447
+ } | null;
3448
+ isBuffering: boolean;
3449
+ isCurrentTimeLive: boolean;
3450
+ isLiveSeekingEnabled: boolean;
3451
+ isMuted: boolean;
3417
3452
  isPlaybackStarted?: boolean;
3418
3453
  isPaused: boolean;
3419
3454
  isPlaying: boolean;
3420
3455
  isIdle: boolean;
3456
+ language: LangCode | null;
3457
+ nextRecommendedVideo: Video | null;
3458
+ prerollCheck: PrerollCheck;
3459
+ previousSource: PlayerSource | null;
3460
+ progress: number | null;
3461
+ progressMetadata: ProgressMetadata;
3462
+ requestedSource: PlayerSource | null;
3463
+ secondaryVideos: Video[] | null;
3421
3464
  error: PlayerError | null;
3465
+ state: PlayerState;
3466
+ volume: number;
3422
3467
  playbackError: PlayerError | null;
3423
3468
  canPlay: boolean;
3424
3469
  /**
@@ -3435,6 +3480,8 @@ export declare interface PlayerWrapper {
3435
3480
  * set volume to value between 0,1
3436
3481
  */
3437
3482
  setVolume: (volume: number) => void;
3483
+ changeLanguage: (langCode: LangCode) => Promise<void>;
3484
+ changeToFallbackSource: () => Promise<void>;
3438
3485
  /**
3439
3486
  * change volume by value between -1,1
3440
3487
  */
@@ -3442,7 +3489,52 @@ export declare interface PlayerWrapper {
3442
3489
  setMuted: (muted: boolean) => void;
3443
3490
  setCanPlay: (canPlay: boolean) => void;
3444
3491
  toggleMuted: () => void;
3492
+ getQualities: () => Track[];
3493
+ playNativeImaAd: (url: string) => void;
3494
+ playSourceAfterAdsRun: () => void;
3495
+ putAd: (ad: AdSourceInterface) => void;
3496
+ putAdMetadata: (ad: AdSourceInterface) => void;
3497
+ reportLoadError: (error: Error) => void;
3498
+ reportStateChanged: (state: PlayerState) => void;
3499
+ reportTimeProgress: (ms: number) => void;
3500
+ reportPlaybackCancelled: () => void;
3501
+ reportPlaybackError: (error: Error) => void;
3502
+ reportPlaybackEnded: () => void;
3445
3503
  resetErrors(): void;
3504
+ seekToPercent: (percentage: number) => void;
3505
+ seekToInternal: (ms: number) => void;
3506
+ seekToLive: () => void;
3507
+ seekToLiveInternal: () => void;
3508
+ setIsBuffering: (isBuffering: boolean) => void;
3509
+ setIsCasting: (isCasting: boolean) => void;
3510
+ skipAd: () => void;
3511
+ skipAllAds: () => void;
3512
+ switchSecondarySource: (activeVideoId?: string) => Promise<void>;
3513
+ }
3514
+
3515
+ /**
3516
+ * @public
3517
+ */
3518
+ export declare enum PlayerWrapperEvents {
3519
+ 'playback_cancelled' = "playback_cancelled",
3520
+ /**
3521
+ * Triggered when content video or ad finished playing until the end
3522
+ */
3523
+ 'playback_ended' = "playback_ended",
3524
+ /**
3525
+ * Triggered when both content video and all its associated ads finished playing until the end.
3526
+ * Or in case of postroll, when content video finished playing unit the end and all postroll
3527
+ * ads either finished / failed or were skipped.
3528
+ */
3529
+ 'video_unit_ended' = "video_unit_ended",
3530
+ /**
3531
+ * Pause was triggered
3532
+ */
3533
+ 'pause_triggered' = "pause_triggered",
3534
+ /**
3535
+ * Un-pause was triggered
3536
+ */
3537
+ 'unpause_triggered' = "unpause_triggered"
3446
3538
  }
3447
3539
 
3448
3540
  /**
@@ -3458,6 +3550,18 @@ export declare enum PlayerWrapperEventType {
3458
3550
  */
3459
3551
  export declare type PlayerWrapperEventTypeType = `${PlayerWrapperEventType}`;
3460
3552
 
3553
+ /**
3554
+ * @public
3555
+ */
3556
+ /**
3557
+ * A promise that ads will be loaded. Resolves to the first ad source,
3558
+ * other ads are linked to it via `ad.next` attribute.
3559
+ *
3560
+ * In case preroll is not configured or no ad
3561
+ * manages to load successfully, resolves to null.
3562
+ */
3563
+ export declare type PrerollCheck = (source: PlayerSource) => Promise<AdSourceInterface | null>;
3564
+
3461
3565
  export declare enum primaPlusMonetizationLevel {
3462
3566
  light = "z7soJTA2dYSxnOOJw7B0",
3463
3567
  premium = "kwfM0D7Vzv5wfLf5go8o",
@@ -3540,6 +3644,18 @@ export declare type ProfileSurvey = {
3540
3644
  age?: AgeRange;
3541
3645
  };
3542
3646
 
3647
+ /**
3648
+ * @public
3649
+ */
3650
+ export declare interface ProgressMetadata {
3651
+ currentTimeMs: number;
3652
+ durationMs: number;
3653
+ percent: number;
3654
+ remainingMs: number;
3655
+ type: 'original' | 'cutout';
3656
+ cutout?: Cutout;
3657
+ }
3658
+
3543
3659
  /**
3544
3660
  * @public
3545
3661
  */
@@ -4175,10 +4291,11 @@ declare type Relationship = {
4175
4291
  * @public
4176
4292
  */
4177
4293
  export declare type RemoteBundleState = {
4178
- config: InternalConfig;
4179
- error: string | null;
4180
4294
  state: 'loading' | 'error' | 'ready';
4181
- } & Nullable<TivioBundle>;
4295
+ error: string | null;
4296
+ config: InternalConfig;
4297
+ settings: Settings;
4298
+ } & Omit<Partial<TivioJsBundleExposedApi>, 'createPlayerWrapper'> & Nullable<TivioBundle>;
4182
4299
 
4183
4300
  export declare interface RemoteControlGenerateSourceResponse {
4184
4301
  sessionId?: string;
@@ -4197,7 +4314,6 @@ export declare interface RemoteControlGetSourceUrlPayload {
4197
4314
  * @public
4198
4315
  */
4199
4316
  export declare interface RemoteControllerProps {
4200
- video: Video;
4201
4317
  className?: string;
4202
4318
  }
4203
4319
 
@@ -4282,6 +4398,8 @@ export declare interface RenderConditionValue {
4282
4398
  subscriptionRefs?: any[];
4283
4399
  }
4284
4400
 
4401
+ export declare const renderWebPlayer: (container: HTMLElement, props: WebPlayerProps) => void;
4402
+
4285
4403
  /**
4286
4404
  * Make all attributes in given type required, non-nullable and defined.
4287
4405
  * e.g. will make `{ attribute?: string | null }` to be `{ attribute: string }`
@@ -4497,6 +4615,14 @@ export declare type RowInScreen = {
4497
4615
  * Setting for decided whether to hide title in the tiles/banners
4498
4616
  */
4499
4617
  hideTitle?: boolean;
4618
+ /**
4619
+ * Link to external URL
4620
+ */
4621
+ externalUrl?: string;
4622
+ /**
4623
+ * Title of Play button
4624
+ */
4625
+ playButtonTitle?: Translation;
4500
4626
  };
4501
4627
 
4502
4628
  /**
@@ -4764,6 +4890,26 @@ export declare interface SeekingMatrixTemplate {
4764
4890
  interval: number;
4765
4891
  }
4766
4892
 
4893
+ export declare interface SeekInterceptionResult {
4894
+ position: number | null;
4895
+ didChangePosition: boolean;
4896
+ priority: number;
4897
+ }
4898
+
4899
+ /**
4900
+ * @public
4901
+ */
4902
+ export declare interface SeekInterceptor {
4903
+ addInterceptor(interceptor: SeekInterceptorFunction, callback?: SeekInterceptorCallback): void;
4904
+ applyInterceptors(currentPosition: number, seekPosition: number): SeekInterceptionResult;
4905
+ callCallbacksAfterInterception(): void;
4906
+ removeInterceptor(interceptor: SeekInterceptorFunction): void;
4907
+ }
4908
+
4909
+ export declare type SeekInterceptorCallback = (requestedSeekPosition: number) => void;
4910
+
4911
+ export declare type SeekInterceptorFunction = (currentPosition: number, seekPosition: number) => SeekInterceptionResult;
4912
+
4767
4913
  export declare enum SemanticDate {
4768
4914
  YESTERDAY = "Yesterday",
4769
4915
  TODAY = "Today",
@@ -4833,6 +4979,13 @@ export declare interface SetCustomClaimsRequest {
4833
4979
  organizationId: string;
4834
4980
  }
4835
4981
 
4982
+ export declare const setSdkReactConfig: (tivioConfig: SdkReactConfig) => void;
4983
+
4984
+ declare type Settings = {
4985
+ onSetUser: (handler: (userId: string, userPayload: UserPayload) => void) => void;
4986
+ setUser: (userId: string, userPayload: UserPayload) => void;
4987
+ };
4988
+
4836
4989
  /**
4837
4990
  * Used for entities, that can be global (e.g. asset presets, tag types).
4838
4991
  * Non-global is stored under organizations (in sub-collection), and shown for organization's users and super-admin.
@@ -5468,7 +5621,7 @@ export declare type TivioGetters = {
5468
5621
  * @returns {Promise<Monetization[] | undefined>} organization subscriptions or undefined if organization does not exists
5469
5622
  */
5470
5623
  getSubscriptions: () => Promise<Monetization[] | undefined>;
5471
- };
5624
+ } | null;
5472
5625
  /**
5473
5626
  * Get video by its id.
5474
5627
  * @param videoId - video id
@@ -5666,7 +5819,7 @@ export declare type TivioJsBundleExposedApi = {
5666
5819
  * @param id - player wrapper id
5667
5820
  * @returns {Player} player wrapper instance
5668
5821
  */
5669
- getPlayerWrapper: (id: string) => Player;
5822
+ getPlayerWrapper: (id: string) => PlayerWrapper;
5670
5823
  /**
5671
5824
  * Get tv channel by its id.
5672
5825
  * @param tvChannelId - tv channel id
@@ -5702,18 +5855,17 @@ export declare interface TivioPlayerWrapper {
5702
5855
  /**
5703
5856
  * @public
5704
5857
  */
5705
- export declare const TivioProvider: React_2.FC<TivioProviderProps>;
5858
+ export declare const TivioProvider: (props: TivioProviderProps) => React_2.JSX.Element;
5706
5859
 
5707
5860
  /**
5708
5861
  * @public
5709
5862
  */
5710
- export declare type TivioProviderProps = {
5863
+ export declare interface TivioProviderProps extends React_2.PropsWithChildren {
5711
5864
  /**
5712
5865
  * This prop must be set only once and not change value afterwards
5713
5866
  */
5714
5867
  conf: SdkReactConfig | undefined | null;
5715
- children: React_2.ReactNode;
5716
- };
5868
+ }
5717
5869
 
5718
5870
  /**
5719
5871
  * @public
@@ -5742,7 +5894,7 @@ export declare type TivioReactBundle = {
5742
5894
  internal: TivioInternalBundle;
5743
5895
  analytics: TivioAnalytics;
5744
5896
  destroy: () => Promise<void>;
5745
- } & Pick<TivioSetters, 'setBundleVersion' | 'setUser' | 'setLanguage' | 'setStorageManager'>;
5897
+ } & Pick<TivioSetters, 'setBundleVersion' | 'setUser' | 'setLanguage' | 'setStorageManager'> & Omit<Partial<TivioJsBundleExposedApi>, 'createPlayerWrapper'>;
5746
5898
 
5747
5899
  /**
5748
5900
  * @public
@@ -6719,6 +6871,8 @@ export declare interface Video extends RowItem, MonetizableItem, ReactableConten
6719
6871
  initApplication: () => Promise<void>;
6720
6872
  init: () => Promise<void>;
6721
6873
  progress?: number;
6874
+ purchasableMonetizationPurchase: Purchase | null;
6875
+ purchaseByVideoId: Purchase | null;
6722
6876
  backgroundBlurBannerMobile?: string | null;
6723
6877
  isWatched?: boolean;
6724
6878
  pgRating?: string;
@@ -6726,6 +6880,8 @@ export declare interface Video extends RowItem, MonetizableItem, ReactableConten
6726
6880
  publishedStatus?: PublishedStatus;
6727
6881
  widgetPaths?: string[];
6728
6882
  forcedCapabilities: PlayerCapability[] | null;
6883
+ mainLinkedVideoId?: string;
6884
+ getLinkedVideoIdByLanguage: (lang: LangCode) => string | undefined;
6729
6885
  }
6730
6886
 
6731
6887
  /**
@@ -7023,10 +7179,10 @@ export declare interface VodTivioSourceInterface extends PlayerSourceInterface<S
7023
7179
  canWatchOnDevice: boolean;
7024
7180
  isAvailable: boolean;
7025
7181
  availability: ContentAvailability | null;
7026
- managementUrl?: string;
7027
7182
  video: Video;
7028
7183
  clone: (params?: Partial<VodTivioSourceParams>) => VodTivioSourceInterface;
7029
7184
  sessionType?: VideoSourceField['sessionType'];
7185
+ sessionId?: string;
7030
7186
  }
7031
7187
 
7032
7188
  /**
@@ -7038,12 +7194,6 @@ export declare interface VodTivioSourceParams extends PlayerSourceParams<SourceT
7038
7194
  language?: LangCode;
7039
7195
  drm?: Drm;
7040
7196
  ignoreWatchPosition?: boolean;
7041
- /**
7042
- * URL for source modification for user (e.g. add PIP window to livestream).
7043
- * TODO mb move to PlayerSourceParams
7044
- * TODO: Remove managementUrl
7045
- */
7046
- managementUrl?: string;
7047
7197
  /**
7048
7198
  * Session ID for authentication and optionally controlling the cameras
7049
7199
  */