@inappstory/slide-api 0.1.6 → 0.1.8

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
@@ -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
  */
package/dist/index.d.ts CHANGED
@@ -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
  */
package/dist/index.js CHANGED
@@ -1149,6 +1149,12 @@ class EsModuleSdkApi {
1149
1149
  enableVerticalSwipeGesture() {
1150
1150
  this.sdkBinding.enableVerticalSwipeGesture();
1151
1151
  }
1152
+ disableHorizontalSwipeGesture() {
1153
+ this.sdkBinding.disableHorizontalSwipeGesture();
1154
+ }
1155
+ enableHorizontalSwipeGesture() {
1156
+ this.sdkBinding.enableHorizontalSwipeGesture();
1157
+ }
1152
1158
  disableBackpress() { }
1153
1159
  enableBackpress() { }
1154
1160
  closeCard(reason) {
@@ -2032,37 +2038,25 @@ const waitForImageHtmlElementLoad = async (nodeRef) => {
2032
2038
  // this is already in HTML markup
2033
2039
  // nodeRef.decoding = "sync";
2034
2040
  if (nodeRef.decode != null) {
2035
- // requestAnimationFrame(() =>
2036
- requestAnimationFrame(() => {
2037
- nodeRef.decode().then(() => {
2038
- // @ts-ignore
2039
- // _log("img loaded 1", true);
2040
- resolve(nodeRef);
2041
- nodeRef.removeEventListener("load", onLoad);
2042
- }, reason => reject(reason));
2043
- });
2044
- // );
2041
+ nodeRef.decode().then(() => resolve(nodeRef), reason => reject(reason));
2045
2042
  }
2046
2043
  else {
2047
2044
  requestAnimationFrame(() => requestAnimationFrame(() => {
2048
- // @ts-ignore
2049
- // _log("img loaded 1", true);
2050
2045
  resolve(nodeRef);
2051
- nodeRef.removeEventListener("load", onLoad);
2052
2046
  }));
2053
2047
  }
2048
+ nodeRef.removeEventListener("load", onLoad);
2054
2049
  };
2055
2050
  nodeRef.addEventListener("load", onLoad);
2056
- // if (nodeRef.complete && 0 !== nodeRef.naturalHeight) {
2057
- // requestAnimationFrame(() => {
2058
- // requestAnimationFrame(() => {
2059
- // // @ts-ignore
2060
- // _log("img loaded 2", true)
2061
- // resolve(nodeRef);
2062
- // });
2063
- // });
2064
- // }
2065
2051
  nodeRef.addEventListener("error", err => reject(err));
2052
+ if (nodeRef.complete && 0 !== nodeRef.naturalHeight) {
2053
+ if (nodeRef.decode != null) {
2054
+ nodeRef.decode().then(() => resolve(nodeRef), reason => reject(reason));
2055
+ }
2056
+ else {
2057
+ requestAnimationFrame(() => requestAnimationFrame(() => resolve(nodeRef)));
2058
+ }
2059
+ }
2066
2060
  });
2067
2061
  };
2068
2062
  // export const waitForImageHtmlElementLoad = async (nodeRef: HTMLImageElement): Promise<HTMLImageElement> => {
@@ -2249,10 +2243,17 @@ class Video {
2249
2243
  }
2250
2244
  }
2251
2245
  this._isVOD = Boolean(this._vodData != null && this._VideoPlayer != null);
2252
- if (this._isVOD) {
2253
- this.mediaElementsLoadingPromises.push(this._initVOD(this._vodData));
2254
- }
2246
+ if (this._isVOD) ;
2255
2247
  else {
2248
+ if (this._vodData != null && Array.isArray(this._vodData.formats)) {
2249
+ this._vodData.formats.forEach(format => {
2250
+ const videoSource = window.document.createElement("source");
2251
+ videoSource.type = format.mimeType;
2252
+ videoSource.src = format.url;
2253
+ videoSource.dataset.remoteSrc = format.url;
2254
+ this._video.appendChild(videoSource);
2255
+ });
2256
+ }
2256
2257
  this.mediaElementsLoadingPromises.push(waitForVideoHtmlElementLoad(this._video));
2257
2258
  }
2258
2259
  // console.log({mediaElementsLoadingPromises: this.mediaElementsLoadingPromises})
@@ -2352,7 +2353,7 @@ class Video {
2352
2353
  this._vodPlayerInstance = player;
2353
2354
  // This runs if the asynchronous load is successful.
2354
2355
  // @ts-ignore
2355
- _log("vod loaded 1", true);
2356
+ // _log("vod loaded 1", true);
2356
2357
  resolve(this._video);
2357
2358
  })
2358
2359
  .catch(reason => {
@@ -3872,7 +3873,7 @@ let SlideApi$1 = class SlideApi {
3872
3873
  async _onAllMediaLoaded(slide) {
3873
3874
  return new Promise((resolve, reject) => {
3874
3875
  const promises = slide.layers.flatMap(layer => layer.elements.flatMap(element => element.mediaElementsLoadingPromises));
3875
- console.log({ promises });
3876
+ // console.log({ promises });
3876
3877
  let checkerTimerId = undefined;
3877
3878
  let timeOutFired = false;
3878
3879
  if (promises.length > 0) {
@@ -17111,6 +17112,7 @@ class WidgetProducts extends WidgetBase {
17111
17112
  this.isOpen = true;
17112
17113
  // prevent next slide navigation gesture
17113
17114
  this.isClickCapturedByWidget = true;
17115
+ this.sdkApi.disableHorizontalSwipeGesture();
17114
17116
  this.sdkApi.disableVerticalSwipeGesture();
17115
17117
  this.sdkApi.disableBackpress();
17116
17118
  this._statEventWidgetOpen(this.currentModels);
@@ -17130,6 +17132,7 @@ class WidgetProducts extends WidgetBase {
17130
17132
  this.productsView?.classList.add("ias-products-container-view--hidden");
17131
17133
  this.element.classList.remove("hidden");
17132
17134
  this.isClickCapturedByWidget = false;
17135
+ this.sdkApi.enableHorizontalSwipeGesture();
17133
17136
  if (this.swipeGestureDetector != null) {
17134
17137
  this.swipeGestureDetector.destroy();
17135
17138
  this.swipeGestureDetector = null;
@@ -18589,6 +18592,7 @@ class WidgetRangeSlider extends WidgetBase {
18589
18592
  }
18590
18593
  e.preventDefault();
18591
18594
  this.isClickCapturedBySlider = true;
18595
+ this.sdkApi.disableHorizontalSwipeGesture();
18592
18596
  if (!this.maxHandlePos) {
18593
18597
  this.update(true, false);
18594
18598
  }
@@ -18618,6 +18622,7 @@ class WidgetRangeSlider extends WidgetBase {
18618
18622
  handleEnd(e) {
18619
18623
  this.env.requestAnimationFrame(() => {
18620
18624
  this.isClickCapturedBySlider = false;
18625
+ this.sdkApi.enableHorizontalSwipeGesture();
18621
18626
  });
18622
18627
  // e.preventDefault();
18623
18628
  this.env.document.removeEventListener("touchmove", this.handleMove);