@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.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var events = require('events');
|
|
4
|
+
|
|
3
5
|
const CONSTRUCTOR_ARGUMENTS_SYMBOL_IDENTIFIER = `___CTOR_ARGS___`;
|
|
4
6
|
const CONSTRUCTOR_ARGUMENTS_SYMBOL = Symbol.for(CONSTRUCTOR_ARGUMENTS_SYMBOL_IDENTIFIER);
|
|
5
7
|
|
|
@@ -1298,6 +1300,7 @@ const DEFAULT_SLIDE_DURATION = 10000;
|
|
|
1298
1300
|
class DataInput {
|
|
1299
1301
|
_elementNodeRef;
|
|
1300
1302
|
_layer;
|
|
1303
|
+
_layersNodesRefs;
|
|
1301
1304
|
_widgetApi;
|
|
1302
1305
|
_widgetCallbacks;
|
|
1303
1306
|
_widgetDeps;
|
|
@@ -1305,9 +1308,10 @@ class DataInput {
|
|
|
1305
1308
|
static className() {
|
|
1306
1309
|
return DataInput._className;
|
|
1307
1310
|
}
|
|
1308
|
-
constructor(_elementNodeRef, _layer, _widgetApi, _widgetCallbacks, _widgetDeps) {
|
|
1311
|
+
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi, _widgetCallbacks, _widgetDeps) {
|
|
1309
1312
|
this._elementNodeRef = _elementNodeRef;
|
|
1310
1313
|
this._layer = _layer;
|
|
1314
|
+
this._layersNodesRefs = _layersNodesRefs;
|
|
1311
1315
|
this._widgetApi = _widgetApi;
|
|
1312
1316
|
this._widgetCallbacks = _widgetCallbacks;
|
|
1313
1317
|
this._widgetDeps = _widgetDeps;
|
|
@@ -1321,7 +1325,7 @@ class DataInput {
|
|
|
1321
1325
|
}
|
|
1322
1326
|
init(localData) {
|
|
1323
1327
|
try {
|
|
1324
|
-
this._widgetApi.init(this._elementNodeRef, localData, this._widgetCallbacks, this._widgetDeps);
|
|
1328
|
+
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData, this._widgetCallbacks, this._widgetDeps);
|
|
1325
1329
|
}
|
|
1326
1330
|
catch (e) {
|
|
1327
1331
|
console.error(e);
|
|
@@ -1339,6 +1343,9 @@ class DataInput {
|
|
|
1339
1343
|
onBeforeUnmount() {
|
|
1340
1344
|
return Promise.resolve();
|
|
1341
1345
|
}
|
|
1346
|
+
onRefreshUserData(localData) {
|
|
1347
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1348
|
+
}
|
|
1342
1349
|
handleClick() {
|
|
1343
1350
|
return false;
|
|
1344
1351
|
}
|
|
@@ -1348,7 +1355,7 @@ class DataInput {
|
|
|
1348
1355
|
get isLayerForcePaused() {
|
|
1349
1356
|
return false;
|
|
1350
1357
|
}
|
|
1351
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetDataInput.api`, `WidgetCallbacks`, `WidgetDeps`]; }
|
|
1358
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetDataInput.api`, `WidgetCallbacks`, `WidgetDeps`]; }
|
|
1352
1359
|
}
|
|
1353
1360
|
|
|
1354
1361
|
class Barcode {
|
|
@@ -1392,6 +1399,9 @@ class Barcode {
|
|
|
1392
1399
|
onBeforeUnmount() {
|
|
1393
1400
|
return Promise.resolve();
|
|
1394
1401
|
}
|
|
1402
|
+
onRefreshUserData(localData) {
|
|
1403
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1404
|
+
}
|
|
1395
1405
|
handleClick() {
|
|
1396
1406
|
return false;
|
|
1397
1407
|
}
|
|
@@ -1557,6 +1567,7 @@ class PromocodeLink {
|
|
|
1557
1567
|
onBeforeUnmount() {
|
|
1558
1568
|
return Promise.resolve();
|
|
1559
1569
|
}
|
|
1570
|
+
onRefreshUserData(localData) { }
|
|
1560
1571
|
handleClick() {
|
|
1561
1572
|
switch (this.state) {
|
|
1562
1573
|
case PromocodeLinkState.Idle:
|
|
@@ -1704,6 +1715,7 @@ class Button extends ClickableBase {
|
|
|
1704
1715
|
this.promocodeLink?.onStart();
|
|
1705
1716
|
}
|
|
1706
1717
|
onStop() { }
|
|
1718
|
+
onRefreshUserData(localData) { }
|
|
1707
1719
|
onBeforeUnmount() {
|
|
1708
1720
|
return Promise.resolve();
|
|
1709
1721
|
}
|
|
@@ -1757,6 +1769,9 @@ class Copy {
|
|
|
1757
1769
|
onBeforeUnmount() {
|
|
1758
1770
|
return Promise.resolve();
|
|
1759
1771
|
}
|
|
1772
|
+
onRefreshUserData(localData) {
|
|
1773
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1774
|
+
}
|
|
1760
1775
|
handleClick() {
|
|
1761
1776
|
return false;
|
|
1762
1777
|
}
|
|
@@ -1813,6 +1828,9 @@ class DateCountdown {
|
|
|
1813
1828
|
onBeforeUnmount() {
|
|
1814
1829
|
return Promise.resolve();
|
|
1815
1830
|
}
|
|
1831
|
+
onRefreshUserData(localData) {
|
|
1832
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1833
|
+
}
|
|
1816
1834
|
handleClick() {
|
|
1817
1835
|
return false;
|
|
1818
1836
|
}
|
|
@@ -1866,6 +1884,9 @@ class Poll {
|
|
|
1866
1884
|
onBeforeUnmount() {
|
|
1867
1885
|
return Promise.resolve();
|
|
1868
1886
|
}
|
|
1887
|
+
onRefreshUserData(localData) {
|
|
1888
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1889
|
+
}
|
|
1869
1890
|
handleClick() {
|
|
1870
1891
|
return false;
|
|
1871
1892
|
}
|
|
@@ -1924,6 +1945,9 @@ class PollLayers {
|
|
|
1924
1945
|
onBeforeUnmount() {
|
|
1925
1946
|
return Promise.resolve();
|
|
1926
1947
|
}
|
|
1948
|
+
onRefreshUserData(localData) {
|
|
1949
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
1950
|
+
}
|
|
1927
1951
|
handleClick() {
|
|
1928
1952
|
return false;
|
|
1929
1953
|
}
|
|
@@ -1977,6 +2001,9 @@ class Products {
|
|
|
1977
2001
|
onBeforeUnmount() {
|
|
1978
2002
|
return Promise.resolve();
|
|
1979
2003
|
}
|
|
2004
|
+
onRefreshUserData(localData) {
|
|
2005
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2006
|
+
}
|
|
1980
2007
|
handleClick() {
|
|
1981
2008
|
return false;
|
|
1982
2009
|
}
|
|
@@ -2039,6 +2066,9 @@ class ProductCarousel {
|
|
|
2039
2066
|
onBeforeUnmount() {
|
|
2040
2067
|
return Promise.resolve();
|
|
2041
2068
|
}
|
|
2069
|
+
onRefreshUserData(localData) {
|
|
2070
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2071
|
+
}
|
|
2042
2072
|
handleClick() {
|
|
2043
2073
|
return false;
|
|
2044
2074
|
}
|
|
@@ -2092,6 +2122,9 @@ class Quest {
|
|
|
2092
2122
|
onBeforeUnmount() {
|
|
2093
2123
|
return Promise.resolve();
|
|
2094
2124
|
}
|
|
2125
|
+
onRefreshUserData(localData) {
|
|
2126
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2127
|
+
}
|
|
2095
2128
|
handleClick() {
|
|
2096
2129
|
return false;
|
|
2097
2130
|
}
|
|
@@ -2149,6 +2182,9 @@ class Quiz {
|
|
|
2149
2182
|
onBeforeUnmount() {
|
|
2150
2183
|
return Promise.resolve();
|
|
2151
2184
|
}
|
|
2185
|
+
onRefreshUserData(localData) {
|
|
2186
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2187
|
+
}
|
|
2152
2188
|
handleClick() {
|
|
2153
2189
|
return false;
|
|
2154
2190
|
}
|
|
@@ -2205,6 +2241,9 @@ class QuizGrouped {
|
|
|
2205
2241
|
onBeforeUnmount() {
|
|
2206
2242
|
return Promise.resolve();
|
|
2207
2243
|
}
|
|
2244
|
+
onRefreshUserData(localData) {
|
|
2245
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2246
|
+
}
|
|
2208
2247
|
handleClick() {
|
|
2209
2248
|
return false;
|
|
2210
2249
|
}
|
|
@@ -2261,8 +2300,8 @@ class RangeSlider {
|
|
|
2261
2300
|
onBeforeUnmount() {
|
|
2262
2301
|
return Promise.resolve();
|
|
2263
2302
|
}
|
|
2264
|
-
|
|
2265
|
-
|
|
2303
|
+
onRefreshUserData(localData) {
|
|
2304
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2266
2305
|
}
|
|
2267
2306
|
handleClick() {
|
|
2268
2307
|
return false;
|
|
@@ -2270,6 +2309,9 @@ class RangeSlider {
|
|
|
2270
2309
|
get isLayerForcePaused() {
|
|
2271
2310
|
return false;
|
|
2272
2311
|
}
|
|
2312
|
+
get isClickCapturedBySlider() {
|
|
2313
|
+
return this._widgetApi.isClickCapturedBySlider(this._elementNodeRef);
|
|
2314
|
+
}
|
|
2273
2315
|
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetRangeSlider.api`, `WidgetCallbacks`, `WidgetDeps`]; }
|
|
2274
2316
|
}
|
|
2275
2317
|
|
|
@@ -2317,6 +2359,9 @@ class Rate {
|
|
|
2317
2359
|
onBeforeUnmount() {
|
|
2318
2360
|
return Promise.resolve();
|
|
2319
2361
|
}
|
|
2362
|
+
onRefreshUserData(localData) {
|
|
2363
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2364
|
+
}
|
|
2320
2365
|
handleClick() {
|
|
2321
2366
|
return false;
|
|
2322
2367
|
}
|
|
@@ -2376,6 +2421,9 @@ class Share {
|
|
|
2376
2421
|
onBeforeUnmount() {
|
|
2377
2422
|
return Promise.resolve();
|
|
2378
2423
|
}
|
|
2424
|
+
onRefreshUserData(localData) {
|
|
2425
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2426
|
+
}
|
|
2379
2427
|
handleClick() {
|
|
2380
2428
|
return false;
|
|
2381
2429
|
}
|
|
@@ -2416,6 +2464,7 @@ class SwipeUpItems {
|
|
|
2416
2464
|
onBeforeUnmount() {
|
|
2417
2465
|
return Promise.resolve();
|
|
2418
2466
|
}
|
|
2467
|
+
onRefreshUserData(localData) { }
|
|
2419
2468
|
handleClick() {
|
|
2420
2469
|
return false;
|
|
2421
2470
|
}
|
|
@@ -2472,6 +2521,9 @@ class Test {
|
|
|
2472
2521
|
onBeforeUnmount() {
|
|
2473
2522
|
return Promise.resolve();
|
|
2474
2523
|
}
|
|
2524
|
+
onRefreshUserData(localData) {
|
|
2525
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2526
|
+
}
|
|
2475
2527
|
handleClick() {
|
|
2476
2528
|
return false;
|
|
2477
2529
|
}
|
|
@@ -2528,6 +2580,9 @@ class Tooltip {
|
|
|
2528
2580
|
onBeforeUnmount() {
|
|
2529
2581
|
return Promise.resolve();
|
|
2530
2582
|
}
|
|
2583
|
+
onRefreshUserData(localData) {
|
|
2584
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2585
|
+
}
|
|
2531
2586
|
handleClick() {
|
|
2532
2587
|
return false;
|
|
2533
2588
|
}
|
|
@@ -2578,6 +2633,9 @@ class Vote {
|
|
|
2578
2633
|
onBeforeUnmount() {
|
|
2579
2634
|
return Promise.resolve();
|
|
2580
2635
|
}
|
|
2636
|
+
onRefreshUserData(localData) {
|
|
2637
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
2638
|
+
}
|
|
2581
2639
|
handleClick() {
|
|
2582
2640
|
return false;
|
|
2583
2641
|
}
|
|
@@ -2612,6 +2670,7 @@ class Text {
|
|
|
2612
2670
|
onBeforeUnmount() {
|
|
2613
2671
|
return Promise.resolve();
|
|
2614
2672
|
}
|
|
2673
|
+
onRefreshUserData(localData) { }
|
|
2615
2674
|
handleClick() {
|
|
2616
2675
|
return false;
|
|
2617
2676
|
}
|
|
@@ -2750,6 +2809,7 @@ class Image extends ClickableBase {
|
|
|
2750
2809
|
onBeforeUnmount() {
|
|
2751
2810
|
return Promise.resolve();
|
|
2752
2811
|
}
|
|
2812
|
+
onRefreshUserData(localData) { }
|
|
2753
2813
|
handleClick() {
|
|
2754
2814
|
return false;
|
|
2755
2815
|
}
|
|
@@ -2787,6 +2847,7 @@ class SwipeUp {
|
|
|
2787
2847
|
onBeforeUnmount() {
|
|
2788
2848
|
return Promise.resolve();
|
|
2789
2849
|
}
|
|
2850
|
+
onRefreshUserData(localData) { }
|
|
2790
2851
|
handleClick() {
|
|
2791
2852
|
return false;
|
|
2792
2853
|
}
|
|
@@ -2888,6 +2949,7 @@ class Video {
|
|
|
2888
2949
|
}
|
|
2889
2950
|
onStart() { }
|
|
2890
2951
|
onStop() { }
|
|
2952
|
+
onRefreshUserData(localData) { }
|
|
2891
2953
|
async onBeforeUnmount() {
|
|
2892
2954
|
// clean up memory and cpu processes
|
|
2893
2955
|
// @ts-ignore
|
|
@@ -3423,6 +3485,9 @@ class Timer {
|
|
|
3423
3485
|
onBeforeUnmount() {
|
|
3424
3486
|
return Promise.resolve();
|
|
3425
3487
|
}
|
|
3488
|
+
onRefreshUserData(localData) {
|
|
3489
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
3490
|
+
}
|
|
3426
3491
|
handleClick() {
|
|
3427
3492
|
return false;
|
|
3428
3493
|
}
|
|
@@ -3474,6 +3539,9 @@ class Reactions {
|
|
|
3474
3539
|
onBeforeUnmount() {
|
|
3475
3540
|
return Promise.resolve();
|
|
3476
3541
|
}
|
|
3542
|
+
onRefreshUserData(localData) {
|
|
3543
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
3544
|
+
}
|
|
3477
3545
|
handleClick() {
|
|
3478
3546
|
return false;
|
|
3479
3547
|
}
|
|
@@ -3527,6 +3595,9 @@ class ScratchCard {
|
|
|
3527
3595
|
onBeforeUnmount() {
|
|
3528
3596
|
return Promise.resolve();
|
|
3529
3597
|
}
|
|
3598
|
+
onRefreshUserData(localData) {
|
|
3599
|
+
this._widgetApi.onRefreshUserData(this._elementNodeRef, localData);
|
|
3600
|
+
}
|
|
3530
3601
|
handleClick() {
|
|
3531
3602
|
return false;
|
|
3532
3603
|
}
|
|
@@ -3568,7 +3639,9 @@ const tryCreateFromHtmlElement = (nodeRef, layer, widgetCallbacks, widgetDeps) =
|
|
|
3568
3639
|
case Barcode.className():
|
|
3569
3640
|
return layoutApi.widgetBarcodeApi ? new Barcode(nodeRef, layer, layoutApi.widgetBarcodeApi, widgetCallbacks, widgetDeps) : null;
|
|
3570
3641
|
case DataInput.className():
|
|
3571
|
-
return layoutApi.widgetDataInputApi
|
|
3642
|
+
return layoutApi.widgetDataInputApi
|
|
3643
|
+
? new DataInput(nodeRef, layer, layersNodesRefs, layoutApi.widgetDataInputApi, widgetCallbacks, widgetDeps)
|
|
3644
|
+
: null;
|
|
3572
3645
|
case DateCountdown.className():
|
|
3573
3646
|
return layoutApi.widgetDateCountdownApi
|
|
3574
3647
|
? new DateCountdown(nodeRef, layer, layersNodesRefs, layoutApi.widgetDateCountdownApi, widgetCallbacks, widgetDeps)
|
|
@@ -3937,7 +4010,7 @@ class SlideTimeline {
|
|
|
3937
4010
|
static get [Symbol.for("___CTOR_ARGS___")]() { return [`number`, `number`, `boolean`, `Promise`, `(cb: () => void) => void`, `ISlideApiDeps`]; }
|
|
3938
4011
|
}
|
|
3939
4012
|
|
|
3940
|
-
class Layer {
|
|
4013
|
+
class Layer extends events.EventEmitter {
|
|
3941
4014
|
_nodeRef;
|
|
3942
4015
|
_slide;
|
|
3943
4016
|
_layerIndex;
|
|
@@ -3964,6 +4037,7 @@ class Layer {
|
|
|
3964
4037
|
_timeline;
|
|
3965
4038
|
_widgetDeps;
|
|
3966
4039
|
constructor(_nodeRef, _slide, _layerIndex, _slideReadyPromise, _afterAppResumeQueuePush, _afterStartInitQueuePush, slideApiDeps, _slideRoot, _getLayoutDirection, _slidePauseUI, _slideResumeUI, _getSdkClientVariables) {
|
|
4040
|
+
super();
|
|
3967
4041
|
this._nodeRef = _nodeRef;
|
|
3968
4042
|
this._slide = _slide;
|
|
3969
4043
|
this._layerIndex = _layerIndex;
|
|
@@ -3986,7 +4060,7 @@ class Layer {
|
|
|
3986
4060
|
this._scrollable = this._nodeRef.getAttribute("data-scrollable") === "1";
|
|
3987
4061
|
this._scrollView = _nodeRef.querySelector(".narrative-layer-scroll-view");
|
|
3988
4062
|
this._layerVerticalScrollNotifier = new LayerVerticalScrollNotifier(this._scrollable, this._cardId, this._slideIndex, this._layerIndex, this._scrollView, this.slideApiDeps.onVerticalScrollChange.bind(this.slideApiDeps));
|
|
3989
|
-
this.
|
|
4063
|
+
this.initTimeline();
|
|
3990
4064
|
this._widgetDeps = {
|
|
3991
4065
|
slideApiDeps: this.slideApiDeps,
|
|
3992
4066
|
slideRoot: this._slideRoot,
|
|
@@ -4046,6 +4120,9 @@ class Layer {
|
|
|
4046
4120
|
}, this._widgetDeps));
|
|
4047
4121
|
}
|
|
4048
4122
|
}
|
|
4123
|
+
initTimeline() {
|
|
4124
|
+
this._timeline = new SlideTimeline(this._slideIndex, this._duration, this._disabledTimer, this._slideReadyPromise, this._afterAppResumeQueuePush, this.slideApiDeps);
|
|
4125
|
+
}
|
|
4049
4126
|
init(localData) {
|
|
4050
4127
|
if (this.slideApiDeps.isIOS || this.slideApiDeps.isAndroid) {
|
|
4051
4128
|
this._nodeRef.classList.add("_app");
|
|
@@ -4246,6 +4323,7 @@ class Layer {
|
|
|
4246
4323
|
_animationPauseCb;
|
|
4247
4324
|
_animationResumeCb;
|
|
4248
4325
|
async start(muted = true) {
|
|
4326
|
+
this.emit("beforeStart");
|
|
4249
4327
|
if (this._layerVerticalScrollNotifier === null) {
|
|
4250
4328
|
this._layerVerticalScrollNotifier = new LayerVerticalScrollNotifier(this._scrollable, this._cardId, this._slideIndex, this._layerIndex, this._scrollView, this.slideApiDeps.onVerticalScrollChange.bind(this.slideApiDeps));
|
|
4251
4329
|
}
|
|
@@ -5617,15 +5695,20 @@ let SlideApi$1 = class SlideApi {
|
|
|
5617
5695
|
}
|
|
5618
5696
|
if (element) {
|
|
5619
5697
|
propagation = false;
|
|
5620
|
-
|
|
5621
|
-
this.slideApiDeps.
|
|
5622
|
-
|
|
5698
|
+
const localData = {};
|
|
5699
|
+
this.slideApiDeps.setCardLocalData(localData, true);
|
|
5700
|
+
this.slideApiDeps.updateCardServerDataLocally(localData);
|
|
5623
5701
|
// сделать async в ios
|
|
5624
5702
|
let slideIndex = this.slide.slideIndex;
|
|
5625
5703
|
// prevent simultaneous call _showNarrativeSlide and _showLayer - prevent 2 calls of initAfterLoad (break video start on iOS)
|
|
5626
5704
|
if (slideIndex === 0) {
|
|
5705
|
+
this.slide.layers[0]?.once("beforeStart", () => {
|
|
5706
|
+
// reset timers
|
|
5707
|
+
this.slide.layers[0]?.initTimeline();
|
|
5708
|
+
});
|
|
5627
5709
|
// for story repeat on the first slide with layers
|
|
5628
5710
|
this.slideApiDeps.showLayer(0);
|
|
5711
|
+
this.activeLayer.elements.forEach(item => item.onRefreshUserData(localData));
|
|
5629
5712
|
}
|
|
5630
5713
|
else {
|
|
5631
5714
|
this.slideApiDeps.showCardSlide(0); // сделать ее async
|
|
@@ -5813,7 +5896,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
5813
5896
|
handled = true;
|
|
5814
5897
|
}
|
|
5815
5898
|
}
|
|
5816
|
-
if (handled) {
|
|
5899
|
+
if (handled && linkType !== "products") {
|
|
5817
5900
|
try {
|
|
5818
5901
|
const cardId = this.slide.cardId;
|
|
5819
5902
|
const cardType = this.slide.cardType;
|
|
@@ -18278,12 +18361,20 @@ class WidgetCopy extends WidgetBase {
|
|
|
18278
18361
|
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `WidgetCallbacks`, `WidgetDeps`]; }
|
|
18279
18362
|
}
|
|
18280
18363
|
|
|
18364
|
+
var DataInputActionAfterCompletion;
|
|
18365
|
+
(function (DataInputActionAfterCompletion) {
|
|
18366
|
+
DataInputActionAfterCompletion["ShowNotification"] = "showNotification";
|
|
18367
|
+
DataInputActionAfterCompletion["ShowLayer"] = "showLayer";
|
|
18368
|
+
DataInputActionAfterCompletion["None"] = "none";
|
|
18369
|
+
})(DataInputActionAfterCompletion || (DataInputActionAfterCompletion = {}));
|
|
18370
|
+
|
|
18281
18371
|
class WidgetDataInput extends WidgetBase {
|
|
18282
18372
|
static DEFAULTS = {
|
|
18283
18373
|
slide: null,
|
|
18284
18374
|
activateAfterCreate: false,
|
|
18285
18375
|
create: false,
|
|
18286
18376
|
localData: {},
|
|
18377
|
+
layers: [],
|
|
18287
18378
|
};
|
|
18288
18379
|
static widgetClassName = "narrative-element-data-input";
|
|
18289
18380
|
label;
|
|
@@ -18291,6 +18382,8 @@ class WidgetDataInput extends WidgetBase {
|
|
|
18291
18382
|
inputElement;
|
|
18292
18383
|
textElement;
|
|
18293
18384
|
inputPlaceholderValue;
|
|
18385
|
+
layers;
|
|
18386
|
+
actionAfterCompletion = null;
|
|
18294
18387
|
/**
|
|
18295
18388
|
* @throws Error
|
|
18296
18389
|
* @param element
|
|
@@ -18305,6 +18398,9 @@ class WidgetDataInput extends WidgetBase {
|
|
|
18305
18398
|
this.inputElement = getValueOrException(this.element.querySelector(".input-view .input"), "Empty .input-view .input");
|
|
18306
18399
|
this.textElement = getValueOrException(this.inputElement.querySelector(".narrative-element-text-lines"), "Empty .narrative-element-text-lines");
|
|
18307
18400
|
this.inputPlaceholderValue = this.textElement.innerHTML;
|
|
18401
|
+
this.layers = this.options.layers;
|
|
18402
|
+
this.actionAfterCompletion =
|
|
18403
|
+
getTagData(this.element, "actionAfterCompletion") ?? DataInputActionAfterCompletion.ShowNotification;
|
|
18308
18404
|
}
|
|
18309
18405
|
/**
|
|
18310
18406
|
* Start or restart widget
|
|
@@ -18313,15 +18409,14 @@ class WidgetDataInput extends WidgetBase {
|
|
|
18313
18409
|
onRefreshUserData(localData) {
|
|
18314
18410
|
super.onRefreshUserData(localData);
|
|
18315
18411
|
const text = this.getTextFromLocalData();
|
|
18316
|
-
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
|
|
18324
|
-
}
|
|
18412
|
+
if (!text)
|
|
18413
|
+
return;
|
|
18414
|
+
this.doCompletitionActionOnRefreshUserData(text);
|
|
18415
|
+
this.startReadyPromise.then(() => {
|
|
18416
|
+
if (this.disableTimer) {
|
|
18417
|
+
this.onWidgetComplete();
|
|
18418
|
+
}
|
|
18419
|
+
});
|
|
18325
18420
|
}
|
|
18326
18421
|
getTextFromLocalData() {
|
|
18327
18422
|
return this.localData["_di_g_" + this.elementId + "_t"];
|
|
@@ -18423,15 +18518,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
18423
18518
|
this.localData["_di_g_" + this.elementId + "_t"] = text;
|
|
18424
18519
|
// answer to question
|
|
18425
18520
|
this.localData["_&ts_di_g_" + this.elementId + "_a_at"] = Math.round(new Date().getTime() / 1000);
|
|
18426
|
-
|
|
18427
|
-
this.widgetDone.classList.add("active", "opacity-active");
|
|
18428
|
-
setTimeout(() => {
|
|
18429
|
-
this.widgetDone?.classList.remove("active");
|
|
18430
|
-
setTimeout(() => {
|
|
18431
|
-
this.widgetDone?.classList.remove("opacity-active");
|
|
18432
|
-
}, 250);
|
|
18433
|
-
}, 2000);
|
|
18434
|
-
}
|
|
18521
|
+
this.doCompletitionAction();
|
|
18435
18522
|
this.setLocalData(this.localData, true);
|
|
18436
18523
|
this._statEventInputSave(text);
|
|
18437
18524
|
if (this.disableTimer) {
|
|
@@ -18443,11 +18530,48 @@ class WidgetDataInput extends WidgetBase {
|
|
|
18443
18530
|
this.onWidgetRequireResumeUI();
|
|
18444
18531
|
}
|
|
18445
18532
|
}
|
|
18533
|
+
doCompletitionAction() {
|
|
18534
|
+
switch (this.actionAfterCompletion) {
|
|
18535
|
+
case DataInputActionAfterCompletion.ShowNotification:
|
|
18536
|
+
this.showNotification();
|
|
18537
|
+
break;
|
|
18538
|
+
case DataInputActionAfterCompletion.ShowLayer:
|
|
18539
|
+
this.showLayer();
|
|
18540
|
+
break;
|
|
18541
|
+
case DataInputActionAfterCompletion.None:
|
|
18542
|
+
return;
|
|
18543
|
+
}
|
|
18544
|
+
}
|
|
18545
|
+
doCompletitionActionOnRefreshUserData(text) {
|
|
18546
|
+
if (this.actionAfterCompletion === DataInputActionAfterCompletion.ShowLayer) {
|
|
18547
|
+
this.showLayer();
|
|
18548
|
+
}
|
|
18549
|
+
else {
|
|
18550
|
+
this._fillUserText(text);
|
|
18551
|
+
this.element.classList.add("done");
|
|
18552
|
+
}
|
|
18553
|
+
}
|
|
18554
|
+
showNotification() {
|
|
18555
|
+
if (this.widgetDone) {
|
|
18556
|
+
this.widgetDone.classList.add("active", "opacity-active");
|
|
18557
|
+
setTimeout(() => {
|
|
18558
|
+
this.widgetDone?.classList.remove("active");
|
|
18559
|
+
setTimeout(() => {
|
|
18560
|
+
this.widgetDone?.classList.remove("opacity-active");
|
|
18561
|
+
}, 250);
|
|
18562
|
+
}, 2000);
|
|
18563
|
+
}
|
|
18564
|
+
}
|
|
18565
|
+
showLayer() {
|
|
18566
|
+
if (this.layers[1] != null) {
|
|
18567
|
+
this._showLayer(this.layers, 1);
|
|
18568
|
+
}
|
|
18569
|
+
}
|
|
18446
18570
|
static api = {
|
|
18447
18571
|
widgetClassName: WidgetDataInput.widgetClassName,
|
|
18448
18572
|
onRefreshUserData: WidgetDataInput.onRefreshUserData,
|
|
18449
|
-
init: function (element, localData, widgetCallbacks, widgetDeps) {
|
|
18450
|
-
WidgetDataInput.initWidget(element, localData, (element, options) => new WidgetDataInput(element, options, widgetCallbacks, widgetDeps));
|
|
18573
|
+
init: function (element, layers, localData, widgetCallbacks, widgetDeps) {
|
|
18574
|
+
WidgetDataInput.initWidget(element, localData, (element, options) => new WidgetDataInput(element, { ...options, layers }, widgetCallbacks, widgetDeps));
|
|
18451
18575
|
},
|
|
18452
18576
|
onStart: function (element) {
|
|
18453
18577
|
WidgetDataInput.getInstance(element)?.onStart();
|
|
@@ -20817,11 +20941,12 @@ class ProductComponentsFactory {
|
|
|
20817
20941
|
},
|
|
20818
20942
|
});
|
|
20819
20943
|
}
|
|
20820
|
-
createProductCheckout(bottomSheet) {
|
|
20944
|
+
createProductCheckout(bottomSheet, params) {
|
|
20821
20945
|
return new ProductCheckout({
|
|
20822
20946
|
onClose: () => bottomSheet.close(),
|
|
20823
20947
|
onCheckout: () => {
|
|
20824
20948
|
this.widgetDeps.slideApiDeps.productCartClicked();
|
|
20949
|
+
params.onCheckout();
|
|
20825
20950
|
},
|
|
20826
20951
|
translations: this.props.translations,
|
|
20827
20952
|
});
|
|
@@ -20864,9 +20989,9 @@ class ProductOfferMapper {
|
|
|
20864
20989
|
oldPrice: offerDto.oldPrice,
|
|
20865
20990
|
currency: offerDto.currency,
|
|
20866
20991
|
description: offerDto.description,
|
|
20867
|
-
imageUrls: offerDto.
|
|
20992
|
+
imageUrls: offerDto.blobImages?.map(image => image.url) ?? [],
|
|
20868
20993
|
adult: offerDto.adult,
|
|
20869
|
-
coverUrl: offerDto.
|
|
20994
|
+
coverUrl: offerDto.blobCoverUrl,
|
|
20870
20995
|
groupId: offerDto.groupId,
|
|
20871
20996
|
url: offerDto.url,
|
|
20872
20997
|
};
|
|
@@ -20932,6 +21057,7 @@ class ProductDetailsBottomSheet extends RenderableComponent {
|
|
|
20932
21057
|
quantity: payload.quantity,
|
|
20933
21058
|
});
|
|
20934
21059
|
this.showProductCheckout();
|
|
21060
|
+
this.props.onAddToCart({ offer, quantity: payload.quantity });
|
|
20935
21061
|
},
|
|
20936
21062
|
isCartSupported,
|
|
20937
21063
|
isCartQuantityEnabled,
|
|
@@ -20939,7 +21065,9 @@ class ProductDetailsBottomSheet extends RenderableComponent {
|
|
|
20939
21065
|
this.updateBottomSheetContent(productDetails);
|
|
20940
21066
|
}
|
|
20941
21067
|
showProductCheckout() {
|
|
20942
|
-
const productCheckout = this.factory.createProductCheckout(this.bottomSheet
|
|
21068
|
+
const productCheckout = this.factory.createProductCheckout(this.bottomSheet, {
|
|
21069
|
+
onCheckout: this.props.onCheckout,
|
|
21070
|
+
});
|
|
20943
21071
|
this.updateBottomSheetContent(productCheckout);
|
|
20944
21072
|
}
|
|
20945
21073
|
updateBottomSheetContent(content) {
|
|
@@ -20991,7 +21119,9 @@ class ProductCheckoutBottomSheet extends RenderableComponent {
|
|
|
20991
21119
|
return this.bottomSheet.render();
|
|
20992
21120
|
}
|
|
20993
21121
|
open() {
|
|
20994
|
-
const productCheckout = this.factory.createProductCheckout(this.bottomSheet
|
|
21122
|
+
const productCheckout = this.factory.createProductCheckout(this.bottomSheet, {
|
|
21123
|
+
onCheckout: this.props.onCheckout,
|
|
21124
|
+
});
|
|
20995
21125
|
this.updateBottomSheetContent(productCheckout);
|
|
20996
21126
|
this.bottomSheet.open();
|
|
20997
21127
|
}
|
|
@@ -21162,33 +21292,34 @@ class ProductOfferRepository {
|
|
|
21162
21292
|
}
|
|
21163
21293
|
}
|
|
21164
21294
|
static collectDistinctImageUrls(offers, into) {
|
|
21165
|
-
for (const
|
|
21166
|
-
if (
|
|
21167
|
-
into.add(
|
|
21295
|
+
for (const offer of offers) {
|
|
21296
|
+
if (offer.coverUrl) {
|
|
21297
|
+
into.add(offer.coverUrl);
|
|
21168
21298
|
}
|
|
21169
|
-
if (
|
|
21170
|
-
for (const img of
|
|
21299
|
+
if (offer.images?.length) {
|
|
21300
|
+
for (const img of offer.images) {
|
|
21171
21301
|
if (img.url) {
|
|
21172
21302
|
into.add(img.url);
|
|
21173
21303
|
}
|
|
21174
21304
|
}
|
|
21175
21305
|
}
|
|
21176
|
-
if (
|
|
21177
|
-
this.collectDistinctImageUrls(
|
|
21306
|
+
if (offer.subOffersApi?.length) {
|
|
21307
|
+
this.collectDistinctImageUrls(offer.subOffersApi, into);
|
|
21178
21308
|
}
|
|
21179
21309
|
}
|
|
21180
21310
|
}
|
|
21181
21311
|
static applyImageBlobMap(offers, originalToBlob) {
|
|
21182
|
-
for (const
|
|
21183
|
-
const coverOrig =
|
|
21312
|
+
for (const offer of offers) {
|
|
21313
|
+
const coverOrig = offer.coverUrl;
|
|
21184
21314
|
if (coverOrig) {
|
|
21185
21315
|
const blobUrl = originalToBlob.get(coverOrig);
|
|
21186
21316
|
if (blobUrl) {
|
|
21187
|
-
|
|
21317
|
+
offer.blobCoverUrl = blobUrl;
|
|
21188
21318
|
}
|
|
21189
21319
|
}
|
|
21190
|
-
if (
|
|
21191
|
-
|
|
21320
|
+
if (offer.images?.length) {
|
|
21321
|
+
offer.blobImages = offer.images.map(image => ({ ...image }));
|
|
21322
|
+
for (const img of offer.blobImages) {
|
|
21192
21323
|
const urlOrig = img.url;
|
|
21193
21324
|
const blobUrl = originalToBlob.get(urlOrig);
|
|
21194
21325
|
if (blobUrl) {
|
|
@@ -21196,8 +21327,8 @@ class ProductOfferRepository {
|
|
|
21196
21327
|
}
|
|
21197
21328
|
}
|
|
21198
21329
|
}
|
|
21199
|
-
if (
|
|
21200
|
-
this.applyImageBlobMap(
|
|
21330
|
+
if (offer.subOffersApi?.length) {
|
|
21331
|
+
this.applyImageBlobMap(offer.subOffersApi, originalToBlob);
|
|
21201
21332
|
}
|
|
21202
21333
|
}
|
|
21203
21334
|
}
|
|
@@ -21551,6 +21682,12 @@ class WidgetProducts extends WidgetBase {
|
|
|
21551
21682
|
openUrl: getTagData(this.element, "msgOpenUrl") ?? "",
|
|
21552
21683
|
},
|
|
21553
21684
|
height: backgroundViewHeight + scrollViewGroupHeight,
|
|
21685
|
+
onCheckout: () => {
|
|
21686
|
+
this.statEventGoToCart();
|
|
21687
|
+
},
|
|
21688
|
+
onAddToCart: (event) => {
|
|
21689
|
+
this.statEventAddToCart(event);
|
|
21690
|
+
},
|
|
21554
21691
|
});
|
|
21555
21692
|
const isCartEnabled = getTagData(this.element, "isCartEnabled") === "true";
|
|
21556
21693
|
const isCartQuantityEnabled = !getTagData(this.element, "isCartQuantityEnabled") || getTagData(this.element, "isCartQuantityEnabled") === "true";
|
|
@@ -21558,6 +21695,49 @@ class WidgetProducts extends WidgetBase {
|
|
|
21558
21695
|
this.productsView.appendChild(bs.render());
|
|
21559
21696
|
bs.open({ offer, isCartSupported, isCartQuantityEnabled });
|
|
21560
21697
|
};
|
|
21698
|
+
statEventGoToCart() {
|
|
21699
|
+
try {
|
|
21700
|
+
const captionViewText = this.captionView?.textContent ?? "";
|
|
21701
|
+
this.sendStatisticEventToApp("w-products-go-to-cart", {
|
|
21702
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
21703
|
+
wi: this.elementId,
|
|
21704
|
+
wl: captionViewText,
|
|
21705
|
+
}, {
|
|
21706
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
21707
|
+
widget_id: this.elementId,
|
|
21708
|
+
widget_label: captionViewText,
|
|
21709
|
+
}, {
|
|
21710
|
+
forceEnableStatisticV2: false,
|
|
21711
|
+
});
|
|
21712
|
+
}
|
|
21713
|
+
catch (error) {
|
|
21714
|
+
console.error(error);
|
|
21715
|
+
}
|
|
21716
|
+
}
|
|
21717
|
+
statEventAddToCart({ offer, quantity }) {
|
|
21718
|
+
try {
|
|
21719
|
+
const captionViewText = this.captionView?.textContent ?? "";
|
|
21720
|
+
this.sendStatisticEventToApp("w-products-add-to-cart", {
|
|
21721
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
21722
|
+
wi: this.elementId,
|
|
21723
|
+
wl: captionViewText,
|
|
21724
|
+
wv: offer.offerId,
|
|
21725
|
+
wvi: offer.id,
|
|
21726
|
+
}, {
|
|
21727
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
21728
|
+
widget_id: this.elementId,
|
|
21729
|
+
widget_label: captionViewText,
|
|
21730
|
+
widget_value: offer.offerId,
|
|
21731
|
+
quantity,
|
|
21732
|
+
widget_value_id: offer.id,
|
|
21733
|
+
}, {
|
|
21734
|
+
forceEnableStatisticV2: false,
|
|
21735
|
+
});
|
|
21736
|
+
}
|
|
21737
|
+
catch (error) {
|
|
21738
|
+
console.error(error);
|
|
21739
|
+
}
|
|
21740
|
+
}
|
|
21561
21741
|
createScrollView(offers) {
|
|
21562
21742
|
const scrollViewGroup = document.createElement("div");
|
|
21563
21743
|
scrollViewGroup.classList.add("ias-products-scroll-view-group");
|
|
@@ -22045,7 +22225,7 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22045
22225
|
this.onWidgetRequirePauseUI();
|
|
22046
22226
|
}
|
|
22047
22227
|
e.stopPropagation();
|
|
22048
|
-
this.
|
|
22228
|
+
this.statEventClickPurchaseButton(offer);
|
|
22049
22229
|
if (isCartSupported) {
|
|
22050
22230
|
this.addToCart(offer, button);
|
|
22051
22231
|
}
|
|
@@ -22091,6 +22271,7 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22091
22271
|
bs.open();
|
|
22092
22272
|
this.isBottomSheetOpened = true;
|
|
22093
22273
|
this.disableHostUIInteraction();
|
|
22274
|
+
this.statEventAddToCart({ offer: offerDto, quantity: 1 });
|
|
22094
22275
|
}
|
|
22095
22276
|
catch (error) {
|
|
22096
22277
|
if (error instanceof Error) {
|
|
@@ -22130,6 +22311,12 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22130
22311
|
this.productsView = null;
|
|
22131
22312
|
}
|
|
22132
22313
|
},
|
|
22314
|
+
onCheckout: () => {
|
|
22315
|
+
this.statEventGoToCart();
|
|
22316
|
+
},
|
|
22317
|
+
onAddToCart: (event) => {
|
|
22318
|
+
this.statEventAddToCart(event);
|
|
22319
|
+
},
|
|
22133
22320
|
};
|
|
22134
22321
|
}
|
|
22135
22322
|
statEventWidgetCardClick(offer) {
|
|
@@ -22138,8 +22325,8 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22138
22325
|
this.sendStatisticEventToApp("w-product-carousel-card-click", {
|
|
22139
22326
|
...this.statisticEventBaseFieldsShortForm,
|
|
22140
22327
|
wi: this.elementId,
|
|
22141
|
-
wl: captionViewText,
|
|
22142
22328
|
wv: offer.offerId,
|
|
22329
|
+
wl: captionViewText,
|
|
22143
22330
|
wvi: offer.id,
|
|
22144
22331
|
}, {
|
|
22145
22332
|
...this.statisticEventBaseFieldsFullForm,
|
|
@@ -22155,6 +22342,63 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22155
22342
|
console.error(error);
|
|
22156
22343
|
}
|
|
22157
22344
|
}
|
|
22345
|
+
statEventClickPurchaseButton(offer) {
|
|
22346
|
+
try {
|
|
22347
|
+
this.sendStatisticEventToApp("w-product-carousel-buy-click", {
|
|
22348
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
22349
|
+
wi: this.elementId,
|
|
22350
|
+
wv: offer.offerId,
|
|
22351
|
+
wvi: offer.id,
|
|
22352
|
+
}, {
|
|
22353
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
22354
|
+
widget_id: this.elementId,
|
|
22355
|
+
widget_value: offer.offerId,
|
|
22356
|
+
widget_value_id: offer.id,
|
|
22357
|
+
}, {
|
|
22358
|
+
forceEnableStatisticV2: false,
|
|
22359
|
+
});
|
|
22360
|
+
}
|
|
22361
|
+
catch (error) {
|
|
22362
|
+
console.error(error);
|
|
22363
|
+
}
|
|
22364
|
+
}
|
|
22365
|
+
statEventAddToCart({ offer, quantity }) {
|
|
22366
|
+
try {
|
|
22367
|
+
this.sendStatisticEventToApp("w-product-carousel-add-to-cart", {
|
|
22368
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
22369
|
+
wi: this.elementId,
|
|
22370
|
+
wv: offer.offerId,
|
|
22371
|
+
wvi: offer.id,
|
|
22372
|
+
}, {
|
|
22373
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
22374
|
+
widget_id: this.elementId,
|
|
22375
|
+
widget_value: offer.offerId,
|
|
22376
|
+
quantity,
|
|
22377
|
+
widget_value_id: offer.id,
|
|
22378
|
+
}, {
|
|
22379
|
+
forceEnableStatisticV2: false,
|
|
22380
|
+
});
|
|
22381
|
+
}
|
|
22382
|
+
catch (error) {
|
|
22383
|
+
console.error(error);
|
|
22384
|
+
}
|
|
22385
|
+
}
|
|
22386
|
+
statEventGoToCart() {
|
|
22387
|
+
try {
|
|
22388
|
+
this.sendStatisticEventToApp("w-product-carousel-go-to-cart", {
|
|
22389
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
22390
|
+
wi: this.elementId,
|
|
22391
|
+
}, {
|
|
22392
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
22393
|
+
widget_id: this.elementId,
|
|
22394
|
+
}, {
|
|
22395
|
+
forceEnableStatisticV2: false,
|
|
22396
|
+
});
|
|
22397
|
+
}
|
|
22398
|
+
catch (error) {
|
|
22399
|
+
console.error(error);
|
|
22400
|
+
}
|
|
22401
|
+
}
|
|
22158
22402
|
isCartSupported() {
|
|
22159
22403
|
const isCartEnabled = getTagData(this.element, "isCartEnabled") === "true";
|
|
22160
22404
|
return this.widgetDeps.slideApiDeps.isSdkSupportProductCart && isCartEnabled;
|
|
@@ -26774,6 +27018,10 @@ class WidgetScratchCard extends WidgetBase {
|
|
|
26774
27018
|
...this.statisticEventBaseFieldsShortForm,
|
|
26775
27019
|
wi: this.elementId,
|
|
26776
27020
|
d: duration,
|
|
27021
|
+
}, {
|
|
27022
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
27023
|
+
widget_id: this.elementId,
|
|
27024
|
+
duration_ms: duration,
|
|
26777
27025
|
});
|
|
26778
27026
|
}
|
|
26779
27027
|
saveToLocalData() {
|