@tivio/sdk-react 9.3.1 → 9.5.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
@@ -1,3 +1,4 @@
1
+ import { AD_SERVICE_PROXY_NAME } from '@tivio/common';
1
2
  import type { ComponentType } from 'react';
2
3
  import type dayjs from 'dayjs';
3
4
  import { DocumentReference } from '@firebase/firestore-types';
@@ -34,6 +35,8 @@ declare interface actualPriceDetails {
34
35
  currency?: primaSupportedCurrency;
35
36
  }
36
37
 
38
+ export { AD_SERVICE_PROXY_NAME }
39
+
37
40
  export declare type AdBannerScene = InteractiveWidgetSceneBase<InteractiveWidgetSceneTemplateType.AD_BANNER>;
38
41
 
39
42
  export declare type AddEditCommentResponse = {
@@ -100,6 +103,7 @@ export declare type AdMetadata = {
100
103
  isSkippable: boolean;
101
104
  order: number | null;
102
105
  totalCount: number | null;
106
+ customAdMetadata?: Record<string, unknown>;
103
107
  skip: () => void;
104
108
  } | null;
105
109
 
@@ -217,6 +221,10 @@ export declare interface AdSourceInterface extends CommonSourceInterface<SourceT
217
221
  skipAll(): void;
218
222
  onRemainingTimeChanged(ms: number): void;
219
223
  click(): void;
224
+ /**
225
+ * Rich IMA ad metadata including customAdMetadata (only available for IMA ads)
226
+ */
227
+ imaAdMetadata?: any;
220
228
  }
221
229
 
222
230
  /**
@@ -1210,7 +1218,8 @@ export declare enum CustomerId {
1210
1218
  KAROL_A_KVIDO = "KAROL_A_KVIDO",
1211
1219
  UZ_BUDU = "UZ_BUDU",
1212
1220
  PRIMA = "PRIMA",
1213
- NORA_FRIDRICHOVA = "NORA_FRIDRICHOVA"
1221
+ NORA_FRIDRICHOVA = "NORA_FRIDRICHOVA",
1222
+ LONGEVITY = "LONGEVITY"
1214
1223
  }
1215
1224
 
1216
1225
  export declare interface CustomScript {
@@ -2030,6 +2039,8 @@ export declare interface IndexedVideo extends IndexedObject {
2030
2039
  monetizationAccessIds: string[] | false;
2031
2040
  }
2032
2041
 
2042
+ export declare type InputSourceParams = SourceParams | VodExternalMultiSourceParams;
2043
+
2033
2044
  export declare type IntegrationType = 'discord' | 'patreon';
2034
2045
 
2035
2046
  export declare interface InteractiveWidget<T extends InteractiveWidgetScene = InteractiveWidgetScene> {
@@ -3054,6 +3065,20 @@ export declare interface PartialRegistrationOverlayContextState {
3054
3065
  voucher?: string;
3055
3066
  }
3056
3067
 
3068
+ /**
3069
+ * @public
3070
+ * Generic interface for sources that can be identified by a path (video or TV channel)
3071
+ */
3072
+ export declare type PathSourceParams = PathSourceParamsTvChannel | PathSourceParamsVideo;
3073
+
3074
+ declare interface PathSourceParamsTvChannel extends Partial<ChannelSourceParams> {
3075
+ path: `tvChannels/${string}`;
3076
+ }
3077
+
3078
+ declare interface PathSourceParamsVideo extends Partial<Omit<VodTivioSourceParams, 'videoPath'>> {
3079
+ path: `videos/${string}`;
3080
+ }
3081
+
3057
3082
  export declare type PatreonCreatorData = {
3058
3083
  campaign: string;
3059
3084
  tiers: Tier[];
@@ -3500,6 +3525,7 @@ export declare interface PlayerSourceInterface<T extends NonAdSourceType = NonAd
3500
3525
  start?: Date;
3501
3526
  from?: Date;
3502
3527
  sourceHistory?: string[];
3528
+ staticAdsConfig?: StaticAdsBreak[];
3503
3529
  }
