@tivio/sdk-react 9.1.7 → 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,6 +5,10 @@ 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
+
8
12
  * 9.1.7
9
13
  * patch: update remote controller component API
10
14
 
@@ -24,6 +28,13 @@ settings in the administration of Tivio Studio while having the freedom to build
24
28
  * patch: add renderWebPlayer method for rendering outside of React
25
29
  * patch: expose createTivio
26
30
 
31
+ * 9.1.4
32
+ * patch: disable setUser check
33
+
34
+ * 9.1.3
35
+ * minor: add renderWebPlayer method for rendering outside of React
36
+ * minor: expose createTivio
37
+
27
38
  * 9.1.2
28
39
  * patch: update PurchaseEndpointPayload type (cityName, externalId, geoPoint)
29
40
 
package/README.md.bak CHANGED
@@ -5,6 +5,10 @@ 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
+
8
12
  * 9.1.7
9
13
  * patch: update remote controller component API
10
14
 
@@ -24,6 +28,13 @@ settings in the administration of Tivio Studio while having the freedom to build
24
28
  * patch: add renderWebPlayer method for rendering outside of React
25
29
  * patch: expose createTivio
26
30
 
31
+ * 9.1.4
32
+ * patch: disable setUser check
33
+
34
+ * 9.1.3
35
+ * minor: add renderWebPlayer method for rendering outside of React
36
+ * minor: expose createTivio
37
+
27
38
  * 9.1.2
28
39
  * patch: update PurchaseEndpointPayload type (cityName, externalId, geoPoint)
29
40
 
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
  */
@@ -2840,6 +2843,9 @@ export declare interface OrganizationSettingsField extends OrganizationResponsiv
2840
2843
  tagModal?: {
2841
2844
  hideTitle?: boolean;
2842
2845
  };
2846
+ seriesModal?: {
2847
+ hideHeader?: boolean;
2848
+ };
2843
2849
  };
2844
2850
  voucher?: VoucherPageConfiguration;
2845
2851
  }
@@ -3206,6 +3212,18 @@ export declare interface PlayerError {
3206
3212
  timestamp: number;
3207
3213
  }
3208
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
+
3209
3227
  /**
3210
3228
  * @public
3211
3229
  */
@@ -3333,7 +3351,6 @@ export declare interface PlayerSourceInterface<T extends NonAdSourceType = NonAd
3333
3351
  pauseReactions(): void;
3334
3352
  correctStartPosition(): Promise<void | null>;
3335
3353
  setCanSeek(canSeek: boolean): void;
3336
- getOffset(): number;
3337
3354
  getSeekingMatrixPreviewByTime(timeMs: number, offsetIndex?: number): SeekingMatrix | null;
3338
3355
  originalOptions: Record<string, any>;
3339
3356
  start?: Date;
@@ -3402,11 +3419,20 @@ export declare interface PlayerWrapper {
3402
3419
  * Pause video
3403
3420
  */
3404
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;
3405
3429
  /**
3406
3430
  * Currently playing source
3407
3431
  */
3408
3432
  source: PlayerSource | null;
3433
+ seekInterceptor: SeekInterceptor;
3409
3434
  events: EmitterInterface;
3435
+ event: PlayerEvent | null;
3410
3436
  /**
3411
3437
  * Register a low level player that implements player methods, like play video, change volume, etc.
3412
3438
  */
@@ -3414,12 +3440,30 @@ export declare interface PlayerWrapper {
3414
3440
  /**
3415
3441
  * duration of current source in ms (both setter and getter)
3416
3442
  */
3417
- 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;
3418
3452
  isPlaybackStarted?: boolean;
3419
3453
  isPaused: boolean;
3420
3454
  isPlaying: boolean;
3421
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;
3422
3464
  error: PlayerError | null;
3465
+ state: PlayerState;
3466
+ volume: number;
3423
3467
  playbackError: PlayerError | null;
3424
3468
  canPlay: boolean;
3425
3469
  /**
@@ -3436,6 +3480,8 @@ export declare interface PlayerWrapper {
3436
3480
  * set volume to value between 0,1
3437
3481
  */
3438
3482
  setVolume: (volume: number) => void;
3483
+ changeLanguage: (langCode: LangCode) => Promise<void>;
3484
+ changeToFallbackSource: () => Promise<void>;
3439
3485
  /**
3440
3486
  * change volume by value between -1,1
3441
3487
  */
@@ -3443,7 +3489,52 @@ export declare interface PlayerWrapper {
3443
3489
  setMuted: (muted: boolean) => void;
3444
3490
  setCanPlay: (canPlay: boolean) => void;
3445
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;
3446
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"
3447
3538
  }
3448
3539
 
3449
3540
  /**
@@ -3459,6 +3550,18 @@ export declare enum PlayerWrapperEventType {
3459
3550
  */
3460
3551
  export declare type PlayerWrapperEventTypeType = `${PlayerWrapperEventType}`;
3461
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
+
3462
3565
  export declare enum primaPlusMonetizationLevel {
3463
3566
  light = "z7soJTA2dYSxnOOJw7B0",
3464
3567
  premium = "kwfM0D7Vzv5wfLf5go8o",
@@ -3541,6 +3644,18 @@ export declare type ProfileSurvey = {
3541
3644
  age?: AgeRange;
3542
3645
  };
3543
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
+
3544
3659
  /**
3545
3660
  * @public
3546
3661
  */
@@ -4176,10 +4291,11 @@ declare type Relationship = {
4176
4291
  * @public
4177
4292
  */
4178
4293
  export declare type RemoteBundleState = {
4179
- config: InternalConfig;
4180
- error: string | null;
4181
4294
  state: 'loading' | 'error' | 'ready';
4182
- } & Nullable<TivioBundle>;
4295
+ error: string | null;
4296
+ config: InternalConfig;
4297
+ settings: Settings;
4298
+ } & Omit<Partial<TivioJsBundleExposedApi>, 'createPlayerWrapper'> & Nullable<TivioBundle>;
4183
4299
 
4184
4300
  export declare interface RemoteControlGenerateSourceResponse {
4185
4301
  sessionId?: string;
@@ -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