@inappstory/slide-api 0.1.21 → 0.1.23

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
@@ -3134,6 +3134,7 @@ class Layer {
3134
3134
  _getLayoutDirection;
3135
3135
  _slidePauseUI;
3136
3136
  _slideResumeUI;
3137
+ _getSdkClientVariables;
3137
3138
  _slideIndex;
3138
3139
  _cardId;
3139
3140
  _cardType;
@@ -3144,7 +3145,7 @@ class Layer {
3144
3145
  _elements = [];
3145
3146
  _timeline;
3146
3147
  _widgetDeps;
3147
- constructor(_nodeRef, _slide, _slideReadyPromise, _afterAppResumeQueuePush, _afterStartInitQueuePush, _showNextSlide, sdkApi, _slideRoot, _getLayoutDirection, _slidePauseUI, _slideResumeUI) {
3148
+ constructor(_nodeRef, _slide, _slideReadyPromise, _afterAppResumeQueuePush, _afterStartInitQueuePush, _showNextSlide, sdkApi, _slideRoot, _getLayoutDirection, _slidePauseUI, _slideResumeUI, _getSdkClientVariables) {
3148
3149
  this._nodeRef = _nodeRef;
3149
3150
  this._slide = _slide;
3150
3151
  this._slideReadyPromise = _slideReadyPromise;
@@ -3156,6 +3157,7 @@ class Layer {
3156
3157
  this._getLayoutDirection = _getLayoutDirection;
3157
3158
  this._slidePauseUI = _slidePauseUI;
3158
3159
  this._slideResumeUI = _slideResumeUI;
3160
+ this._getSdkClientVariables = _getSdkClientVariables;
3159
3161
  this._slideIndex = parseInt(this._nodeRef.getAttribute("data-index") ?? "0");
3160
3162
  this._cardId = parseInt(this._nodeRef.getAttribute("data-id") ?? "0");
3161
3163
  this._cardType = parseInt(this._nodeRef.getAttribute("data-card-type") ?? "1") || 1 /* CARD_TYPE.STORY */;
@@ -3164,7 +3166,12 @@ class Layer {
3164
3166
  this._disabledTimer = this._nodeRef.getAttribute("data-disable-timer") === "1";
3165
3167
  this._disabledNavigation = this._nodeRef.getAttribute("data-disable-navigation") === "1";
3166
3168
  this._timeline = new SlideTimeline(this._slideIndex, this._duration, this._disabledTimer, this._slideReadyPromise, this._afterAppResumeQueuePush, this.sdkApi);
3167
- this._widgetDeps = { sdkApi: this.sdkApi, slideRoot: this._slideRoot, getLayoutDirection: this._getLayoutDirection };
3169
+ this._widgetDeps = {
3170
+ sdkApi: this.sdkApi,
3171
+ slideRoot: this._slideRoot,
3172
+ getLayoutDirection: this._getLayoutDirection,
3173
+ getSdkClientVariables: this._getSdkClientVariables,
3174
+ };
3168
3175
  const onWidgetComplete = (cardId, slideIndex) => {
3169
3176
  // todo if nothing more widgets with disabled timers - we can start layer timeline
3170
3177
  const fallback = () => this._showNextSlide(DEFAULT_SLIDE_DURATION);
@@ -3501,7 +3508,7 @@ class Layer {
3501
3508
  get isLayerForcePaused() {
3502
3509
  return this.elements.some(element => element.isLayerForcePaused);
3503
3510
  }
3504
- static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Slide`, `Promise`, `(cb: () => void) => void`, `(cb: () => void) => void`, `(duration: number) => void`, `SDKApi`, `HTMLElement`, `() => "ltr" | "rtl"`, `() => Promise<void>`, `() => Promise<void>`]; }
3511
+ static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Slide`, `Promise`, `(cb: () => void) => void`, `(cb: () => void) => void`, `(duration: number) => void`, `SDKApi`, `HTMLElement`, `() => "ltr" | "rtl"`, `() => Promise<void>`, `() => Promise<void>`, `GetSdkClientVariables`]; }
3505
3512
  }
3506
3513
  const TextFit = (function () {
3507
3514
  const defaultSettings = {
@@ -3698,9 +3705,10 @@ class Slide {
3698
3705
  _getLayoutDirection;
3699
3706
  _slidePauseUI;
3700
3707
  _slideResumeUI;
3708
+ _getSdkClientVariables;
3701
3709
  _layers;
3702
3710
  _start;
3703
- constructor(_slidesNodesRefs, _slideReadyPromise, _afterAppResumeQueuePush, _afterStartInitQueuePush, _showNextSlide, sdkApi, _slideRoot, _getLayoutDirection, _slidePauseUI, _slideResumeUI) {
3711
+ constructor(_slidesNodesRefs, _slideReadyPromise, _afterAppResumeQueuePush, _afterStartInitQueuePush, _showNextSlide, sdkApi, _slideRoot, _getLayoutDirection, _slidePauseUI, _slideResumeUI, _getSdkClientVariables) {
3704
3712
  this._slidesNodesRefs = _slidesNodesRefs;
3705
3713
  this._slideReadyPromise = _slideReadyPromise;
3706
3714
  this._afterAppResumeQueuePush = _afterAppResumeQueuePush;
@@ -3711,11 +3719,12 @@ class Slide {
3711
3719
  this._getLayoutDirection = _getLayoutDirection;
3712
3720
  this._slidePauseUI = _slidePauseUI;
3713
3721
  this._slideResumeUI = _slideResumeUI;
3722
+ this._getSdkClientVariables = _getSdkClientVariables;
3714
3723
  this._start = window.performance.now();
3715
3724
  if (!this._slidesNodesRefs.length) {
3716
3725
  throw new Error("No slides found.");
3717
3726
  }
3718
- this._layers = this._slidesNodesRefs.map(item => new Layer(item, this, this._slideReadyPromise, this._afterAppResumeQueuePush, this._afterStartInitQueuePush, this._showNextSlide, this.sdkApi, this._slideRoot, this._getLayoutDirection, this._slidePauseUI, this._slideResumeUI));
3727
+ this._layers = this._slidesNodesRefs.map(item => new Layer(item, this, this._slideReadyPromise, this._afterAppResumeQueuePush, this._afterStartInitQueuePush, this._showNextSlide, this.sdkApi, this._slideRoot, this._getLayoutDirection, this._slidePauseUI, this._slideResumeUI, this._getSdkClientVariables));
3719
3728
  this._activeLayer = this._layers[0];
3720
3729
  }
3721
3730
  _activeLayer;
@@ -3738,6 +3747,7 @@ class Slide {
3738
3747
  sdkApi: this.sdkApi,
3739
3748
  slideRoot: this._slideRoot,
3740
3749
  getLayoutDirection: this._getLayoutDirection,
3750
+ getSdkClientVariables: this._getSdkClientVariables,
3741
3751
  });
3742
3752
  }
3743
3753
  catch (e) {
@@ -3811,10 +3821,10 @@ class Slide {
3811
3821
  get disabledNavigation() {
3812
3822
  return this._activeLayer.disabledNavigation;
3813
3823
  }
3814
- static get [Symbol.for("___CTOR_ARGS___")]() { return [`Array`, `Promise`, `(cb: () => void) => void`, `(cb: () => void) => void`, `(duration: number) => void`, `SDKApi`, `HTMLElement`, `() => "ltr" | "rtl"`, `() => Promise<void>`, `() => Promise<void>`]; }
3824
+ static get [Symbol.for("___CTOR_ARGS___")]() { return [`Array`, `Promise`, `(cb: () => void) => void`, `(cb: () => void) => void`, `(duration: number) => void`, `SDKApi`, `HTMLElement`, `() => "ltr" | "rtl"`, `() => Promise<void>`, `() => Promise<void>`, `GetSdkClientVariables`]; }
3815
3825
  }
3816
3826
 
3817
- let SlideApi$1 = class SlideApi {
3827
+ class CardApi {
3818
3828
  config;
3819
3829
  get layoutDirection() {
3820
3830
  // warning, detection in ctor not working, bcz sdk changes layout later
@@ -3828,6 +3838,7 @@ let SlideApi$1 = class SlideApi {
3828
3838
  _getViewportHeight;
3829
3839
  _overlappingActionBarHeight;
3830
3840
  _separateUserAndAppPause;
3841
+ _index;
3831
3842
  sdkApi;
3832
3843
  constructor(config) {
3833
3844
  this.config = config;
@@ -3838,9 +3849,10 @@ let SlideApi$1 = class SlideApi {
3838
3849
  this._getViewportHeight = config.getViewportHeight;
3839
3850
  this._overlappingActionBarHeight = config.overlappingActionBarHeight ?? 0;
3840
3851
  this._separateUserAndAppPause = config.separateUserAndAppPause;
3841
- this.refreshSizes = proxy(this.refreshSizes, this);
3842
- this.initListeners();
3843
- this.refreshSizes();
3852
+ this._index = config.index;
3853
+ }
3854
+ checkAndInitPreloadedInLayoutSlide(slideLoadedCb) {
3855
+ // for sdk backward compatibility
3844
3856
  const slideBox = document.getElementById("narrative-slide-box");
3845
3857
  // todo via first child and its innerText - faster variant
3846
3858
  if (slideBox && slideBox.innerText.trim() !== "{%content}".replace("{", "{{").replace("}", "}}")) {
@@ -3848,121 +3860,45 @@ let SlideApi$1 = class SlideApi {
3848
3860
  this._slideInRender = true;
3849
3861
  this._init(() => this._slideBoxRenderComplete(null)).then(({ slide, result, reason }) => {
3850
3862
  this._slide = slide;
3851
- if (config.slideLoadedCb != null) {
3852
- config.slideLoadedCb({ cardId: slide.cardId, slideIndex: slide.slideIndex, result, reason });
3863
+ if (slideLoadedCb != null) {
3864
+ slideLoadedCb({ cardId: slide.cardId, slideIndex: slide.slideIndex, result, reason });
3853
3865
  }
3854
3866
  });
3855
3867
  }
3856
3868
  }
3857
- async destroy() {
3858
- if (this.slide != null) {
3859
- await this.slide.onBeforeUnmount();
3860
- }
3861
- this.destroyListeners();
3862
- this._state = 13 /* STATE.DESTROYED */;
3863
- }
3864
- initListeners() {
3865
- this._viewport.addEventListener("resize", this.refreshSizes);
3866
- }
3867
- destroyListeners() {
3868
- this._viewport.removeEventListener("resize", this.refreshSizes);
3869
- }
3870
- _savedViewportWidth = null;
3871
- _savedViewportHeight = null;
3872
- refreshSizes() {
3873
- const viewportWidth = this._getViewportWidth();
3874
- const viewportHeight = this._getViewportHeight();
3875
- if (this._savedViewportWidth === viewportWidth && this._savedViewportHeight === viewportHeight) {
3876
- return;
3877
- }
3878
- this._savedViewportWidth = viewportWidth;
3879
- this._savedViewportHeight = viewportHeight;
3880
- const viewportRatio = viewportWidth / viewportHeight;
3881
- let slideWidth = 0;
3882
- let slideHeight = 0;
3883
- // _ratio = 310 / 480,
3884
- const _ratio = this.config.slideRatio;
3885
- let _isFullscreen = this.config.isFullscreen;
3886
- const slideOffset = this._slideWrapper.querySelector(".narrative-slide-offset");
3887
- let offset = 0;
3888
- let xOffset = "0px";
3889
- // for elements with bottom anchor (absolute position)
3890
- let yOffset = "0px";
3891
- // alert(viewportHeight);
3892
- // todo - mobile only (or isIos or isAndroid)
3893
- if (this.sdkApi.isAndroid || this.sdkApi.isIOS) {
3894
- if (viewportRatio > _ratio) {
3895
- // disable _isFullscreen if viewport small
3896
- _isFullscreen = false;
3897
- }
3898
- }
3899
- if (_isFullscreen) {
3900
- // более квадратное чем надо (desktop)
3901
- if (viewportRatio > _ratio) {
3902
- // fit by height
3903
- slideHeight = viewportHeight;
3904
- slideWidth = Math.ceil(slideHeight * _ratio);
3905
- offset = Math.ceil(slideWidth - viewportWidth) / 2;
3906
- if (slideOffset != null) {
3907
- slideOffset.style.margin = "0 " + -offset + "px"; // -8.5
3908
- }
3909
- xOffset = offset + "px";
3910
- }
3911
- else {
3912
- // fit by width, top and bottom - to offscreen or fill with bg image
3913
- slideWidth = viewportWidth;
3914
- slideHeight = Math.ceil(viewportWidth / _ratio);
3915
- offset = Math.ceil(slideHeight - viewportHeight) / 2;
3916
- if (slideOffset != null) {
3917
- slideOffset.style.margin = -1 * offset + "px" + " 0 ";
3918
- }
3919
- // offset from viewport bottom to StoryBottom plus safe area offset bottom
3920
- yOffset = `calc(${offset + this._overlappingActionBarHeight}px + env(safe-area-inset-bottom))`;
3921
- // detect safe area offset
3922
- }
3923
- }
3924
- else {
3925
- // более квадратное чем надо
3926
- if (viewportRatio > _ratio) {
3927
- // fit by width, top and bottom - to offscreen
3928
- slideWidth = viewportWidth;
3929
- slideHeight = Math.ceil(viewportWidth / _ratio);
3930
- offset = Math.ceil(slideHeight - viewportHeight) / 2;
3931
- if (slideOffset != null) {
3932
- slideOffset.style.margin = -offset + "px" + " 0 ";
3933
- }
3934
- yOffset = offset + this._overlappingActionBarHeight + "px";
3869
+ onUpdateSizeMetrics({ fontSize, xOffset, yOffset, isFullscreen, }) {
3870
+ // todo CSP violation
3871
+ this._slideWrapper.style.fontSize = fontSize;
3872
+ if (this.slideOffsetElement != null) {
3873
+ // todo CSP violation
3874
+ this.slideOffsetElement.style.setProperty("--y-offset", yOffset);
3875
+ this.slideOffsetElement.style.setProperty("--x-offset", xOffset);
3876
+ if (isFullscreen) {
3877
+ this.slideOffsetElement.classList.add("narrative-slide-offset-fullscreen");
3935
3878
  }
3936
3879
  else {
3937
- // вьюпорт более вытянутый чем надо
3938
- // fit by height, sides - to offscreen
3939
- slideHeight = viewportHeight;
3940
- slideWidth = Math.ceil(slideHeight * _ratio);
3941
- offset = Math.ceil(slideWidth - viewportWidth) / 2;
3942
- if (slideOffset != null) {
3943
- slideOffset.style.margin = "0 " + -offset + "px"; // -8.5
3944
- }
3945
- xOffset = offset + "px";
3880
+ this.slideOffsetElement.classList.remove("narrative-slide-offset-fullscreen");
3946
3881
  }
3947
3882
  }
3948
- const fontSize = slideWidth / 20;
3949
- // todo CSP violation
3950
- this._slideWrapper.style.fontSize = fontSize + "px";
3951
- if (slideOffset != null) {
3952
- // todo CSP violation
3953
- slideOffset.style.setProperty("--y-offset", yOffset);
3954
- slideOffset.style.setProperty("--x-offset", xOffset);
3955
- }
3956
- if (_isFullscreen) {
3957
- slideOffset?.classList.add("narrative-slide-offset-fullscreen");
3958
- }
3959
- if (this.config.userResizeHandler != null) {
3960
- this.config.userResizeHandler({ viewportWidth, viewportHeight, fontSize });
3883
+ }
3884
+ get slideWrapperElement() {
3885
+ return this._slideWrapper;
3886
+ }
3887
+ get slideOffsetElement() {
3888
+ return this._slideWrapper.querySelector(".narrative-slide-offset");
3889
+ }
3890
+ get index() {
3891
+ return this._index;
3892
+ }
3893
+ async destroy() {
3894
+ if (this.slide != null) {
3895
+ await this.slide.onBeforeUnmount();
3961
3896
  }
3897
+ this._state = 13 /* STATE.DESTROYED */;
3962
3898
  }
3963
3899
  async showSlide(html) {
3964
- const slideBox = this._slideWrapper.querySelector(`.${SlideApi.renderedBoxClassName}`);
3965
- const slideBoxPrerender = this._slideWrapper.querySelector(`.${SlideApi.prerenderBoxClassName}`);
3900
+ const slideBox = this._slideWrapper.querySelector(`.${CardApi.renderedBoxClassName}`);
3901
+ const slideBoxPrerender = this._slideWrapper.querySelector(`.${CardApi.prerenderBoxClassName}`);
3966
3902
  const _result = { cardId: this.slide?.cardId ?? 0, slideIndex: this.slide?.slideIndex ?? 0, result: false, reason: "" };
3967
3903
  if (slideBox && slideBoxPrerender) {
3968
3904
  if (this._slideInRender) {
@@ -3971,7 +3907,9 @@ let SlideApi$1 = class SlideApi {
3971
3907
  }
3972
3908
  this._slideInInit = null;
3973
3909
  this._slideInRender = true;
3974
- slideBoxPrerender.innerHTML = html;
3910
+ if (html != null) {
3911
+ slideBoxPrerender.innerHTML = html;
3912
+ }
3975
3913
  const prevSlide = this.slide ? Object.assign(Object.create(Object.getPrototypeOf(this.slide)), this.slide) : null;
3976
3914
  const { slide, result, reason } = await this._init(() => this._slideBoxRenderComplete(prevSlide));
3977
3915
  this._slide = slide;
@@ -3980,7 +3918,7 @@ let SlideApi$1 = class SlideApi {
3980
3918
  }
3981
3919
  else {
3982
3920
  _result.result = false;
3983
- _result.reason = `Element .${SlideApi.renderedBoxClassName} or .${SlideApi.prerenderBoxClassName} does not found in DOM`;
3921
+ _result.reason = `Element .${CardApi.renderedBoxClassName} or .${CardApi.prerenderBoxClassName} does not found in DOM`;
3984
3922
  }
3985
3923
  _result.cardId = this.slide.cardId;
3986
3924
  _result.slideIndex = this.slide.slideIndex;
@@ -4085,9 +4023,9 @@ let SlideApi$1 = class SlideApi {
4085
4023
  /**
4086
4024
  * For case when SlideApi instance was created before root was attached to DOM
4087
4025
  */
4088
- this.refreshSizes();
4089
- const slideNodeRef = this._slideWrapper.querySelector(`.${SlideApi.prerenderBoxClassName} .narrative-slide`);
4090
- const slidesNodesRefs = Array.prototype.slice.call(this._slideWrapper.querySelectorAll(`.${SlideApi.prerenderBoxClassName} .narrative-slide.narrative-multi-slide`));
4026
+ this.config.refreshSizes();
4027
+ const slideNodeRef = this._slideWrapper.querySelector(`.${CardApi.prerenderBoxClassName} .narrative-slide`);
4028
+ const slidesNodesRefs = Array.prototype.slice.call(this._slideWrapper.querySelectorAll(`.${CardApi.prerenderBoxClassName} .narrative-slide.narrative-multi-slide`));
4091
4029
  if (!slidesNodesRefs.length && slideNodeRef != null) {
4092
4030
  slidesNodesRefs.push(slideNodeRef);
4093
4031
  }
@@ -4098,7 +4036,7 @@ let SlideApi$1 = class SlideApi {
4098
4036
  const slideReadyPromise = new Promise(resolve => {
4099
4037
  slideReadyResolve = resolve;
4100
4038
  });
4101
- const slide = new Slide(slidesNodesRefs, slideReadyPromise, this.afterAppResumeQueuePush.bind(this), this.afterStartInitQueuePush.bind(this), this.sdkApi.showNextSlide.bind(this), this.sdkApi, this._slideWrapper, () => this.layoutDirection, this.slidePauseUI.bind(this), this.slideResumeUI.bind(this));
4039
+ const slide = new Slide(slidesNodesRefs, slideReadyPromise, this.afterAppResumeQueuePush.bind(this), this.afterStartInitQueuePush.bind(this), this.sdkApi.showNextSlide.bind(this), this.sdkApi, this._slideWrapper, () => this.layoutDirection, this.slidePauseUI.bind(this), this.slideResumeUI.bind(this), this.config.getSdkClientVariables);
4102
4040
  this._slideInInit = slide;
4103
4041
  slide.activeLayer.timeline.triggerSlideLoadState();
4104
4042
  if (this.sdkApi.isAndroid) {
@@ -4160,12 +4098,12 @@ let SlideApi$1 = class SlideApi {
4160
4098
  return;
4161
4099
  }
4162
4100
  return new Promise(resolve => {
4163
- const slideBox = this._slideWrapper.querySelector(`.${SlideApi.renderedBoxClassName}`);
4164
- const slideBoxPrerender = this._slideWrapper.querySelector(`.${SlideApi.prerenderBoxClassName}`);
4101
+ const slideBox = this._slideWrapper.querySelector(`.${CardApi.renderedBoxClassName}`);
4102
+ const slideBoxPrerender = this._slideWrapper.querySelector(`.${CardApi.prerenderBoxClassName}`);
4165
4103
  if (slideBox && slideBoxPrerender) {
4166
- slideBoxPrerender.classList.remove(SlideApi.prerenderBoxClassName);
4167
- slideBox.classList.remove(SlideApi.renderedBoxClassName);
4168
- slideBox.classList.add(SlideApi.prerenderBoxClassName);
4104
+ slideBoxPrerender.classList.remove(CardApi.prerenderBoxClassName);
4105
+ slideBox.classList.remove(CardApi.renderedBoxClassName);
4106
+ slideBox.classList.add(CardApi.prerenderBoxClassName);
4169
4107
  // pause Video - prevent triggering onDataWaiting from VODPlayer
4170
4108
  prevSlide?.activeLayer.pause(false, true, false);
4171
4109
  // 2 RAF - wait for browser render complete (CSS changes, etc.)
@@ -4189,7 +4127,7 @@ let SlideApi$1 = class SlideApi {
4189
4127
  else {
4190
4128
  resolve();
4191
4129
  }
4192
- slideBoxPrerender.classList.add(SlideApi.renderedBoxClassName);
4130
+ slideBoxPrerender.classList.add(CardApi.renderedBoxClassName);
4193
4131
  }
4194
4132
  else {
4195
4133
  resolve();
@@ -5028,7 +4966,446 @@ let SlideApi$1 = class SlideApi {
5028
4966
  }
5029
4967
  }
5030
4968
  }
5031
- static get [Symbol.for("___CTOR_ARGS___")]() { return [`{\n sdkApi: SDKApi;\n slideWrapper: HTMLElement;\n viewport: Window;\n userResizeHandler?: (data: { viewportWidth: number; viewportHeight: number; fontSize: number }) => void;\n slideRatio: number;\n isFullscreen: boolean;\n slideLoadedCb?: (data: { cardId: number; slideIndex: number; result: boolean; reason?: string }) => void;\n getViewportWidth: () => number;\n getViewportHeight: () => number;\n overlappingActionBarHeight?: number;\n separateUserAndAppPause: boolean;\n }`]; }
4969
+ static get [Symbol.for("___CTOR_ARGS___")]() { return [`{
4970
+ sdkApi: SDKApi;
4971
+ slideWrapper: HTMLElement;
4972
+ viewport: Window;
4973
+ userResizeHandler?: (data: { viewportWidth: number; viewportHeight: number; fontSize: number }) => void;
4974
+ slideRatio: number;
4975
+ isFullscreen: boolean;
4976
+ getViewportWidth: () => number;
4977
+ getViewportHeight: () => number;
4978
+ overlappingActionBarHeight?: number;
4979
+ separateUserAndAppPause: boolean;
4980
+ root: HTMLElement;
4981
+ nonce?: string;
4982
+ refreshSizes: () => void;
4983
+ index: number;
4984
+ getSdkClientVariables: GetSdkClientVariables;
4985
+ }`]; }
4986
+ }
4987
+
4988
+ class CardsSlider {
4989
+ sdkApi;
4990
+ constructor(sdkApi, config) {
4991
+ this.sdkApi = sdkApi;
4992
+ const slideWrapper = this.createSliderElement({ slides: config.cards, nonce: config.nonce, cardRender: config.cardRender });
4993
+ // todo need to clear root node before append slideWrapper?
4994
+ config.root.appendChild(slideWrapper);
4995
+ // cardMounted: (card: HTMLElement) => Promise<void>
4996
+ requestAnimationFrame(async () => {
4997
+ for (let i = 0; i < this.cardsElements.length; ++i) {
4998
+ await config.onCardMounted(this.cardsElements[i], i);
4999
+ }
5000
+ });
5001
+ }
5002
+ cardsElements = [];
5003
+ sliderTrack = null;
5004
+ createSliderElement = ({ slides, nonce, cardRender }) => {
5005
+ const style = document.createElement("style");
5006
+ if (nonce != null) {
5007
+ style.nonce = nonce;
5008
+ }
5009
+ const slider = document.createElement("div");
5010
+ slider.classList.add("cards-slider");
5011
+ const track = document.createElement("div");
5012
+ track.classList.add("cards-slider__track");
5013
+ this.sliderTrack = track;
5014
+ for (let i = 0; i < slides.length; ++i) {
5015
+ const slide = document.createElement("div");
5016
+ slide.classList.add("cards-slider__slide");
5017
+ slide.setAttribute("data-index", String(i));
5018
+ this.cardsElements[i] = cardRender(slides[i]);
5019
+ slide.appendChild(this.cardsElements[i]);
5020
+ track.appendChild(slide);
5021
+ }
5022
+ const bullets = document.createElement("div");
5023
+ bullets.classList.add("cards-slider__bullets");
5024
+ slider.appendChild(track);
5025
+ slider.appendChild(bullets);
5026
+ slider.appendChild(style);
5027
+ return slider;
5028
+ };
5029
+ showByIndex(prevIndex, newIndex) {
5030
+ const width = this.cardsElements[0].clientWidth;
5031
+ let offset = 0;
5032
+ // todo rtl ltr
5033
+ // if (newIndex > prevIndex) {
5034
+ offset = -1 * newIndex * width;
5035
+ // } else {
5036
+ // offset = newIndex * width;
5037
+ // }
5038
+ console.log({ prevIndex, newIndex, offset, width });
5039
+ this.sliderTrack?.style.setProperty("transition", "transform 300ms");
5040
+ setTimeout(() => {
5041
+ this.sliderTrack?.style.setProperty("transition", "none");
5042
+ }, 300);
5043
+ this.sliderTrack?.style.setProperty("transform", `translateX(${offset}px)`);
5044
+ }
5045
+ static get [Symbol.for("___CTOR_ARGS___")]() { return [`SDKApi`, `{
5046
+ cards: Array<string>;
5047
+ root: HTMLElement;
5048
+ // isFullscreen: boolean;
5049
+ nonce?: string;
5050
+ // viewport: Window;
5051
+ // userResizeHandler?: (data: { viewportWidth: number; viewportHeight: number; fontSize: number }) => void;
5052
+ // VODPlayer?: typeof VODPlayer;
5053
+ // overlappingActionBarHeight?: number;
5054
+ cardRender: (card: string) => HTMLElement;
5055
+ onCardMounted: (card: HTMLElement, index: number) => Promise<void>;
5056
+ }`]; }
5057
+ }
5058
+
5059
+ let SlideApi$1 = class SlideApi {
5060
+ config;
5061
+ get layoutDirection() {
5062
+ return this.activeCard.layoutDirection;
5063
+ }
5064
+ static renderedBoxClassName = "narrative-slide-box-rendered";
5065
+ static prerenderBoxClassName = "narrative-slide-box-prerender";
5066
+ _singleCardSlideWrapper;
5067
+ _viewport;
5068
+ _getViewportWidth;
5069
+ _getViewportHeight;
5070
+ _overlappingActionBarHeight;
5071
+ _separateUserAndAppPause;
5072
+ sdkApi;
5073
+ activeCard = null;
5074
+ cards = [];
5075
+ multiCardsMode = 0 /* MULTI_CARDS_MODE.SINGLE */;
5076
+ constructor(config) {
5077
+ this.config = config;
5078
+ this.sdkApi = config.sdkApi;
5079
+ this._singleCardSlideWrapper = config.slideWrapper;
5080
+ this._viewport = config.viewport;
5081
+ this._getViewportWidth = config.getViewportWidth;
5082
+ this._getViewportHeight = config.getViewportHeight;
5083
+ this._overlappingActionBarHeight = config.overlappingActionBarHeight ?? 0;
5084
+ this._separateUserAndAppPause = config.separateUserAndAppPause;
5085
+ this.refreshSizes = proxy(this.refreshSizes, this);
5086
+ this.getSdkClientVariables = proxy(this.getSdkClientVariables, this);
5087
+ // create card api instance, need for refreshSizes
5088
+ // default mode - single slide
5089
+ this.activeCard = new CardApi({
5090
+ sdkApi: this.config.sdkApi,
5091
+ slideWrapper: this.config.slideWrapper,
5092
+ viewport: this.config.viewport,
5093
+ userResizeHandler: this.config.userResizeHandler,
5094
+ slideRatio: this.config.slideRatio,
5095
+ isFullscreen: this.config.isFullscreen,
5096
+ getViewportWidth: this.config.getViewportWidth,
5097
+ getViewportHeight: this.config.getViewportHeight,
5098
+ overlappingActionBarHeight: this.config.overlappingActionBarHeight,
5099
+ separateUserAndAppPause: this.config.separateUserAndAppPause,
5100
+ root: this.config.root,
5101
+ refreshSizes: this.refreshSizes,
5102
+ index: 0,
5103
+ getSdkClientVariables: this.getSdkClientVariables,
5104
+ });
5105
+ this.activeCard.checkAndInitPreloadedInLayoutSlide(this.config.slideLoadedCb);
5106
+ this.initListeners();
5107
+ this.refreshSizes();
5108
+ }
5109
+ get state() {
5110
+ // TODO remove usage from web-sdk
5111
+ return this.activeCard.state;
5112
+ }
5113
+ async destroy() {
5114
+ await this.activeCard.destroy();
5115
+ await Promise.all(this.cards.map(card => {
5116
+ if (card !== this.activeCard) {
5117
+ return card.destroy();
5118
+ }
5119
+ }));
5120
+ this.destroyListeners();
5121
+ }
5122
+ initListeners() {
5123
+ this._viewport.addEventListener("resize", this.refreshSizes);
5124
+ }
5125
+ destroyListeners() {
5126
+ this._viewport.removeEventListener("resize", this.refreshSizes);
5127
+ }
5128
+ _savedViewportWidth = null;
5129
+ _savedViewportHeight = null;
5130
+ refreshSizes() {
5131
+ const viewportWidth = this._getViewportWidth();
5132
+ const viewportHeight = this._getViewportHeight();
5133
+ if (this._savedViewportWidth === viewportWidth && this._savedViewportHeight === viewportHeight) {
5134
+ return;
5135
+ }
5136
+ this._savedViewportWidth = viewportWidth;
5137
+ this._savedViewportHeight = viewportHeight;
5138
+ const viewportRatio = viewportWidth / viewportHeight;
5139
+ let slideWidth = 0;
5140
+ let slideHeight = 0;
5141
+ // _ratio = 310 / 480,
5142
+ const _ratio = this.config.slideRatio;
5143
+ let _isFullscreen = this.config.isFullscreen;
5144
+ const slideOffset = this.activeCard.slideOffsetElement;
5145
+ let offset = 0;
5146
+ let xOffset = "0px";
5147
+ // for elements with bottom anchor (absolute position)
5148
+ let yOffset = "0px";
5149
+ // alert(viewportHeight);
5150
+ // todo - mobile only (or isIos or isAndroid)
5151
+ if (this.sdkApi.isAndroid || this.sdkApi.isIOS) {
5152
+ if (viewportRatio > _ratio) {
5153
+ // disable _isFullscreen if viewport small
5154
+ _isFullscreen = false;
5155
+ }
5156
+ }
5157
+ if (_isFullscreen) {
5158
+ // более квадратное чем надо (desktop)
5159
+ if (viewportRatio > _ratio) {
5160
+ // fit by height
5161
+ slideHeight = viewportHeight;
5162
+ slideWidth = Math.ceil(slideHeight * _ratio);
5163
+ offset = Math.ceil(slideWidth - viewportWidth) / 2;
5164
+ if (slideOffset != null) {
5165
+ slideOffset.style.margin = "0 " + -offset + "px"; // -8.5
5166
+ }
5167
+ xOffset = offset + "px";
5168
+ }
5169
+ else {
5170
+ // fit by width, top and bottom - to offscreen or fill with bg image
5171
+ slideWidth = viewportWidth;
5172
+ slideHeight = Math.ceil(viewportWidth / _ratio);
5173
+ offset = Math.ceil(slideHeight - viewportHeight) / 2;
5174
+ if (slideOffset != null) {
5175
+ slideOffset.style.margin = -1 * offset + "px" + " 0 ";
5176
+ }
5177
+ // offset from viewport bottom to StoryBottom plus safe area offset bottom
5178
+ yOffset = `calc(${offset + this._overlappingActionBarHeight}px + env(safe-area-inset-bottom))`;
5179
+ // detect safe area offset
5180
+ }
5181
+ }
5182
+ else {
5183
+ // более квадратное чем надо
5184
+ if (viewportRatio > _ratio) {
5185
+ // fit by width, top and bottom - to offscreen
5186
+ slideWidth = viewportWidth;
5187
+ slideHeight = Math.ceil(viewportWidth / _ratio);
5188
+ offset = Math.ceil(slideHeight - viewportHeight) / 2;
5189
+ if (slideOffset != null) {
5190
+ slideOffset.style.margin = -offset + "px" + " 0 ";
5191
+ }
5192
+ yOffset = offset + this._overlappingActionBarHeight + "px";
5193
+ }
5194
+ else {
5195
+ // вьюпорт более вытянутый чем надо
5196
+ // fit by height, sides - to offscreen
5197
+ slideHeight = viewportHeight;
5198
+ slideWidth = Math.ceil(slideHeight * _ratio);
5199
+ offset = Math.ceil(slideWidth - viewportWidth) / 2;
5200
+ if (slideOffset != null) {
5201
+ slideOffset.style.margin = "0 " + -offset + "px"; // -8.5
5202
+ }
5203
+ xOffset = offset + "px";
5204
+ }
5205
+ }
5206
+ const fontSizeNumber = slideWidth / 20;
5207
+ const fontSize = `${fontSizeNumber}px`;
5208
+ this.activeCard.onUpdateSizeMetrics({ fontSize, xOffset, yOffset, isFullscreen: _isFullscreen });
5209
+ this.cards.forEach(card => {
5210
+ if (card !== this.activeCard) {
5211
+ card.onUpdateSizeMetrics({ fontSize, xOffset, yOffset, isFullscreen: _isFullscreen });
5212
+ }
5213
+ });
5214
+ if (this.config.userResizeHandler != null) {
5215
+ this.config.userResizeHandler({ viewportWidth, viewportHeight, fontSize: fontSizeNumber });
5216
+ }
5217
+ }
5218
+ async showSlide(html) {
5219
+ this.multiCardsMode = 0 /* MULTI_CARDS_MODE.SINGLE */;
5220
+ return this.activeCard.showSlide(html);
5221
+ }
5222
+ cardsSlider = null;
5223
+ async showSlides(cards, cardAppearance) {
5224
+ this.multiCardsMode = 1 /* MULTI_CARDS_MODE.MULTIPLE */;
5225
+ const cardRender = (card) => {
5226
+ const slideWrapper = document.createElement("div");
5227
+ slideWrapper.classList.add("narrative-slide-wrapper");
5228
+ slideWrapper.classList.add("stories-viewer");
5229
+ const slideOffset = document.createElement("div");
5230
+ slideOffset.classList.add("narrative-slide-offset");
5231
+ const slideBoxPrerender = document.createElement("div");
5232
+ slideBoxPrerender.classList.add("narrative-slide-box");
5233
+ slideBoxPrerender.classList.add("narrative-slide-box-prerender");
5234
+ const slideBoxRendered = document.createElement("div");
5235
+ slideBoxRendered.classList.add("narrative-slide-box");
5236
+ slideBoxRendered.classList.add("narrative-slide-box-rendered");
5237
+ const style = document.createElement("style");
5238
+ if (this.config.nonce != null) {
5239
+ style.nonce = this.config.nonce;
5240
+ }
5241
+ const paddingTop = `${String(100 / this.config.slideRatio)}%`;
5242
+ // .narrative-slide-box {
5243
+ // padding: <?= $slideRatioPadding ?> 0 0 0;
5244
+ // }
5245
+ // style.sheet?.insertRule(`.narrative-slide-box {padding: ${paddingTop} 0 0 0;`);
5246
+ slideBoxRendered.style.padding = `${paddingTop} 0 0 0`;
5247
+ slideBoxPrerender.style.padding = `${paddingTop} 0 0 0`;
5248
+ slideBoxPrerender.innerHTML = card;
5249
+ slideOffset.appendChild(slideBoxPrerender);
5250
+ slideOffset.appendChild(slideBoxRendered);
5251
+ slideWrapper.appendChild(slideOffset);
5252
+ slideWrapper.appendChild(style);
5253
+ return slideWrapper;
5254
+ };
5255
+ let onShowActiveCardResolver = null;
5256
+ const onShowActiveCard = new Promise(resolve => {
5257
+ onShowActiveCardResolver = resolve;
5258
+ });
5259
+ const onCardMounted = async (card, index) => {
5260
+ const cardApi = new CardApi({
5261
+ sdkApi: this.config.sdkApi,
5262
+ slideWrapper: card,
5263
+ viewport: this.config.viewport,
5264
+ userResizeHandler: this.config.userResizeHandler,
5265
+ slideRatio: this.config.slideRatio,
5266
+ isFullscreen: this.config.isFullscreen,
5267
+ getViewportWidth: this.config.getViewportWidth,
5268
+ getViewportHeight: this.config.getViewportHeight,
5269
+ overlappingActionBarHeight: this.config.overlappingActionBarHeight,
5270
+ separateUserAndAppPause: this.config.separateUserAndAppPause,
5271
+ root: this.config.root,
5272
+ refreshSizes: this.refreshSizes,
5273
+ index,
5274
+ getSdkClientVariables: this.getSdkClientVariables,
5275
+ });
5276
+ this.cards[index] = cardApi;
5277
+ if (index === 0) {
5278
+ this.activeCard = cardApi;
5279
+ }
5280
+ const result = await cardApi.showSlide();
5281
+ onShowActiveCardResolver(result);
5282
+ // console.log({ result, index });
5283
+ };
5284
+ this.cardsSlider = new CardsSlider(this.sdkApi, {
5285
+ root: this.config.root,
5286
+ cards,
5287
+ nonce: this.config.nonce,
5288
+ cardRender,
5289
+ onCardMounted,
5290
+ });
5291
+ return await onShowActiveCard;
5292
+ }
5293
+ handleBackpress() {
5294
+ this.activeCard.handleBackpress();
5295
+ }
5296
+ get layoutService() {
5297
+ return container.get({ identifier: "LayoutService" });
5298
+ }
5299
+ getLocalData() {
5300
+ return this.sdkApi.getCardLocalData();
5301
+ }
5302
+ async slideStart(config) {
5303
+ return this.activeCard.slideStart(config);
5304
+ }
5305
+ async slideRestart(config) {
5306
+ return this.activeCard.slideRestart(config);
5307
+ }
5308
+ async slideUserPause() {
5309
+ return this.activeCard.slideUserPause();
5310
+ }
5311
+ async slideUserResume() {
5312
+ return this.activeCard.slideUserResume();
5313
+ }
5314
+ /**
5315
+ * Call on app gone background
5316
+ */
5317
+ async slideAppPause() {
5318
+ return this.activeCard.slideAppPause();
5319
+ }
5320
+ /**
5321
+ * Call on app gone foreground after a background
5322
+ */
5323
+ async slideAppResume() {
5324
+ return this.activeCard.slideAppResume();
5325
+ }
5326
+ async slideStop(options) {
5327
+ return this.activeCard.slideStop(options);
5328
+ }
5329
+ slideTimerEnd() {
5330
+ this.activeCard.slideTimerEnd();
5331
+ }
5332
+ enableAudio() {
5333
+ this.activeCard.enableAudio();
5334
+ }
5335
+ disableAudio() {
5336
+ this.activeCard.disableAudio();
5337
+ }
5338
+ get isStopped() {
5339
+ return this.activeCard.isStopped;
5340
+ }
5341
+ afterStartInitQueuePush(cb) {
5342
+ return this.activeCard.afterStartInitQueuePush(cb);
5343
+ }
5344
+ afterAppResumeQueuePush(cb) {
5345
+ return this.activeCard.afterAppResumeQueuePush(cb);
5346
+ }
5347
+ get activeLayer() {
5348
+ return this.activeCard.slide.activeLayer;
5349
+ }
5350
+ get slide() {
5351
+ return this.activeCard.slide;
5352
+ }
5353
+ showLayer(index) {
5354
+ this.activeCard.showLayer(index);
5355
+ }
5356
+ slideClickHandler(targetElement, navigationDirection) {
5357
+ const result = this.activeCard.slideClickHandler(targetElement, navigationDirection);
5358
+ if (this.multiCardsMode === 1 /* MULTI_CARDS_MODE.MULTIPLE */) {
5359
+ // handle nav click via CardsSlider, not via SDK
5360
+ result.canClickNext = false;
5361
+ const currentIndex = this.activeCard.index;
5362
+ let index = navigationDirection === "forward" ? currentIndex + 1 : currentIndex - 1;
5363
+ if (index >= this.cards.length) {
5364
+ index = 0;
5365
+ }
5366
+ else if (index < 0) {
5367
+ index = this.cards.length - 1;
5368
+ }
5369
+ // todo async
5370
+ this.cardsSlider.showByIndex(currentIndex, index);
5371
+ this.activeCard = this.cards[index];
5372
+ }
5373
+ return result;
5374
+ }
5375
+ slideSwipeUpHandler() {
5376
+ return this.activeCard.slideSwipeUpHandler();
5377
+ }
5378
+ setTextInputResult(id, text) {
5379
+ this.activeCard.setTextInputResult(id, text);
5380
+ }
5381
+ setShareComplete(id, isSuccess) {
5382
+ this.activeCard.setShareComplete(id, isSuccess);
5383
+ }
5384
+ setWidgetGoodsComplete(elementId) {
5385
+ this.activeCard.setWidgetGoodsComplete(elementId);
5386
+ }
5387
+ _sdkClientVariables = {};
5388
+ getSdkClientVariables() {
5389
+ return this._sdkClientVariables;
5390
+ }
5391
+ setSdkClientVariables(variables) {
5392
+ this._sdkClientVariables = variables;
5393
+ }
5394
+ static get [Symbol.for("___CTOR_ARGS___")]() { return [`{
5395
+ sdkApi: SDKApi;
5396
+ slideWrapper: HTMLElement;
5397
+ viewport: Window;
5398
+ userResizeHandler?: (data: { viewportWidth: number; viewportHeight: number; fontSize: number }) => void;
5399
+ slideRatio: number;
5400
+ isFullscreen: boolean;
5401
+ slideLoadedCb?: (data: { cardId: number; slideIndex: number; result: boolean; reason?: string }) => void;
5402
+ getViewportWidth: () => number;
5403
+ getViewportHeight: () => number;
5404
+ overlappingActionBarHeight?: number;
5405
+ separateUserAndAppPause: boolean;
5406
+ root: HTMLElement;
5407
+ nonce?: string;
5408
+ }`]; }
5032
5409
  };
5033
5410
 
5034
5411
  const slideApiPeerDeps = {};
@@ -5062,10 +5439,11 @@ const createSlideWrapper = ({ slideBoxRatio, nonce }) => {
5062
5439
  return slideWrapper;
5063
5440
  };
5064
5441
  class SlideApi extends SlideApi$1 {
5442
+ root;
5443
+ slideWrapper;
5065
5444
  constructor(_sdkInterface, config) {
5066
5445
  slideApiPeerDeps.VODPlayer = config.VODPlayer;
5067
5446
  const slideWrapper = createSlideWrapper({ slideBoxRatio: config.slideRatio, nonce: config.nonce });
5068
- // todo need to clear root node before append slideWrapper?
5069
5447
  config.root.appendChild(slideWrapper);
5070
5448
  super({
5071
5449
  sdkApi: new EsModuleSdkApi(_sdkInterface),
@@ -5078,9 +5456,29 @@ class SlideApi extends SlideApi$1 {
5078
5456
  getViewportHeight: () => slideWrapper.clientHeight,
5079
5457
  overlappingActionBarHeight: config.overlappingActionBarHeight,
5080
5458
  separateUserAndAppPause: true,
5459
+ root: config.root,
5460
+ nonce: config.nonce,
5081
5461
  });
5462
+ this.root = config.root;
5463
+ this.slideWrapper = slideWrapper;
5082
5464
  }
5083
- static get [Symbol.for("___CTOR_ARGS___")]() { return [`SDKInterface`, `{\n root: HTMLElement;\n slideRatio: number;\n isFullscreen: boolean;\n nonce?: string;\n viewport: Window;\n userResizeHandler?: (data: { viewportWidth: number; viewportHeight: number; fontSize: number }) => void;\n VODPlayer?: typeof VODPlayer;\n overlappingActionBarHeight?: number;\n }`]; }
5465
+ async destroy() {
5466
+ if (!this.slideWrapper)
5467
+ return;
5468
+ this.root.removeChild(this.slideWrapper);
5469
+ this.slideWrapper = null;
5470
+ await super.destroy();
5471
+ }
5472
+ static get [Symbol.for("___CTOR_ARGS___")]() { return [`SDKInterface`, `{
5473
+ root: HTMLElement;
5474
+ slideRatio: number;
5475
+ isFullscreen: boolean;
5476
+ nonce?: string;
5477
+ viewport: Window;
5478
+ userResizeHandler?: (data: { viewportWidth: number; viewportHeight: number; fontSize: number }) => void;
5479
+ VODPlayer?: typeof VODPlayer;
5480
+ overlappingActionBarHeight?: number;
5481
+ }`]; }
5084
5482
  }
5085
5483
 
5086
5484
  // This file is part of the bwip-js project available at:
@@ -7352,7 +7750,7 @@ function bwipp_pdf417() {
7352
7750
  if ((($get($_.msg, $_.i) >= 0) && ($get($_.numtext, $_.i) < 5)) && ($get($_.numdigits, $_.i) < 13)) { //#17032
7353
7751
  $put($_.numbytes, $_.i, $f($get($_.numbytes, $_.i + 1) + 1)); //#17031
7354
7752
  } //#17031
7355
- $put($_.iseci, $_.i, $get($_.msg, $_.i) <= -1000000); //#17033
7753
+ $put($_.iseci, $_.i, $get($_.msg, $_.i) <= -1e6); //#17033
7356
7754
  } //#17033
7357
7755
  $_.numdigits = $geti($_.numdigits, 0, $_.msglen); //#17035
7358
7756
  $_.numtext = $geti($_.numtext, 0, $_.msglen); //#17036
@@ -7606,7 +8004,7 @@ function bwipp_pdf417() {
7606
8004
  $_.nextecitext = false; //#17228
7607
8005
  break; //#17228
7608
8006
  } //#17228
7609
- if ($get($get($_.seq, $_.ti), 0) > -1000000) { //#17229
8007
+ if ($get($get($_.seq, $_.ti), 0) > -1e6) { //#17229
7610
8008
  break; //#17229
7611
8009
  } //#17229
7612
8010
  $_.nextecitext = true; //#17230
@@ -7803,7 +8201,7 @@ function bwipp_pdf417() {
7803
8201
  } //#17333
7804
8202
  $_.chars = $get($_.seq, $_.i); //#17334
7805
8203
  if ($eq($type($_.chars), 'arraytype')) { //#17348
7806
- if ($get($_.chars, 0) <= -1000000) { //#17339
8204
+ if ($get($_.chars, 0) <= -1e6) { //#17339
7807
8205
  $k[$j++] = $_.chars; //#17337
7808
8206
  $_.ence(); //#17337
7809
8207
  $_.addtocws(); //#17337
@@ -8606,7 +9004,7 @@ function bwipp_qrcode() {
8606
9004
  } else { //#20441
8607
9005
  $put($_.nextAs, $_.i, $f($get($_.nextAs, $_.i + 1) + 1)); //#20441
8608
9006
  } //#20441
8609
- $put($_.isECI, $_.i, $_.barchar <= -1000000); //#20443
9007
+ $put($_.isECI, $_.i, $_.barchar <= -1e6); //#20443
8610
9008
  } //#20443
8611
9009
  for (var _6K = 0, _6J = $_.msglen - 1; _6K <= _6J; _6K += 1) { //#20451
8612
9010
  $_.i = _6K; //#20446
@@ -13847,7 +14245,7 @@ function stbtt__new_active(e, off_x, start_point) {
13847
14245
  fdx:dxdy,
13848
14246
  fdy:dxdy != 0.0 ? (1.0 / dxdy) : 0.0,
13849
14247
  fx:(e.x0 + dxdy * (start_point - e.y0)) - (off_x|0),
13850
- direction:e.invert ? 1.0 : -1.0,
14248
+ direction:e.invert ? 1.0 : -1,
13851
14249
  sy:e.y0,
13852
14250
  ey:e.y1,
13853
14251
  next:0,
@@ -14535,12 +14933,9 @@ class WidgetBase {
14535
14933
  this.localData = extend({}, this.savedData ?? {}, localData);
14536
14934
  }
14537
14935
  onStart() {
14538
- // add active class for enable animation
14539
- this.element.classList.add("active");
14540
14936
  this.startReadyResolve();
14541
14937
  }
14542
14938
  onStop() {
14543
- this.element.classList.remove("active");
14544
14939
  this.resetStartReadyPromise();
14545
14940
  }
14546
14941
  onPause() { }
@@ -16952,7 +17347,10 @@ class Formatter {
16952
17347
  get locale() {
16953
17348
  return this.context.determineLocale();
16954
17349
  }
16955
- static get [Symbol.for("___CTOR_ARGS___")]() { return [`{\n determineLocale: () => string;\n i18n: { t: (key: string) => string; tc: (key: string, value: string | number) => string } | undefined;\n }`]; }
17350
+ static get [Symbol.for("___CTOR_ARGS___")]() { return [`{
17351
+ determineLocale: () => string;
17352
+ i18n: { t: (key: string) => string; tc: (key: string, value: string | number) => string } | undefined;
17353
+ }`]; }
16956
17354
  }
16957
17355
  const formatter = new Formatter({ determineLocale, i18n: undefined });
16958
17356
 
@@ -17256,7 +17654,13 @@ class WidgetProducts extends WidgetBase {
17256
17654
  if (!this.linkTarget.length) {
17257
17655
  return { message: this.msgServiceError ?? "", models: [] };
17258
17656
  }
17259
- const path = `product/offer?id=${this.linkTarget.join(",")}`;
17657
+ const searchParams = new URLSearchParams();
17658
+ searchParams.set("id", this.linkTarget.join(","));
17659
+ const sdkClientVariables = this.widgetDeps.getSdkClientVariables();
17660
+ if (sdkClientVariables != null && sdkClientVariables.pos != null) {
17661
+ searchParams.set("pos", String(sdkClientVariables.pos));
17662
+ }
17663
+ const path = `product/offer?${searchParams.toString()}`;
17260
17664
  const headers = {
17261
17665
  accept: "application/json",
17262
17666
  "Content-Type": "application/json",
@@ -19929,6 +20333,9 @@ class WidgetTooltip extends WidgetBase {
19929
20333
  const tooltipGeometry = this.tooltipElement?.parentElement;
19930
20334
  const triggerGeometry = this.triggerElement?.parentElement;
19931
20335
  if (tooltipGeometry != null && triggerGeometry != null) {
20336
+ if (!this.disableTimer) {
20337
+ this.onWidgetRequirePauseUI();
20338
+ }
19932
20339
  this.computePositionForTooltip(this.getBox(triggerGeometry), this.getBox(tooltipGeometry));
19933
20340
  addClass(tooltipGeometry, "popper__popper--shown");
19934
20341
  this.env.requestAnimationFrame(() => {
@@ -19939,6 +20346,9 @@ class WidgetTooltip extends WidgetBase {
19939
20346
  this._statEventWidgetClick();
19940
20347
  }
19941
20348
  closeTooltip() {
20349
+ if (!this.disableTimer) {
20350
+ this.onWidgetRequireResumeUI();
20351
+ }
19942
20352
  const tooltipGeometry = this.tooltipElement?.parentElement;
19943
20353
  if (tooltipGeometry != null) {
19944
20354
  addClass(tooltipGeometry, "popper__popper--hidden");