@inappstory/slide-api 0.1.7 → 0.1.9

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/dist/index.d.cts CHANGED
@@ -817,9 +817,9 @@ declare class SlideTimeline {
817
817
  private readonly slideDuration;
818
818
  private readonly slideDisabledTimer;
819
819
  private readonly slideReady;
820
- private readonly _afterResumeQueuePush;
820
+ private readonly _afterAppResumeQueuePush;
821
821
  private readonly sdkApi;
822
- constructor(slideIndex: number, slideDuration: number, slideDisabledTimer: boolean, slideReady: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void, sdkApi: SDKApi);
822
+ constructor(slideIndex: number, slideDuration: number, slideDisabledTimer: boolean, slideReady: Promise<void>, _afterAppResumeQueuePush: (cb: () => void) => void, sdkApi: SDKApi);
823
823
  private resumedAt;
824
824
  private timeSpent;
825
825
  private timelineDisabledState;
@@ -926,6 +926,8 @@ interface SDKApi {
926
926
  getCardFonts(): Array<FontDTO>;
927
927
  disableVerticalSwipeGesture(): void;
928
928
  enableVerticalSwipeGesture(): void;
929
+ disableHorizontalSwipeGesture(): void;
930
+ enableHorizontalSwipeGesture(): void;
929
931
  disableBackpress(): void;
930
932
  enableBackpress(): void;
931
933
  closeCard(reason: string): void;
@@ -1181,13 +1183,21 @@ interface SDKInterface {
1181
1183
  */
1182
1184
  showToast(text: string): void;
1183
1185
  /**
1184
- * Stop react on any detected vertical swipe gesture
1186
+ * Stop reacting on any detected vertical swipe gesture
1185
1187
  */
1186
1188
  disableVerticalSwipeGesture(): void;
1187
1189
  /**
1188
- * Continue to react on any vertical swipe gesture
1190
+ * Continue reacting on any vertical swipe gesture
1189
1191
  */
1190
1192
  enableVerticalSwipeGesture(): void;
1193
+ /**
1194
+ * Stop reacting on any detected horizontal swipe gesture
1195
+ */
1196
+ disableHorizontalSwipeGesture(): void;
1197
+ /**
1198
+ * Stop reacting on any detected vertical swipe gesture
1199
+ */
1200
+ enableHorizontalSwipeGesture(): void;
1191
1201
  /**
1192
1202
  * Intent with action - close card (story | IAM)
1193
1203
  */
@@ -1549,13 +1559,13 @@ declare class Video implements IElement {
1549
1559
  declare class Slide {
1550
1560
  private readonly _slidesNodesRefs;
1551
1561
  private readonly _slideReadyPromise;
1552
- private readonly _afterResumeQueuePush;
1562
+ private readonly _afterAppResumeQueuePush;
1553
1563
  private readonly _afterStartInitQueuePush;
1554
1564
  private readonly _showNextSlide;
1555
1565
  readonly sdkApi: SDKApi;
1556
1566
  private readonly _layers;
1557
1567
  private _start;
1558
- constructor(_slidesNodesRefs: Array<HTMLElement>, _slideReadyPromise: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void, _afterStartInitQueuePush: (cb: () => void) => void, _showNextSlide: (duration: number) => void, sdkApi: SDKApi);
1568
+ constructor(_slidesNodesRefs: Array<HTMLElement>, _slideReadyPromise: Promise<void>, _afterAppResumeQueuePush: (cb: () => void) => void, _afterStartInitQueuePush: (cb: () => void) => void, _showNextSlide: (duration: number) => void, sdkApi: SDKApi);
1559
1569
  private _activeLayer;
1560
1570
  get activeLayer(): Layer;
1561
1571
  get layers(): Array<Layer>;
@@ -1581,7 +1591,7 @@ declare class Layer {
1581
1591
  private readonly _nodeRef;
1582
1592
  private readonly _slide;
1583
1593
  private readonly _slideReadyPromise;
1584
- private readonly _afterResumeQueuePush;
1594
+ private readonly _afterAppResumeQueuePush;
1585
1595
  private readonly _afterStartInitQueuePush;
1586
1596
  private readonly _showNextSlide;
1587
1597
  readonly sdkApi: SDKApi;
@@ -1594,7 +1604,7 @@ declare class Layer {
1594
1604
  private readonly _disabledNavigation;
1595
1605
  private _elements;
1596
1606
  private readonly _timeline;
1597
- constructor(_nodeRef: HTMLElement, _slide: Slide, _slideReadyPromise: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void, _afterStartInitQueuePush: (cb: () => void) => void, _showNextSlide: (duration: number) => void, sdkApi: SDKApi);
1607
+ constructor(_nodeRef: HTMLElement, _slide: Slide, _slideReadyPromise: Promise<void>, _afterAppResumeQueuePush: (cb: () => void) => void, _afterStartInitQueuePush: (cb: () => void) => void, _showNextSlide: (duration: number) => void, sdkApi: SDKApi);
1598
1608
  init(localData: LocalData): Array<Promise<boolean>>;
1599
1609
  get nodeRef(): HTMLElement;
1600
1610
  get elements(): Array<IElement>;
@@ -1636,7 +1646,7 @@ declare class Layer {
1636
1646
  stopInternal(options: {
1637
1647
  prepareForRestart: ON_SLIDE_STOP_PREPARE_FOR_RESTART;
1638
1648
  }): void;
1639
- pause(resetVideoTime?: boolean, stopAnimation?: boolean): Promise<{
1649
+ pause(resetVideoTime?: boolean, stopAnimation?: boolean, updateTimeline?: boolean): Promise<{
1640
1650
  currentTime: number | null;
1641
1651
  }>;
1642
1652
  resume(): Promise<unknown>;
@@ -1652,11 +1662,14 @@ declare const enum STATE {
1652
1662
  STARTED = 3,
1653
1663
  RESUME = 4,
1654
1664
  RESUMED = 5,
1655
- PAUSE = 6,
1656
- PAUSED = 7,
1657
- FORCE_PAUSED = 8,
1658
- STOP = 9,
1659
- STOPPED = 10
1665
+ APP_PAUSE = 6,
1666
+ APP_PAUSED = 7,
1667
+ USER_PAUSE = 8,
1668
+ USER_PAUSED = 9,
1669
+ FORCE_PAUSED = 10,
1670
+ STOP = 11,
1671
+ STOPPED = 12,
1672
+ DESTROYED = 13
1660
1673
  }
1661
1674
  declare class SlideApi {
1662
1675
  private readonly config;
@@ -1668,6 +1681,7 @@ declare class SlideApi {
1668
1681
  private readonly _getViewportWidth;
1669
1682
  private readonly _getViewportHeight;
1670
1683
  private readonly _overlappingActionBarHeight;
1684
+ private readonly _separateUserAndAppPause;
1671
1685
  readonly sdkApi: SDKApi;
1672
1686
  constructor(config: {
1673
1687
  sdkApi: SDKApi;
@@ -1681,20 +1695,23 @@ declare class SlideApi {
1681
1695
  slideRatio: number;
1682
1696
  isFullscreen: boolean;
1683
1697
  slideLoadedCb?: (data: {
1684
- slide: Slide;
1698
+ cardId: number;
1699
+ slideIndex: number;
1685
1700
  result: boolean;
1686
1701
  reason?: string;
1687
1702
  }) => void;
1688
1703
  getViewportWidth: () => number;
1689
1704
  getViewportHeight: () => number;
1690
1705
  overlappingActionBarHeight?: number;
1706
+ separateUserAndAppPause: boolean;
1691
1707
  });
1692
1708
  destroy(): void;
1693
1709
  private initListeners;
1694
1710
  private destroyListeners;
1695
1711
  private refreshSizes;
1696
1712
  showSlide(html: string): Promise<{
1697
- slide: Slide;
1713
+ cardId: number;
1714
+ slideIndex: number;
1698
1715
  result: boolean;
1699
1716
  reason?: string;
1700
1717
  }>;
@@ -1703,17 +1720,17 @@ declare class SlideApi {
1703
1720
  private getLocalData;
1704
1721
  private _fontsInit;
1705
1722
  private _initAndLoadFonts;
1723
+ // todo nullable
1706
1724
  private _slide;
1707
1725
  private _slideInInit;
1708
1726
  private _state;
1709
1727
  private _afterStartInitQueue;
1710
- private _afterResumeQueue;
1728
+ private _afterAppResumeQueue;
1711
1729
  get state(): STATE;
1712
1730
  private _onAllMediaLoaded;
1713
1731
  private _init;
1714
1732
  private _slideInRender;
1715
1733
  private _slideBoxRenderComplete;
1716
- private _slideBoxRenderError;
1717
1734
  private _slideConfig;
1718
1735
  slideStart(config: {
1719
1736
  muted?: boolean;
@@ -1726,8 +1743,16 @@ declare class SlideApi {
1726
1743
  currentTime: number;
1727
1744
  }>;
1728
1745
  private _pauseCbTimer;
1729
- slidePause(): Promise<void>;
1730
- slideResume(): Promise<void>;
1746
+ slideUserPause(): Promise<void>;
1747
+ slideUserResume(): Promise<void>;
1748
+ /**
1749
+ * Call on app gone background
1750
+ */
1751
+ slideAppPause(): Promise<void>;
1752
+ /**
1753
+ * Call on app gone foreground after a background
1754
+ */
1755
+ slideAppResume(): Promise<void>;
1731
1756
  slideStop(options: {
1732
1757
  prepareForRestart: ON_SLIDE_STOP_PREPARE_FOR_RESTART;
1733
1758
  }): Promise<void>;
@@ -1742,7 +1767,7 @@ declare class SlideApi {
1742
1767
  disableAudio(): void;
1743
1768
  get isStopped(): boolean;
1744
1769
  afterStartInitQueuePush(cb: () => void): false | undefined;
1745
- afterResumeQueuePush(cb: () => void): false | undefined;
1770
+ afterAppResumeQueuePush(cb: () => void): false | undefined;
1746
1771
  get activeLayer(): Layer;
1747
1772
  get slide(): Slide;
1748
1773
  showLayer(index: number): void;
package/dist/index.d.ts CHANGED
@@ -817,9 +817,9 @@ declare class SlideTimeline {
817
817
  private readonly slideDuration;
818
818
  private readonly slideDisabledTimer;
819
819
  private readonly slideReady;
820
- private readonly _afterResumeQueuePush;
820
+ private readonly _afterAppResumeQueuePush;
821
821
  private readonly sdkApi;
822
- constructor(slideIndex: number, slideDuration: number, slideDisabledTimer: boolean, slideReady: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void, sdkApi: SDKApi);
822
+ constructor(slideIndex: number, slideDuration: number, slideDisabledTimer: boolean, slideReady: Promise<void>, _afterAppResumeQueuePush: (cb: () => void) => void, sdkApi: SDKApi);
823
823
  private resumedAt;
824
824
  private timeSpent;
825
825
  private timelineDisabledState;
@@ -926,6 +926,8 @@ interface SDKApi {
926
926
  getCardFonts(): Array<FontDTO>;
927
927
  disableVerticalSwipeGesture(): void;
928
928
  enableVerticalSwipeGesture(): void;
929
+ disableHorizontalSwipeGesture(): void;
930
+ enableHorizontalSwipeGesture(): void;
929
931
  disableBackpress(): void;
930
932
  enableBackpress(): void;
931
933
  closeCard(reason: string): void;
@@ -1181,13 +1183,21 @@ interface SDKInterface {
1181
1183
  */
1182
1184
  showToast(text: string): void;
1183
1185
  /**
1184
- * Stop react on any detected vertical swipe gesture
1186
+ * Stop reacting on any detected vertical swipe gesture
1185
1187
  */
1186
1188
  disableVerticalSwipeGesture(): void;
1187
1189
  /**
1188
- * Continue to react on any vertical swipe gesture
1190
+ * Continue reacting on any vertical swipe gesture
1189
1191
  */
1190
1192
  enableVerticalSwipeGesture(): void;
1193
+ /**
1194
+ * Stop reacting on any detected horizontal swipe gesture
1195
+ */
1196
+ disableHorizontalSwipeGesture(): void;
1197
+ /**
1198
+ * Stop reacting on any detected vertical swipe gesture
1199
+ */
1200
+ enableHorizontalSwipeGesture(): void;
1191
1201
  /**
1192
1202
  * Intent with action - close card (story | IAM)
1193
1203
  */
@@ -1549,13 +1559,13 @@ declare class Video implements IElement {
1549
1559
  declare class Slide {
1550
1560
  private readonly _slidesNodesRefs;
1551
1561
  private readonly _slideReadyPromise;
1552
- private readonly _afterResumeQueuePush;
1562
+ private readonly _afterAppResumeQueuePush;
1553
1563
  private readonly _afterStartInitQueuePush;
1554
1564
  private readonly _showNextSlide;
1555
1565
  readonly sdkApi: SDKApi;
1556
1566
  private readonly _layers;
1557
1567
  private _start;
1558
- constructor(_slidesNodesRefs: Array<HTMLElement>, _slideReadyPromise: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void, _afterStartInitQueuePush: (cb: () => void) => void, _showNextSlide: (duration: number) => void, sdkApi: SDKApi);
1568
+ constructor(_slidesNodesRefs: Array<HTMLElement>, _slideReadyPromise: Promise<void>, _afterAppResumeQueuePush: (cb: () => void) => void, _afterStartInitQueuePush: (cb: () => void) => void, _showNextSlide: (duration: number) => void, sdkApi: SDKApi);
1559
1569
  private _activeLayer;
1560
1570
  get activeLayer(): Layer;
1561
1571
  get layers(): Array<Layer>;
@@ -1581,7 +1591,7 @@ declare class Layer {
1581
1591
  private readonly _nodeRef;
1582
1592
  private readonly _slide;
1583
1593
  private readonly _slideReadyPromise;
1584
- private readonly _afterResumeQueuePush;
1594
+ private readonly _afterAppResumeQueuePush;
1585
1595
  private readonly _afterStartInitQueuePush;
1586
1596
  private readonly _showNextSlide;
1587
1597
  readonly sdkApi: SDKApi;
@@ -1594,7 +1604,7 @@ declare class Layer {
1594
1604
  private readonly _disabledNavigation;
1595
1605
  private _elements;
1596
1606
  private readonly _timeline;
1597
- constructor(_nodeRef: HTMLElement, _slide: Slide, _slideReadyPromise: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void, _afterStartInitQueuePush: (cb: () => void) => void, _showNextSlide: (duration: number) => void, sdkApi: SDKApi);
1607
+ constructor(_nodeRef: HTMLElement, _slide: Slide, _slideReadyPromise: Promise<void>, _afterAppResumeQueuePush: (cb: () => void) => void, _afterStartInitQueuePush: (cb: () => void) => void, _showNextSlide: (duration: number) => void, sdkApi: SDKApi);
1598
1608
  init(localData: LocalData): Array<Promise<boolean>>;
1599
1609
  get nodeRef(): HTMLElement;
1600
1610
  get elements(): Array<IElement>;
@@ -1636,7 +1646,7 @@ declare class Layer {
1636
1646
  stopInternal(options: {
1637
1647
  prepareForRestart: ON_SLIDE_STOP_PREPARE_FOR_RESTART;
1638
1648
  }): void;
1639
- pause(resetVideoTime?: boolean, stopAnimation?: boolean): Promise<{
1649
+ pause(resetVideoTime?: boolean, stopAnimation?: boolean, updateTimeline?: boolean): Promise<{
1640
1650
  currentTime: number | null;
1641
1651
  }>;
1642
1652
  resume(): Promise<unknown>;
@@ -1652,11 +1662,14 @@ declare const enum STATE {
1652
1662
  STARTED = 3,
1653
1663
  RESUME = 4,
1654
1664
  RESUMED = 5,
1655
- PAUSE = 6,
1656
- PAUSED = 7,
1657
- FORCE_PAUSED = 8,
1658
- STOP = 9,
1659
- STOPPED = 10
1665
+ APP_PAUSE = 6,
1666
+ APP_PAUSED = 7,
1667
+ USER_PAUSE = 8,
1668
+ USER_PAUSED = 9,
1669
+ FORCE_PAUSED = 10,
1670
+ STOP = 11,
1671
+ STOPPED = 12,
1672
+ DESTROYED = 13
1660
1673
  }
1661
1674
  declare class SlideApi {
1662
1675
  private readonly config;
@@ -1668,6 +1681,7 @@ declare class SlideApi {
1668
1681
  private readonly _getViewportWidth;
1669
1682
  private readonly _getViewportHeight;
1670
1683
  private readonly _overlappingActionBarHeight;
1684
+ private readonly _separateUserAndAppPause;
1671
1685
  readonly sdkApi: SDKApi;
1672
1686
  constructor(config: {
1673
1687
  sdkApi: SDKApi;
@@ -1681,20 +1695,23 @@ declare class SlideApi {
1681
1695
  slideRatio: number;
1682
1696
  isFullscreen: boolean;
1683
1697
  slideLoadedCb?: (data: {
1684
- slide: Slide;
1698
+ cardId: number;
1699
+ slideIndex: number;
1685
1700
  result: boolean;
1686
1701
  reason?: string;
1687
1702
  }) => void;
1688
1703
  getViewportWidth: () => number;
1689
1704
  getViewportHeight: () => number;
1690
1705
  overlappingActionBarHeight?: number;
1706
+ separateUserAndAppPause: boolean;
1691
1707
  });
1692
1708
  destroy(): void;
1693
1709
  private initListeners;
1694
1710
  private destroyListeners;
1695
1711
  private refreshSizes;
1696
1712
  showSlide(html: string): Promise<{
1697
- slide: Slide;
1713
+ cardId: number;
1714
+ slideIndex: number;
1698
1715
  result: boolean;
1699
1716
  reason?: string;
1700
1717
  }>;
@@ -1703,17 +1720,17 @@ declare class SlideApi {
1703
1720
  private getLocalData;
1704
1721
  private _fontsInit;
1705
1722
  private _initAndLoadFonts;
1723
+ // todo nullable
1706
1724
  private _slide;
1707
1725
  private _slideInInit;
1708
1726
  private _state;
1709
1727
  private _afterStartInitQueue;
1710
- private _afterResumeQueue;
1728
+ private _afterAppResumeQueue;
1711
1729
  get state(): STATE;
1712
1730
  private _onAllMediaLoaded;
1713
1731
  private _init;
1714
1732
  private _slideInRender;
1715
1733
  private _slideBoxRenderComplete;
1716
- private _slideBoxRenderError;
1717
1734
  private _slideConfig;
1718
1735
  slideStart(config: {
1719
1736
  muted?: boolean;
@@ -1726,8 +1743,16 @@ declare class SlideApi {
1726
1743
  currentTime: number;
1727
1744
  }>;
1728
1745
  private _pauseCbTimer;
1729
- slidePause(): Promise<void>;
1730
- slideResume(): Promise<void>;
1746
+ slideUserPause(): Promise<void>;
1747
+ slideUserResume(): Promise<void>;
1748
+ /**
1749
+ * Call on app gone background
1750
+ */
1751
+ slideAppPause(): Promise<void>;
1752
+ /**
1753
+ * Call on app gone foreground after a background
1754
+ */
1755
+ slideAppResume(): Promise<void>;
1731
1756
  slideStop(options: {
1732
1757
  prepareForRestart: ON_SLIDE_STOP_PREPARE_FOR_RESTART;
1733
1758
  }): Promise<void>;
@@ -1742,7 +1767,7 @@ declare class SlideApi {
1742
1767
  disableAudio(): void;
1743
1768
  get isStopped(): boolean;
1744
1769
  afterStartInitQueuePush(cb: () => void): false | undefined;
1745
- afterResumeQueuePush(cb: () => void): false | undefined;
1770
+ afterAppResumeQueuePush(cb: () => void): false | undefined;
1746
1771
  get activeLayer(): Layer;
1747
1772
  get slide(): Slide;
1748
1773
  showLayer(index: number): void;