@inappstory/slide-api 0.1.49 → 0.1.51
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 +301 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -5
- package/dist/index.d.ts +37 -5
- package/dist/index.js +301 -53
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
|
|
1
3
|
const CONSTRUCTOR_ARGUMENTS_SYMBOL_IDENTIFIER = `___CTOR_ARGS___`;
|
|
2
4
|
const CONSTRUCTOR_ARGUMENTS_SYMBOL = Symbol.for(CONSTRUCTOR_ARGUMENTS_SYMBOL_IDENTIFIER);
|
|
3
5
|
|
|
@@ -1296,6 +1298,7 @@ const DEFAULT_SLIDE_DURATION = 10000;
|
|
|
1296
1298
|
class DataInput {
|
|
1297
1299
|
_elementNodeRef;
|
|
1298
1300
|
_layer;
|
|
1301
|
+
_layersNodesRefs;
|
|
1299
1302
|
_widgetApi;
|
|
1300
1303
|
_widgetCallbacks;
|
|
1301
1304
|
_widgetDeps;
|
|
@@ -1303,9 +1306,10 @@ class DataInput {
|
|
|
1303
1306
|
static className() {
|
|
1304
1307
|
return DataInput._className;
|
|
1305
1308
|
}
|
|
1306
|
-
constructor(_elementNodeRef, _layer, _widgetApi, _widgetCallbacks, _widgetDeps) {
|
|
1309
|
+
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi, _widgetCallbacks, _widgetDeps) {
|
|
1307
1310
|
this._elementNodeRef = _elementNodeRef;
|
|
1308
1311
|
this._layer = _layer;
|
|
1312
|
+
this._layersNodesRefs = _layersNodesRefs;
|
|
1309
1313
|
this._widgetApi = _widgetApi;
|
|
1310
1314
|
this._widgetCallbacks = _widgetCallbacks;
|
|
1311
1315
|
this._widgetDeps = _widgetDeps;
|
|
@@ -1319,7 +1323,7 @@ class DataInput {
|
|
|
1319
1323
|
}
|
|
1320
1324
|
init(localData) {
|
|
1321
1325
|
try {
|
|
1322
|
-
this._widgetApi.init(this._elementNodeRef, localData, this._widgetCallbacks, this._widgetDeps);
|
|
1326
|
+
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData, this._widgetCallbacks, this._widgetDeps);
|
|
1323
1327
|
}
|
|
1324
1328
|
catch (e) {
|
|
1325
1329
|
console.error(e);
|
|
@@ -1337,6 +1341,9 @@ class DataInput {
|
|
|
1337
1341
|
onBeforeUnmount() {
|
|
1338
1342
|
return Promise.resolve();
|
|
1339
1343
|
}
|
|
1344
|
+
onRefreshUserData(localData) {
|
|
1345
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1346
|
+
}
|
|
1340
1347
|
handleClick() {
|
|
1341
1348
|
return false;
|
|
1342
1349
|
}
|
|
@@ -1346,7 +1353,7 @@ class DataInput {
|
|
|
1346
1353
|
get isLayerForcePaused() {
|
|
1347
1354
|
return false;
|
|
1348
1355
|
}
|
|
1349
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetDataInput.api`, `WidgetCallbacks`, `WidgetDeps`]; }
|
|
1356
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetDataInput.api`, `WidgetCallbacks`, `WidgetDeps`]; }
|
|
1350
1357
|
}
|
|
1351
1358
|
|
|
1352
1359
|
class Barcode {
|
|
@@ -1390,6 +1397,9 @@ class Barcode {
|
|
|
1390
1397
|
onBeforeUnmount() {
|
|
1391
1398
|
return Promise.resolve();
|
|
1392
1399
|
}
|
|
1400
|
+
onRefreshUserData(localData) {
|
|
1401
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1402
|
+
}
|
|
1393
1403
|
handleClick() {
|
|
1394
1404
|
return false;
|
|
1395
1405
|
}
|
|
@@ -1555,6 +1565,7 @@ class PromocodeLink {
|
|
|
1555
1565
|
onBeforeUnmount() {
|
|
1556
1566
|
return Promise.resolve();
|
|
1557
1567
|
}
|
|
1568
|
+
onRefreshUserData(localData) { }
|
|
1558
1569
|
handleClick() {
|
|
1559
1570
|
switch (this.state) {
|
|
1560
1571
|
case PromocodeLinkState.Idle:
|
|
@@ -1702,6 +1713,7 @@ class Button extends ClickableBase {
|
|
|
1702
1713
|
this.promocodeLink?.onStart();
|
|
1703
1714
|
}
|
|
1704
1715
|
onStop() { }
|
|
1716
|
+
onRefreshUserData(localData) { }
|
|
1705
1717
|
onBeforeUnmount() {
|
|
1706
1718
|
return Promise.resolve();
|
|
1707
1719
|
}
|
|
@@ -1755,6 +1767,9 @@ class Copy {
|
|
|
1755
1767
|
onBeforeUnmount() {
|
|
1756
1768
|
return Promise.resolve();
|
|
1757
1769
|
}
|
|
1770
|
+
onRefreshUserData(localData) {
|
|
1771
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1772
|
+
}
|
|
1758
1773
|
handleClick() {
|
|
1759
1774
|
return false;
|
|
1760
1775
|
}
|
|
@@ -1811,6 +1826,9 @@ class DateCountdown {
|
|
|
1811
1826
|
onBeforeUnmount() {
|
|
1812
1827
|
return Promise.resolve();
|
|
1813
1828
|
}
|
|
1829
|
+
onRefreshUserData(localData) {
|
|
1830
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1831
|
+
}
|
|
1814
1832
|
handleClick() {
|
|
1815
1833
|
return false;
|
|
1816
1834
|
}
|
|
@@ -1864,6 +1882,9 @@ class Poll {
|
|
|
1864
1882
|
onBeforeUnmount() {
|
|
1865
1883
|
return Promise.resolve();
|
|
1866
1884
|
}
|
|
1885
|
+
onRefreshUserData(localData) {
|
|
1886
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1887
|
+
}
|
|
1867
1888
|
handleClick() {
|
|
1868
1889
|
return false;
|
|
1869
1890
|
}
|
|
@@ -1922,6 +1943,9 @@ class PollLayers {
|
|
|
1922
1943
|
onBeforeUnmount() {
|
|
1923
1944
|
return Promise.resolve();
|
|
1924
1945
|
}
|
|
1946
|
+
onRefreshUserData(localData) {
|
|
1947
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1948
|
+
}
|
|
1925
1949
|
handleClick() {
|
|
1926
1950
|
return false;
|
|
1927
1951
|
}
|
|
@@ -1975,6 +1999,9 @@ class Products {
|
|
|
1975
1999
|
onBeforeUnmount() {
|
|
1976
2000
|
return Promise.resolve();
|
|
1977
2001
|
}
|
|
2002
|
+
onRefreshUserData(localData) {
|
|
2003
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2004
|
+
}
|
|
1978
2005
|
handleClick() {
|
|
1979
2006
|
return false;
|
|
1980
2007
|
}
|
|
@@ -2037,6 +2064,9 @@ class ProductCarousel {
|
|
|
2037
2064
|
onBeforeUnmount() {
|
|
2038
2065
|
return Promise.resolve();
|
|
2039
2066
|
}
|
|
2067
|
+
onRefreshUserData(localData) {
|
|
2068
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2069
|
+
}
|
|
2040
2070
|
handleClick() {
|
|
2041
2071
|
return false;
|
|
2042
2072
|
}
|
|
@@ -2090,6 +2120,9 @@ class Quest {
|
|
|
2090
2120
|
onBeforeUnmount() {
|
|
2091
2121
|
return Promise.resolve();
|
|
2092
2122
|
}
|
|
2123
|
+
onRefreshUserData(localData) {
|
|
2124
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2125
|
+
}
|
|
2093
2126
|
handleClick() {
|
|
2094
2127
|
return false;
|
|
2095
2128
|
}
|
|
@@ -2147,6 +2180,9 @@ class Quiz {
|
|
|
2147
2180
|
onBeforeUnmount() {
|
|
2148
2181
|
return Promise.resolve();
|
|
2149
2182
|
}
|
|
2183
|
+
onRefreshUserData(localData) {
|
|
2184
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2185
|
+
}
|
|
2150
2186
|
handleClick() {
|
|
2151
2187
|
return false;
|
|
2152
2188
|
}
|
|
@@ -2203,6 +2239,9 @@ class QuizGrouped {
|
|
|
2203
2239
|
onBeforeUnmount() {
|
|
2204
2240
|
return Promise.resolve();
|
|
2205
2241
|
}
|
|
2242
|
+
onRefreshUserData(localData) {
|
|
2243
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2244
|
+
}
|
|
2206
2245
|
handleClick() {
|
|
2207
2246
|
return false;
|
|
2208
2247
|
}
|
|
@@ -2259,8 +2298,8 @@ class RangeSlider {
|
|
|
2259
2298
|
onBeforeUnmount() {
|
|
2260
2299
|
return Promise.resolve();
|
|
2261
2300
|
}
|
|
2262
|
-
|
|
2263
|
-
|
|
2301
|
+
onRefreshUserData(localData) {
|
|
2302
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2264
2303
|
}
|
|
2265
2304
|
handleClick() {
|
|
2266
2305
|
return false;
|
|
@@ -2268,6 +2307,9 @@ class RangeSlider {
|
|
|
2268
2307
|
get isLayerForcePaused() {
|
|
2269
2308
|
return false;
|
|
2270
2309
|
}
|
|
2310
|
+
get isClickCapturedBySlider() {
|
|
2311
|
+
return this._widgetApi.isClickCapturedBySlider(this._elementNodeRef);
|
|
2312
|
+
}
|
|
2271
2313
|
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetRangeSlider.api`, `WidgetCallbacks`, `WidgetDeps`]; }
|
|
2272
2314
|
}
|
|
2273
2315
|
|
|
@@ -2315,6 +2357,9 @@ class Rate {
|
|
|
2315
2357
|
onBeforeUnmount() {
|
|
2316
2358
|
return Promise.resolve();
|
|
2317
2359
|
}
|
|
2360
|
+
onRefreshUserData(localData) {
|
|
2361
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2362
|
+
}
|
|
2318
2363
|
handleClick() {
|
|
2319
2364
|
return false;
|
|
2320
2365
|
}
|
|
@@ -2374,6 +2419,9 @@ class Share {
|
|
|
2374
2419
|
onBeforeUnmount() {
|
|
2375
2420
|
return Promise.resolve();
|
|
2376
2421
|
}
|
|
2422
|
+
onRefreshUserData(localData) {
|
|
2423
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2424
|
+
}
|
|
2377
2425
|
handleClick() {
|
|
2378
2426
|
return false;
|
|
2379
2427
|
}
|
|
@@ -2414,6 +2462,7 @@ class SwipeUpItems {
|
|
|
2414
2462
|
onBeforeUnmount() {
|
|
2415
2463
|
return Promise.resolve();
|
|
2416
2464
|
}
|
|
2465
|
+
onRefreshUserData(localData) { }
|
|
2417
2466
|
handleClick() {
|
|
2418
2467
|
return false;
|
|
2419
2468
|
}
|
|
@@ -2470,6 +2519,9 @@ class Test {
|
|
|
2470
2519
|
onBeforeUnmount() {
|
|
2471
2520
|
return Promise.resolve();
|
|
2472
2521
|
}
|
|
2522
|
+
onRefreshUserData(localData) {
|
|
2523
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2524
|
+
}
|
|
2473
2525
|
handleClick() {
|
|
2474
2526
|
return false;
|
|
2475
2527
|
}
|
|
@@ -2526,6 +2578,9 @@ class Tooltip {
|
|
|
2526
2578
|
onBeforeUnmount() {
|
|
2527
2579
|
return Promise.resolve();
|
|
2528
2580
|
}
|
|
2581
|
+
onRefreshUserData(localData) {
|
|
2582
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2583
|
+
}
|
|
2529
2584
|
handleClick() {
|
|
2530
2585
|
return false;
|
|
2531
2586
|
}
|
|
@@ -2576,6 +2631,9 @@ class Vote {
|
|
|
2576
2631
|
onBeforeUnmount() {
|
|
2577
2632
|
return Promise.resolve();
|
|
2578
2633
|
}
|
|
2634
|
+
onRefreshUserData(localData) {
|
|
2635
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2636
|
+
}
|
|
2579
2637
|
handleClick() {
|
|
2580
2638
|
return false;
|
|
2581
2639
|
}
|
|
@@ -2610,6 +2668,7 @@ class Text {
|
|
|
2610
2668
|
onBeforeUnmount() {
|
|
2611
2669
|
return Promise.resolve();
|
|
2612
2670
|
}
|
|
2671
|
+
onRefreshUserData(localData) { }
|
|
2613
2672
|
handleClick() {
|
|
2614
2673
|
return false;
|
|
2615
2674
|
}
|
|
@@ -2748,6 +2807,7 @@ class Image extends ClickableBase {
|
|
|
2748
2807
|
onBeforeUnmount() {
|
|
2749
2808
|
return Promise.resolve();
|
|
2750
2809
|
}
|
|
2810
|
+
onRefreshUserData(localData) { }
|
|
2751
2811
|
handleClick() {
|
|
2752
2812
|
return false;
|
|
2753
2813
|
}
|
|
@@ -2785,6 +2845,7 @@ class SwipeUp {
|
|
|
2785
2845
|
onBeforeUnmount() {
|
|
2786
2846
|
return Promise.resolve();
|
|
2787
2847
|
}
|
|
2848
|
+
onRefreshUserData(localData) { }
|
|
2788
2849
|
handleClick() {
|
|
2789
2850
|
return false;
|
|
2790
2851
|
}
|
|
@@ -2886,6 +2947,7 @@ class Video {
|
|
|
2886
2947
|
}
|
|
2887
2948
|
onStart() { }
|
|
2888
2949
|
onStop() { }
|
|
2950
|
+
onRefreshUserData(localData) { }
|
|
2889
2951
|
async onBeforeUnmount() {
|
|
2890
2952
|
// clean up memory and cpu processes
|
|
2891
2953
|
// @ts-ignore
|
|
@@ -3421,6 +3483,9 @@ class Timer {
|
|
|
3421
3483
|
onBeforeUnmount() {
|
|
3422
3484
|
return Promise.resolve();
|
|
3423
3485
|
}
|
|
3486
|
+
onRefreshUserData(localData) {
|
|
3487
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
3488
|
+
}
|
|
3424
3489
|
handleClick() {
|
|
3425
3490
|
return false;
|
|
3426
3491
|
}
|
|
@@ -3472,6 +3537,9 @@ class Reactions {
|
|
|
3472
3537
|
onBeforeUnmount() {
|
|
3473
3538
|
return Promise.resolve();
|
|
3474
3539
|
}
|
|
3540
|
+
onRefreshUserData(localData) {
|
|
3541
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
3542
|
+
}
|
|
3475
3543
|
handleClick() {
|
|
3476
3544
|
return false;
|
|
3477
3545
|
}
|
|
@@ -3525,6 +3593,9 @@ class ScratchCard {
|
|
|
3525
3593
|
onBeforeUnmount() {
|
|
3526
3594
|
return Promise.resolve();
|
|
3527
3595
|
}
|
|
3596
|
+
onRefreshUserData(localData) {
|
|
3597
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
3598
|
+
}
|
|
3528
3599
|
handleClick() {
|
|
3529
3600
|
return false;
|
|
3530
3601
|
}
|
|
@@ -3566,7 +3637,9 @@ const tryCreateFromHtmlElement = (nodeRef, layer, widgetCallbacks, widgetDeps) =
|
|
|
3566
3637
|
case Barcode.className():
|
|
3567
3638
|
return layoutApi.widgetBarcodeApi ? new Barcode(nodeRef, layer, layoutApi.widgetBarcodeApi, widgetCallbacks, widgetDeps) : null;
|
|
3568
3639
|
case DataInput.className():
|
|
3569
|
-
return layoutApi.widgetDataInputApi
|
|
3640
|
+
return layoutApi.widgetDataInputApi
|
|
3641
|
+
? new DataInput(nodeRef, layer, layersNodesRefs, layoutApi.widgetDataInputApi, widgetCallbacks, widgetDeps)
|
|
3642
|
+
: null;
|
|
3570
3643
|
case DateCountdown.className():
|
|
3571
3644
|
return layoutApi.widgetDateCountdownApi
|
|
3572
3645
|
? new DateCountdown(nodeRef, layer, layersNodesRefs, layoutApi.widgetDateCountdownApi, widgetCallbacks, widgetDeps)
|
|
@@ -3935,7 +4008,7 @@ class SlideTimeline {
|
|
|
3935
4008
|
static get [Symbol.for("___CTOR_ARGS___")]() { return [`number`, `number`, `boolean`, `Promise`, `(cb: () => void) => void`, `ISlideApiDeps`]; }
|
|
3936
4009
|
}
|
|
3937
4010
|
|
|
3938
|
-
class Layer {
|
|
4011
|
+
class Layer extends EventEmitter {
|
|
3939
4012
|
_nodeRef;
|
|
3940
4013
|
_slide;
|
|
3941
4014
|
_layerIndex;
|
|
@@ -3962,6 +4035,7 @@ class Layer {
|
|
|
3962
4035
|
_timeline;
|
|
3963
4036
|
_widgetDeps;
|
|
3964
4037
|
constructor(_nodeRef, _slide, _layerIndex, _slideReadyPromise, _afterAppResumeQueuePush, _afterStartInitQueuePush, slideApiDeps, _slideRoot, _getLayoutDirection, _slidePauseUI, _slideResumeUI, _getSdkClientVariables) {
|
|
4038
|
+
super();
|
|
3965
4039
|
this._nodeRef = _nodeRef;
|
|
3966
4040
|
this._slide = _slide;
|
|
3967
4041
|
this._layerIndex = _layerIndex;
|
|
@@ -3984,7 +4058,7 @@ class Layer {
|
|
|
3984
4058
|
this._scrollable = this._nodeRef.getAttribute("data-scrollable") === "1";
|
|
3985
4059
|
this._scrollView = _nodeRef.querySelector(".narrative-layer-scroll-view");
|
|
3986
4060
|
this._layerVerticalScrollNotifier = new LayerVerticalScrollNotifier(this._scrollable, this._cardId, this._slideIndex, this._layerIndex, this._scrollView, this.slideApiDeps.onVerticalScrollChange.bind(this.slideApiDeps));
|
|
3987
|
-
this.
|
|
4061
|
+
this.initTimeline();
|
|
3988
4062
|
this._widgetDeps = {
|
|
3989
4063
|
slideApiDeps: this.slideApiDeps,
|
|
3990
4064
|
slideRoot: this._slideRoot,
|
|
@@ -4044,6 +4118,9 @@ class Layer {
|
|
|
4044
4118
|
}, this._widgetDeps));
|
|
4045
4119
|
}
|
|
4046
4120
|
}
|
|
4121
|
+
initTimeline() {
|
|
4122
|
+
this._timeline = new SlideTimeline(this._slideIndex, this._duration, this._disabledTimer, this._slideReadyPromise, this._afterAppResumeQueuePush, this.slideApiDeps);
|
|
4123
|
+
}
|
|
4047
4124
|
init(localData) {
|
|
4048
4125
|
if (this.slideApiDeps.isIOS || this.slideApiDeps.isAndroid) {
|
|
4049
4126
|
this._nodeRef.classList.add("_app");
|
|
@@ -4244,6 +4321,7 @@ class Layer {
|
|
|
4244
4321
|
_animationPauseCb;
|
|
4245
4322
|
_animationResumeCb;
|
|
4246
4323
|
async start(muted = true) {
|
|
4324
|
+
this.emit("beforeStart");
|
|
4247
4325
|
if (this._layerVerticalScrollNotifier === null) {
|
|
4248
4326
|
this._layerVerticalScrollNotifier = new LayerVerticalScrollNotifier(this._scrollable, this._cardId, this._slideIndex, this._layerIndex, this._scrollView, this.slideApiDeps.onVerticalScrollChange.bind(this.slideApiDeps));
|
|
4249
4327
|
}
|
|
@@ -5615,15 +5693,20 @@ let SlideApi$1 = class SlideApi {
|
|
|
5615
5693
|
}
|
|
5616
5694
|
if (element) {
|
|
5617
5695
|
propagation = false;
|
|
5618
|
-
|
|
5619
|
-
this.slideApiDeps.
|
|
5620
|
-
|
|
5696
|
+
const localData = {};
|
|
5697
|
+
this.slideApiDeps.setCardLocalData(localData, true);
|
|
5698
|
+
this.slideApiDeps.updateCardServerDataLocally(localData);
|
|
5621
5699
|
// сделать async в ios
|
|
5622
5700
|
let slideIndex = this.slide.slideIndex;
|
|
5623
5701
|
// prevent simultaneous call _showNarrativeSlide and _showLayer - prevent 2 calls of initAfterLoad (break video start on iOS)
|
|
5624
5702
|
if (slideIndex === 0) {
|
|
5703
|
+
this.slide.layers[0]?.once("beforeStart", () => {
|
|
5704
|
+
// reset timers
|
|
5705
|
+
this.slide.layers[0]?.initTimeline();
|
|
5706
|
+
});
|
|
5625
5707
|
// for story repeat on the first slide with layers
|
|
5626
5708
|
this.slideApiDeps.showLayer(0);
|
|
5709
|
+
this.activeLayer.elements.forEach(item => item.onRefreshUserData(localData));
|
|
5627
5710
|
}
|
|
5628
5711
|
else {
|
|
5629
5712
|
this.slideApiDeps.showCardSlide(0); // сделать ее async
|
|
@@ -5811,7 +5894,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
5811
5894
|
handled = true;
|
|
5812
5895
|
}
|
|
5813
5896
|
}
|
|
5814
|
-
if (handled) {
|
|
5897
|
+
if (handled && linkType !== "products") {
|
|
5815
5898
|
try {
|
|
5816
5899
|
const cardId = this.slide.cardId;
|
|
5817
5900
|
const cardType = this.slide.cardType;
|
|
@@ -18276,12 +18359,20 @@ class WidgetCopy extends WidgetBase {
|
|
|
18276
18359
|
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `WidgetCallbacks`, `WidgetDeps`]; }
|
|
18277
18360
|
}
|
|
18278
18361
|
|
|
18362
|
+
var DataInputActionAfterCompletion;
|
|
18363
|
+
(function (DataInputActionAfterCompletion) {
|
|
18364
|
+
DataInputActionAfterCompletion["ShowNotification"] = "showNotification";
|
|
18365
|
+
DataInputActionAfterCompletion["ShowLayer"] = "showLayer";
|
|
18366
|
+
DataInputActionAfterCompletion["None"] = "none";
|
|
18367
|
+
})(DataInputActionAfterCompletion || (DataInputActionAfterCompletion = {}));
|
|
18368
|
+
|
|
18279
18369
|
class WidgetDataInput extends WidgetBase {
|
|
18280
18370
|
static DEFAULTS = {
|
|
18281
18371
|
slide: null,
|
|
18282
18372
|
activateAfterCreate: false,
|
|
18283
18373
|
create: false,
|
|
18284
18374
|
localData: {},
|
|
18375
|
+
layers: [],
|
|
18285
18376
|
};
|
|
18286
18377
|
static widgetClassName = "narrative-element-data-input";
|
|
18287
18378
|
label;
|
|
@@ -18289,6 +18380,8 @@ class WidgetDataInput extends WidgetBase {
|
|
|
18289
18380
|
inputElement;
|
|
18290
18381
|
textElement;
|
|
18291
18382
|
inputPlaceholderValue;
|
|
18383
|
+
layers;
|
|
18384
|
+
actionAfterCompletion = null;
|
|
18292
18385
|
/**
|
|
18293
18386
|
* @throws Error
|
|
18294
18387
|
* @param element
|
|
@@ -18303,6 +18396,9 @@ class WidgetDataInput extends WidgetBase {
|
|
|
18303
18396
|
this.inputElement = getValueOrException(this.element.querySelector(".input-view .input"), "Empty .input-view .input");
|
|
18304
18397
|
this.textElement = getValueOrException(this.inputElement.querySelector(".narrative-element-text-lines"), "Empty .narrative-element-text-lines");
|
|
18305
18398
|
this.inputPlaceholderValue = this.textElement.innerHTML;
|
|
18399
|
+
this.layers = this.options.layers;
|
|
18400
|
+
this.actionAfterCompletion =
|
|
18401
|
+
getTagData(this.element, "actionAfterCompletion") ?? DataInputActionAfterCompletion.ShowNotification;
|
|
18306
18402
|
}
|
|
18307
18403
|
/**
|
|
18308
18404
|
* Start or restart widget
|
|
@@ -18311,15 +18407,14 @@ class WidgetDataInput extends WidgetBase {
|
|
|
18311
18407
|
onRefreshUserData(localData) {
|
|
18312
18408
|
super.onRefreshUserData(localData);
|
|
18313
18409
|
const text = this.getTextFromLocalData();
|
|
18314
|
-
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
}
|
|
18410
|
+
if (!text)
|
|
18411
|
+
return;
|
|
18412
|
+
this.doCompletitionActionOnRefreshUserData(text);
|
|
18413
|
+
this.startReadyPromise.then(() => {
|
|
18414
|
+
if (this.disableTimer) {
|
|
18415
|
+
this.onWidgetComplete();
|
|
18416
|
+
}
|
|
18417
|
+
});
|
|
18323
18418
|
}
|
|
18324
18419
|
getTextFromLocalData() {
|
|
18325
18420
|
return this.localData["_di_g_" + this.elementId + "_t"];
|
|
@@ -18421,15 +18516,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
18421
18516
|
this.localData["_di_g_" + this.elementId + "_t"] = text;
|
|
18422
18517
|
// answer to question
|
|
18423
18518
|
this.localData["_&ts_di_g_" + this.elementId + "_a_at"] = Math.round(new Date().getTime() / 1000);
|
|
18424
|
-
|
|
18425
|
-
this.widgetDone.classList.add("active", "opacity-active");
|
|
18426
|
-
setTimeout(() => {
|
|
18427
|
-
this.widgetDone?.classList.remove("active");
|
|
18428
|
-
setTimeout(() => {
|
|
18429
|
-
this.widgetDone?.classList.remove("opacity-active");
|
|
18430
|
-
}, 250);
|
|
18431
|
-
}, 2000);
|
|
18432
|
-
}
|
|
18519
|
+
this.doCompletitionAction();
|
|
18433
18520
|
this.setLocalData(this.localData, true);
|
|
18434
18521
|
this._statEventInputSave(text);
|
|
18435
18522
|
if (this.disableTimer) {
|
|
@@ -18441,11 +18528,48 @@ class WidgetDataInput extends WidgetBase {
|
|
|
18441
18528
|
this.onWidgetRequireResumeUI();
|
|
18442
18529
|
}
|
|
18443
18530
|
}
|
|
18531
|
+
doCompletitionAction() {
|
|
18532
|
+
switch (this.actionAfterCompletion) {
|
|
18533
|
+
case DataInputActionAfterCompletion.ShowNotification:
|
|
18534
|
+
this.showNotification();
|
|
18535
|
+
break;
|
|
18536
|
+
case DataInputActionAfterCompletion.ShowLayer:
|
|
18537
|
+
this.showLayer();
|
|
18538
|
+
break;
|
|
18539
|
+
case DataInputActionAfterCompletion.None:
|
|
18540
|
+
return;
|
|
18541
|
+
}
|
|
18542
|
+
}
|
|
18543
|
+
doCompletitionActionOnRefreshUserData(text) {
|
|
18544
|
+
if (this.actionAfterCompletion === DataInputActionAfterCompletion.ShowLayer) {
|
|
18545
|
+
this.showLayer();
|
|
18546
|
+
}
|
|
18547
|
+
else {
|
|
18548
|
+
this._fillUserText(text);
|
|
18549
|
+
this.element.classList.add("done");
|
|
18550
|
+
}
|
|
18551
|
+
}
|
|
18552
|
+
showNotification() {
|
|
18553
|
+
if (this.widgetDone) {
|
|
18554
|
+
this.widgetDone.classList.add("active", "opacity-active");
|
|
18555
|
+
setTimeout(() => {
|
|
18556
|
+
this.widgetDone?.classList.remove("active");
|
|
18557
|
+
setTimeout(() => {
|
|
18558
|
+
this.widgetDone?.classList.remove("opacity-active");
|
|
18559
|
+
}, 250);
|
|
18560
|
+
}, 2000);
|
|
18561
|
+
}
|
|
18562
|
+
}
|
|
18563
|
+
showLayer() {
|
|
18564
|
+
if (this.layers[1] != null) {
|
|
18565
|
+
this._showLayer(this.layers, 1);
|
|
18566
|
+
}
|
|
18567
|
+
}
|
|
18444
18568
|
static api = {
|
|
18445
18569
|
widgetClassName: WidgetDataInput.widgetClassName,
|
|
18446
18570
|
onRefreshUserData: WidgetDataInput.onRefreshUserData,
|
|
18447
|
-
init: function (element, localData, widgetCallbacks, widgetDeps) {
|
|
18448
|
-
WidgetDataInput.initWidget(element, localData, (element, options) => new WidgetDataInput(element, options, widgetCallbacks, widgetDeps));
|
|
18571
|
+
init: function (element, layers, localData, widgetCallbacks, widgetDeps) {
|
|
18572
|
+
WidgetDataInput.initWidget(element, localData, (element, options) => new WidgetDataInput(element, { ...options, layers }, widgetCallbacks, widgetDeps));
|
|
18449
18573
|
},
|
|
18450
18574
|
onStart: function (element) {
|
|
18451
18575
|
WidgetDataInput.getInstance(element)?.onStart();
|
|
@@ -20815,11 +20939,12 @@ class ProductComponentsFactory {
|
|
|
20815
20939
|
},
|
|
20816
20940
|
});
|
|
20817
20941
|
}
|
|
20818
|
-
createProductCheckout(bottomSheet) {
|
|
20942
|
+
createProductCheckout(bottomSheet, params) {
|
|
20819
20943
|
return new ProductCheckout({
|
|
20820
20944
|
onClose: () => bottomSheet.close(),
|
|
20821
20945
|
onCheckout: () => {
|
|
20822
20946
|
this.widgetDeps.slideApiDeps.productCartClicked();
|
|
20947
|
+
params.onCheckout();
|
|
20823
20948
|
},
|
|
20824
20949
|
translations: this.props.translations,
|
|
20825
20950
|
});
|
|
@@ -20862,9 +20987,9 @@ class ProductOfferMapper {
|
|
|
20862
20987
|
oldPrice: offerDto.oldPrice,
|
|
20863
20988
|
currency: offerDto.currency,
|
|
20864
20989
|
description: offerDto.description,
|
|
20865
|
-
imageUrls: offerDto.
|
|
20990
|
+
imageUrls: offerDto.blobImages?.map(image => image.url) ?? [],
|
|
20866
20991
|
adult: offerDto.adult,
|
|
20867
|
-
coverUrl: offerDto.
|
|
20992
|
+
coverUrl: offerDto.blobCoverUrl,
|
|
20868
20993
|
groupId: offerDto.groupId,
|
|
20869
20994
|
url: offerDto.url,
|
|
20870
20995
|
};
|
|
@@ -20930,6 +21055,7 @@ class ProductDetailsBottomSheet extends RenderableComponent {
|
|
|
20930
21055
|
quantity: payload.quantity,
|
|
20931
21056
|
});
|
|
20932
21057
|
this.showProductCheckout();
|
|
21058
|
+
this.props.onAddToCart({ offer, quantity: payload.quantity });
|
|
20933
21059
|
},
|
|
20934
21060
|
isCartSupported,
|
|
20935
21061
|
isCartQuantityEnabled,
|
|
@@ -20937,7 +21063,9 @@ class ProductDetailsBottomSheet extends RenderableComponent {
|
|
|
20937
21063
|
this.updateBottomSheetContent(productDetails);
|
|
20938
21064
|
}
|
|
20939
21065
|
showProductCheckout() {
|
|
20940
|
-
const productCheckout = this.factory.createProductCheckout(this.bottomSheet
|
|
21066
|
+
const productCheckout = this.factory.createProductCheckout(this.bottomSheet, {
|
|
21067
|
+
onCheckout: this.props.onCheckout,
|
|
21068
|
+
});
|
|
20941
21069
|
this.updateBottomSheetContent(productCheckout);
|
|
20942
21070
|
}
|
|
20943
21071
|
updateBottomSheetContent(content) {
|
|
@@ -20989,7 +21117,9 @@ class ProductCheckoutBottomSheet extends RenderableComponent {
|
|
|
20989
21117
|
return this.bottomSheet.render();
|
|
20990
21118
|
}
|
|
20991
21119
|
open() {
|
|
20992
|
-
const productCheckout = this.factory.createProductCheckout(this.bottomSheet
|
|
21120
|
+
const productCheckout = this.factory.createProductCheckout(this.bottomSheet, {
|
|
21121
|
+
onCheckout: this.props.onCheckout,
|
|
21122
|
+
});
|
|
20993
21123
|
this.updateBottomSheetContent(productCheckout);
|
|
20994
21124
|
this.bottomSheet.open();
|
|
20995
21125
|
}
|
|
@@ -21160,33 +21290,34 @@ class ProductOfferRepository {
|
|
|
21160
21290
|
}
|
|
21161
21291
|
}
|
|
21162
21292
|
static collectDistinctImageUrls(offers, into) {
|
|
21163
|
-
for (const
|
|
21164
|
-
if (
|
|
21165
|
-
into.add(
|
|
21293
|
+
for (const offer of offers) {
|
|
21294
|
+
if (offer.coverUrl) {
|
|
21295
|
+
into.add(offer.coverUrl);
|
|
21166
21296
|
}
|
|
21167
|
-
if (
|
|
21168
|
-
for (const img of
|
|
21297
|
+
if (offer.images?.length) {
|
|
21298
|
+
for (const img of offer.images) {
|
|
21169
21299
|
if (img.url) {
|
|
21170
21300
|
into.add(img.url);
|
|
21171
21301
|
}
|
|
21172
21302
|
}
|
|
21173
21303
|
}
|
|
21174
|
-
if (
|
|
21175
|
-
this.collectDistinctImageUrls(
|
|
21304
|
+
if (offer.subOffersApi?.length) {
|
|
21305
|
+
this.collectDistinctImageUrls(offer.subOffersApi, into);
|
|
21176
21306
|
}
|
|
21177
21307
|
}
|
|
21178
21308
|
}
|
|
21179
21309
|
static applyImageBlobMap(offers, originalToBlob) {
|
|
21180
|
-
for (const
|
|
21181
|
-
const coverOrig =
|
|
21310
|
+
for (const offer of offers) {
|
|
21311
|
+
const coverOrig = offer.coverUrl;
|
|
21182
21312
|
if (coverOrig) {
|
|
21183
21313
|
const blobUrl = originalToBlob.get(coverOrig);
|
|
21184
21314
|
if (blobUrl) {
|
|
21185
|
-
|
|
21315
|
+
offer.blobCoverUrl = blobUrl;
|
|
21186
21316
|
}
|
|
21187
21317
|
}
|
|
21188
|
-
if (
|
|
21189
|
-
|
|
21318
|
+
if (offer.images?.length) {
|
|
21319
|
+
offer.blobImages = offer.images.map(image => ({ ...image }));
|
|
21320
|
+
for (const img of offer.blobImages) {
|
|
21190
21321
|
const urlOrig = img.url;
|
|
21191
21322
|
const blobUrl = originalToBlob.get(urlOrig);
|
|
21192
21323
|
if (blobUrl) {
|
|
@@ -21194,8 +21325,8 @@ class ProductOfferRepository {
|
|
|
21194
21325
|
}
|
|
21195
21326
|
}
|
|
21196
21327
|
}
|
|
21197
|
-
if (
|
|
21198
|
-
this.applyImageBlobMap(
|
|
21328
|
+
if (offer.subOffersApi?.length) {
|
|
21329
|
+
this.applyImageBlobMap(offer.subOffersApi, originalToBlob);
|
|
21199
21330
|
}
|
|
21200
21331
|
}
|
|
21201
21332
|
}
|
|
@@ -21549,6 +21680,12 @@ class WidgetProducts extends WidgetBase {
|
|
|
21549
21680
|
openUrl: getTagData(this.element, "msgOpenUrl") ?? "",
|
|
21550
21681
|
},
|
|
21551
21682
|
height: backgroundViewHeight + scrollViewGroupHeight,
|
|
21683
|
+
onCheckout: () => {
|
|
21684
|
+
this.statEventGoToCart();
|
|
21685
|
+
},
|
|
21686
|
+
onAddToCart: (event) => {
|
|
21687
|
+
this.statEventAddToCart(event);
|
|
21688
|
+
},
|
|
21552
21689
|
});
|
|
21553
21690
|
const isCartEnabled = getTagData(this.element, "isCartEnabled") === "true";
|
|
21554
21691
|
const isCartQuantityEnabled = !getTagData(this.element, "isCartQuantityEnabled") || getTagData(this.element, "isCartQuantityEnabled") === "true";
|
|
@@ -21556,6 +21693,49 @@ class WidgetProducts extends WidgetBase {
|
|
|
21556
21693
|
this.productsView.appendChild(bs.render());
|
|
21557
21694
|
bs.open({ offer, isCartSupported, isCartQuantityEnabled });
|
|
21558
21695
|
};
|
|
21696
|
+
statEventGoToCart() {
|
|
21697
|
+
try {
|
|
21698
|
+
const captionViewText = this.captionView?.textContent ?? "";
|
|
21699
|
+
this.sendStatisticEventToApp("w-products-go-to-cart", {
|
|
21700
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
21701
|
+
wi: this.elementId,
|
|
21702
|
+
wl: captionViewText,
|
|
21703
|
+
}, {
|
|
21704
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
21705
|
+
widget_id: this.elementId,
|
|
21706
|
+
widget_label: captionViewText,
|
|
21707
|
+
}, {
|
|
21708
|
+
forceEnableStatisticV2: false,
|
|
21709
|
+
});
|
|
21710
|
+
}
|
|
21711
|
+
catch (error) {
|
|
21712
|
+
console.error(error);
|
|
21713
|
+
}
|
|
21714
|
+
}
|
|
21715
|
+
statEventAddToCart({ offer, quantity }) {
|
|
21716
|
+
try {
|
|
21717
|
+
const captionViewText = this.captionView?.textContent ?? "";
|
|
21718
|
+
this.sendStatisticEventToApp("w-products-add-to-cart", {
|
|
21719
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
21720
|
+
wi: this.elementId,
|
|
21721
|
+
wl: captionViewText,
|
|
21722
|
+
wv: offer.offerId,
|
|
21723
|
+
wvi: offer.id,
|
|
21724
|
+
}, {
|
|
21725
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
21726
|
+
widget_id: this.elementId,
|
|
21727
|
+
widget_label: captionViewText,
|
|
21728
|
+
widget_value: offer.offerId,
|
|
21729
|
+
quantity,
|
|
21730
|
+
widget_value_id: offer.id,
|
|
21731
|
+
}, {
|
|
21732
|
+
forceEnableStatisticV2: false,
|
|
21733
|
+
});
|
|
21734
|
+
}
|
|
21735
|
+
catch (error) {
|
|
21736
|
+
console.error(error);
|
|
21737
|
+
}
|
|
21738
|
+
}
|
|
21559
21739
|
createScrollView(offers) {
|
|
21560
21740
|
const scrollViewGroup = document.createElement("div");
|
|
21561
21741
|
scrollViewGroup.classList.add("ias-products-scroll-view-group");
|
|
@@ -22043,7 +22223,7 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22043
22223
|
this.onWidgetRequirePauseUI();
|
|
22044
22224
|
}
|
|
22045
22225
|
e.stopPropagation();
|
|
22046
|
-
this.
|
|
22226
|
+
this.statEventClickPurchaseButton(offer);
|
|
22047
22227
|
if (isCartSupported) {
|
|
22048
22228
|
this.addToCart(offer, button);
|
|
22049
22229
|
}
|
|
@@ -22089,6 +22269,7 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22089
22269
|
bs.open();
|
|
22090
22270
|
this.isBottomSheetOpened = true;
|
|
22091
22271
|
this.disableHostUIInteraction();
|
|
22272
|
+
this.statEventAddToCart({ offer: offerDto, quantity: 1 });
|
|
22092
22273
|
}
|
|
22093
22274
|
catch (error) {
|
|
22094
22275
|
if (error instanceof Error) {
|
|
@@ -22128,6 +22309,12 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22128
22309
|
this.productsView = null;
|
|
22129
22310
|
}
|
|
22130
22311
|
},
|
|
22312
|
+
onCheckout: () => {
|
|
22313
|
+
this.statEventGoToCart();
|
|
22314
|
+
},
|
|
22315
|
+
onAddToCart: (event) => {
|
|
22316
|
+
this.statEventAddToCart(event);
|
|
22317
|
+
},
|
|
22131
22318
|
};
|
|
22132
22319
|
}
|
|
22133
22320
|
statEventWidgetCardClick(offer) {
|
|
@@ -22136,8 +22323,8 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22136
22323
|
this.sendStatisticEventToApp("w-product-carousel-card-click", {
|
|
22137
22324
|
...this.statisticEventBaseFieldsShortForm,
|
|
22138
22325
|
wi: this.elementId,
|
|
22139
|
-
wl: captionViewText,
|
|
22140
22326
|
wv: offer.offerId,
|
|
22327
|
+
wl: captionViewText,
|
|
22141
22328
|
wvi: offer.id,
|
|
22142
22329
|
}, {
|
|
22143
22330
|
...this.statisticEventBaseFieldsFullForm,
|
|
@@ -22153,6 +22340,63 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22153
22340
|
console.error(error);
|
|
22154
22341
|
}
|
|
22155
22342
|
}
|
|
22343
|
+
statEventClickPurchaseButton(offer) {
|
|
22344
|
+
try {
|
|
22345
|
+
this.sendStatisticEventToApp("w-product-carousel-buy-click", {
|
|
22346
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
22347
|
+
wi: this.elementId,
|
|
22348
|
+
wv: offer.offerId,
|
|
22349
|
+
wvi: offer.id,
|
|
22350
|
+
}, {
|
|
22351
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
22352
|
+
widget_id: this.elementId,
|
|
22353
|
+
widget_value: offer.offerId,
|
|
22354
|
+
widget_value_id: offer.id,
|
|
22355
|
+
}, {
|
|
22356
|
+
forceEnableStatisticV2: false,
|
|
22357
|
+
});
|
|
22358
|
+
}
|
|
22359
|
+
catch (error) {
|
|
22360
|
+
console.error(error);
|
|
22361
|
+
}
|
|
22362
|
+
}
|
|
22363
|
+
statEventAddToCart({ offer, quantity }) {
|
|
22364
|
+
try {
|
|
22365
|
+
this.sendStatisticEventToApp("w-product-carousel-add-to-cart", {
|
|
22366
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
22367
|
+
wi: this.elementId,
|
|
22368
|
+
wv: offer.offerId,
|
|
22369
|
+
wvi: offer.id,
|
|
22370
|
+
}, {
|
|
22371
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
22372
|
+
widget_id: this.elementId,
|
|
22373
|
+
widget_value: offer.offerId,
|
|
22374
|
+
quantity,
|
|
22375
|
+
widget_value_id: offer.id,
|
|
22376
|
+
}, {
|
|
22377
|
+
forceEnableStatisticV2: false,
|
|
22378
|
+
});
|
|
22379
|
+
}
|
|
22380
|
+
catch (error) {
|
|
22381
|
+
console.error(error);
|
|
22382
|
+
}
|
|
22383
|
+
}
|
|
22384
|
+
statEventGoToCart() {
|
|
22385
|
+
try {
|
|
22386
|
+
this.sendStatisticEventToApp("w-product-carousel-go-to-cart", {
|
|
22387
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
22388
|
+
wi: this.elementId,
|
|
22389
|
+
}, {
|
|
22390
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
22391
|
+
widget_id: this.elementId,
|
|
22392
|
+
}, {
|
|
22393
|
+
forceEnableStatisticV2: false,
|
|
22394
|
+
});
|
|
22395
|
+
}
|
|
22396
|
+
catch (error) {
|
|
22397
|
+
console.error(error);
|
|
22398
|
+
}
|
|
22399
|
+
}
|
|
22156
22400
|
isCartSupported() {
|
|
22157
22401
|
const isCartEnabled = getTagData(this.element, "isCartEnabled") === "true";
|
|
22158
22402
|
return this.widgetDeps.slideApiDeps.isSdkSupportProductCart && isCartEnabled;
|
|
@@ -26772,6 +27016,10 @@ class WidgetScratchCard extends WidgetBase {
|
|
|
26772
27016
|
...this.statisticEventBaseFieldsShortForm,
|
|
26773
27017
|
wi: this.elementId,
|
|
26774
27018
|
d: duration,
|
|
27019
|
+
}, {
|
|
27020
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
27021
|
+
widget_id: this.elementId,
|
|
27022
|
+
duration_ms: duration,
|
|
26775
27023
|
});
|
|
26776
27024
|
}
|
|
26777
27025
|
saveToLocalData() {
|