@inappstory/slide-api 0.1.48 → 0.1.50

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.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
- get isClickCapturedBySlider() {
2263
- return this._widgetApi.isClickCapturedBySlider(this._elementNodeRef);
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 ? new DataInput(nodeRef, layer, layoutApi.widgetDataInputApi, widgetCallbacks, widgetDeps) : null;
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._timeline = new SlideTimeline(this._slideIndex, this._duration, this._disabledTimer, this._slideReadyPromise, this._afterAppResumeQueuePush, this.slideApiDeps);
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
- this.slideApiDeps.setCardLocalData({}, true);
5619
- this.slideApiDeps.updateCardServerDataLocally({});
5620
- // window._resetTimers();
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
@@ -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
- this._fillUserText(text);
18315
- if (text != null) {
18316
- this.element.classList.add("done");
18317
- this.startReadyPromise.then(() => {
18318
- if (this.disableTimer) {
18319
- this.onWidgetComplete();
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
- if (this.widgetDone) {
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();
@@ -20408,7 +20532,7 @@ class ProductDetailsPurchase extends RenderableComponent {
20408
20532
  onAddToCartError: this.props.onAddToCartError,
20409
20533
  translations: this.props.translations,
20410
20534
  });
20411
- return h("div", { class: "ias-product-details__purchase" }, h("div", { class: "ias-product-details__price-box" }, this.price.render(), this.counter.render()), this.action.render());
20535
+ return h("div", { class: "ias-product-details__purchase" }, h("div", { class: "ias-product-details__price-box" }, this.price.render(), this.props.isCartQuantityEnabled ? this.counter.render() : null), this.action.render());
20412
20536
  }
20413
20537
  updateProps(props) {
20414
20538
  this.props = { ...this.props, ...props };
@@ -20808,6 +20932,7 @@ class ProductComponentsFactory {
20808
20932
  },
20809
20933
  translations: this.props.translations,
20810
20934
  isCartSupported: params.isCartSupported,
20935
+ isCartQuantityEnabled: params.isCartQuantityEnabled,
20811
20936
  onOpenUrl: () => {
20812
20937
  if (params.product.url)
20813
20938
  this.widgetDeps.slideApiDeps.openUrl({ type: "link", link: { type: "url", target: params.product.url } });
@@ -20912,12 +21037,12 @@ class ProductDetailsBottomSheet extends RenderableComponent {
20912
21037
  this.showProductDetails(params);
20913
21038
  this.bottomSheet.open();
20914
21039
  }
20915
- showProductDetails = ({ offer, isCartSupported }) => {
21040
+ showProductDetails = ({ offer, isCartSupported, isCartQuantityEnabled, }) => {
20916
21041
  const factory = new ProductComponentsFactory(this.widgetDeps, this.props);
20917
21042
  const offerDtos = [offer, ...(offer.subOffersApi ?? [])];
20918
- this.renderProductDetails({ factory, offer, offerDtos, isCartSupported });
21043
+ this.renderProductDetails({ factory, offer, offerDtos, isCartSupported, isCartQuantityEnabled });
20919
21044
  };
20920
- renderProductDetails({ factory, offer, offerDtos, isCartSupported, }) {
21045
+ renderProductDetails({ factory, offer, offerDtos, isCartSupported, isCartQuantityEnabled, }) {
20921
21046
  const { product, relatedProducts } = this.getProductAndRelatedProducts(offer);
20922
21047
  const productDetails = factory.createProductDetails({
20923
21048
  product,
@@ -20931,6 +21056,7 @@ class ProductDetailsBottomSheet extends RenderableComponent {
20931
21056
  this.showProductCheckout();
20932
21057
  },
20933
21058
  isCartSupported,
21059
+ isCartQuantityEnabled,
20934
21060
  });
20935
21061
  this.updateBottomSheetContent(productDetails);
20936
21062
  }
@@ -21549,9 +21675,10 @@ class WidgetProducts extends WidgetBase {
21549
21675
  height: backgroundViewHeight + scrollViewGroupHeight,
21550
21676
  });
21551
21677
  const isCartEnabled = getTagData(this.element, "isCartEnabled") === "true";
21678
+ const isCartQuantityEnabled = !getTagData(this.element, "isCartQuantityEnabled") || getTagData(this.element, "isCartQuantityEnabled") === "true";
21552
21679
  const isCartSupported = this.widgetDeps.slideApiDeps.isSdkSupportProductCart && isCartEnabled;
21553
21680
  this.productsView.appendChild(bs.render());
21554
- bs.open({ offer, isCartSupported });
21681
+ bs.open({ offer, isCartSupported, isCartQuantityEnabled });
21555
21682
  };
21556
21683
  createScrollView(offers) {
21557
21684
  const scrollViewGroup = document.createElement("div");
@@ -21980,7 +22107,8 @@ class WidgetProductCarousel extends WidgetBase {
21980
22107
  showProductDetails = ({ offer, card }) => {
21981
22108
  const bs = new ProductDetailsBottomSheet(this.widgetDeps, this.getBottomSheetParams());
21982
22109
  this.mountBottomSheet(bs);
21983
- bs.open({ offer, isCartSupported: this.isCartSupported() });
22110
+ const isCartQuantityEnabled = !getTagData(this.element, "isCartQuantityEnabled") || getTagData(this.element, "isCartQuantityEnabled") === "true";
22111
+ bs.open({ offer, isCartSupported: this.isCartSupported(), isCartQuantityEnabled });
21984
22112
  this.isBottomSheetOpened = true;
21985
22113
  this.disableHostUIInteraction();
21986
22114
  };