@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.
@@ -1053,6 +1053,18 @@ export declare interface ConversionsTargetItem {
1053
1053
 
1054
1054
  export declare type CountdownScene = InteractiveWidgetSceneBase<InteractiveWidgetSceneTemplateType.COUNTDOWN>;
1055
1055
 
1056
+ /**
1057
+ * Maps supported country codes (ISO 3166-1 alpha-2) to their primary language codes (ISO 639-1).
1058
+ * Used to determine the default language settings for specific countries.
1059
+ * @example
1060
+ * CountryToLanguageMap['CZ'] // Returns LangCode.CS for Czech Republic
1061
+ */
1062
+ export declare const CountryToLangCodeMap: {
1063
+ CZ: LangCode;
1064
+ PL: LangCode;
1065
+ SK: LangCode;
1066
+ };
1067
+
1056
1068
  /**
1057
1069
  * @public
1058
1070
  * @TODO move somewhere else
@@ -1073,11 +1085,11 @@ export declare const createPubSub: () => PubSub;
1073
1085
  * Fetch & load CommonJS remote module.
1074
1086
  * @public
1075
1087
  */
1076
- export declare const createRemotePackageLoader: () => (secret: string, conf: InternalConfig, checkBundleCharCount?: boolean) => Promise<TivioBundle>;
1088
+ export declare const createRemotePackageLoader: () => (secret: string, conf: InternalConfig, checkBundleCharCount?: boolean, skipCache?: boolean) => Promise<TivioBundle>;
1077
1089
 
1078
1090
  export declare const createTivio: () => (conf: SdkReactConfig) => Promise<RemoteBundleState>;
1079
1091
 
1080
- export declare const createUseRemoteBundle: () => (sdkReactConfig: SdkReactConfig, checkBundleCharCount?: boolean) => RemoteBundleState;
1092
+ export declare const createUseRemoteBundle: () => (sdkReactConfig: SdkReactConfig, checkBundleCharCount?: boolean, skipCache?: boolean) => RemoteBundleState;
1081
1093
 
1082
1094
  export declare interface CreateUserPayload {
1083
1095
  displayName?: string;
@@ -1153,7 +1165,6 @@ export declare enum CustomerId {
1153
1165
  GRAPE = "GRAPE",
1154
1166
  HODINA_DEJEPICHU = "HODINA_DEJEPICHU",
1155
1167
  INVESTICNI_PRUVODCE = "INVESTICNI_PRUVODCE",
1156
- INVESTOREES = "INVESTOREES",
1157
1168
  JOJ = "JOJ",
1158
1169
  KLUCI_Z_PRAHY = "KLUCI_Z_PRAHY",
1159
1170
  MALL = "MALL",
@@ -1198,7 +1209,8 @@ export declare enum CustomerId {
1198
1209
  BEAT_SEXISM = "BEAT_SEXISM",
1199
1210
  KAROL_A_KVIDO = "KAROL_A_KVIDO",
1200
1211
  UZ_BUDU = "UZ_BUDU",
1201
- PRIMA = "PRIMA"
1212
+ PRIMA = "PRIMA",
1213
+ NORA_FRIDRICHOVA = "NORA_FRIDRICHOVA"
1202
1214
  }
1203
1215
 
1204
1216
  /**
@@ -1299,6 +1311,8 @@ export declare interface Customizations {
1299
1311
  color?: string;
1300
1312
  backgroundGradient?: string;
1301
1313
  iconColor?: string;
1314
+ roundedMenuColor?: string;
1315
+ roundedMenuHoverColor?: string;
1302
1316
  };
1303
1317
  CenteredMenu?: {
1304
1318
  backgroundColor: string;
@@ -1562,6 +1576,8 @@ export declare enum DrmProvider {
1562
1576
  * Original oktagon stream provider.
1563
1577
  *
1564
1578
  * https://streamonline.pl
1579
+ *
1580
+ * @deprecated oktagon no longer uses this drm provider.
1565
1581
  */
1566
1582
  STREAMONLINE = "streamonline"
1567
1583
  }
@@ -1705,8 +1721,8 @@ export declare type EmbedScreenPostMessageFn = <T extends EmbedScreenPostMessage
1705
1721
  */
1706
1722
  export declare interface EmitterInterface {
1707
1723
  isSupported: (even: string) => boolean;
1708
- addListener: <T = any>(event: string, cb: (value: T) => Empty_2) => void;
1709
- removeListener: <T = any>(event: string, cb: (value: T) => Empty_2) => void;
1724
+ addListener: <T = unknown>(event: string, cb: (value: T) => Empty_2) => void;
1725
+ removeListener: <T = unknown>(event: string, cb: (value: T) => Empty_2) => void;
1710
1726
  }
1711
1727
 
1712
1728
  /**
@@ -3408,9 +3424,8 @@ export declare interface PlayerEngineInterface {
3408
3424
  stop(): Promise<void>;
3409
3425
  addEventListener<T>(event: PlayerEngineEvent, callback: PlayerEngineListener<T>): void;
3410
3426
  addEventListener(event: 'statechange', callback: PlayerEngineListener<PlayerState>): void;
3411
- addEventListener(event: 'bufferingchange', callback: PlayerEngineListener<boolean>): void;
3427
+ addEventListener(event: 'bufferingchange' | 'togglefullscreen', callback: PlayerEngineListener<boolean>): void;
3412
3428
  addEventListener(event: 'bufferedinfochange', callback: PlayerEngineListener<BufferPercentChunk[]>): void;
3413
- addEventListener(event: 'togglefullscreen', callback: PlayerEngineListener<boolean>): void;
3414
3429
  removeEventListener<T>(event: PlayerEngineEvent, listener: PlayerEngineListener<T>): void;
3415
3430
  /**
3416
3431
  * @returns currently playing audio track in ISO 639-1 format ('cs', 'en' etc.) or null if not available
@@ -3494,7 +3509,7 @@ export declare interface PlayerEngineInterface {
3494
3509
  /**
3495
3510
  * @public
3496
3511
  */
3497
- export declare type PlayerEngineListener<T> = (value: T) => any;
3512
+ export declare type PlayerEngineListener<T> = (value: T) => void;
3498
3513
 
3499
3514
  /**
3500
3515
  * @public
@@ -4261,6 +4276,14 @@ export declare type PurchaseEndpointPayload = {
4261
4276
  };
4262
4277
  };
4263
4278
 
4279
+ /**
4280
+ * @public
4281
+ */
4282
+ export declare type PurchaseEventHandlers = {
4283
+ onPurchaseIntention?: (purchase: PurchasableMonetization) => void;
4284
+ onPurchaseFinished?: (purchase: Purchase) => void;
4285
+ };
4286
+
4264
4287
  /**
4265
4288
  * @public
4266
4289
  */
@@ -4695,7 +4718,7 @@ export declare interface RenderConditionValue {
4695
4718
  subscriptionRefs?: any[];
4696
4719
  }
4697
4720
 
4698
- export declare const renderWebPlayer: (container: HTMLElement, props: WebPlayerProps) => void;
4721
+ export declare const renderWebPlayer: (container: HTMLElement, props: Omit<WebPlayerProps, 'onPlayerControllerCreated'>) => Promise<SimplifiedVideoController>;
4699
4722
 
4700
4723
  /**
4701
4724
  * Make all attributes in given type required, non-nullable and defined.
@@ -5088,6 +5111,7 @@ declare interface Screen_2 {
5088
5111
  fetchMoreRows: () => Promise<void>;
5089
5112
  hasNextPage: boolean;
5090
5113
  refetchIfNeeded: () => Promise<void>;
5114
+ allowOrganizationBanner?: boolean;
5091
5115
  }
5092
5116
  export { Screen_2 as Screen }
5093
5117
 
@@ -5337,6 +5361,110 @@ export declare const showGdprConsentPreferences: () => Promise<void>;
5337
5361
  */
5338
5362
  export declare type SignInProvider = 'google' | 'patreon' | 'apple';
5339
5363
 
5364
+ /**
5365
+ * Simplified VideoController interface for external rendering
5366
+ */
5367
+ export declare interface SimplifiedVideoController {
5368
+ /**
5369
+ * Resume playback from paused state
5370
+ */
5371
+ play(): void;
5372
+ /**
5373
+ * Pause the current playback
5374
+ */
5375
+ pause(): void;
5376
+ /**
5377
+ * Toggle between play and pause states
5378
+ */
5379
+ togglePause(): void;
5380
+ /**
5381
+ * Replay the current video from the beginning
5382
+ */
5383
+ replay(): Promise<void>;
5384
+ /**
5385
+ * Retry playback if it failed to start
5386
+ */
5387
+ retry(): void;
5388
+ /**
5389
+ * Seek to an absolute position in milliseconds
5390
+ * @param ms - Position in milliseconds from the start of the video
5391
+ */
5392
+ seekToAbsolutePosition(ms: number): void;
5393
+ /**
5394
+ * Seek relative to current position
5395
+ * @param ms - Number of milliseconds to seek (positive for forward, negative for backward)
5396
+ */
5397
+ seekBy(ms: number): void;
5398
+ /**
5399
+ * Seek to a percentage of the video duration
5400
+ * @param percentage - Percentage value between 0 and 100
5401
+ */
5402
+ seekToPercent(percentage: number): void;
5403
+ /**
5404
+ * Seek to the live position for live streams
5405
+ */
5406
+ seekToLive(): void;
5407
+ /**
5408
+ * Set the volume level
5409
+ * @param value - Volume level between 0 and 1
5410
+ */
5411
+ changeVolume(value: number): void;
5412
+ /**
5413
+ * Increase volume by 5%
5414
+ */
5415
+ volumeUp(): void;
5416
+ /**
5417
+ * Decrease volume by 5%
5418
+ */
5419
+ volumeDown(): void;
5420
+ /**
5421
+ * Mute the audio
5422
+ */
5423
+ mute(): void;
5424
+ /**
5425
+ * Unmute the audio
5426
+ */
5427
+ unmute(): void;
5428
+ /**
5429
+ * Toggle between muted and unmuted states
5430
+ */
5431
+ toggleMute(): void;
5432
+ /**
5433
+ * Currently playing source or null if no source is loaded
5434
+ */
5435
+ readonly currentSource: PlayerSource | null;
5436
+ /**
5437
+ * Add an event listener for player events
5438
+ * @param event - The event name to listen for (e.g., 'ended', 'timeupdate', 'statechange')
5439
+ * @param callback - Function to call when the event occurs
5440
+ */
5441
+ addEventListener<T>(event: string, callback: (value: T) => void): void;
5442
+ /**
5443
+ * Add an event listener for volume changes
5444
+ * @param event - Must be 'volumechange'
5445
+ * @param callback - Function called with volume state object
5446
+ */
5447
+ addEventListener(event: 'volumechange', callback: (value: {
5448
+ muted: boolean;
5449
+ volume: number;
5450
+ }) => void): void;
5451
+ /**
5452
+ * Remove an event listener
5453
+ * @param event - The event name to stop listening for
5454
+ * @param callback - The callback function to remove
5455
+ */
5456
+ removeEventListener<T>(event: string, callback: (value: T) => void): void;
5457
+ /**
5458
+ * Change the current source to a new one
5459
+ * @param source - The new source to load (can be a video path, channel path, or source parameters)
5460
+ */
5461
+ setSource(source: WebPlayerProps['source']): void;
5462
+ /**
5463
+ * Destroy the player and clean up all resources
5464
+ */
5465
+ destroy(): Promise<void>;
5466
+ }
5467
+
5340
5468
  export declare enum SocialNetworks {
5341
5469
  FACEBOOK = 0,
5342
5470
  INSTAGRAM = 1,
@@ -5908,7 +6036,6 @@ export declare interface TivioComponents {
5908
6036
  }>;
5909
6037
  Provider: React_2.ComponentType<RemoteProviderProps>;
5910
6038
  WebPlayer: React_2.ComponentType<WebPlayerProps>;
5911
- Widget: React_2.ComponentType<TivioWidgetProps>;
5912
6039
  PlayerDataContextProvider: React_2.ComponentType<{
5913
6040
  id: string;
5914
6041
  }>;
@@ -5937,9 +6064,7 @@ export declare interface TivioComponents {
5937
6064
  WebTile: React_2.ComponentType<{
5938
6065
  item?: ItemInRow;
5939
6066
  } & TilePropsPartial>;
5940
- ChannelContext: React_2.Context<TvChannel | undefined>;
5941
6067
  ContentSortPicker: React_2.ComponentType<ContentSortPickerProps>;
5942
- WebProfileScreen: React_2.ComponentType<WebProfileScreenProps>;
5943
6068
  WebTivioProVideoScreen: React_2.ComponentType<WebTivioProVideoScreenProps>;
5944
6069
  RemoteController: React_2.ComponentType<RemoteControllerProps>;
5945
6070
  }
@@ -5965,14 +6090,24 @@ export declare interface TivioConfig {
5965
6090
  preferHttp?: boolean;
5966
6091
  };
5967
6092
  secret: string;
6093
+ /**
6094
+ * Language used when isLanguageSelectionEnabled is false | undefined or when not possible to load language from local storage or localization worker
6095
+ */
5968
6096
  language: LangCode;
5969
6097
  debug?: boolean;
5970
6098
  verbose?: boolean;
5971
6099
  firebaseApp?: any | null;
5972
- firebaseFactory?: (config: Object, appName?: string) => firebase_2.FirebaseApp;
6100
+ firebaseFactory?: (config: object, appName?: string) => firebase_2.FirebaseApp;
5973
6101
  authDomainOverride?: string;
5974
6102
  firestore?: any | null;
5975
6103
  currency: Currency;
6104
+ /**
6105
+ * A flag that indicates whether the language selection feature is enabled.
6106
+ * Language is then stored to local storage 'tivio-user-language'.
6107
+ * If nothing is stored in local storage, then language is set according to location
6108
+ * When set to `true`, users are allowed to choose their preferred language
6109
+ */
6110
+ isLanguageSelectionEnabled?: boolean;
5976
6111
  applicationId?: string;
5977
6112
  isTivioProApp?: boolean;
5978
6113
  lockApplicationHandle?: string;
@@ -6198,6 +6333,9 @@ export declare type TivioInternalProviders = {
6198
6333
  }>;
6199
6334
  MonetizationsSelectOverlayContextProvider: React_2.ComponentType;
6200
6335
  QerkoOverlayContextProvider: React_2.ComponentType;
6336
+ /**
6337
+ * @deprecated do not use, this provider will be removed in the future
6338
+ */
6201
6339
  PurchasesWithVideosContextProvider: React_2.ComponentType<{
6202
6340
  children?: React_2.ReactNode;
6203
6341
  }>;
@@ -6363,55 +6501,6 @@ export declare type TivioVodSource = SourceBase & StartAndContinuePosition & {
6363
6501
  videoPath: string;
6364
6502
  };
6365
6503
 
6366
- /**
6367
- * @public
6368
- */
6369
- export declare const TivioWidget: React_2.ForwardRefExoticComponent<Omit<TivioWidgetProps, "ref"> & React_2.RefAttributes<TivioWidgetRef>>;
6370
-
6371
- /**
6372
- * @public
6373
- */
6374
- export declare const TivioWidgetError: React_2.FC<TivioWidgetErrorProps>;
6375
-
6376
- declare type TivioWidgetErrorProps = {
6377
- error: string | null;
6378
- };
6379
-
6380
- /**
6381
- * @public
6382
- */
6383
- export declare const TivioWidgetLoader: React_2.FC;
6384
-
6385
- /**
6386
- * @public
6387
- */
6388
- export declare interface TivioWidgetProps {
6389
- id: string;
6390
- ref: React_2.MutableRefObject<TivioWidgetRef>;
6391
- onEnabled?: (enabled: boolean) => any;
6392
- onBlur?: (event: {
6393
- key: string;
6394
- width: number;
6395
- x: number;
6396
- }) => any;
6397
- }
6398
-
6399
- /**
6400
- * @public
6401
- */
6402
- export declare interface TivioWidgetRef {
6403
- focus: (args: {
6404
- x?: number;
6405
- }) => void;
6406
- handleKey: (key: string) => ({
6407
- handled: boolean;
6408
- x: number;
6409
- });
6410
- unfocus: () => ({
6411
- x: number;
6412
- });
6413
- }
6414
-
6415
6504
  export declare interface TokenInterface {
6416
6505
  token: string;
6417
6506
  expirationDate: Date;
@@ -7348,6 +7437,154 @@ export declare enum VideoContentType {
7348
7437
  SERIES = "SERIES"
7349
7438
  }
7350
7439
 
7440
+ /**
7441
+ * @public
7442
+ * VideoController provides control over video playback, seeking, volume, and event handling.
7443
+ */
7444
+ export declare interface VideoController {
7445
+ /** Unique identifier for this player instance */
7446
+ readonly playerId: string;
7447
+ /** Internal control queue for managing player operations */
7448
+ readonly controlQueue: unknown;
7449
+ /** Currently playing source or null if no source is loaded */
7450
+ readonly currentSource: PlayerSource | null;
7451
+ /**
7452
+ * Add an event listener for player events
7453
+ * @param event - The event name to listen for (e.g., 'ended', 'timeupdate', 'statechange')
7454
+ * @param callback - Function to call when the event occurs
7455
+ */
7456
+ addEventListener<T>(event: string, callback: (value: T) => void): void;
7457
+ addEventListener(event: 'volumechange', callback: (value: {
7458
+ muted: boolean;
7459
+ volume: number;
7460
+ }) => void): void;
7461
+ /**
7462
+ * Remove an event listener
7463
+ * @param event - The event name to stop listening for
7464
+ * @param callback - The callback function to remove
7465
+ */
7466
+ removeEventListener<T>(event: string, callback: (value: T) => void): void;
7467
+ /**
7468
+ * Change the current source to a new one
7469
+ * @param sourceData - The new source parameters
7470
+ * @param autoplay - Whether to start playing immediately (default: true)
7471
+ * @returns Promise that resolves to the new source or null if failed
7472
+ */
7473
+ changeSource(sourceData: SourceParams, autoplay?: boolean): Promise<PlayerSource | null>;
7474
+ /**
7475
+ * Load a new source and optionally start playing
7476
+ * @param sourceData - The source parameters to load
7477
+ * @param autoplay - Whether to start playing immediately
7478
+ */
7479
+ load(sourceData: SourceParams, autoplay: boolean): Promise<void>;
7480
+ /**
7481
+ * Toggle between play and pause states
7482
+ */
7483
+ togglePause(): void;
7484
+ /**
7485
+ * Pause the current playback
7486
+ */
7487
+ pause(): void;
7488
+ /**
7489
+ * Resume playback from paused state
7490
+ */
7491
+ unpause(): void;
7492
+ /**
7493
+ * Replay the current video from the beginning
7494
+ */
7495
+ replay(): Promise<void>;
7496
+ /**
7497
+ * Retry playback if it failed to start
7498
+ */
7499
+ retry(): void;
7500
+ /**
7501
+ * Stop playback and reset player state
7502
+ */
7503
+ close(): void;
7504
+ /**
7505
+ * Destroy the player and clean up all resources
7506
+ */
7507
+ destroy(): Promise<void>;
7508
+ /**
7509
+ * Seek to an absolute position in milliseconds
7510
+ * @param ms - Position in milliseconds from the start of the video
7511
+ */
7512
+ seekToAbsolutePosition(ms: number): void;
7513
+ /**
7514
+ * Seek relative to current position
7515
+ * @param ms - Number of milliseconds to seek (positive for forward, negative for backward)
7516
+ */
7517
+ seekBy(ms: number): void;
7518
+ /**
7519
+ * Seek to a percentage of the video duration
7520
+ * @param percentage - Percentage value between 0 and 100
7521
+ */
7522
+ seekToPercent(percentage: number): void;
7523
+ /**
7524
+ * @deprecated Use seekToPercent instead
7525
+ * Seek to a relative position as percentage of video duration
7526
+ * @param percentage - Percentage value between 0 and 100
7527
+ */
7528
+ seekToRelativePosition(percentage: number): void;
7529
+ /**
7530
+ * Seek to the live position for live streams
7531
+ */
7532
+ seekToLive(): void;
7533
+ /**
7534
+ * Internal method to seek to live position
7535
+ */
7536
+ seekToLiveInternal(): void;
7537
+ /**
7538
+ * Set the volume level
7539
+ * @param value - Volume level between 0 and 1
7540
+ */
7541
+ changeVolume(value: number): void;
7542
+ /**
7543
+ * Increase volume by 5%
7544
+ */
7545
+ volumeUp(): void;
7546
+ /**
7547
+ * Decrease volume by 5%
7548
+ */
7549
+ volumeDown(): void;
7550
+ /**
7551
+ * Mute the audio
7552
+ */
7553
+ mute(): void;
7554
+ /**
7555
+ * Unmute the audio
7556
+ */
7557
+ unmute(): void;
7558
+ /**
7559
+ * Toggle between muted and unmuted states
7560
+ */
7561
+ toggleMute(): void;
7562
+ /**
7563
+ * Enter fullscreen mode
7564
+ */
7565
+ goFullScreen(): Promise<void>;
7566
+ /**
7567
+ * @deprecated Use durationchange event instead
7568
+ * Set the duration of the current video in milliseconds
7569
+ * @param ms - Duration in milliseconds
7570
+ */
7571
+ setDurationMs(ms: number): void;
7572
+ /**
7573
+ * Get the duration of the current video in milliseconds
7574
+ * @returns Duration in milliseconds
7575
+ */
7576
+ getDurationMs(): number;
7577
+ /** Whether live seeking is enabled for the current source */
7578
+ readonly isLiveSeekingEnabled: boolean;
7579
+ /** Whether the current playback position is live */
7580
+ readonly isCurrentTimeLive: boolean;
7581
+ /**
7582
+ * Handle watermark element changes for security purposes
7583
+ * @param mutations - Array of DOM mutation records
7584
+ */
7585
+ onWatermarkElementChange(mutations: MutationRecord[]): void;
7586
+ }
7587
+
7351
7588
  declare type VideoDetailResponsiveField = OrganizationResponsiveSetting<{
7352
7589
  modalView?: boolean;
7353
7590
  showDateOfPublicationForRelatedVideos?: boolean;
@@ -7905,6 +8142,10 @@ export declare interface WebConfig {
7905
8142
  [key: string]: string;
7906
8143
  };
7907
8144
  };
8145
+ /**
8146
+ * Map for all handlers
8147
+ */
8148
+ handlers?: PurchaseEventHandlers;
7908
8149
  }
7909
8150
 
7910
8151
  /**
@@ -7970,10 +8211,7 @@ export declare interface WebPlayerProps {
7970
8211
  */
7971
8212
  enableKeyboardShortcuts?: boolean;
7972
8213
  onProgress?: (event: React_2.ChangeEvent<HTMLVideoElement>) => void;
7973
- /**
7974
- * @deprecated this callback is never called. Will be removed in @tivio/sdk-react version 4
7975
- */
7976
- onPlayerControllerCreated?: (playerController: any) => void;
8214
+ onPlayerControllerCreated?: (playerController: VideoController) => void;
7977
8215
  /**
7978
8216
  * If true, saving of watch position won't be performed.
7979
8217
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-react",
3
- "version": "9.2.0-alpha.4",
3
+ "version": "9.2.0",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -16,7 +16,7 @@
16
16
  "turbo:build:libs:prod": "yarn build:prod",
17
17
  "build:ci": "yarn build:prod",
18
18
  "build:local": "bash ./scripts/build_with_local_bundle.sh && yarn typesRollup",
19
- "release": "ts-node ./scripts/release.ts -p=sdk-react -c=README.md",
19
+ "release": "ts-node ./scripts/release.ts -p=sdk-react -c=CHANGELOG.md",
20
20
  "release:patch": "yarn release -r=patch",
21
21
  "release:minor": "yarn release -r=minor",
22
22
  "release:major": "yarn release -r=major",
@@ -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.130",
41
+ "@tivio/common": "1.1.131",
42
42
  "dayjs": "^1.11.0",
43
43
  "es7-object-polyfill": "^1.0.1",
44
44
  "firebase": "8.10.1",