3504
3530
 
3505
3531
  /**
@@ -3518,6 +3544,7 @@ export declare interface PlayerSourceParams<T extends NonAdSourceType = NonAdSou
3518
3544
  seekingMatrix?: SeekingMatrixTemplate;
3519
3545
  sessionType?: VideoSourceField['sessionType'];
3520
3546
  sessionId?: string;
3547
+ staticAdsConfig?: StaticAdsBreak[];
3521
3548
  }
3522
3549
 
3523
3550
  export declare type PlayersScene = InteractiveWidgetSceneBase<InteractiveWidgetSceneTemplateType.PLAYERS>;
@@ -3678,7 +3705,15 @@ export declare enum PlayerWrapperEvents {
3678
3705
  /**
3679
3706
  * Un-pause was triggered
3680
3707
  */
3681
- 'unpause_triggered' = "unpause_triggered"
3708
+ 'unpause_triggered' = "unpause_triggered",
3709
+ /**
3710
+ * Triggered when an ad starts playing
3711
+ */
3712
+ 'ad_started' = "ad_started",
3713
+ /**
3714
+ * Triggered when an ad finishes playing
3715
+ */
3716
+ 'ad_ended' = "ad_ended"
3682
3717
  }
3683
3718
 
3684
3719
  /**
@@ -3938,6 +3973,11 @@ export declare type Purchase = {
3938
3973
  voucherId: string | null;
3939
3974
  isVoucherActivation?: boolean;
3940
3975
  rebalancingVideoRef?: any;
3976
+ /**
3977
+ * Returns all purchases that are connected via originalPurchaseRef.
3978
+ * For example, if user has subscription purchase, this method will return all purchases that are RENEWED + PAID/CANCELLED latest one.
3979
+ */
3980
+ getRelatedPurchases: () => Promise<Purchase[]>;
3941
3981
  };
3942
3982
 
3943
3983
  /**
@@ -5360,6 +5400,21 @@ export declare interface SimplifiedVideoController {
5360
5400
  muted: boolean;
5361
5401
  volume: number;
5362
5402
  }) => void): void;
5403
+ /**
5404
+ * Add an event listener for ad started events
5405
+ * @param event - Must be 'ad_started'
5406
+ * @param callback - Function called when an ad starts playing
5407
+ */
5408
+ addEventListener(event: 'ad_started', callback: (adMetadata: AdMetadata & {
5409
+ customAdMetadata?: Record<string, unknown> | null;
5410
+ ctaElement: HTMLElement | null;
5411
+ }) => void): void;
5412
+ /**
5413
+ * Add an event listener for ad ended events
5414
+ * @param event - Must be 'ad_ended'
5415
+ * @param callback - Function called when an ad finishes playing
5416
+ */
5417
+ addEventListener(event: 'ad_ended', callback: () => void): void;
5363
5418
  /**
5364
5419
  * Remove an event listener
5365
5420
  * @param event - The event name to stop listening for
@@ -5371,6 +5426,7 @@ export declare interface SimplifiedVideoController {
5371
5426
  * @param source - The new source to load (can be a video path, channel path, or source parameters)
5372
5427
  */
5373
5428
  setSource(source: WebPlayerProps['source']): void;
5429
+ setAdsConfig(adsConfig: StaticAdsBreak[]): void;
5374
5430
  /**
5375
5431
  * Destroy the player and clean up all resources
5376
5432
  */
@@ -5490,6 +5546,19 @@ export declare interface StartLiveStreamResponse {
5490
5546
  error?: string;
5491
5547
  }
5492
5548
 
5549
+ export declare type StaticAdsBreak = StaticAdsBreakPostrollPreroll | StaticAdsBreakMidroll;
5550
+
5551
+ export declare interface StaticAdsBreakMidroll {
5552
+ type: 'midroll';
5553
+ from: number;
5554
+ url: string;
5555
+ }
5556
+
5557
+ declare interface StaticAdsBreakPostrollPreroll {
5558
+ type: 'preroll' | 'postroll';
5559
+ url: string;
5560
+ }
5561
+
5493
5562
  /**
5494
5563
  * @public
5495
5564
  */
