@wscsports/blaze-web-sdk 0.0.107 → 0.0.109

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.109",
4
4
  "main": "publish/index",
5
5
  "types": "publish/index",
6
6
  "files": [
@@ -9,7 +9,7 @@
9
9
  "scripts": {
10
10
  "start:dev": "webpack --config webpack.config.dev.js && webpack-dev-server --config webpack.config.dev",
11
11
  "build:dev": "webpack --config webpack.config.dev.js",
12
- "build:prod": "webpack --config webpack.config.prod.js",
12
+ "build:prod": "webpack --config webpack.config.prod.js",
13
13
  "publish:npm": "npm publish --access public --tag latest"
14
14
  },
15
15
  "devDependencies": {
@@ -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;
@@ -433,6 +433,7 @@ export interface IAPIOptions {
433
433
  }
434
434
  export interface IRequestOptions {
435
435
  init?: RequestInit;
436
+ baseUrl?: string;
436
437
  urlSearchParams?: {};
437
438
  }
438
439
  export declare class API {
@@ -543,11 +544,9 @@ export declare const exposedFieldsByAction: ExposedFields;
543
544
 
544
545
  export declare class Database implements IDatabase {
545
546
  private readonly options;
546
- private static _instances;
547
547
  constructor(options: IDatabaseOptions);
548
548
  dbInstance: IDBDatabase;
549
- init(): Promise<void>;
550
- open(databaseName: string, version: number): Promise<void>;
549
+ init(options: IDatabaseInitOptions): Promise<void>;
551
550
  createTransaction(tableName: string, mode: 'readonly' | 'readwrite'): IDBObjectStore;
552
551
  get<T>(tableName: string, key: string): Promise<IResponse<T>>;
553
552
  update<T>(tableName: string, value: any): Promise<IResponse<T>>;
@@ -555,6 +554,15 @@ export declare class Database implements IDatabase {
555
554
 
556
555
  export * from './database';
557
556
 
557
+ export interface IContent {
558
+ id: string;
559
+ title: string;
560
+ updateTime: string;
561
+ createTime: string;
562
+ thumbnails: IThumbnail[];
563
+ hasViewed: boolean;
564
+ }
565
+
558
566
  export interface ICTA {
559
567
  type: 'Deeplink' | 'Web' | null;
560
568
  text: string;
@@ -563,6 +571,7 @@ export interface ICTA {
563
571
  textColor: string;
564
572
  }
565
573
 
574
+ export * from './content.interface';
566
575
  export * from './cta.interface';
567
576
  export * from './layer-content.interface';
568
577
  export * from './layer.interface';
@@ -581,12 +590,8 @@ export interface ILayer {
581
590
  content: ILayerContent;
582
591
  }
583
592
 
584
- export interface IMoment {
585
- id: string;
586
- title: string;
593
+ export interface IMoment extends IContent {
587
594
  duration: string;
588
- updateTime: string;
589
- createTime: string;
590
595
  thumbnails: IThumbnail[];
591
596
  likes: number;
592
597
  baseLayer: ILayer;
@@ -594,7 +599,6 @@ export interface IMoment {
594
599
  rendition: IRendition;
595
600
  type: string;
596
601
  };
597
- hasViewed: boolean;
598
602
  }
599
603
 
600
604
  export interface IPage {
@@ -613,15 +617,10 @@ export interface IRendition {
613
617
  url: string;
614
618
  }
615
619
 
616
- export interface IStory {
617
- id: string;
618
- title: string;
620
+ export interface IStory extends IContent {
619
621
  description: string;
620
622
  isLive: boolean;
621
- updateTime: string;
622
- thumbnails: IThumbnail[];
623
623
  pages: IPage[];
624
- hasViewed: boolean;
625
624
  isAd: boolean;
626
625
  }
627
626
 
@@ -655,16 +654,18 @@ export interface IBlazeSDKOptions {
655
654
  }
656
655
 
657
656
  export interface IDatabase {
658
- dbInstance: IDBDatabase;
657
+ init: (options: IDatabaseInitOptions) => Promise<void>;
659
658
  get: <T>(tableName: string, key: string) => Promise<IResponse<T>>;
660
659
  update: <T>(tableName: string, value: any) => Promise<IResponse<T>>;
661
660
  }
661
+ export interface IDatabaseInitOptions {
662
+ onOpen: (db: IDBDatabase) => Promise<void>;
663
+ onError: (e: Event) => Promise<void>;
664
+ onUpgradeNeeded?: (db: IDBDatabase) => Promise<void>;
665
+ }
662
666
  export interface IDatabaseOptions {
663
667
  databaseName: string;
664
668
  version: number;
665
- onSuccess?: (db: IDBDatabase) => Promise<void>;
666
- onUpgradeNeeded?: (db: IDBDatabase) => Promise<void>;
667
- onError?: () => Promise<void>;
668
669
  }
669
670
 
670
671
  export * from './blaze-sdk.interface';
@@ -681,7 +682,7 @@ export default interface IntersectionObservable {
681
682
 
682
683
  export interface IResponse<T = any> {
683
684
  data: T;
684
- error: Error;
685
+ error?: Error;
685
686
  }
686
687
 
687
688
  export interface IService {
@@ -694,7 +695,7 @@ export interface IWidgetViewOptions {
694
695
  maxItemsCount?: number;
695
696
  maxDisplayItemsCount?: number;
696
697
  contentType: ContentType;
697
- theme?: IWidgetTheme | string;
698
+ theme?: IWidgetTheme | ThemeType;
698
699
  }
699
700
 
700
701
  export interface IWidgetView {
@@ -875,23 +876,19 @@ declare const BlazeApiServiceClass_base: {
875
876
  declare abstract class BlazeApiServiceClass extends BlazeApiServiceClass_base implements IService {
876
877
  api: API;
877
878
  init(): Promise<void>;
878
- getStories(labels: string, orderType: OrderType, maxItemsSize?: number): Promise<import("../interfaces").IResponse<{
879
+ getStories(labels: string, orderType: OrderType, maxItemsSize?: number): Promise<IResponse<{
879
880
  assetsExpiryTime: string;
880
881
  totalItems: number;
881
882
  result: IStory[];
882
883
  }>>;
883
- getShorts(labels: string, orderType: OrderType, maxItemsSize?: number): Promise<import("../interfaces").IResponse<{
884
+ getShorts(labels: string, orderType: OrderType, maxItemsSize?: number): Promise<IResponse<{
884
885
  assetsExpiryTime: string;
885
886
  totalItems: number;
886
887
  result: IMoment[];
887
888
  }>>;
888
- preview(storyId: string, publishedOnly?: boolean): Promise<import("../interfaces").IResponse<IStory[]>>;
889
- preivewMoment(momentId: string, publishedOnly?: boolean): Promise<import("../interfaces").IResponse<{
890
- assetsExpiryTime: string;
891
- totalItems: number;
892
- result: IMoment[];
893
- }>>;
894
- analyticsEvents(body: Partial<AnalyticsEvent>[]): Promise<import("../interfaces").IResponse<unknown>>;
889
+ preview(storyId: string, publishedOnly?: boolean): Promise<IResponse<any>>;
890
+ preivewMoment(momentId: string, publishedOnly?: boolean): Promise<IResponse<any>>;
891
+ analyticsEvents(body: Partial<AnalyticsEvent>[]): Promise<IResponse<unknown>>;
895
892
  }
896
893
  export declare const ApiService: BlazeApiServiceClass;
897
894
 
@@ -903,7 +900,8 @@ declare const BlazeDatabaseServiceClass_base: {
903
900
  declare abstract class BlazeDatabaseServiceClass extends BlazeDatabaseServiceClass_base implements IService {
904
901
  database: IDatabase;
905
902
  init(): Promise<void>;
906
- onSuccess(db: IDBDatabase): Promise<void>;
903
+ onOpen(): Promise<void>;
904
+ onError(e: Event): Promise<void>;
907
905
  onUpgradeNeeded(db: IDBDatabase): Promise<void>;
908
906
  getPageViewed(id: string): Promise<any>;
909
907
  updatePageViewed(id: string, storyId: string): Promise<any>;
@@ -948,6 +946,16 @@ declare abstract class ConfigServiceClass extends ConfigServiceClass_base implem
948
946
  }
949
947
  export declare const ConfigService: ConfigServiceClass;
950
948
 
949
+ declare const ErrorServiceClass_base: {
950
+ new (): {};
951
+ _instance: ErrorServiceClass;
952
+ getInstance(): ErrorServiceClass;
953
+ };
954
+ declare abstract class ErrorServiceClass extends ErrorServiceClass_base implements IService {
955
+ init(): Promise<void>;
956
+ }
957
+ export declare const ErrorService: ErrorServiceClass;
958
+
951
959
  export interface Registry {
952
960
  unsubscribed: () => void;
953
961
  }
@@ -998,11 +1006,12 @@ export declare const EventService: EventServiceClass;
998
1006
  export * from './analytics.service';
999
1007
  export * from './blaze-api.service';
1000
1008
  export * from './blaze-database.service';
1001
- export * from './video-cache.service';
1002
1009
  export * from './config.service';
1010
+ export * from './error.service';
1003
1011
  export * from './event-bus.service';
1004
1012
  export * from './event.service';
1005
1013
  export * from './startup.service';
1014
+ export * from './video-cache.service';
1006
1015
  export * from './widgets.service';
1007
1016
 
1008
1017
  declare const StartupServiceClass_base: {
@@ -1134,13 +1143,9 @@ export declare const Colors: {
1134
1143
  readonly TimeColor: "#7F7F7F";
1135
1144
  };
1136
1145
 
1146
+ export type ThemeType = 'default' | 'grid-2-columns' | 'grid-3-columns' | 'row-circle' | 'row-rectangle';
1137
1147
  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;
1148
+ static create(name?: ThemeType): IWidgetTheme;
1144
1149
  }
1145
1150
  export declare function getIndicatorStyle(el: IAttributeParser, state: string): Partial<IndicatorStyle>;
1146
1151
  export declare function getLabelStyle(el: IAttributeParser): Partial<LabelStyle>;
@@ -1196,9 +1201,8 @@ export interface BlazeWidgetItemOptions {
1196
1201
  theme: IWidgetTheme;
1197
1202
  story: IStory;
1198
1203
  thumbnailType: string;
1199
- fetchPriority: FetchPriorityType;
1200
1204
  }
1201
- export declare class BlazeWidgetItem extends HTMLElement {
1205
+ export declare class BlazeWidgetItem extends BaseHTMLElement {
1202
1206
  protected options: BlazeWidgetItemOptions;
1203
1207
  wrapper: HTMLElement;
1204
1208
  container: HTMLElement;
@@ -1209,14 +1213,11 @@ export declare class BlazeWidgetItem extends HTMLElement {
1209
1213
  modal: BlazeWidgetModal | undefined;
1210
1214
  thumbnailType: string | undefined;
1211
1215
  theme: IWidgetTheme;
1212
- labelStyle: LabelStyle;
1213
- labelWidth: number;
1214
1216
  data: IStory | IMoment | undefined;
1215
1217
  onClick: (() => void) | undefined;
1216
1218
  chip: HTMLElement;
1217
1219
  newChip: HTMLElement | undefined;
1218
1220
  state: 'loading' | 'done' | 'failed';
1219
- fetchPriority: FetchPriorityType;
1220
1221
  isLive: boolean | undefined;
1221
1222
  statusIndicatorSettings: IndicatorStyle;
1222
1223
  constructor(options: BlazeWidgetItemOptions);