@wscsports/blaze-web-sdk 0.0.107 → 0.0.108

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.0.107",
3
+ "version": "0.0.108",
4
4
  "main": "publish/index",
5
5
  "types": "publish/index",
6
6
  "files": [
@@ -368,7 +368,7 @@ export declare function mergeStyles(element: HTMLElement, styles: Partial<CSSSty
368
368
  export declare function formatDate(date: Date): string;
369
369
  export declare function formatUTCDate(date: Date): string;
370
370
  export declare function getRandomId(): string;
371
- export declare function loadImage(src: string, priority?: 'low' | 'high' | 'auto'): Promise<any>;
371
+ export declare function loadImage(src: string): Promise<any>;
372
372
  export declare function setId(element: HTMLElement, prefix?: string, suffix?: string): void;
373
373
  declare let isMobile: boolean;
374
374
  declare const isIOS: boolean;
@@ -383,7 +383,7 @@ export declare function flattenObject<T extends Record<string, any>>(obj: T): Re
383
383
  export declare function Initialize(apiKey: string, options?: IBlazeSDKOptions): Promise<void>;
384
384
  export declare function WidgetRowView(containerId: string, options: IWidgetViewOptions): IWidgetView;
385
385
  export declare function WidgetGridView(containerId: string, options: IWidgetViewOptions): IWidgetView;
386
- export declare function Theme(preset?: string): IWidgetTheme;
386
+ export declare function Theme(theme: ThemeType): IWidgetTheme;
387
387
  export declare const Delegations: typeof Delegation;
388
388
  declare const _default: {
389
389
  Initialize: typeof Initialize;
@@ -543,11 +543,9 @@ export declare const exposedFieldsByAction: ExposedFields;
543
543
 
544
544
  export declare class Database implements IDatabase {
545
545
  private readonly options;
546
- private static _instances;
547
546
  constructor(options: IDatabaseOptions);
548
547
  dbInstance: IDBDatabase;
549
- init(): Promise<void>;
550
- open(databaseName: string, version: number): Promise<void>;
548
+ init(options: IDatabaseInitOptions): Promise<void>;
551
549
  createTransaction(tableName: string, mode: 'readonly' | 'readwrite'): IDBObjectStore;
552
550
  get<T>(tableName: string, key: string): Promise<IResponse<T>>;
553
551
  update<T>(tableName: string, value: any): Promise<IResponse<T>>;
@@ -555,6 +553,15 @@ export declare class Database implements IDatabase {
555
553
 
556
554
  export * from './database';
557
555
 
556
+ export interface IContent {
557
+ id: string;
558
+ title: string;
559
+ updateTime: string;
560
+ createTime: string;
561
+ thumbnails: IThumbnail[];
562
+ hasViewed: boolean;
563
+ }
564
+
558
565
  export interface ICTA {
559
566
  type: 'Deeplink' | 'Web' | null;
560
567
  text: string;
@@ -563,6 +570,7 @@ export interface ICTA {
563
570
  textColor: string;
564
571
  }
565
572
 
573
+ export * from './content.interface';
566
574
  export * from './cta.interface';
567
575
  export * from './layer-content.interface';
568
576
  export * from './layer.interface';
@@ -581,12 +589,8 @@ export interface ILayer {
581
589
  content: ILayerContent;
582
590
  }
583
591
 
584
- export interface IMoment {
585
- id: string;
586
- title: string;
592
+ export interface IMoment extends IContent {
587
593
  duration: string;
588
- updateTime: string;
589
- createTime: string;
590
594
  thumbnails: IThumbnail[];
591
595
  likes: number;
592
596
  baseLayer: ILayer;
@@ -594,7 +598,6 @@ export interface IMoment {
594
598
  rendition: IRendition;
595
599
  type: string;
596
600
  };
597
- hasViewed: boolean;
598
601
  }
599
602
 
600
603
  export interface IPage {
@@ -613,15 +616,10 @@ export interface IRendition {
613
616
  url: string;
614
617
  }
615
618
 
616
- export interface IStory {
617
- id: string;
618
- title: string;
619
+ export interface IStory extends IContent {
619
620
  description: string;
620
621
  isLive: boolean;
621
- updateTime: string;
622
- thumbnails: IThumbnail[];
623
622
  pages: IPage[];
624
- hasViewed: boolean;
625
623
  isAd: boolean;
626
624
  }
627
625
 
@@ -655,16 +653,18 @@ export interface IBlazeSDKOptions {
655
653
  }
656
654
 
657
655
  export interface IDatabase {
658
- dbInstance: IDBDatabase;
656
+ init: (options: IDatabaseInitOptions) => Promise<void>;
659
657
  get: <T>(tableName: string, key: string) => Promise<IResponse<T>>;
660
658
  update: <T>(tableName: string, value: any) => Promise<IResponse<T>>;
661
659
  }
660
+ export interface IDatabaseInitOptions {
661
+ onOpen: (db: IDBDatabase) => Promise<void>;
662
+ onError: (e: Event) => Promise<void>;
663
+ onUpgradeNeeded?: (db: IDBDatabase) => Promise<void>;
664
+ }
662
665
  export interface IDatabaseOptions {
663
666
  databaseName: string;
664
667
  version: number;
665
- onSuccess?: (db: IDBDatabase) => Promise<void>;
666
- onUpgradeNeeded?: (db: IDBDatabase) => Promise<void>;
667
- onError?: () => Promise<void>;
668
668
  }
669
669
 
670
670
  export * from './blaze-sdk.interface';
@@ -694,7 +694,7 @@ export interface IWidgetViewOptions {
694
694
  maxItemsCount?: number;
695
695
  maxDisplayItemsCount?: number;
696
696
  contentType: ContentType;
697
- theme?: IWidgetTheme | string;
697
+ theme?: IWidgetTheme | ThemeType;
698
698
  }
699
699
 
700
700
  export interface IWidgetView {
@@ -903,7 +903,8 @@ declare const BlazeDatabaseServiceClass_base: {
903
903
  declare abstract class BlazeDatabaseServiceClass extends BlazeDatabaseServiceClass_base implements IService {
904
904
  database: IDatabase;
905
905
  init(): Promise<void>;
906
- onSuccess(db: IDBDatabase): Promise<void>;
906
+ onOpen(): Promise<void>;
907
+ onError(e: Event): Promise<void>;
907
908
  onUpgradeNeeded(db: IDBDatabase): Promise<void>;
908
909
  getPageViewed(id: string): Promise<any>;
909
910
  updatePageViewed(id: string, storyId: string): Promise<any>;
@@ -948,6 +949,16 @@ declare abstract class ConfigServiceClass extends ConfigServiceClass_base implem
948
949
  }
949
950
  export declare const ConfigService: ConfigServiceClass;
950
951
 
952
+ declare const ErrorServiceClass_base: {
953
+ new (): {};
954
+ _instance: ErrorServiceClass;
955
+ getInstance(): ErrorServiceClass;
956
+ };
957
+ declare abstract class ErrorServiceClass extends ErrorServiceClass_base implements IService {
958
+ init(): Promise<void>;
959
+ }
960
+ export declare const ErrorService: ErrorServiceClass;
961
+
951
962
  export interface Registry {
952
963
  unsubscribed: () => void;
953
964
  }
@@ -998,11 +1009,12 @@ export declare const EventService: EventServiceClass;
998
1009
  export * from './analytics.service';
999
1010
  export * from './blaze-api.service';
1000
1011
  export * from './blaze-database.service';
1001
- export * from './video-cache.service';
1002
1012
  export * from './config.service';
1013
+ export * from './error.service';
1003
1014
  export * from './event-bus.service';
1004
1015
  export * from './event.service';
1005
1016
  export * from './startup.service';
1017
+ export * from './video-cache.service';
1006
1018
  export * from './widgets.service';
1007
1019
 
1008
1020
  declare const StartupServiceClass_base: {
@@ -1134,13 +1146,9 @@ export declare const Colors: {
1134
1146
  readonly TimeColor: "#7F7F7F";
1135
1147
  };
1136
1148
 
1149
+ export type ThemeType = 'default' | 'grid-2-columns' | 'grid-3-columns' | 'row-circle' | 'row-rectangle';
1137
1150
  export declare class ThemeFactory {
1138
- static GRID_WIDGET_TWO_COLUMNS(): IWidgetTheme;
1139
- static GRID_WIDGET_THREE_COLUMNS(): IWidgetTheme;
1140
- static ROW_WIDGET_CIRCLES(): IWidgetTheme;
1141
- static ROW_WIDGET_RECTANGLES(): IWidgetTheme;
1142
- static getTheme(): IWidgetTheme;
1143
- static getThemeByString(name?: string): IWidgetTheme;
1151
+ static create(name?: ThemeType): IWidgetTheme;
1144
1152
  }
1145
1153
  export declare function getIndicatorStyle(el: IAttributeParser, state: string): Partial<IndicatorStyle>;
1146
1154
  export declare function getLabelStyle(el: IAttributeParser): Partial<LabelStyle>;
@@ -1196,9 +1204,8 @@ export interface BlazeWidgetItemOptions {
1196
1204
  theme: IWidgetTheme;
1197
1205
  story: IStory;
1198
1206
  thumbnailType: string;
1199
- fetchPriority: FetchPriorityType;
1200
1207
  }
1201
- export declare class BlazeWidgetItem extends HTMLElement {
1208
+ export declare class BlazeWidgetItem extends BaseHTMLElement {
1202
1209
  protected options: BlazeWidgetItemOptions;
1203
1210
  wrapper: HTMLElement;
1204
1211
  container: HTMLElement;
@@ -1209,14 +1216,12 @@ export declare class BlazeWidgetItem extends HTMLElement {
1209
1216
  modal: BlazeWidgetModal | undefined;
1210
1217
  thumbnailType: string | undefined;
1211
1218
  theme: IWidgetTheme;
1212
- labelStyle: LabelStyle;
1213
1219
  labelWidth: number;
1214
1220
  data: IStory | IMoment | undefined;
1215
1221
  onClick: (() => void) | undefined;
1216
1222
  chip: HTMLElement;
1217
1223
  newChip: HTMLElement | undefined;
1218
1224
  state: 'loading' | 'done' | 'failed';
1219
- fetchPriority: FetchPriorityType;
1220
1225
  isLive: boolean | undefined;
1221
1226
  statusIndicatorSettings: IndicatorStyle;
1222
1227
  constructor(options: BlazeWidgetItemOptions);