@inappstory/slide-api 0.1.42 → 0.1.43

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
@@ -1202,6 +1202,9 @@ class EsModuleSdkApi {
1202
1202
  isSdkSupportCorrectPauseResumeLifecycle() {
1203
1203
  return true;
1204
1204
  }
1205
+ isSdkSupportVerticalSwipeGestureControl() {
1206
+ return true;
1207
+ }
1205
1208
  emitEvent(name, event) {
1206
1209
  this.sdkBinding.onEvent(name, event);
1207
1210
  }
@@ -3802,6 +3805,7 @@ class SlideTimeline {
3802
3805
  if (this.isSDKSupportUpdateTimeline) {
3803
3806
  this.timelineDisabledState = TimelineDisabledState.enabled;
3804
3807
  this.timeSpent = 0;
3808
+ this.resumedAt = new Date().getTime();
3805
3809
  this.updateTimeline("start" /* TIMELINE_ACTION.START */);
3806
3810
  }
3807
3811
  else {
@@ -5850,6 +5854,9 @@ class SlideApiDepsMultiSlideMode {
5850
5854
  enableVerticalSwipeGesture() {
5851
5855
  this.sdkApi.enableVerticalSwipeGesture();
5852
5856
  }
5857
+ isSdkSupportVerticalSwipeGestureControl() {
5858
+ return this.sdkApi.isSdkSupportVerticalSwipeGestureControl();
5859
+ }
5853
5860
  disableBackpress() {
5854
5861
  this.sdkApi.disableBackpress();
5855
5862
  }
@@ -6024,6 +6031,9 @@ class SlideApiDepsSingleSlideMode {
6024
6031
  enableVerticalSwipeGesture() {
6025
6032
  this.sdkApi.enableVerticalSwipeGesture();
6026
6033
  }
6034
+ isSdkSupportVerticalSwipeGestureControl() {
6035
+ return this.sdkApi.isSdkSupportVerticalSwipeGestureControl();
6036
+ }
6027
6037
  disableBackpress() {
6028
6038
  this.sdkApi.disableBackpress();
6029
6039
  }
@@ -20788,7 +20798,7 @@ class ProductDetailsBottomSheet extends RenderableComponent {
20788
20798
  });
20789
20799
  }
20790
20800
  renderTemplate() {
20791
- return h("div", { class: "ias-products-container-view" }, this.bottomSheet.render());
20801
+ return this.bottomSheet.render();
20792
20802
  }
20793
20803
  open(params) {
20794
20804
  this.showProductDetails(params);
@@ -20866,7 +20876,7 @@ class ProductCheckoutBottomSheet extends RenderableComponent {
20866
20876
  });
20867
20877
  }
20868
20878
  renderTemplate() {
20869
- return h("div", { class: "ias-products-container-view" }, this.bottomSheet.render());
20879
+ return this.bottomSheet.render();
20870
20880
  }
20871
20881
  open() {
20872
20882
  const productCheckout = this.factory.createProductCheckout(this.bottomSheet);
@@ -21643,6 +21653,7 @@ class WidgetProductCarousel extends WidgetBase {
21643
21653
  $carousel = null;
21644
21654
  $track = null;
21645
21655
  isTouchListenersInit = false;
21656
+ productsView = null;
21646
21657
  constructor(element, options, widgetCallbacks, widgetDeps) {
21647
21658
  super(element, options, widgetCallbacks, widgetDeps);
21648
21659
  this.captionView = this.element.querySelector(".narrative-element-text-lines");
@@ -21860,10 +21871,7 @@ class WidgetProductCarousel extends WidgetBase {
21860
21871
  }
21861
21872
  showProductDetails = ({ offer, card }) => {
21862
21873
  const bs = new ProductDetailsBottomSheet(this.widgetDeps, this.getBottomSheetParams());
21863
- const bsNode = bs.render();
21864
- if (!bsNode)
21865
- throw new BottomSheetMountingError();
21866
- this.slide.appendChild(bsNode);
21874
+ this.mountBottomSheet(bs);
21867
21875
  bs.open({ offer, isCartSupported: this.isCartSupported() });
21868
21876
  this.isBottomSheetOpened = true;
21869
21877
  this.disableHostUIInteraction();
@@ -21934,6 +21942,22 @@ class WidgetProductCarousel extends WidgetBase {
21934
21942
  });
21935
21943
  return button;
21936
21944
  }
21945
+ mountBottomSheet(bs) {
21946
+ if (this.productsView)
21947
+ return;
21948
+ const bsNode = bs.render();
21949
+ if (!bsNode)
21950
+ throw new BottomSheetMountingError();
21951
+ this.productsView = this.createProductsView();
21952
+ this.productsView.appendChild(bsNode);
21953
+ this.slide.appendChild(this.productsView);
21954
+ }
21955
+ createProductsView() {
21956
+ const containerView = document.createElement("div");
21957
+ containerView.classList.add("ias-products-container-view");
21958
+ containerView.dir = this.layoutDirection;
21959
+ return containerView;
21960
+ }
21937
21961
  async withTimeout(promise, timeout) {
21938
21962
  await Promise.race([promise, new Promise((resolve, reject) => setTimeout(reject, timeout))]);
21939
21963
  }
@@ -21949,10 +21973,7 @@ class WidgetProductCarousel extends WidgetBase {
21949
21973
  offerId: offerDto.offerId,
21950
21974
  quantity: 1,
21951
21975
  }), ADD_TO_CART_TIMEOUT);
21952
- const bsNode = bs.render();
21953
- if (!bsNode)
21954
- throw new BottomSheetMountingError();
21955
- this.slide.appendChild(bsNode);
21976
+ this.mountBottomSheet(bs);
21956
21977
  bs.open();
21957
21978
  this.isBottomSheetOpened = true;
21958
21979
  this.disableHostUIInteraction();
@@ -21990,6 +22011,10 @@ class WidgetProductCarousel extends WidgetBase {
21990
22011
  }
21991
22012
  this.isBottomSheetOpened = false;
21992
22013
  this.enableHostUIInteraction();
22014
+ if (this.productsView) {
22015
+ this.slide.removeChild(this.productsView);
22016
+ this.productsView = null;
22017
+ }
21993
22018
  },
21994
22019
  };
21995
22020
  }
@@ -26653,6 +26678,9 @@ class WidgetScratchCard extends WidgetBase {
26653
26678
  this.widgetDeps.slideApiDeps.disableHorizontalSwipeGesture();
26654
26679
  this.widgetDeps.slideApiDeps.disableVerticalSwipeGesture();
26655
26680
  this._isClickCaptured = true;
26681
+ if (!this.widgetDeps.slideApiDeps.isSdkSupportVerticalSwipeGestureControl()) {
26682
+ this.scratchLayer?.startCompleteReveal();
26683
+ }
26656
26684
  }
26657
26685
  static api = {
26658
26686
  widgetClassName: WidgetScratchCard.widgetClassName,