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