@tivio/sdk-react 9.2.0-alpha.4 → 9.2.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/dist/index.d.ts CHANGED
@@ -1014,6 +1014,18 @@ export declare interface ConversionsTargetItem {
1014
1014
 
1015
1015
  export declare type CountdownScene = InteractiveWidgetSceneBase<InteractiveWidgetSceneTemplateType.COUNTDOWN>;
1016
1016
 
1017
+ /**
1018
+ * Maps supported country codes (ISO 3166-1 alpha-2) to their primary language codes (ISO 639-1).
1019
+ * Used to determine the default language settings for specific countries.
1020
+ * @example
1021
+ * CountryToLanguageMap['CZ'] // Returns LangCode.CS for Czech Republic
1022
+ */
1023
+ export declare const CountryToLangCodeMap: {
1024
+ CZ: LangCode;
1025
+ PL: LangCode;
1026
+ SK: LangCode;
1027
+ };
1028
+
1017
1029
  /**
1018
1030
  * @public
1019
1031
  * @TODO move somewhere else
@@ -1034,11 +1046,11 @@ export declare const createPubSub: () => PubSub;
1034
1046
  * Fetch & load CommonJS remote module.
1035
1047
  * @public
1036
1048
  */
1037
- export declare const createRemotePackageLoader: () => (secret: string, conf: InternalConfig, checkBundleCharCount?: boolean) => Promise<TivioBundle>;
1049
+ export declare const createRemotePackageLoader: () => (secret: string, conf: InternalConfig, checkBundleCharCount?: boolean, skipCache?: boolean) => Promise<TivioBundle>;
1038
1050
 
1039
1051
  export declare const createTivio: () => (conf: SdkReactConfig) => Promise<RemoteBundleState>;
1040
1052
 
1041
- export declare const createUseRemoteBundle: () => (sdkReactConfig: SdkReactConfig, checkBundleCharCount?: boolean) => RemoteBundleState;
1053
+ export declare const createUseRemoteBundle: () => (sdkReactConfig: SdkReactConfig, checkBundleCharCount?: boolean, skipCache?: boolean) => RemoteBundleState;
1042
1054
 
1043
1055
  export declare interface CreateUserPayload {
1044
1056
  displayName?: string;
@@ -1114,7 +1126,6 @@ export declare enum CustomerId {
1114
1126
  GRAPE = "GRAPE",
1115
1127
  HODINA_DEJEPICHU = "HODINA_DEJEPICHU",
1116
1128
  INVESTICNI_PRUVODCE = "INVESTICNI_PRUVODCE",
1117
- INVESTOREES = "INVESTOREES",
1118
1129
  JOJ = "JOJ",
1119
1130
  KLUCI_Z_PRAHY = "KLUCI_Z_PRAHY",
1120
1131
  MALL = "MALL",
@@ -1159,7 +1170,8 @@ export declare enum CustomerId {
1159
1170
  BEAT_SEXISM = "BEAT_SEXISM",
1160
1171
  KAROL_A_KVIDO = "KAROL_A_KVIDO",
1161
1172
  UZ_BUDU = "UZ_BUDU",
1162
- PRIMA = "PRIMA"
1173
+ PRIMA = "PRIMA",
1174
+ NORA_FRIDRICHOVA = "NORA_FRIDRICHOVA"
1163
1175
  }
1164
1176
 
1165
1177
  export declare interface CustomScript {
@@ -1291,6 +1303,8 @@ export declare enum DrmProvider {
1291
1303
  * Original oktagon stream provider.
1292
1304
  *
1293
1305
  * https://streamonline.pl
1306
+ *
1307
+ * @deprecated oktagon no longer uses this drm provider.
1294
1308
  */
1295
1309
  STREAMONLINE = "streamonline"
1296
1310
  }
@@ -1434,8 +1448,8 @@ export declare type EmbedScreenPostMessageFn = <T extends EmbedScreenPostMessage
1434
1448
  */
1435
1449
  export declare interface EmitterInterface {
1436
1450
  isSupported: (even: string) => boolean;
1437
- addListener: <T = any>(event: string, cb: (value: T) => Empty_2) => void;
1438
- removeListener: <T = any>(event: string, cb: (value: T) => Empty_2) => void;
1451
+ addListener: <T = unknown>(event: string, cb: (value: T) => Empty_2) => void;
1452
+ removeListener: <T = unknown>(event: string, cb: (value: T) => Empty_2) => void;
1439
1453
  }
1440
1454
 
1441
1455
  /**
@@ -3117,9 +3131,8 @@ export declare interface PlayerEngineInterface {
3117
3131
  stop(): Promise<void>;
3118
3132
  addEventListener<T>(event: PlayerEngineEvent, callback: PlayerEngineListener<T>): void;
3119
3133
  addEventListener(event: 'statechange', callback: PlayerEngineListener<PlayerState>): void;
3120
- addEventListener(event: 'bufferingchange', callback: PlayerEngineListener<boolean>): void;
3134
+ addEventListener(event: 'bufferingchange' | 'togglefullscreen', callback: PlayerEngineListener<boolean>): void;
3121
3135
  addEventListener(event: 'bufferedinfochange', callback: PlayerEngineListener<BufferPercentChunk[]>): void;
3122
- addEventListener(event: 'togglefullscreen', callback: PlayerEngineListener<boolean>): void;
3123
3136
  removeEventListener<T>(event: PlayerEngineEvent, listener: PlayerEngineListener<T>): void;
3124
3137
  /**
3125
3138
  * @returns currently playing audio track in ISO 639-1 format ('cs', 'en' etc.) or null if not available
@@ -3203,7 +3216,7 @@ export declare interface PlayerEngineInterface {
3203
3216
  /**
3204
3217
  * @public
3205
3218
  */
3206
- export declare type PlayerEngineListener<T> = (value: T) => any;
3219
+ export declare type PlayerEngineListener<T> = (value: T) => void;
3207
3220
 
3208
3221
  /**
3209
3222
  * @public
@@ -3970,6 +3983,14 @@ export declare type PurchaseEndpointPayload = {
3970
3983
  };
3971
3984
  };
3972
3985
 
3986
+ /**
3987
+ * @public
3988
+ */
3989
+ export declare type PurchaseEventHandlers = {
3990
+ onPurchaseIntention?: (purchase: PurchasableMonetization) => void;
3991
+ onPurchaseFinished?: (purchase: Purchase) => void;
3992
+ };
3993
+
3973
3994
  /**
3974
3995
  * @public
3975
3996
  */
@@ -4404,7 +4425,7 @@ export declare interface RenderConditionValue {
4404
4425
  subscriptionRefs?: any[];
4405
4426
  }
4406
4427
 
4407
- export declare const renderWebPlayer: (container: HTMLElement, props: WebPlayerProps) => void;
4428
+ export declare const renderWebPlayer: (container: HTMLElement, props: Omit<WebPlayerProps, 'onPlayerControllerCreated'>) => Promise<SimplifiedVideoController>;
4408
4429
 
4409
4430
  /**
4410
4431
  * Make all attributes in given type required, non-nullable and defined.
@@ -4788,6 +4809,7 @@ declare interface Screen_2 {
4788
4809
  fetchMoreRows: () => Promise<void>;
4789
4810
  hasNextPage: boolean;
4790
4811
  refetchIfNeeded: () => Promise<void>;
4812
+ allowOrganizationBanner?: boolean;
4791
4813
  }
4792
4814
  export { Screen_2 as Screen }
4793
4815
 
@@ -5037,6 +5059,110 @@ export declare const showGdprConsentPreferences: () => Promise<void>;
5037
5059
  */
5038
5060
  export declare type SignInProvider = 'google' | 'patreon' | 'apple';
5039
5061
 
5062
+ /**
5063
+ * Simplified VideoController interface for external rendering
5064
+ */
5065
+ export declare interface SimplifiedVideoController {
5066
+ /**
5067
+ * Resume playback from paused state
5068
+ */
5069
+ play(): void;
5070
+ /**
5071
+ * Pause the current playback
5072
+ */
5073
+ pause(): void;
5074
+ /**
5075
+ * Toggle between play and pause states
5076
+ */
5077
+ togglePause(): void;
5078
+ /**
5079
+ * Replay the current video from the beginning
5080
+ */
5081
+ replay(): Promise<void>;
5082
+ /**
5083
+ * Retry playback if it failed to start
5084
+ */
5085
+ retry(): void;
5086
+ /**
5087
+ * Seek to an absolute position in milliseconds
5088
+ * @param ms - Position in milliseconds from the start of the video
5089
+ */
5090
+ seekToAbsolutePosition(ms: number): void;
5091
+ /**
5092
+ * Seek relative to current position
5093
+ * @param ms - Number of milliseconds to seek (positive for forward, negative for backward)
5094
+ */
5095
+ seekBy(ms: number): void;
5096
+ /**
5097
+ * Seek to a percentage of the video duration
5098
+ * @param percentage - Percentage value between 0 and 100
5099
+ */
5100
+ seekToPercent(percentage: number): void;
5101
+ /**
5102
+ * Seek to the live position for live streams
5103
+ */
5104
+ seekToLive(): void;
5105
+ /**
5106
+ * Set the volume level
5107
+ * @param value - Volume level between 0 and 1
5108
+ */
5109
+ changeVolume(value: number): void;
5110
+ /**
5111
+ * Increase volume by 5%
5112
+ */
5113
+ volumeUp(): void;
5114
+ /**
5115
+ * Decrease volume by 5%
5116
+ */
5117
+ volumeDown(): void;
5118
+ /**
5119
+ * Mute the audio
5120
+ */
5121
+ mute(): void;
5122
+ /**
5123
+ * Unmute the audio
5124
+ */
5125
+ unmute(): void;
5126
+ /**
5127
+ * Toggle between muted and unmuted states
5128
+ */
5129
+ toggleMute(): void;
5130
+ /**
5131
+ * Currently playing source or null if no source is loaded
5132
+ */
5133
+ readonly currentSource: PlayerSource | null;
5134
+ /**
5135
+ * Add an event listener for player events
5136
+ * @param event - The event name to listen for (e.g., 'ended', 'timeupdate', 'statechange')
5137
+ * @param callback - Function to call when the event occurs
5138
+ */
5139
+ addEventListener<T>(event: string, callback: (value: T) => void): void;
5140
+ /**
5141
+ * Add an event listener for volume changes
5142
+ * @param event - Must be 'volumechange'
5143
+ * @param callback - Function called with volume state object
5144
+ */
5145
+ addEventListener(event: 'volumechange', callback: (value: {
5146
+ muted: boolean;
5147
+ volume: number;
5148
+ }) => void): void;
5149
+ /**
5150
+ * Remove an event listener
5151
+ * @param event - The event name to stop listening for
5152
+ * @param callback - The callback function to remove
5153
+ */
5154
+ removeEventListener<T>(event: string, callback: (value: T) => void): void;
5155
+ /**
5156
+ * Change the current source to a new one
5157
+ * @param source - The new source to load (can be a video path, channel path, or source parameters)
5158
+ */
5159
+ setSource(source: WebPlayerProps['source']): void;
5160
+ /**
5161
+ * Destroy the player and clean up all resources
5162
+ */
5163
+ destroy(): Promise<void>;
5164
+ }
5165
+
5040
5166
  export declare enum SocialNetworks {
5041
5167
  FACEBOOK = 0,
5042
5168
  INSTAGRAM = 1,
@@ -5522,7 +5648,6 @@ export declare interface TivioComponents {
5522
5648
  }>;
5523
5649
  Provider: React_2.ComponentType<RemoteProviderProps>;
5524
5650
  WebPlayer: React_2.ComponentType<WebPlayerProps>;
5525
- Widget: React_2.ComponentType<TivioWidgetProps>;
5526
5651
  PlayerDataContextProvider: React_2.ComponentType<{
5527
5652
  id: string;
5528
5653
  }>;
@@ -5551,9 +5676,7 @@ export declare interface TivioComponents {
5551
5676
  WebTile: React_2.ComponentType<{
5552
5677
  item?: ItemInRow;
5553
5678
  } & TilePropsPartial>;
5554
- ChannelContext: React_2.Context<TvChannel | undefined>;
5555
5679
  ContentSortPicker: React_2.ComponentType<ContentSortPickerProps>;
5556
- WebProfileScreen: React_2.ComponentType<WebProfileScreenProps>;
5557
5680
  WebTivioProVideoScreen: React_2.ComponentType<WebTivioProVideoScreenProps>;
5558
5681
  RemoteController: React_2.ComponentType<RemoteControllerProps>;
5559
5682
  }
@@ -5579,14 +5702,24 @@ export declare interface TivioConfig {
5579
5702
  preferHttp?: boolean;
5580
5703
  };
5581
5704
  secret: string;
5705
+ /**
5706
+ * Language used when isLanguageSelectionEnabled is false | undefined or when not possible to load language from local storage or localization worker
5707
+ */
5582
5708
  language: LangCode;
5583
5709
  debug?: boolean;
5584
5710
  verbose?: boolean;
5585
5711
  firebaseApp?: any | null;
5586
- firebaseFactory?: (config: Object, appName?: string) => firebase_2.FirebaseApp;
5712
+ firebaseFactory?: (config: object, appName?: string) => firebase_2.FirebaseApp;
5587
5713
  authDomainOverride?: string;
5588
5714
  firestore?: any | null;
5589
5715
  currency: Currency;
5716
+ /**
5717
+ * A flag that indicates whether the language selection feature is enabled.
5718
+ * Language is then stored to local storage 'tivio-user-language'.
5719
+ * If nothing is stored in local storage, then language is set according to location
5720
+ * When set to `true`, users are allowed to choose their preferred language
5721
+ */
5722
+ isLanguageSelectionEnabled?: boolean;
5590
5723
  applicationId?: string;
5591
5724
  isTivioProApp?: boolean;
5592
5725
  lockApplicationHandle?: string;
@@ -5812,6 +5945,9 @@ export declare type TivioInternalProviders = {
5812
5945
  }>;
5813
5946
  MonetizationsSelectOverlayContextProvider: React_2.ComponentType;
5814
5947
  QerkoOverlayContextProvider: React_2.ComponentType;
5948
+ /**
5949
+ * @deprecated do not use, this provider will be removed in the future
5950
+ */
5815
5951
  PurchasesWithVideosContextProvider: React_2.ComponentType<{
5816
5952
  children?: React_2.ReactNode;
5817
5953
  }>;
@@ -5969,55 +6105,6 @@ export declare type TivioVodSource = SourceBase & StartAndContinuePosition & {
5969
6105
  videoPath: string;
5970
6106
  };
5971
6107
 
5972
- /**
5973
- * @public
5974
- */
5975
- export declare const TivioWidget: React_2.ForwardRefExoticComponent<Omit<TivioWidgetProps, "ref"> & React_2.RefAttributes<TivioWidgetRef>>;
5976
-
5977
- /**
5978
- * @public
5979
- */
5980
- export declare const TivioWidgetError: React_2.FC<TivioWidgetErrorProps>;
5981
-
5982
- declare type TivioWidgetErrorProps = {
5983
- error: string | null;
5984
- };
5985
-
5986
- /**
5987
- * @public
5988
- */
5989
- export declare const TivioWidgetLoader: React_2.FC;
5990
-
5991
- /**
5992
- * @public
5993
- */
5994
- export declare interface TivioWidgetProps {
5995
- id: string;
5996
- ref: React_2.MutableRefObject<TivioWidgetRef>;
5997
- onEnabled?: (enabled: boolean) => any;
5998
- onBlur?: (event: {
5999
- key: string;
6000
- width: number;
6001
- x: number;
6002
- }) => any;
6003
- }
6004
-
6005
- /**
6006
- * @public
6007
- */
6008
- export declare interface TivioWidgetRef {
6009
- focus: (args: {
6010
- x?: number;
6011
- }) => void;
6012
- handleKey: (key: string) => ({
6013
- handled: boolean;
6014
- x: number;
6015
- });
6016
- unfocus: () => ({
6017
- x: number;
6018
- });
6019
- }
6020
-
6021
6108
  export declare interface TokenInterface {
6022
6109
  token: string;
6023
6110
  expirationDate: Date;
@@ -6954,6 +7041,154 @@ export declare enum VideoContentType {
6954
7041
  SERIES = "SERIES"
6955
7042
  }
6956
7043
 
7044
+ /**
7045
+ * @public
7046
+ * VideoController provides control over video playback, seeking, volume, and event handling.
7047
+ */
7048
+ export declare interface VideoController {
7049
+ /** Unique identifier for this player instance */
7050
+ readonly playerId: string;
7051
+ /** Internal control queue for managing player operations */
7052
+ readonly controlQueue: unknown;
7053
+ /** Currently playing source or null if no source is loaded */
7054
+ readonly currentSource: PlayerSource | null;
7055
+ /**
7056
+ * Add an event listener for player events
7057
+ * @param event - The event name to listen for (e.g., 'ended', 'timeupdate', 'statechange')
7058
+ * @param callback - Function to call when the event occurs
7059
+ */
7060
+ addEventListener<T>(event: string, callback: (value: T) => void): void;
7061
+ addEventListener(event: 'volumechange', callback: (value: {
7062
+ muted: boolean;
7063
+ volume: number;
7064
+ }) => void): void;
7065
+ /**
7066
+ * Remove an event listener
7067
+ * @param event - The event name to stop listening for
7068
+ * @param callback - The callback function to remove
7069
+ */
7070
+ removeEventListener<T>(event: string, callback: (value: T) => void): void;
7071
+ /**
7072
+ * Change the current source to a new one
7073
+ * @param sourceData - The new source parameters
7074
+ * @param autoplay - Whether to start playing immediately (default: true)
7075
+ * @returns Promise that resolves to the new source or null if failed
7076
+ */
7077
+ changeSource(sourceData: SourceParams, autoplay?: boolean): Promise<PlayerSource | null>;
7078
+ /**
7079
+ * Load a new source and optionally start playing
7080
+ * @param sourceData - The source parameters to load
7081
+ * @param autoplay - Whether to start playing immediately
7082
+ */
7083
+ load(sourceData: SourceParams, autoplay: boolean): Promise<void>;
7084
+ /**
7085
+ * Toggle between play and pause states
7086
+ */
7087
+ togglePause(): void;
7088
+ /**
7089
+ * Pause the current playback
7090
+ */
7091
+ pause(): void;
7092
+ /**
7093
+ * Resume playback from paused state
7094
+ */
7095
+ unpause(): void;
7096
+ /**
7097
+ * Replay the current video from the beginning
7098
+ */
7099
+ replay(): Promise<void>;
7100
+ /**
7101
+ * Retry playback if it failed to start
7102
+ */
7103
+ retry(): void;
7104
+ /**
7105
+ * Stop playback and reset player state
7106
+ */
7107
+ close(): void;
7108
+ /**
7109
+ * Destroy the player and clean up all resources
7110
+ */
7111
+ destroy(): Promise<void>;
7112
+ /**
7113
+ * Seek to an absolute position in milliseconds
7114
+ * @param ms - Position in milliseconds from the start of the video
7115
+ */
7116
+ seekToAbsolutePosition(ms: number): void;
7117
+ /**
7118
+ * Seek relative to current position
7119
+ * @param ms - Number of milliseconds to seek (positive for forward, negative for backward)
7120
+ */
7121
+ seekBy(ms: number): void;
7122
+ /**
7123
+ * Seek to a percentage of the video duration
7124
+ * @param percentage - Percentage value between 0 and 100
7125
+ */
7126
+ seekToPercent(percentage: number): void;
7127
+ /**
7128
+ * @deprecated Use seekToPercent instead
7129
+ * Seek to a relative position as percentage of video duration
7130
+ * @param percentage - Percentage value between 0 and 100
7131
+ */
7132
+ seekToRelativePosition(percentage: number): void;
7133
+ /**
7134
+ * Seek to the live position for live streams
7135
+ */
7136
+ seekToLive(): void;
7137
+ /**
7138
+ * Internal method to seek to live position
7139
+ */
7140
+ seekToLiveInternal(): void;
7141
+ /**
7142
+ * Set the volume level
7143
+ * @param value - Volume level between 0 and 1
7144
+ */
7145
+ changeVolume(value: number): void;
7146
+ /**
7147
+ * Increase volume by 5%
7148
+ */
7149
+ volumeUp(): void;
7150
+ /**
7151
+ * Decrease volume by 5%
7152
+ */
7153
+ volumeDown(): void;
7154
+ /**
7155
+ * Mute the audio
7156
+ */
7157
+ mute(): void;
7158
+ /**
7159
+ * Unmute the audio
7160
+ */
7161
+ unmute(): void;
7162
+ /**
7163
+ * Toggle between muted and unmuted states
7164
+ */
7165
+ toggleMute(): void;
7166
+ /**
7167
+ * Enter fullscreen mode
7168
+ */
7169
+ goFullScreen(): Promise<void>;
7170
+ /**
7171
+ * @deprecated Use durationchange event instead
7172
+ * Set the duration of the current video in milliseconds
7173
+ * @param ms - Duration in milliseconds
7174
+ */
7175
+ setDurationMs(ms: number): void;
7176
+ /**
7177
+ * Get the duration of the current video in milliseconds
7178
+ * @returns Duration in milliseconds
7179
+ */
7180
+ getDurationMs(): number;
7181
+ /** Whether live seeking is enabled for the current source */
7182
+ readonly isLiveSeekingEnabled: boolean;
7183
+ /** Whether the current playback position is live */
7184
+ readonly isCurrentTimeLive: boolean;
7185
+ /**
7186
+ * Handle watermark element changes for security purposes
7187
+ * @param mutations - Array of DOM mutation records
7188
+ */
7189
+ onWatermarkElementChange(mutations: MutationRecord[]): void;
7190
+ }
7191
+
6957
7192
  declare type VideoDetailResponsiveField = OrganizationResponsiveSetting<{
6958
7193
  modalView?: boolean;
6959
7194
  showDateOfPublicationForRelatedVideos?: boolean;
@@ -7511,6 +7746,10 @@ export declare interface WebConfig {
7511
7746
  [key: string]: string;
7512
7747
  };
7513
7748
  };
7749
+ /**
7750
+ * Map for all handlers
7751
+ */
7752
+ handlers?: PurchaseEventHandlers;
7514
7753
  }
7515
7754
 
7516
7755
  /**
@@ -7576,10 +7815,7 @@ export declare interface WebPlayerProps {
7576
7815
  */
7577
7816
  enableKeyboardShortcuts?: boolean;
7578
7817
  onProgress?: (event: React_2.ChangeEvent<HTMLVideoElement>) => void;
7579
- /**
7580
- * @deprecated this callback is never called. Will be removed in @tivio/sdk-react version 4
7581
- */
7582
- onPlayerControllerCreated?: (playerController: any) => void;
7818
+ onPlayerControllerCreated?: (playerController: VideoController) => void;
7583
7819
  /**
7584
7820
  * If true, saving of watch position won't be performed.
7585
7821
  */