@wscsports/blaze-web-sdk 0.4.2 → 0.4.4-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wscsports/blaze-web-sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.4-beta.0",
4
4
  "main": "publish/index",
5
5
  "types": "publish/index",
6
6
  "files": [
@@ -1,7 +1,7 @@
1
1
  type PlayContentOptions = {
2
2
  dataSource: BlazeDataSourceType;
3
3
  actionHandlers?: ActionHandler[];
4
- style?: StoryPlayerStyle | VideoPlayerStyle;
4
+ style?: StoryPlayerStyle | VideoPlayerStyle | MomentPlayerStyle;
5
5
  };
6
6
  export declare function setDoNotTrack(value: boolean): void;
7
7
  export declare function setGeoLocation(value: string): void;
@@ -27,6 +27,7 @@ export declare function playStories(dataSource: BlazeDataSourceType, style?: Sto
27
27
  export declare function playContent(contentType: ContentType, options: PlayContentOptions): Promise<void>;
28
28
  export declare function setAbTestParams(abTestParams: BlazeAbTestType): void;
29
29
  export declare function getAppContextManager(): Record<string, any>;
30
+ export declare const pushConsentEvent: (action: string, body: Record<string, any>) => void;
30
31
  declare const _default: {
31
32
  Initialize: typeof Initialize;
32
33
  WidgetGridView: typeof WidgetGridView;
@@ -49,6 +50,7 @@ declare const _default: {
49
50
  playContent: typeof playContent;
50
51
  setAbTestParams: typeof setAbTestParams;
51
52
  getAppContextManager: typeof getAppContextManager;
53
+ pushConsentEvent: (action: string, body: Record<string, any>) => void;
52
54
  };
53
55
  export default _default;
54
56
 
@@ -80,7 +82,8 @@ export declare enum Category {
80
82
  Widget = "widget",
81
83
  Video = "video",
82
84
  Ad = "ad",
83
- Interaction = "interaction"
85
+ Interaction = "interaction",
86
+ Consent = "consent"
84
87
  }
85
88
  declare class UserEventInfo {
86
89
  'generated_user_id': string;
@@ -170,6 +173,7 @@ export declare class AnalyticsEvent {
170
173
  video: Partial<VideoEvent> | undefined;
171
174
  ad: Partial<AdEvent> | undefined;
172
175
  interaction: Partial<InteractionEvent> | undefined;
176
+ consent: Partial<ConsentEvent> | undefined;
173
177
  }
174
178
  export declare class StoryEvent {
175
179
  'story_start_id': string;
@@ -326,6 +330,8 @@ export declare class InteractionEvent {
326
330
  'audio_state': string;
327
331
  'content_extra_info': string;
328
332
  }
333
+ export declare class ConsentEvent {
334
+ }
329
335
 
330
336
  export declare abstract class BaseWidget extends HTMLElement {
331
337
  protected _animationDuration: number;
@@ -825,7 +831,8 @@ export declare enum VideoAction {
825
831
  export declare enum WidgetAction {
826
832
  Load = "widget_load",
827
833
  Visible = "widget_visible",
828
- Click = "widget_click"
834
+ Click = "widget_click",
835
+ SDKInit = "sdk_init"
829
836
  }
830
837
  export declare enum AdAction {
831
838
  Requested = "ad_requested",
@@ -1325,16 +1332,6 @@ export declare abstract class WidgetsFactory {
1325
1332
  }
1326
1333
 
1327
1334
  export * from './elements.factory';
1328
- export * from './player.factory';
1329
-
1330
- export declare class PlayerViewFactory {
1331
- static create(type: ContentType, dataSource: BlazeDataSourceType, options: {
1332
- style: StoryPlayerStyle | VideoPlayerStyle;
1333
- actionHandlers?: ActionHandler[];
1334
- }): Promise<void>;
1335
- static createStory(dataSource: BlazeDataSourceType, style: StoryPlayerStyle, actionHandlers?: ActionHandler[]): Promise<void>;
1336
- static createVideos(dataSource: BlazeDataSourceType, style: VideoPlayerStyle): Promise<void>;
1337
- }
1338
1335
 
1339
1336
  export * from './widget-theme.guard';
1340
1337
 
@@ -1411,6 +1408,7 @@ export interface IBlazeSDKOptions {
1411
1408
  autoAdvanceUrl?: string;
1412
1409
  layoutDirection?: LocaleDirectionType;
1413
1410
  shouldAllowClosedCaptions?: boolean;
1411
+ disableAutoLoadingContent?: boolean;
1414
1412
  }
1415
1413
 
1416
1414
  export interface IButtonPlayerNavigationConfig {
@@ -1647,6 +1645,7 @@ declare abstract class AnalyticsServiceClass extends AnalyticsServiceClass_base
1647
1645
  pushMomentEvent(action: MomentAction, body: Partial<MomentEvent>, label?: string | undefined, referrer?: ReferringEventInfo | undefined): void;
1648
1646
  pushVideoEvent(action: VideoAction, body: Partial<VideoEvent>, label?: string | undefined, referrer?: ReferringEventInfo | undefined): void;
1649
1647
  pushAdEvent(action: AdAction, body: Partial<AdEvent>, label?: string | undefined, referrer?: ReferringEventInfo | undefined): void;
1648
+ pushConsentEvent(action: string, body: Record<string, any>): void;
1650
1649
  pushImaAdEvent(action: ImaAdAction, body: Partial<ImaAdEvent>, label?: string | undefined, referrer?: ReferringEventInfo | undefined): void;
1651
1650
  pushInteractionEvent(action: InteractionAction, body: Partial<InteractionEvent>, label?: string | undefined, referrer?: ReferringEventInfo | undefined): void;
1652
1651
  pushWidgetEvent(action: WidgetAction, body: Partial<WidgetEvent>, label?: string | undefined, referrer?: ReferringEventInfo | undefined): void;
@@ -1781,6 +1780,7 @@ declare abstract class ConfigServiceClass extends ConfigServiceClass_base implem
1781
1780
  private _layoutDirection;
1782
1781
  private _shouldAllowClosedCaptions;
1783
1782
  private _appContext;
1783
+ private _disableAutoLoadingContent;
1784
1784
  protected constructor();
1785
1785
  init(options: IBlazeSDKOptions): Promise<void>;
1786
1786
  private _urls;
@@ -1826,6 +1826,8 @@ declare abstract class ConfigServiceClass extends ConfigServiceClass_base implem
1826
1826
  get shouldAllowClosedCaptions(): boolean;
1827
1827
  get appContext(): Record<string, any>;
1828
1828
  set appContext(value: Record<string, any>);
1829
+ get disableAutoLoadingContent(): boolean;
1830
+ set disableAutoLoadingContent(value: boolean);
1829
1831
  }
1830
1832
  export declare const ConfigService: ConfigServiceClass;
1831
1833
 
@@ -2008,7 +2010,7 @@ declare abstract class MomentServiceClass extends MomentServiceClass_base implem
2008
2010
  init(): void;
2009
2011
  fetchContent(dataSource: BlazeDataSourceType): Promise<MomentsResponse>;
2010
2012
  updateMomentReadStatusById(momentId: string): Promise<any>;
2011
- encrichMoment(moment: IMoment[]): Promise<IMoment[]>;
2013
+ enrichContent(moment: IMoment[]): Promise<IMoment[]>;
2012
2014
  }
2013
2015
  export declare const MomentService: MomentServiceClass;
2014
2016
 
@@ -2030,7 +2032,7 @@ declare const StoryServiceClass_base: {
2030
2032
  declare abstract class StoryServiceClass extends StoryServiceClass_base implements IService {
2031
2033
  init(): void;
2032
2034
  fetchContent(dataSource: BlazeDataSourceType): Promise<StoriesResponse>;
2033
- enrichStories(stories: IStory[]): Promise<IStory[]>;
2035
+ enrichContent(stories: IStory[]): Promise<IStory[]>;
2034
2036
  }
2035
2037
  export declare const StoryService: StoryServiceClass;
2036
2038
 
@@ -2148,7 +2150,7 @@ declare abstract class VideoServiceClass extends VideoServiceClass_base implemen
2148
2150
  init(): Promise<void>;
2149
2151
  private loadHlsScript;
2150
2152
  fetchContent(dataSource: BlazeDataSourceType): Promise<VideosResponse>;
2151
- enrichVideos(videos: IVideo[]): Promise<IVideo[]>;
2153
+ enrichContent(videos: IVideo[]): Promise<IVideo[]>;
2152
2154
  getVideoDataById(videoId: string): Promise<VideoDBData | null>;
2153
2155
  updateVideoDataById(videoId: string, data: Partial<VideoDBData>): Promise<void>;
2154
2156
  markVideoAsViewed(videoId: string, poster: string): Promise<void>;
@@ -2165,6 +2167,107 @@ declare abstract class WidgetsServiceClass extends WidgetsServiceClass_base impl
2165
2167
  }
2166
2168
  export declare const WidgetsService: WidgetsServiceClass;
2167
2169
 
2170
+ export * from './player.template';
2171
+
2172
+ export declare class PlayerViewTemplate {
2173
+ private static templates;
2174
+ static display(type: ContentType, dataSource: BlazeDataSourceType, options: {
2175
+ style: StoryPlayerStyle | VideoPlayerStyle | MomentPlayerStyle;
2176
+ actionHandlers?: ActionHandler[];
2177
+ }): Promise<void>;
2178
+ private static validateStyleType;
2179
+ }
2180
+
2181
+ export interface ContentResponse<T> {
2182
+ result: T[];
2183
+ defaultAdsInfo?: IAdInfo;
2184
+ }
2185
+
2186
+ export interface ContentService<T extends IContent> {
2187
+ fetchContent(dataSource: BlazeDataSourceType): Promise<ContentResponse<T>>;
2188
+ enrichContent?(content: T[]): Promise<T[]>;
2189
+ }
2190
+
2191
+ export * from './modal-options';
2192
+ export * from './content-service';
2193
+ export * from './content-response';
2194
+
2195
+ export interface ModalTemplateOptions<T> {
2196
+ style: T;
2197
+ actionHandlers?: ActionHandler[];
2198
+ }
2199
+
2200
+ export interface ModalTemplateOptions<T> {
2201
+ actionHandlers?: ActionHandler[];
2202
+ }
2203
+ export interface ContentResponse<T> {
2204
+ defaultAdsInfo?: IAdInfo;
2205
+ }
2206
+ export declare abstract class BaseModalTemplate<M extends BlazeWidgetModal, C extends IContent, S> {
2207
+ render(dataSource: BlazeDataSourceType, options: ModalTemplateOptions<S>): Promise<void>;
2208
+ protected validateRequirements(dataSource: BlazeDataSourceType): {
2209
+ isValid: boolean;
2210
+ blazeSdk: null;
2211
+ dataSourceStringRep: undefined;
2212
+ } | {
2213
+ isValid: boolean;
2214
+ blazeSdk: BlazeWidgetSDK;
2215
+ dataSourceStringRep: undefined;
2216
+ } | {
2217
+ isValid: boolean;
2218
+ blazeSdk: BlazeWidgetSDK;
2219
+ dataSourceStringRep: string;
2220
+ };
2221
+ protected filterContent(content: C[]): C[];
2222
+ protected validateContentResponse(data: ContentResponse<C>, blazeSdk: BlazeWidgetSDK, dataSourceStringRep: string): boolean;
2223
+ protected openModal(modal: M, blazeSdk: BlazeWidgetSDK): void;
2224
+ protected handleError(error: unknown, blazeSdk: BlazeWidgetSDK, dataSourceStringRep: string): void;
2225
+ protected fetchContent(dataSource: BlazeDataSourceType): Promise<ContentResponse<C>>;
2226
+ protected abstract createModal(parent: HTMLElement, style: S, actionHandlers?: ActionHandler[]): M;
2227
+ protected abstract prepareContent(content: C[], service: ContentService<C>): Promise<C[]>;
2228
+ protected abstract configureModal(modal: M, content: C[]): void;
2229
+ protected abstract getService(): ContentService<C>;
2230
+ protected abstract getErrorCode(): ErrorCode;
2231
+ }
2232
+
2233
+ export * from './base.template';
2234
+ export * from './story.template';
2235
+ export * from './video.template';
2236
+ export * from './moment.template';
2237
+
2238
+ export declare class MomentModalTemplate extends BaseModalTemplate<BlazeWidgetMomentModal, IMoment, MomentPlayerStyle> {
2239
+ protected createModal(parent: HTMLElement, style: MomentPlayerStyle, actionHandlers?: ActionHandler[]): BlazeWidgetMomentModal;
2240
+ protected prepareContent(content: IMoment[], service: ContentService<IMoment>): Promise<IMoment[]>;
2241
+ protected configureModal(modal: BlazeWidgetMomentModal, content: IMoment[]): void;
2242
+ protected getService(): ContentService<IMoment>;
2243
+ protected getErrorCode(): ErrorCode;
2244
+ }
2245
+
2246
+ export declare class StoryModalTemplate extends BaseModalTemplate<BlazeWidgetStoryModal, IStory, StoryPlayerStyle> {
2247
+ protected createModal(parent: HTMLElement, style: StoryPlayerStyle, actionHandlers?: ActionHandler[]): BlazeWidgetStoryModal;
2248
+ protected prepareContent(content: IStory[], service: ContentService<IStory>): Promise<IStory[]>;
2249
+ protected configureModal(modal: BlazeWidgetStoryModal, content: IStory[]): void;
2250
+ protected getService(): ContentService<IStory>;
2251
+ protected getErrorCode(): ErrorCode;
2252
+ }
2253
+
2254
+ export declare class VideoModalTemplate extends BaseModalTemplate<BlazeWidgetVideoModal, IVideo, VideoPlayerStyle> {
2255
+ protected createModal(parent: HTMLElement, style: VideoPlayerStyle): BlazeWidgetVideoModal;
2256
+ protected prepareContent(content: IVideo[], service: ContentService<IVideo>): Promise<IVideo[]>;
2257
+ protected configureModal(modal: BlazeWidgetVideoModal, content: IVideo[]): void;
2258
+ protected getService(): ContentService<IVideo>;
2259
+ protected getErrorCode(): ErrorCode;
2260
+ }
2261
+
2262
+ export declare function getDataSourceStringRep(dataSource: BlazeDataSourceType): string | undefined;
2263
+
2264
+ export * from './data-source.utils';
2265
+ export * from './sort.utils';
2266
+
2267
+ export declare function sortVideosByViewedStatus(a: IVideo, b: IVideo): number;
2268
+ export declare function sortStoriesByViewedStatus(a: IStory, b: IStory): number;
2269
+ export declare function sortMomentsByViewedStatus(a: IMoment, b: IMoment): number;
2270
+
2168
2271
  export * from './preset';
2169
2272
  export * from './theme';
2170
2273
  export * from './theme.interface';
@@ -3508,8 +3611,6 @@ export declare class BlazeWidgetVideoModal extends BlazeWidgetModal {
3508
3611
  parentWidget: HTMLElement;
3509
3612
  playerLayout: VideoPlayerStyle;
3510
3613
  data: IVideo[];
3511
- onClose: (() => void) | undefined;
3512
- onOpen: (() => void) | undefined;
3513
3614
  boundOnResizeEventDelay: (this: Window, ev: UIEvent) => void;
3514
3615
  boundOnKeyDown: (ev: KeyboardEvent) => void;
3515
3616
  boundOnBeforeUnload: () => void;
@@ -4169,6 +4270,8 @@ export declare class BlazeWidgetModal extends BaseWidget {
4169
4270
  boundOnResizeEvent: (this: Window, ev: UIEvent) => void;
4170
4271
  boundOnPopStateEvent: (ev: PopStateEvent) => void;
4171
4272
  onContentChange?: (mode: ContentDirection) => void;
4273
+ onClose: ((options?: ISmoothOpenCloseModal) => void) | undefined;
4274
+ onOpen: (() => void) | undefined;
4172
4275
  constructor(type: ContentType);
4173
4276
  connectedCallback(): void;
4174
4277
  disconnectedCallback(): void;
@@ -4300,6 +4403,7 @@ export declare class BlazeWidgetSDK extends BaseWidget {
4300
4403
  private injectFontResource;
4301
4404
  private injectGoogleTag;
4302
4405
  private injectIma;
4406
+ private pushInitEvent;
4303
4407
  }
4304
4408
 
4305
4409
  export interface IShareButton {
@@ -4387,7 +4491,6 @@ export declare class BlazeWidgetVideo extends BlazeWidgetVideoBase {
4387
4491
  adDisplayContainer: any;
4388
4492
  adsManager: any;
4389
4493
  shouldShowImaAd: boolean;
4390
- googleIMA: any;
4391
4494
  isCurrentlyTryingToRunImaAd: boolean;
4392
4495
  hasPoster: boolean;
4393
4496
  static get observedAttributes(): string[];
@@ -4396,6 +4499,7 @@ export declare class BlazeWidgetVideo extends BlazeWidgetVideoBase {
4396
4499
  connectedCallback(): void;
4397
4500
  disconnectedCallback(): void;
4398
4501
  setData(data: IPage): void;
4502
+ getGoogleIMA(): any;
4399
4503
  private isEnableInteractions;
4400
4504
  loadClosedCaptions(): Promise<void>;
4401
4505
  getVideoDuration(existingVideo?: HTMLVideoElement): Promise<number>;
@@ -4450,7 +4554,6 @@ export declare class BlazeWidgetAd extends BlazeWidgetVideoBase {
4450
4554
  private isCurrentlyDisplay;
4451
4555
  private adContainer;
4452
4556
  private placeholderContainer;
4453
- private googletag;
4454
4557
  private failToLoadTimeout?;
4455
4558
  private onFail?;
4456
4559
  private isAdFailed;
@@ -4467,6 +4570,7 @@ export declare class BlazeWidgetAd extends BlazeWidgetVideoBase {
4467
4570
  get duration(): number;
4468
4571
  get progress(): number;
4469
4572
  set muted(isMuted: boolean);
4573
+ getGoogletag(): any;
4470
4574
  getAdIframeRef(): HTMLIFrameElement | null;
4471
4575
  changeAdMutedState(isMuted: boolean): void;
4472
4576
  setData(data: IPage): void;
@@ -4540,8 +4644,6 @@ export declare class BlazeWidgetMomentModal extends BlazeWidgetModal {
4540
4644
  navigationButtonsContainerElement: BlazeDiv;
4541
4645
  nextContentButtonElement?: BlazeButton;
4542
4646
  prevContentButtonElement?: BlazeButton;
4543
- onClose: (() => void) | undefined;
4544
- onOpen: (() => void) | undefined;
4545
4647
  boundOnKeyDown: (ev: KeyboardEvent) => void;
4546
4648
  boundOnNavigationChange: (ev: Event) => void;
4547
4649
  boundOnResizeEventDelay: (this: Window, ev: UIEvent) => void;
@@ -4804,8 +4906,6 @@ export declare class BlazeWidgetStoryModal extends BlazeWidgetModal {
4804
4906
  parentWidget: HTMLElement;
4805
4907
  playerLayout: StoryPlayerStyle;
4806
4908
  actionHandlers?: ActionHandler[] | undefined;
4807
- onOpen?: () => void;
4808
- onClose?: (options?: ISmoothOpenCloseModal) => void;
4809
4909
  boundOnResizeEventDelay: (this: Window, ev: UIEvent) => void;
4810
4910
  boundOnKeyDown: (ev: KeyboardEvent) => void;
4811
4911
  boundOnBeforeUnload: () => void;