@wscsports/blaze-web-sdk 0.3.6 → 0.3.7

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.3.6",
3
+ "version": "0.3.7",
4
4
  "main": "publish/index",
5
5
  "types": "publish/index",
6
6
  "files": [
@@ -409,15 +409,28 @@ interface UpdateLocationContentHashParams {
409
409
  contentId?: string;
410
410
  isAd?: boolean;
411
411
  }
412
+ export declare const URL_PARAMS: {
413
+ readonly SESSION_ID: "wsc_session_id";
414
+ readonly USER_ID: "wsc_user_id";
415
+ readonly EXCLUDE_CONTENT_ID: "wsc_exclude_content_id";
416
+ };
412
417
  export declare class URLManager {
413
418
  static isUpdateLocationByScript: boolean;
414
419
  static isBackWasCalled: boolean;
420
+ static isAutoAdvancingEnabled: boolean;
415
421
  static resetLocationAfterContentClose(): void;
416
422
  static resetLocation(): void;
417
423
  static updateLocationContentHash(params: UpdateLocationContentHashParams): void;
418
424
  static getHashMatch(): boolean;
419
425
  static getHash(): string;
420
426
  static updateContentInHash(contentId: string, contentType: ContentType): void;
427
+ static appendUrlForPrefetch(url?: string, timeout?: number): void;
428
+ static navigateToLink(url: string): void;
429
+ static removeUrlParamFromSearchParams(param: string, searchParams: URLSearchParams): URLSearchParams;
430
+ static removeStringParamsFromCurrentUrl(paramsToDelete: string | string[]): void;
431
+ static updateParamInUrl(param: string, value: string): void;
432
+ static updateCurrentUrlWithParams(params: URLSearchParams): void;
433
+ static navigateTo(navigationFeature: 'AUTO_ADVANCE'): Promise<void>;
421
434
  }
422
435
 
423
436
  export declare class BlazeAlert extends BaseWidget {
@@ -1085,6 +1098,8 @@ export interface IBlazeSDKOptions {
1085
1098
  externalUserId?: string | null;
1086
1099
  prefetchingPolicy?: PrefetchingPolicyType;
1087
1100
  shouldAllowHorizontalStories?: boolean;
1101
+ shouldAutoAdvance?: boolean;
1102
+ autoAdvanceUrl?: string;
1088
1103
  }
1089
1104
 
1090
1105
  export interface IButtonPlayerNavigationConfig {
@@ -1343,7 +1358,7 @@ declare abstract class ApiServiceClass extends ApiServiceClass_base implements I
1343
1358
  data?: StoriesResponse | undefined;
1344
1359
  error?: Error | undefined;
1345
1360
  }>;
1346
- getStories(labels: string, orderType?: OrderType, maxItemsSize?: number, labelsPriority?: string): Promise<{
1361
+ getStoriesByLabels(labels: string, orderType?: OrderType, maxItems?: number, labelsPriority?: string): Promise<{
1347
1362
  result: IStory[];
1348
1363
  httpStatus?: number | undefined;
1349
1364
  data?: StoriesResponse | undefined;
@@ -1354,7 +1369,7 @@ declare abstract class ApiServiceClass extends ApiServiceClass_base implements I
1354
1369
  data?: MomentsResponse | undefined;
1355
1370
  error?: Error | undefined;
1356
1371
  }>;
1357
- getMomentsByLabels(labels: string, orderType: OrderType, maxItemsSize?: number): Promise<import("../interfaces").IHttpResponse<MomentsResponse>>;
1372
+ getMomentsByLabels(labels: string, orderType?: OrderType, maxItems?: number): Promise<import("../interfaces").IHttpResponse<MomentsResponse>>;
1358
1373
  updateMomentLikeStatus(options: {
1359
1374
  momentId: string;
1360
1375
  setLiked: boolean;
@@ -1394,6 +1409,8 @@ declare abstract class ConfigServiceClass extends ConfigServiceClass_base implem
1394
1409
  private _runInShadowDom;
1395
1410
  private _shouldModifyUrlWithStoryId;
1396
1411
  private _shouldDismissPlayer;
1412
+ private _shouldAutoAdvance;
1413
+ private _autoAdvanceUrl;
1397
1414
  private _googleCustomNativeAdHandler?;
1398
1415
  private _imaAdHandler?;
1399
1416
  private _playerStyleCustomization?;
@@ -1401,6 +1418,7 @@ declare abstract class ConfigServiceClass extends ConfigServiceClass_base implem
1401
1418
  private _externalUserId;
1402
1419
  private _prefetchingPolicy;
1403
1420
  private _shouldAllowHorizontalStories;
1421
+ private _excludeContentId;
1404
1422
  protected constructor();
1405
1423
  init(options: IBlazeSDKOptions): Promise<void>;
1406
1424
  private _urls;
@@ -1429,12 +1447,16 @@ declare abstract class ConfigServiceClass extends ConfigServiceClass_base implem
1429
1447
  set playerStyleCustomization(value: Partial<StoryPlayerStyle>);
1430
1448
  get shouldModifyUrlWithStoryId(): boolean;
1431
1449
  get shouldDismissPlayer(): boolean;
1450
+ get shouldAutoAdvance(): boolean;
1451
+ get autoAdvanceUrl(): string | undefined;
1432
1452
  get googleCustomNativeAdHandler(): CustomNativeAdHandler | undefined;
1433
1453
  set googleCustomNativeAdHandler(value: CustomNativeAdHandler | undefined);
1434
1454
  get imaAdHandler(): ImaAdHandler | undefined;
1435
1455
  set imaAdHandler(value: ImaAdHandler | undefined);
1436
1456
  get prefetchingPolicy(): PrefetchingPolicyType;
1437
1457
  set prefetchingPolicy(value: PrefetchingPolicyType);
1458
+ get excludeContentId(): string | undefined;
1459
+ set excludeContentId(value: string | undefined);
1438
1460
  }
1439
1461
  export declare const ConfigService: ConfigServiceClass;
1440
1462
 
@@ -1453,7 +1475,7 @@ declare abstract class DatabaseServiceClass extends DatabaseServiceClass_base im
1453
1475
  id: string;
1454
1476
  value: string;
1455
1477
  }>>;
1456
- updateUserId(id: string): Promise<IResponse<{
1478
+ updateUserId(userId: string): Promise<IResponse<{
1457
1479
  id: string;
1458
1480
  value: string;
1459
1481
  }>>;
@@ -1609,9 +1631,9 @@ declare const MomentServiceClass_base: {
1609
1631
  };
1610
1632
  declare abstract class MomentServiceClass extends MomentServiceClass_base implements IService {
1611
1633
  init(): void;
1634
+ fetchContent(dataSource: BlazeDataSourceType): Promise<MomentsResponse>;
1612
1635
  updateMomentReadStatusById(momentId: string): Promise<any>;
1613
1636
  encrichMoment(moment: IMoment[]): Promise<IMoment[]>;
1614
- getMoments(dataSource: any): Promise<MomentsResponse>;
1615
1637
  }
1616
1638
  export declare const MomentService: MomentServiceClass;
1617
1639
 
@@ -1625,13 +1647,17 @@ declare abstract class StartupServiceClass extends StartupServiceClass_base impl
1625
1647
  }
1626
1648
  export declare const StartupService: StartupServiceClass;
1627
1649
 
1628
- export declare class StoryService {
1629
- static fetchStories(dataSource: BlazeDataSourceType): Promise<{
1630
- data: any;
1631
- error: any;
1632
- }>;
1633
- static enrichStories(stories: IStory[]): Promise<IStory[]>;
1650
+ declare const StoryServiceClass_base: {
1651
+ new (): {};
1652
+ _instance: StoryServiceClass;
1653
+ getInstance(): StoryServiceClass;
1654
+ };
1655
+ declare abstract class StoryServiceClass extends StoryServiceClass_base implements IService {
1656
+ init(): void;
1657
+ fetchContent(dataSource: BlazeDataSourceType): Promise<StoriesResponse>;
1658
+ enrichStories(stories: IStory[]): Promise<IStory[]>;
1634
1659
  }
1660
+ export declare const StoryService: StoryServiceClass;
1635
1661
 
1636
1662
  declare const UserServiceClass_base: {
1637
1663
  new (): {};
@@ -1645,8 +1671,12 @@ declare abstract class UserServiceClass extends UserServiceClass_base implements
1645
1671
  get userId(): string;
1646
1672
  get sessionId(): string;
1647
1673
  init(): Promise<void>;
1674
+ private ensureSessionId;
1675
+ assignUserId(): Promise<void>;
1648
1676
  onBlazeDatabaseServiceOpen(): Promise<void>;
1649
- getUserId(): Promise<string | null>;
1677
+ private getUserId;
1678
+ private fetchUserIdFromDatabase;
1679
+ private handleMissingUserId;
1650
1680
  private makeSureCurrentExternalUserTokenExists;
1651
1681
  getAndStoreNewUserToken(): Promise<void>;
1652
1682
  refreshUserToken(): Promise<void>;
@@ -1699,12 +1729,16 @@ declare abstract class VideoPlayerServiceClass extends VideoPlayerServiceClass_b
1699
1729
  private _isModalOpen;
1700
1730
  private _isSeekBarDragging;
1701
1731
  private _playReference;
1732
+ private _currentPlayedContentId;
1702
1733
  muteStateBeforeAd: 'mute' | 'unmute' | 'no-ad';
1703
1734
  playerLoadingSpinner: HTMLElement | undefined;
1704
1735
  constructor();
1705
1736
  init(): Promise<void>;
1706
1737
  get isMuted(): boolean;
1707
1738
  set isMuted(value: boolean);
1739
+ private updateExcludeContentIdFromURL;
1740
+ get currentlyPlayedContentId(): string;
1741
+ set currentlyPlayedContentId(value: string);
1708
1742
  get isPlaying(): boolean;
1709
1743
  set isPlaying(value: boolean);
1710
1744
  get isNavigating(): boolean;
@@ -1782,6 +1816,7 @@ export interface LayoutStyle {
1782
1816
  isSkeleton: boolean;
1783
1817
  labelStyle: LabelStyle;
1784
1818
  lines: number;
1819
+ wordBreak: string;
1785
1820
  horizontalItemsSpacing: number;
1786
1821
  verticalItemsSpacing: number;
1787
1822
  borderWidth: number;
@@ -1804,6 +1839,7 @@ export interface LabelStyle {
1804
1839
  padding: string;
1805
1840
  font: string;
1806
1841
  fontSize: string;
1842
+ fontWeight: FontWeightType;
1807
1843
  textAlign?: string;
1808
1844
  position: PositionType;
1809
1845
  }
@@ -1912,7 +1948,6 @@ export interface MomentPlayerStyle {
1912
1948
  buttons: BlazeMomentsPlayerButtonsStyle;
1913
1949
  icons: BlazeMomentIconsStyle;
1914
1950
  iconsButtonOrder: IconButtonType[];
1915
- iconsPosition: IconsPositionType;
1916
1951
  contentBoxHorizontalSpacing: string;
1917
1952
  seekBar: BlazeMomentsPlayerSeekBarStyle;
1918
1953
  ctaButton: BlazeMomentsPlayerCtaStyle;
@@ -2310,7 +2345,7 @@ export declare function AttributeParser<TBase extends GHTMLElement>(Base: TBase)
2310
2345
  };
2311
2346
  } & TBase;
2312
2347
 
2313
- export type ButtonType = 'ALL' | 'PAGE_NAVIGATION_ONLY' | 'STORY_NAVIGATION_ONLY';
2348
+ export type ButtonType = 'ALL' | 'PAGE_NAVIGATION_ONLY' | 'STORIES_NAVIGATION_ONLY';
2314
2349
  export type ButtonState = 'ACTIVE' | 'DISABLED';
2315
2350
  export declare enum ButtonNavigation {
2316
2351
  PREV_STORY = 0,
@@ -2392,7 +2427,7 @@ export type LocaleDirectionType = 'LTR' | 'RTL';
2392
2427
  export type OrderType = 'Manual' | 'AtoZ' | 'ZtoA' | 'RecentlyUpdatedFirst' | 'RecentlyUpdatedLast' | 'RecentlyCreatedFirst' | 'RecentlyCreatedLast';
2393
2428
  export type ContentOrderType = 'LIVE_CHIP' | 'STORY_TITLE' | 'PUBLISHED_DATE';
2394
2429
 
2395
- export declare const PlayTypeArray: readonly ["Widget", "Share", "SingleStory"];
2430
+ export declare const PlayTypeArray: readonly ["Widget", "Share", "SingleStory", "AutoAdvance"];
2396
2431
  export type PlayType = typeof PlayTypeArray[number];
2397
2432
 
2398
2433
  export type PositionInsideType = 'insideTopLeft' | 'insideTopRight' | 'insideTop' | 'insideTopMiddle' | 'insideBottomRight' | 'insideBottomLeft' | 'insideBottom' | 'insideBottomMiddle' | 'insideMiddle' | 'insideMiddleLeft' | 'insideMiddleRight';
@@ -2422,7 +2457,7 @@ export type ThumbnailShape = 'Circle' | 'Rectangle';
2422
2457
  export declare function thumbnailMapping(thumbnailType: ThumbnailType): ThumbnailApiType;
2423
2458
 
2424
2459
  export type ExitTriggerType = 'Swipe' | 'Swipe Left' | 'Swipe Right' | 'Swipe Down' | 'Swipe Up' | 'Skip' | 'Close Button' | 'CTA Click' | 'Escape Button' | 'Stories Completed' | 'Story Completed' | '';
2425
- export type StartTriggerType = 'Embedded Player in Viewport' | 'UI Button' | 'Widget' | 'Deeplink' | 'Swipe' | 'Skip' | 'SingleStory' | 'Share' | '';
2460
+ export type StartTriggerType = 'Embedded Player in Viewport' | 'UI Button' | 'Widget' | 'Deeplink' | 'Swipe' | 'Skip' | 'SingleStory' | 'Share' | 'AutoAdvance' | '';
2426
2461
 
2427
2462
  export type GetUserTokenRequest = {
2428
2463
  externalId: string | null;
@@ -2781,7 +2816,7 @@ export declare class BlazeWidgetLayout extends BlazeWidgetScrollable implements
2781
2816
  addDelegateListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
2782
2817
  set storyIds(value: string);
2783
2818
  set contentIds(value: string);
2784
- setContentIds(storyIds: string[], options?: ISetWidgetOptions): void;
2819
+ setContentIds(ids: string[], options?: ISetWidgetOptions): void;
2785
2820
  setLabelsPriority(labelsPriority: string | string[] | BlazeWidgetLabel[], options?: ISetWidgetOptions): void;
2786
2821
  setLabels(labels: string | string[] | BlazeWidgetLabel, options?: ISetWidgetOptions): void;
2787
2822
  getTheme(): IWidgetTheme;
@@ -2796,7 +2831,7 @@ export declare class BlazeWidgetLayout extends BlazeWidgetScrollable implements
2796
2831
  setDelegations(delegates: Record<Delegation, EventListenerOrEventListenerObject>): void;
2797
2832
  private setOrderType;
2798
2833
  setMaxItemsDisplaySize(maxSize: number): void;
2799
- setMaxItemsSize(maxItemsSize?: number): void;
2834
+ setMaxItemsSize(maxItemsSize?: number, options?: ISetWidgetOptions): void;
2800
2835
  private updatePlayerStyle;
2801
2836
  private createModal;
2802
2837
  private appendModalToBlazeSDK;
@@ -2962,12 +2997,11 @@ export declare class BlazeWidgetScrollable extends BaseWidget {
2962
2997
  render(): void;
2963
2998
  }
2964
2999
 
2965
- export type playRefType = 'Share' | 'SingleStory';
3000
+ export type playRefType = 'Share' | 'SingleStory' | 'AutoAdvance';
2966
3001
  export declare class BlazeWidgetSDK extends BaseWidget {
2967
3002
  modal: BlazeWidgetStoryModal | BlazeWidgetMomentModal;
2968
3003
  boundOnResizeEvent: (this: Window, ev: UIEvent) => void;
2969
3004
  boundOnResizeEventDelay: () => void;
2970
- static get observedAttributes(): string[];
2971
3005
  constructor();
2972
3006
  connectedCallback(): Promise<void>;
2973
3007
  disconnectedCallback(): void;
@@ -2985,7 +3019,6 @@ export declare class BlazeWidgetSDK extends BaseWidget {
2985
3019
  handleStaticContentLoad(playReference: playRefType): Promise<void>;
2986
3020
  enrichContent(content: IStory[]): Promise<IStory[]>;
2987
3021
  setupModalAndLoadContent(contentType: ContentType, playReference: playRefType, content: IStory | IMoment): Promise<void>;
2988
- attributeChangedCallback(name: string, oldValue: string, newValue: string): Promise<void>;
2989
3022
  private getConfigAttributes;
2990
3023
  private initialize;
2991
3024
  private injectToHead;
@@ -3436,7 +3469,7 @@ export declare class BlazeWidgetMoment extends BlazeWidgetContent {
3436
3469
  resume(): void;
3437
3470
  resetPosition(): void;
3438
3471
  restartVideo(): void;
3439
- adjustAdView(): void;
3472
+ adjustContentView(): void;
3440
3473
  event(action: MomentAction, momentData: Partial<MomentEvent>, label?: string | undefined): Promise<void>;
3441
3474
  render(): void;
3442
3475
  }
@@ -3460,6 +3493,7 @@ export declare class BlazeWidgetStoryModal extends BlazeWidgetModal {
3460
3493
  open(options?: ISmoothOpenCloseModal): void;
3461
3494
  play(): void;
3462
3495
  render(): void;
3496
+ private shouldShowExitButton;
3463
3497
  playToggleCurrentStory(): void;
3464
3498
  onResize(): void;
3465
3499
  onResizeEventDelay(): void;
@@ -3487,7 +3521,12 @@ export declare class BlazeWidgetStoryPlayer extends WidgetAbstractPlayer {
3487
3521
  handleAnimationCompletion(content: BlazeWidgetStory, direction: ContentDirection): void;
3488
3522
  createAnimation(content: BlazeWidgetStory, direction: ContentDirection, targetIndex: number): anime.AnimeTimelineInstance;
3489
3523
  handleAnimationStart(content: BlazeWidgetStory, targetContent: BlazeWidgetStory, direction: ContentDirection): void;
3490
- closeWithAnimation(direction: Direction): void;
3524
+ animateCloseWithDirection(options: {
3525
+ direction: Direction;
3526
+ callback?: () => void;
3527
+ exitTrigger?: ExitTriggerType;
3528
+ navigationType?: NavigationType;
3529
+ }): void;
3491
3530
  onKeyDown(event: KeyboardEvent): false | undefined;
3492
3531
  render(): void;
3493
3532
  loadContentBatch(): void;
@@ -3551,16 +3590,19 @@ export declare class BlazeWidgetStory extends BlazeWidgetContent {
3551
3590
  adContext?: IAdContext;
3552
3591
  bannerAdElement?: BlazeWidgetBannerAd;
3553
3592
  constructor(playerStyle: StoryPlayerStyle, mode: ScreenMode);
3554
- private isButtonVisible;
3593
+ isButtonVisible(iconName: IconButtonType | StoryDirectionType): boolean | undefined;
3555
3594
  private createPlayerButtonsAndAppendToButtonsContainer;
3556
3595
  private createNavigationButtonsAndAppendToWidgetStoryContainer;
3596
+ private createResumeAfterBlurButton;
3557
3597
  private applyIconStyle;
3558
3598
  onShareClick(): Promise<void>;
3559
3599
  private updateCtaButtonLayout;
3560
3600
  private updateChip;
3561
3601
  setTheme(playerStyle: StoryPlayerStyle): void;
3602
+ private disableStoriesNavigationButtons;
3603
+ private disablePageNavigationButtons;
3562
3604
  private setButtonNavigationAsDisabled;
3563
- adjustAdView(): void;
3605
+ adjustContentView(): void;
3564
3606
  private setPlayerButtonPosition;
3565
3607
  updatePlayerButtonIcons(): void;
3566
3608
  handleCtaAction(event: Event, gestureType: StoryGestureType): boolean;
@@ -3601,6 +3643,10 @@ export declare class BlazeWidgetStory extends BlazeWidgetContent {
3601
3643
  resetPosition(): void;
3602
3644
  updateWidgetStatusReadUnread(): void;
3603
3645
  markAsRead(): Promise<any>;
3646
+ private hasNoMorePagesToPlay;
3647
+ isLastPage(): boolean;
3648
+ private isAutomaticNavigation;
3649
+ private handleLastPageAutomaticNavigation;
3604
3650
  goNextPage(navigationType?: NavigationType): void;
3605
3651
  goPrevPage(): void;
3606
3652
  disconnectedCallback(): void;
@@ -3608,6 +3654,8 @@ export declare class BlazeWidgetStory extends BlazeWidgetContent {
3608
3654
  updateCta(pageIndex: number): void;
3609
3655
  updatePlayerButtonsState(displayPageNavigationButtons?: boolean): void;
3610
3656
  updateButtonState(buttonType: ButtonNavigation, button: BlazeButton | undefined): void;
3657
+ private isSingleStoryWithAutoAdvance;
3658
+ private isStoryPagesNavigation;
3611
3659
  isNavigationButtonActive(navigationType: ButtonNavigation): boolean;
3612
3660
  updateNavButton(state: ButtonState, navButtonElement: BlazeButton): void;
3613
3661
  updatePlayerButtonsStyleAttributes(): void;