@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.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
- get isClickCapturedBySlider() {
2265
- return this._widgetApi.isClickCapturedBySlider(this._elementNodeRef);
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 ? new DataInput(nodeRef, layer, layoutApi.widgetDataInputApi, widgetCallbacks, widgetDeps) : null;
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._timeline = new SlideTimeline(this._slideIndex, this._duration, this._disabledTimer, this._slideReadyPromise, this._afterAppResumeQueuePush, this.slideApiDeps);
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
- this.slideApiDeps.setCardLocalData({}, true);
5621
- this.slideApiDeps.updateCardServerDataLocally({});
5622
- // window._resetTimers();
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
@@ -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
- this._fillUserText(text);
18317
- if (text != null) {
18318
- this.element.classList.add("done");
18319
- this.startReadyPromise.then(() => {
18320
- if (this.disableTimer) {
18321
- this.onWidgetComplete();
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
- if (this.widgetDone) {
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();
@@ -20410,7 +20534,7 @@ class ProductDetailsPurchase extends RenderableComponent {
20410
20534
  onAddToCartError: this.props.onAddToCartError,
20411
20535
  translations: this.props.translations,
20412
20536
  });
20413
- 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());
20537
+ 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());
20414
20538
  }
20415
20539
  updateProps(props) {
20416
20540
  this.props = { ...this.props, ...props };
@@ -20810,6 +20934,7 @@ class ProductComponentsFactory {
20810
20934
  },
20811
20935
  translations: this.props.translations,
20812
20936
  isCartSupported: params.isCartSupported,
20937
+ isCartQuantityEnabled: params.isCartQuantityEnabled,
20813
20938
  onOpenUrl: () => {
20814
20939
  if (params.product.url)
20815
20940
  this.widgetDeps.slideApiDeps.openUrl({ type: "link", link: { type: "url", target: params.product.url } });
@@ -20914,12 +21039,12 @@ class ProductDetailsBottomSheet extends RenderableComponent {
20914
21039
  this.showProductDetails(params);
20915
21040
  this.bottomSheet.open();
20916
21041
  }
20917
- showProductDetails = ({ offer, isCartSupported }) => {
21042
+ showProductDetails = ({ offer, isCartSupported, isCartQuantityEnabled, }) => {
20918
21043
  const factory = new ProductComponentsFactory(this.widgetDeps, this.props);
20919
21044
  const offerDtos = [offer, ...(offer.subOffersApi ?? [])];
20920
- this.renderProductDetails({ factory, offer, offerDtos, isCartSupported });
21045
+ this.renderProductDetails({ factory, offer, offerDtos, isCartSupported, isCartQuantityEnabled });
20921
21046
  };
20922
- renderProductDetails({ factory, offer, offerDtos, isCartSupported, }) {
21047
+ renderProductDetails({ factory, offer, offerDtos, isCartSupported, isCartQuantityEnabled, }) {
20923
21048
  const { product, relatedProducts } = this.getProductAndRelatedProducts(offer);
20924
21049
  const productDetails = factory.createProductDetails({
20925
21050
  product,
@@ -20933,6 +21058,7 @@ class ProductDetailsBottomSheet extends RenderableComponent {
20933
21058
  this.showProductCheckout();
20934
21059
  },
20935
21060
  isCartSupported,
21061
+ isCartQuantityEnabled,
20936
21062
  });
20937
21063
  this.updateBottomSheetContent(productDetails);
20938
21064
  }
@@ -21551,9 +21677,10 @@ class WidgetProducts extends WidgetBase {
21551
21677
  height: backgroundViewHeight + scrollViewGroupHeight,
21552
21678
  });
21553
21679
  const isCartEnabled = getTagData(this.element, "isCartEnabled") === "true";
21680
+ const isCartQuantityEnabled = !getTagData(this.element, "isCartQuantityEnabled") || getTagData(this.element, "isCartQuantityEnabled") === "true";
21554
21681
  const isCartSupported = this.widgetDeps.slideApiDeps.isSdkSupportProductCart && isCartEnabled;
21555
21682
  this.productsView.appendChild(bs.render());
21556
- bs.open({ offer, isCartSupported });
21683
+ bs.open({ offer, isCartSupported, isCartQuantityEnabled });
21557
21684
  };
21558
21685
  createScrollView(offers) {
21559
21686
  const scrollViewGroup = document.createElement("div");
@@ -21982,7 +22109,8 @@ class WidgetProductCarousel extends WidgetBase {
21982
22109
  showProductDetails = ({ offer, card }) => {
21983
22110
  const bs = new ProductDetailsBottomSheet(this.widgetDeps, this.getBottomSheetParams());
21984
22111
  this.mountBottomSheet(bs);
21985
- bs.open({ offer, isCartSupported: this.isCartSupported() });
22112
+ const isCartQuantityEnabled = !getTagData(this.element, "isCartQuantityEnabled") || getTagData(this.element, "isCartQuantityEnabled") === "true";
22113
+ bs.open({ offer, isCartSupported: this.isCartSupported(), isCartQuantityEnabled });
21986
22114
  this.isBottomSheetOpened = true;
21987
22115
  this.disableHostUIInteraction();
21988
22116
  };