@inappstory/slide-api 0.1.38 → 0.1.40

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.cjs CHANGED
@@ -6383,7 +6383,7 @@ class Slider {
6383
6383
  timer.classList.add("cards-slider__timer--reverse-direction");
6384
6384
  }
6385
6385
  const timeline = document.createElement("div");
6386
- timeline.classList.add("cards-slider__timer_timeline", "touchable");
6386
+ timeline.classList.add("cards-slider__timer_timeline");
6387
6387
  const timelineFill = document.createElement("div");
6388
6388
  timelineFill.classList.add("cards-slider__timer_timeline-fill");
6389
6389
  timeline.append(timelineFill);
@@ -6549,6 +6549,8 @@ class Slider {
6549
6549
  }
6550
6550
  }
6551
6551
  async updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError) {
6552
+ // Don't use <activeSlide> and <activeIndex>, as <slideIndex> may differ from <activeIndex>
6553
+ const slide = this.slides[slideIndex];
6552
6554
  switch (action) {
6553
6555
  case "before_start" /* TIMELINE_ACTION.BEFORE_START */: {
6554
6556
  // switch timeline to active slide and wait for start (wait VOD loading)
@@ -6580,7 +6582,7 @@ class Slider {
6580
6582
  // we must resume timer - for trigger done callback and hide Card (SingleSlideTimer business logic)
6581
6583
  }
6582
6584
  if (resumeTimer) {
6583
- this.activeSlide?.timer.resume(currentTime, duration);
6585
+ slide?.timer.resume(currentTime, duration);
6584
6586
  }
6585
6587
  break;
6586
6588
  }
@@ -6588,7 +6590,7 @@ class Slider {
6588
6590
  if (showLoader) {
6589
6591
  this.config.onSlideDataWaiting();
6590
6592
  }
6591
- this.activeSlide?.timer.pause();
6593
+ slide?.timer.pause();
6592
6594
  if (this.isSingleSlideTimerActive) {
6593
6595
  this.pausedAt = new Date().getTime();
6594
6596
  }
@@ -6600,7 +6602,7 @@ class Slider {
6600
6602
  if (showError) {
6601
6603
  this.config.onSlideDataError();
6602
6604
  }
6603
- this.activeSlide?.timer.stop();
6605
+ slide?.timer.stop();
6604
6606
  // todo нужен STOP когда вручную переключаем слайд на другой
6605
6607
  // console.log("TIMELINE_ACTION.STOP", { activeSlide: this.activeSlide, duration });
6606
6608
  break;
@@ -6675,6 +6677,22 @@ class CardApi {
6675
6677
  this._overlappingActionBarHeight = config.overlappingActionBarHeight ?? 0;
6676
6678
  this._separateUserAndAppPause = config.separateUserAndAppPause;
6677
6679
  this._useSdkCacheForMultislideMode = config.useSdkCacheForMultislideMode;
6680
+ let isSafari = false;
6681
+ if (this.config.sdkApi.isIOS) {
6682
+ isSafari = true;
6683
+ }
6684
+ else {
6685
+ if (navigator.vendor &&
6686
+ navigator.vendor.indexOf("Apple") > -1 &&
6687
+ navigator.userAgent &&
6688
+ navigator.userAgent.indexOf("CriOS") == -1 &&
6689
+ navigator.userAgent.indexOf("FxiOS") == -1) {
6690
+ isSafari = true;
6691
+ }
6692
+ }
6693
+ if (isSafari) {
6694
+ this.config.root.classList.add("_isSafari");
6695
+ }
6678
6696
  this.refreshSizes = proxy(this.refreshSizes, this);
6679
6697
  this.getSdkClientVariables = proxy(this.getSdkClientVariables, this);
6680
6698
  this.refreshSizes();
@@ -17801,8 +17819,19 @@ class WidgetCopy extends WidgetBase {
17801
17819
  }
17802
17820
  onStart() {
17803
17821
  super.onStart();
17804
- // add active class for enable animation
17805
- this.resultLayer?.classList.add("active");
17822
+ /**
17823
+ * Prevent showing resultLayer on SlideStart when widget has animation
17824
+ * Clean up all possible animation classes (.narrative-element-animation-fade-in-up, etc.)
17825
+ */
17826
+ // TODO this is temporal workaround, in future - move animation on separated layer, prevent intersection with widget css properties
17827
+ this.resultLayer?.classList.remove("narrative-element-animation", "active", "animated");
17828
+ const toDelete = [];
17829
+ this.resultLayer?.classList.forEach(item => {
17830
+ if (item.includes("narrative-element-animation-")) {
17831
+ toDelete.push(item);
17832
+ }
17833
+ });
17834
+ this.resultLayer?.classList.remove(...toDelete);
17806
17835
  if (this.isPromotionalCode) {
17807
17836
  this.fetchPromoCode();
17808
17837
  }
@@ -24335,7 +24364,7 @@ class WidgetReactions extends WidgetBase {
24335
24364
  createReactionsModel() {
24336
24365
  return {
24337
24366
  icons: getTagData(this.element, "icons")?.split(",") ?? [],
24338
- showAnimationAfterSelection: Boolean(getTagData(this.element, "showAnimationAfterSelection")),
24367
+ showAnimationAfterSelection: getTagData(this.element, "showAnimationAfterSelection") === "true",
24339
24368
  resultDisplayMode: getTagData(this.element, "resultDisplayMode"),
24340
24369
  resultDisplayFormat: getTagData(this.element, "resultDisplayFormat"),
24341
24370
  };