@wscsports/blaze-web-sdk 0.13.3 → 0.13.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wscsports/blaze-web-sdk",
3
- "version": "0.13.3",
3
+ "version": "0.13.5",
4
4
  "main": "publish/index",
5
5
  "types": "publish/index",
6
6
  "files": [
@@ -328,6 +328,7 @@ export declare class ImaAdEvent {
328
328
  'audio_state': string;
329
329
  'content_type': string;
330
330
  'backoffice_campaign_data': string;
331
+ 'session_id': string;
331
332
  }
332
333
  export declare class InteractionEvent {
333
334
  'interaction_id': string;
@@ -662,6 +663,10 @@ export declare const PLAYER_MENU_EVENTS: {
662
663
  readonly EXPAND: "player-menu-expand";
663
664
  readonly COLLAPSE: "player-menu-collapse";
664
665
  };
666
+ export declare const PLAYER_MENU_ATTRIBUTES: {
667
+ readonly OPEN: "open";
668
+ readonly EXPANDED: "expanded";
669
+ };
665
670
  export declare class BlazePlayerMenu extends BaseWidget {
666
671
  private menuOptions;
667
672
  private menuComponent;
@@ -671,6 +676,7 @@ export declare class BlazePlayerMenu extends BaseWidget {
671
676
  private titleElement;
672
677
  private closeButton;
673
678
  menuContainer: BlazeDiv;
679
+ private boundPreventScrollBubbling;
674
680
  private detachTouchEventListeners;
675
681
  constructor();
676
682
  connectedCallback(): void;
@@ -678,6 +684,7 @@ export declare class BlazePlayerMenu extends BaseWidget {
678
684
  setAttribute(qualifiedName: string, value: string): void;
679
685
  private setupEventListeners;
680
686
  private detachEventListeners;
687
+ private preventScrollBubbling;
681
688
  init(options: IPlayerMenuOptions): void;
682
689
  private buildHeader;
683
690
  private buildBackdrop;
@@ -978,9 +985,32 @@ export * from './css.constants';
978
985
  export * from './cc-supported-languages.constants';
979
986
  export * from './closed-captions.constants';
980
987
  export * from './common.constants';
988
+ export * from './network.constants';
981
989
 
982
990
  export declare const CountryCodes: readonly ["AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW"];
983
991
 
992
+ export interface NetworkConfig {
993
+ posterLimits: {
994
+ previous: number;
995
+ next: number;
996
+ };
997
+ videoPreloadLimits: {
998
+ next: number;
999
+ };
1000
+ }
1001
+ export type NetworkSpeed = 'slow' | 'medium' | 'fast';
1002
+ export declare const NETWORK_CONFIGS: Record<NetworkSpeed, NetworkConfig>;
1003
+ export declare const DEFAULT_NETWORK_SPEED: NetworkSpeed;
1004
+ export declare function getNavigatorConnection(): any;
1005
+ export declare function getNetworkSpeed(downlinkMbps: number): NetworkSpeed;
1006
+ export declare function getPosterLimits(): {
1007
+ previous: number;
1008
+ next: number;
1009
+ };
1010
+ export declare function getVideoPreloadLimits(): {
1011
+ next: number;
1012
+ };
1013
+
984
1014
  export declare const DEFAULT_CTA_HEIGHT = 40;
985
1015
  export declare const MIN_PADDING_BOTTOM = 10;
986
1016
  export declare const Z_INDEX: {
@@ -1032,6 +1062,7 @@ interface IBaseAdInfo {
1032
1062
  configuration?: IAdInfoConfiguration;
1033
1063
  context?: IAdContext;
1034
1064
  externalAdServerId?: string;
1065
+ backofficeCampaignData?: string;
1035
1066
  }
1036
1067
  export interface IImaAdInfo extends IBaseAdInfo {
1037
1068
  type: 'IMA';
@@ -1042,7 +1073,7 @@ export interface IWebAdInfo extends IBaseAdInfo {
1042
1073
  type: 'Web';
1043
1074
  path: string;
1044
1075
  }
1045
- export interface IBannerAdInfo {
1076
+ export interface IBannerAdInfo extends IBaseAdInfo {
1046
1077
  type: 'Banner';
1047
1078
  adUnitId: string;
1048
1079
  size: 'Banner';
@@ -1221,7 +1252,7 @@ export interface IMoment extends IContent {
1221
1252
  type: string;
1222
1253
  };
1223
1254
  cta: ICta;
1224
- adPath?: string;
1255
+ adInfo?: IAdInfo;
1225
1256
  subtitle?: string;
1226
1257
  description?: string;
1227
1258
  }
@@ -3245,6 +3276,7 @@ export * from './environment.type';
3245
3276
  export * from './gesture.type';
3246
3277
  export * from './item.type';
3247
3278
  export * from './label.type';
3279
+ export * from './loading.type';
3248
3280
  export * from './locale.type';
3249
3281
  export * from './order.type';
3250
3282
  export * from './personalized.type';
@@ -3280,9 +3312,11 @@ export type PerItemStyleOverrides = Partial<Record<EntitiesType, Array<{
3280
3312
 
3281
3313
  export type LabelsType = string | string[] | BlazeWidgetLabel;
3282
3314
 
3315
+ export type LoadingType = 'cache' | 'direct';
3316
+
3283
3317
  export type LocaleDirectionType = 'LTR' | 'RTL';
3284
3318
 
3285
- export type OrderType = 'Manual' | 'AtoZ' | 'ZtoA' | 'RecentlyUpdatedFirst' | 'RecentlyUpdatedLast' | 'RecentlyCreatedFirst' | 'RecentlyCreatedLast';
3319
+ export type OrderType = 'Manual' | 'AtoZ' | 'ZtoA' | 'RecentlyUpdatedFirst' | 'RecentlyUpdatedLast' | 'RecentlyCreatedFirst' | 'RecentlyCreatedLast' | 'Random';
3286
3320
  export type ContentOrderType = 'LIVE_CHIP' | 'STORY_TITLE' | 'PUBLISHED_DATE';
3287
3321
 
3288
3322
  type BlazePersonalizedIds = {
@@ -3421,18 +3455,18 @@ export declare function findParentOfType<T>(target: EventTarget | null, type: {
3421
3455
  new (...args: any[]): T;
3422
3456
  }, stopAt: Element): T | null;
3423
3457
 
3458
+ export * from './ad-info.utils';
3459
+ export * from './cc-language.utils';
3424
3460
  export * from './chip.utils';
3425
3461
  export * from './common.utils';
3426
3462
  export * from './country-location.utils';
3427
3463
  export * from './guard.utils';
3428
3464
  export * from './helper';
3429
3465
  export * from './personalized.utils';
3430
- export * from './regex.utils';
3431
- export * from './stopwatch';
3432
3466
  export * from './position.utils';
3433
- export * from './ad-info.utils';
3434
- export * from './cc-language.utils';
3467
+ export * from './regex.utils';
3435
3468
  export * from './shared-event-target.utils';
3469
+ export * from './stopwatch';
3436
3470
 
3437
3471
  export declare function getPersonalizedParamsForRequest(personalized?: BlazePersonalized): {
3438
3472
  PersonalPlayers?: undefined;
@@ -3478,6 +3512,8 @@ export declare class Stopwatch {
3478
3512
  reset(): void;
3479
3513
  }
3480
3514
 
3515
+ export declare function getVideoDuration(existingVideo?: HTMLVideoElement, videoUrl?: string): Promise<number>;
3516
+
3481
3517
  export * from './commands/player-buttons.command';
3482
3518
  export * from './commands/video-commands';
3483
3519
  export * from './components/timer';
@@ -3825,7 +3861,7 @@ export declare class BlazeVideoNavigationOverlay extends HTMLElement {
3825
3861
  loader: BlazeLoader;
3826
3862
  private _platform;
3827
3863
  constructor();
3828
- static get observedAttributes(): ("hidden" | "layout" | "has-next" | "has-prev")[];
3864
+ static get observedAttributes(): ("layout" | "hidden" | "has-next" | "has-prev")[];
3829
3865
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
3830
3866
  private applyAttribute;
3831
3867
  connectedCallback(): void;
@@ -3933,8 +3969,9 @@ export declare class BlazeVideoElement extends BlazeWidgetVideoBase {
3933
3969
  videoOverlay: BlazeLongFormControlsOverlay;
3934
3970
  shareModal: BlazeWidgetShareModal;
3935
3971
  closedCaptionsModal: BlazeWidgetClosedCaptionsModal | undefined;
3936
- private widgetVastAd;
3972
+ widgetVastAd: BlazeWidgetVastAd;
3937
3973
  private adPercentageShownPlaces;
3974
+ private adIndex;
3938
3975
  private lastSavedTime;
3939
3976
  private lastSeekAction;
3940
3977
  private shouldSaveAfterSeek;
@@ -4223,8 +4260,8 @@ export declare class BlazeWidgetClosedCaptionsModal extends BaseWidget {
4223
4260
  private onMenuCollapse;
4224
4261
  open(): void;
4225
4262
  close(): void;
4226
- get isOpen(): boolean;
4227
- reloadData(data: IClosedCaption[]): void;
4263
+ isOpen(): boolean;
4264
+ reloadData(data: IClosedCaption[] | undefined): void;
4228
4265
  private handleCcOptionClick;
4229
4266
  private buildCcOption;
4230
4267
  private fillContainerWithOptions;
@@ -4253,10 +4290,15 @@ export declare abstract class BlazeWidgetContent extends HTMLElement {
4253
4290
  widgetParentItem: BlazeWidgetItem;
4254
4291
  sessionId: string;
4255
4292
  refContentModal?: BlazeWidgetStoryModal | BlazeWidgetMomentModal | BlazeWidgetVideoModal;
4293
+ adIndex: number;
4256
4294
  abstract aspectRatio?: ContentAspectRatio;
4295
+ private detachTimeout;
4296
+ private isScheduledForDetach;
4257
4297
  constructor();
4258
4298
  connectedCallback(): void;
4259
4299
  disconnectedCallback(): void;
4300
+ attachEventListeners(): void;
4301
+ detachEventListeners(): void;
4260
4302
  setWidgetItemParent(item: BlazeWidgetItem): void;
4261
4303
  updateWidgetStatusReadUnread(): void;
4262
4304
  getRefferingObject(): ReferringEventInfo;
@@ -4759,7 +4801,7 @@ export declare class BlazeWidgetVideoBase extends HTMLElement {
4759
4801
  shouldShowImaAd?: boolean;
4760
4802
  isCurrentlyTryingToRunImaAd?: boolean;
4761
4803
  _isAd?: boolean | undefined;
4762
- adsManager?: any;
4804
+ widgetVastAd?: BlazeWidgetVastAd;
4763
4805
  constructor();
4764
4806
  setData(data: IPage | IVideo): void;
4765
4807
  loadPoster(): void;
@@ -4773,7 +4815,7 @@ export declare class BlazeWidgetVideoBase extends HTMLElement {
4773
4815
  get isAd(): boolean | undefined;
4774
4816
  set isAd(value: boolean | undefined);
4775
4817
  removeLoader(): any;
4776
- load(): void;
4818
+ load(loadingType?: LoadingType): void;
4777
4819
  unload(): void;
4778
4820
  display(onFail?: () => void): void;
4779
4821
  hide(): void;
@@ -4809,19 +4851,19 @@ export declare class BlazeWidgetVideo extends BlazeWidgetVideoBase {
4809
4851
  isLoaded: boolean;
4810
4852
  isVideoRunning: boolean;
4811
4853
  maxRetryTimes: number;
4812
- adContainer: HTMLElement;
4813
- adLoaderContainer: BlazeLoader;
4814
- adDisplayContainer: any;
4815
- adsManager: any;
4816
4854
  shouldShowImaAd: boolean;
4817
4855
  isCurrentlyTryingToRunImaAd: boolean;
4818
4856
  hasPoster: boolean;
4857
+ widgetVastAd: BlazeWidgetVastAd;
4858
+ private boundHandleAdStarted;
4859
+ private boundHandleAdEnded;
4819
4860
  boundLanguageChangeEvent: (event: Event) => void;
4820
4861
  static get observedAttributes(): string[];
4821
4862
  constructor(contentParent: BlazeWidgetStory | BlazeWidgetMoment);
4822
4863
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
4823
4864
  connectedCallback(): void;
4824
4865
  disconnectedCallback(): void;
4866
+ private getContentType;
4825
4867
  setData(data: IPage): void;
4826
4868
  getGoogleIMA(): any;
4827
4869
  private isEnableInteractions;
@@ -4830,7 +4872,8 @@ export declare class BlazeWidgetVideo extends BlazeWidgetVideoBase {
4830
4872
  loadPoster(): void;
4831
4873
  display(): void;
4832
4874
  hide(): void;
4833
- load(loadingType?: 'cache' | 'direct'): Promise<void>;
4875
+ load(loadingType?: LoadingType): Promise<void>;
4876
+ setVideoSource(videoUrl: string): void;
4834
4877
  unload(): Promise<void>;
4835
4878
  resetVideoState(): void;
4836
4879
  removeLoader(): void;
@@ -4851,26 +4894,12 @@ export declare class BlazeWidgetVideo extends BlazeWidgetVideoBase {
4851
4894
  get isAd(): boolean;
4852
4895
  render(): void;
4853
4896
  restartVideo(): void;
4854
- initializeIMA(): Promise<void>;
4855
- buildImaUrl(iamData: IImaAdInfo, pageIndex?: number, contentExtraInfo?: ContentExtraInfo): Promise<string>;
4856
- buildAndSetCustParams(iamData: IImaAdInfo, newUrl: URL, pageIndex?: number): void;
4857
- setSearchParamIfNotNullOrZero(newUrl: URL, key: string, value?: string | number): void;
4858
- addAniviewMacrosToUrl(newUrl: URL): void;
4859
- addGoogleAdsMacrosToUrl(newUrl: URL): void;
4860
- onAdsManagerLoaded(adsManagerLoadedEvent: any): void;
4861
- onAdEvent(adEvent: any): void;
4862
- onWindowResize(): void;
4863
- onVisibile(): void;
4864
- onBlur(): void;
4865
- onFocus(): void;
4866
- onAdError(): void;
4867
- loadAds(): void;
4868
- onContentPauseRequested(): void;
4869
- onContentResumeRequested(): void;
4870
- removeAdLoader(): void;
4897
+ handleAdStarted(): void;
4898
+ handleAdEnded(): void;
4871
4899
  loadInteraction(): void;
4872
4900
  onLanguageChange(event: Event): Promise<void>;
4873
4901
  handleInteractionEvent(event: CustomEvent<InteractionAnalyticCustomEvent>): void;
4902
+ private tryToPlayAd;
4874
4903
  }
4875
4904
 
4876
4905
  export declare class BlazeWidgetAd extends BlazeWidgetVideoBase {
@@ -4901,6 +4930,7 @@ export declare class BlazeWidgetAd extends BlazeWidgetVideoBase {
4901
4930
  setData(data: IPage): void;
4902
4931
  startEnter(): Promise<void>;
4903
4932
  endExit(): void;
4933
+ getIframeVideoElement(): HTMLVideoElement | undefined;
4904
4934
  play(): void;
4905
4935
  get paused(): boolean;
4906
4936
  pause(): void;
@@ -4932,9 +4962,11 @@ export declare class BlazeWidgetBannerAd extends HTMLElement {
4932
4962
  raiseAnalyticsViewBannerAd(): void;
4933
4963
  }
4934
4964
 
4965
+ type AddExtraAnalyticsParams = () => Partial<ImaAdEvent>;
4935
4966
  export declare class BlazeWidgetVastAd extends HTMLElement {
4936
4967
  private contentType;
4937
4968
  private getReferringObject?;
4969
+ private isInitialized;
4938
4970
  private adDisplayContainer?;
4939
4971
  private adsManager?;
4940
4972
  private adsLoader?;
@@ -4943,16 +4975,16 @@ export declare class BlazeWidgetVastAd extends HTMLElement {
4943
4975
  private videoElement?;
4944
4976
  private currentAdTag;
4945
4977
  private currentAdInfo?;
4978
+ private currentAddExtraAnalyticsParams?;
4946
4979
  private boundedOnBlur;
4947
4980
  private boundedOnFocus;
4948
4981
  private boundedOnVisibilityChange;
4949
4982
  private boundedOnWindowResize;
4950
- adIndex: number;
4951
4983
  get googleIMA(): any;
4952
4984
  constructor(contentType: ContentType, getReferringObject?: (() => ReferringEventInfo) | undefined);
4953
4985
  private initializeGoogleIma;
4954
4986
  private buildImaUrl;
4955
- startAd(videoElement: HTMLVideoElement, adInfo: IImaAdInfo, contentExtraInfo: ContentExtraInfo): Boolean;
4987
+ startAd(videoElement: HTMLVideoElement, adInfo: IImaAdInfo, contentExtraInfo?: ContentExtraInfo, addCustomParams?: (url: URL) => void, addExtraAnalyticsParams?: AddExtraAnalyticsParams): Promise<Boolean>;
4956
4988
  private onAdsManagerLoaded;
4957
4989
  private loadAds;
4958
4990
  private onAdEvent;
@@ -4964,6 +4996,12 @@ export declare class BlazeWidgetVastAd extends HTMLElement {
4964
4996
  private onFocus;
4965
4997
  private onVisibilityChange;
4966
4998
  private onWindowResize;
4999
+ setSearchParamIfNotNullOrZero(newUrl: URL, key: string, value?: string | number): void;
5000
+ private addAniviewMacrosToUrl;
5001
+ private addGoogleAdsMacrosToUrl;
5002
+ private buildAndSetCustParams;
5003
+ pause(): void;
5004
+ resume(): void;
4967
5005
  }
4968
5006
 
4969
5007
  export type BlazeWidgetContentType = BlazeWidgetMoment[] & BlazeWidgetStory[] & BlazeVideoElement[];
@@ -5003,6 +5041,8 @@ export declare const UPDATE_NAVIGATION_BUTTONS_EVENT = "updateNavigationButtons"
5003
5041
  export declare class BlazeWidgetMomentPlayer extends WidgetAbstractPlayer {
5004
5042
  isWheelEventHandling: boolean;
5005
5043
  boundHandleMuteClicked: () => void;
5044
+ private fetchedPosterUrls;
5045
+ private preloadTimer;
5006
5046
  constructor();
5007
5047
  get currentMoment(): BlazeWidgetMoment;
5008
5048
  connectedCallback(): void;
@@ -5025,8 +5065,11 @@ export declare class BlazeWidgetMomentPlayer extends WidgetAbstractPlayer {
5025
5065
  handleAnimationCompletion(content: BlazeWidgetMoment, mode: ContentDirection): Promise<void>;
5026
5066
  loadAndPlayContent(): Promise<void>;
5027
5067
  setContent(content: BlazeWidgetMoment[]): void;
5028
- preloadAdjacentContent(direction: ContentDirection): Promise<void>;
5029
- prefetchPosters(): Promise<void>;
5068
+ preloadAdjacentVideos(): void;
5069
+ preloadAdjacentPosters(): void;
5070
+ private getCurrentContentIndex;
5071
+ private getIndicesRange;
5072
+ private fetchPosterAtIndex;
5030
5073
  play(): void;
5031
5074
  pause(): void;
5032
5075
  onAnimationEnd(): void;
@@ -5096,6 +5139,7 @@ export declare class BlazeWidgetMomentSeekBar extends HTMLElement {
5096
5139
  interface ButtonElementOptions {
5097
5140
  iconUrl: string;
5098
5141
  width: string;
5142
+ testId: string;
5099
5143
  height: string;
5100
5144
  onClick?: (this: GlobalEventHandlers, ev: MouseEvent) => void;
5101
5145
  backgroundColor?: string;
@@ -5207,8 +5251,7 @@ export declare class BlazeWidgetMoment extends BlazeWidgetContent {
5207
5251
  private handleOnClosedCaptionClick;
5208
5252
  toggleClosedCaptions(language?: CcLanguageCode): void;
5209
5253
  handleOnShareClick(): Promise<void>;
5210
- loadMoments(): Promise<void>;
5211
- load(loadingType?: 'direct' | 'cache'): Promise<void>;
5254
+ load(loadingType?: LoadingType): Promise<void>;
5212
5255
  unload(): Promise<void>;
5213
5256
  playToggle(): void;
5214
5257
  handleOnMuteUnmuteToggle(): void;
@@ -5409,7 +5452,7 @@ export declare class BlazeWidgetStory extends BlazeWidgetContent {
5409
5452
  unload(): void;
5410
5453
  removeFromCache(): void;
5411
5454
  displayCurrentStoryPageAndHideTheRest(): void;
5412
- load(): void;
5455
+ load(loadingType?: LoadingType): void;
5413
5456
  play(): void;
5414
5457
  bannerAdEvent(detail: InternalEventDetails[InternalEvent.BANNER_ANALYTICS]): void;
5415
5458
  event(action: StoryAction, storyData: Partial<StoryEvent>, label?: string | undefined): Promise<void>;