@@ -5967,6 +6036,12 @@ export declare interface TivioConfig {
5967
6036
  * (otherwise organizations would share login token).
5968
6037
  */
5969
6038
  customerId?: CustomerId;
6039
+ /**
6040
+ * An optional variable that enables Single Sign-On (SSO) for all subdomains under the same parent domain.
6041
+ * @example
6042
+ * customTokenCookiesDomain: 'example.com'
6043
+ */
6044
+ customTokenCookiesDomain?: string;
5970
6045
  }
5971
6046
 
5972
6047
  /**
@@ -7190,6 +7265,7 @@ export declare enum VastProvider {
7190
7265
  TEST = "test",
7191
7266
  TEST_VPAID = "test-vpaid",
7192
7267
  TIVIO_ADS = "tivio-ads",
7268
+ STATIC_ADS_PROVIDER = "static-ads-provider",
7193
7269
  JOJ_TEST_AD_FORM_PROGRAMMATIC = "joj-test-ad-form-programmatic",
7194
7270
  JOJ_TEST_TESTER_VASTERIX = "joj-test-tester-vasterix",
7195
7271
  JOJ_TEST_TESTER_ADFORM_30 = "joj-test-tester-adform-30"
@@ -7331,6 +7407,9 @@ export declare interface VideoController {
7331
7407
  muted: boolean;
7332
7408
  volume: number;
7333
7409
  }) => void): void;
7410
+ addEventListener(event: 'ad_started', callback: (value: AdMetadata & {
7411
+ adCtaElement: HTMLElement | null;
7412
+ }) => void): void;
7334
7413
  /**
7335
7414
  * Remove an event listener
7336
7415
  * @param event - The event name to stop listening for
@@ -7456,6 +7535,7 @@ export declare interface VideoController {
7456
7535
  * @param mutations - Array of DOM mutation records
7457
7536
  */
7458
7537
  onWatermarkElementChange(mutations: MutationRecord[]): void;
7538
+ setAdCtaElement: (element: HTMLElement | null) => void;
7459
7539
  }
7460
7540
 
7461
7541
  declare type VideoDetailResponsiveField = OrganizationResponsiveSetting<{
@@ -7700,6 +7780,14 @@ export declare interface VirtualChannelSourceParams extends ChannelSourceParams
7700
7780
  drm?: Drm;
7701
7781
  }
7702
7782
 
7783
+ /**
7784
+ * Interface representing the parameters for a VOD (Video On Demand) external multi-source configuration.
7785
+ * Multi-source means an array of string URLs representing the external sources for the video content.
7786
+ */
7787
+ export declare interface VodExternalMultiSourceParams extends Omit<VodExternalSourceParams, 'url'> {
7788
+ urls: string[];
7789
+ }
7790
+
7703
7791
  /**
7704
7792
  * @public
7705
7793
  */
@@ -8052,7 +8140,7 @@ export declare interface WebGridScreenProps {
8052
8140
  */
8053
8141
  export declare interface WebPlayerProps {
8054
8142
  id: string;
8055
- source?: SourceParams | VideoPath | ChannelPath | null;
8143
+ source?: InputSourceParams | PathSourceParams | VideoPath | ChannelPath | null;
8056
8144
  onEnded?: () => any;
8057
8145
  /**
8058
8146
  * If true, the player will inherit the width and height of its parent element.
@@ -8138,6 +8226,7 @@ export declare interface WebPlayerProps {
8138
8226
  setPaymentOverlayVisible?: React_2.Dispatch<React_2.SetStateAction<boolean>>;
8139
8227
  hideOverlay?: boolean;
8140
8228
  sourcePlayMode?: SourcePlayMode;
8229
+ adsConfig?: StaticAdsBreak[];
8141
8230
  }
8142
8231
 
8143
8232
  /**