@inappstory/slide-api 0.1.4 → 0.1.6

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.d.ts CHANGED
@@ -1,266 +1,5 @@
1
1
  import { Player as VODPlayer } from "@inappstory/video-player";
2
2
  import { Player as VideoPlayer } from "@inappstory/video-player";
3
- declare const enum CARD_TYPE {
4
- STORY = 1,
5
- UGC_STORY = 2,
6
- GAME_CARDS = 3,
7
- IN_APP_MESSAGING = 4
8
- }
9
- type WidgetRangeSliderOptions = WidgetOptionsBase & {
10
- rangeClass: string;
11
- rangeBackgroundClass: string;
12
- activeClass: string;
13
- horizontalClass: string;
14
- verticalClass: string;
15
- fillClass: string;
16
- handleClass: string;
17
- };
18
- type WidgetRangeSliderSharedData = Record<string,
19
- // element_id
20
- {
21
- total_value: number;
22
- total_user: number;
23
- }> & {
24
- ts: number; // unixtimestamp
25
- };
26
- declare class WidgetRangeSlider extends WidgetBase<WidgetRangeSliderOptions> {
27
- static DEFAULTS: WidgetRangeSliderOptions;
28
- static widgetClassName: string;
29
- private label;
30
- private readonly topScale;
31
- private readonly startValue;
32
- private readonly snapPosition;
33
- private readonly hasSubmitButton;
34
- private elementSlider;
35
- private readonly elementAverageResult;
36
- private readonly elementAverageResultTooltip;
37
- private readonly elementAverageResultTooltipLabelView;
38
- private readonly orientation;
39
- private min;
40
- private max;
41
- private value;
42
- private step;
43
- private readonly toFixed;
44
- private fill;
45
- private readonly handle;
46
- private readonly range;
47
- private readonly rangeBgView;
48
- private readonly DIMENSION;
49
- private readonly DIRECTION;
50
- private DIRECTION_STYLE;
51
- private readonly COORDINATE;
52
- private isClickCapturedBySlider;
53
- private handleDimension;
54
- private rangeDimension;
55
- private maxHandlePos;
56
- private grabPos;
57
- private position;
58
- private prevSnapValue;
59
- /**
60
- * @throws Error
61
- * @param element
62
- * @param options
63
- */
64
- constructor(element: HTMLElement, options: Partial<WidgetRangeSliderOptions>);
65
- private isTouchListenersInit;
66
- private initTouchListeners;
67
- /**
68
- * Start or restart widget
69
- * @param localData
70
- */
71
- onRefreshUserData(localData: Record<string, any>): void;
72
- onStart(): void;
73
- onStop(): void;
74
- private _statEventInputSave;
75
- click(): boolean;
76
- private completeWidget;
77
- isDone(): boolean;
78
- getIsClickCapturedBySlider(): boolean;
79
- private displayAverageAnswer;
80
- private init;
81
- private update;
82
- private handleDown;
83
- private handleMove;
84
- private handleEnd;
85
- private cap;
86
- private setPosition;
87
- // Returns element position relative to the parent
88
- private getPositionFromNode;
89
- private getRelativePosition;
90
- private getPercentageFromValue;
91
- private getPositionFromValue;
92
- private getValueFromPosition;
93
- private setValue;
94
- private destroy;
95
- static api: {
96
- widgetClassName: string;
97
- refreshUserData: typeof WidgetBase.refreshUserData;
98
- onRefreshUserData: typeof WidgetBase.onRefreshUserData;
99
- init: (element: HTMLElement, localData?: Record<string, any>) => void;
100
- initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
101
- onStart: (element: HTMLElement) => void;
102
- onStop: (element: HTMLElement) => void;
103
- click: (element: HTMLElement) => boolean;
104
- isClickCapturedBySlider: (element: HTMLElement) => boolean;
105
- };
106
- }
107
- type WidgetPollOptions = WidgetOptionsBase;
108
- type WidgetPollSharedData = Record<string,
109
- // element_id
110
- {
111
- 0: number; // answer_yes total count
112
- 1: number; // answer_no total count
113
- }> & {
114
- ts: number; // unixtimestamp
115
- };
116
- declare class WidgetPoll extends WidgetBase<WidgetPollOptions> {
117
- static DEFAULTS: {
118
- slide: null;
119
- activateAfterCreate: boolean;
120
- create: boolean;
121
- localData: {};
122
- };
123
- static widgetClassName: string;
124
- private label;
125
- private readonly percentFillMask;
126
- private readonly maskedVariants;
127
- private readonly variantsViewGroup;
128
- private readonly variants;
129
- private readonly variantsTexts;
130
- private readonly isInvertedPercentFilledMaskDirection;
131
- private readonly getUseResponseOnFirstButton;
132
- private readonly getUseResponseOnSecondButton;
133
- private readonly showClientTotalResult;
134
- private selectedVariant;
135
- private nativeDialogueWasOpened;
136
- private answerDuration;
137
- private elementRect;
138
- /**
139
- * @throws Error
140
- * @param element
141
- * @param options
142
- */
143
- constructor(element: HTMLElement, options: Partial<WidgetPollOptions>);
144
- /**
145
- * Start or restart widget
146
- * @param localData
147
- */
148
- onRefreshUserData(localData: Record<string, any>): void;
149
- private _statEventPollAnswer;
150
- private _statEventInputSave;
151
- _selectVariant(index: number, filled?: boolean): void;
152
- private _clearVariantSelection;
153
- private selectVariant;
154
- private _getVariantBoxInPercent;
155
- displayPercents(selectedVariantIndex: number, filled?: boolean): void;
156
- setUserText(text: string, buttonPosition: "first_button" | "second_button"): void;
157
- private completeWidget;
158
- isDone(): boolean;
159
- slidePollIsDone(): boolean;
160
- static api: {
161
- widgetClassName: string;
162
- refreshUserData: typeof WidgetBase.refreshUserData;
163
- onRefreshUserData: typeof WidgetBase.onRefreshUserData;
164
- init: (element: HTMLElement, localData?: Record<string, any>) => void;
165
- initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
166
- onStart: (element: HTMLElement) => void;
167
- onStop: (element: HTMLElement) => void;
168
- select: (element: HTMLElement) => boolean;
169
- slidePollIsDone: (element: HTMLElement) => boolean;
170
- setUserData: (id: string, text: string) => void;
171
- };
172
- }
173
- type WidgetVoteOptions = WidgetOptionsBase;
174
- type WidgetVoteSharedData = Record<string, Array<number> // variant_index total count
175
- > & {
176
- ts: number; // unixtimestamp
177
- };
178
- declare class WidgetVote extends WidgetBase<WidgetVoteOptions> {
179
- static DEFAULTS: WidgetVoteOptions;
180
- static widgetClassName: string;
181
- private question;
182
- private answers;
183
- private questionCount;
184
- private selectedAnswer;
185
- private label;
186
- private readonly variants;
187
- private readonly variantsTexts;
188
- private selectedVariant;
189
- private voteAllocation;
190
- private readonly hideClientTotalResult;
191
- private readonly multipleChoice;
192
- /**
193
- * @throws Error
194
- * @param element
195
- * @param options
196
- */
197
- constructor(element: HTMLElement, options: Partial<WidgetVoteOptions>);
198
- private _initFromLocalData;
199
- /**
200
- * Start or restart widget
201
- * @param localData
202
- */
203
- onRefreshUserData(localData: Record<string, any>): void;
204
- private _clearSelectedVariants;
205
- private _statEventVoteVariant;
206
- // user click on (un)checked (radio btn) variant
207
- private _checkVariant;
208
- private _getCheckedVariants;
209
- private _selectVariant;
210
- private _fillWidget;
211
- private _showSubmitBtn;
212
- private _hideSubmitBtn;
213
- selectVariant(variant: HTMLElement): boolean;
214
- private _setInputDone;
215
- private _removeInputDone;
216
- private _completeWidget;
217
- private submitMultipleChoice;
218
- click(): boolean;
219
- private displayPercents;
220
- isDone(): boolean;
221
- slideVoteIsDone(): boolean;
222
- static api: {
223
- widgetClassName: string;
224
- refreshUserData: typeof WidgetBase.refreshUserData;
225
- onRefreshUserData: typeof WidgetBase.onRefreshUserData;
226
- init: (element: HTMLElement, localData?: Record<string, any>) => void;
227
- fallbackInitOnMultiSlide: (element: HTMLElement, localData?: Record<string, any>) => void;
228
- initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
229
- onStart: (element: HTMLElement) => void;
230
- onStop: (element: HTMLElement) => void;
231
- select: (element: HTMLElement) => boolean;
232
- click: (element: HTMLElement) => boolean;
233
- slideVoteIsDone: (element: HTMLElement) => boolean;
234
- };
235
- }
236
- type WidgetOptionsBase = {
237
- slide: HTMLElement | null;
238
- activateAfterCreate: boolean;
239
- create: boolean;
240
- localData: Record<string, any>;
241
- } & {
242
- [P in string]: any;
243
- };
244
- declare const enum Widgets {
245
- DataInput = "dataInput",
246
- Quiz = "quiz",
247
- QuizGrouped = "quizGrouped",
248
- RangeSlider = "rangeSlider",
249
- Poll = "poll",
250
- PollLayers = "pollLayers",
251
- Vote = "vote",
252
- Rate = "rate",
253
- Test = "test",
254
- Copy = "copy",
255
- Share = "share",
256
- DateCountdown = "dateCountdown",
257
- Quest = "quest"
258
- }
259
- interface WidgetsSharedDataMap {
260
- rangeSlider: WidgetRangeSliderSharedData;
261
- poll: WidgetPollSharedData;
262
- vote: WidgetVoteSharedData;
263
- }
264
3
  interface IAnimation {
265
4
  start(slide: HTMLElement, animate?: boolean): void | ((isStop: boolean) => () => void);
266
5
  stop(slide: HTMLElement, animate?: boolean): void;
@@ -271,7 +10,8 @@ interface IAnimation {
271
10
  declare const enum TIMELINE_ACTION {
272
11
  START = "start",
273
12
  PAUSE = "pause",
274
- STOP = "stop"
13
+ STOP = "stop",
14
+ BEFORE_START = "before_start"
275
15
  }
276
16
  type WidgetBarcodeOptions = WidgetOptionsBase;
277
17
  declare class WidgetBarcode extends WidgetBase<WidgetBarcodeOptions> {
@@ -290,7 +30,7 @@ declare class WidgetBarcode extends WidgetBase<WidgetBarcodeOptions> {
290
30
  private readonly msgNoMoreCodes;
291
31
  private readonly msgTryAgain;
292
32
  private readonly msgBarcodeRenderError;
293
- constructor(element: HTMLElement, options: Partial<WidgetBarcodeOptions>);
33
+ constructor(element: HTMLElement, options: Partial<WidgetBarcodeOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
294
34
  /**
295
35
  * Start or restart widget
296
36
  * @param localData
@@ -314,10 +54,8 @@ declare class WidgetBarcode extends WidgetBase<WidgetBarcodeOptions> {
314
54
  isDone(): boolean;
315
55
  static api: {
316
56
  widgetClassName: string;
317
- refreshUserData: typeof WidgetBase.refreshUserData;
318
57
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
319
- init: (element: HTMLElement, localData?: Record<string, any>) => void;
320
- initWidget: (nodeList: Iterable<HTMLElement>, localData?: Record<string, any>) => void;
58
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
321
59
  onStart: (element: HTMLElement) => void;
322
60
  onStop: (element: HTMLElement) => void;
323
61
  click: (element: HTMLElement) => boolean;
@@ -338,7 +76,7 @@ declare class WidgetCopy extends WidgetBase<WidgetCopyOptions> {
338
76
  private readonly geometry;
339
77
  private readonly resultLayer;
340
78
  private readonly resultLayerGeometry;
341
- constructor(element: HTMLElement, options: Partial<WidgetCopyOptions>);
79
+ constructor(element: HTMLElement, options: Partial<WidgetCopyOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
342
80
  /**
343
81
  * Start or restart widget
344
82
  * @param localData
@@ -359,10 +97,8 @@ declare class WidgetCopy extends WidgetBase<WidgetCopyOptions> {
359
97
  isDone(): boolean;
360
98
  static api: {
361
99
  widgetClassName: string;
362
- refreshUserData: typeof WidgetBase.refreshUserData;
363
100
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
364
- init: (element: HTMLElement, localData?: Record<string, any>) => void;
365
- initWidget: (nodeList: Iterable<HTMLElement>, localData?: Record<string, any>) => void;
101
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
366
102
  onStart: (element: HTMLElement) => void;
367
103
  onStop: (element: HTMLElement) => void;
368
104
  click: (element: HTMLElement) => boolean;
@@ -386,8 +122,10 @@ declare class WidgetDataInput extends WidgetBase<WidgetDataInputOptions> {
386
122
  * @throws Error
387
123
  * @param element
388
124
  * @param options
125
+ * @param onWidgetComplete
126
+ * @param sdkApi
389
127
  */
390
- constructor(element: HTMLElement, options: Partial<WidgetDataInputOptions>);
128
+ constructor(element: HTMLElement, options: Partial<WidgetDataInputOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
391
129
  /**
392
130
  * Start or restart widget
393
131
  * @param localData
@@ -402,10 +140,8 @@ declare class WidgetDataInput extends WidgetBase<WidgetDataInputOptions> {
402
140
  setUserText(text: string): void;
403
141
  static api: {
404
142
  widgetClassName: string;
405
- refreshUserData: typeof WidgetBase.refreshUserData;
406
143
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
407
- init: (element: HTMLElement, localData?: Record<string, any>) => void;
408
- initWidget: (nodeList: Iterable<HTMLElement>, localData?: Record<string, any>) => void;
144
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
409
145
  onStart: (element: HTMLElement) => void;
410
146
  onStop: (element: HTMLElement) => void;
411
147
  click: (element: HTMLElement) => boolean;
@@ -434,7 +170,7 @@ declare class WidgetDateCountdown extends WidgetBase<WidgetDateCountdownOptions>
434
170
  private thirdGroup1;
435
171
  private thirdGroup2;
436
172
  private thirdGroupCaption;
437
- constructor(element: HTMLElement, options: Partial<WidgetDateCountdownOptions>);
173
+ constructor(element: HTMLElement, options: Partial<WidgetDateCountdownOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
438
174
  /**
439
175
  * Start or restart widget
440
176
  * @param localData
@@ -449,21 +185,82 @@ declare class WidgetDateCountdown extends WidgetBase<WidgetDateCountdownOptions>
449
185
  private _asDuration;
450
186
  static api: {
451
187
  widgetClassName: string;
452
- refreshUserData: typeof WidgetBase.refreshUserData;
453
188
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
454
- init: (element: HTMLElement, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
455
- initWidget: (nodeList: Iterable<HTMLElement>, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
189
+ init: (element: HTMLElement, layers: Array<HTMLElement>, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
456
190
  onStart: (element: HTMLElement) => void;
457
191
  onStop: (element: HTMLElement) => void;
458
192
  onPause: (element: HTMLElement) => void;
459
193
  onResume: (element: HTMLElement) => void;
460
- pause: (nodeList: Iterable<HTMLElement>) => void;
461
- resume: (nodeList: Iterable<HTMLElement>) => void;
462
194
  };
463
195
  }
464
196
  declare class WidgetMultiSlide {
465
197
  static api: {
466
- init: (slides: Array<HTMLElement>, localData?: Record<string, any>) => void;
198
+ init: (slides: Array<HTMLElement>, localData: Record<string, any>, sdkApi: SDKApi) => void;
199
+ };
200
+ }
201
+ type WidgetPollOptions = WidgetOptionsBase;
202
+ type WidgetPollSharedData = Record<string,
203
+ // element_id
204
+ {
205
+ 0: number; // answer_yes total count
206
+ 1: number; // answer_no total count
207
+ }> & {
208
+ ts: number; // unixtimestamp
209
+ };
210
+ declare class WidgetPoll extends WidgetBase<WidgetPollOptions> {
211
+ static DEFAULTS: {
212
+ slide: null;
213
+ activateAfterCreate: boolean;
214
+ create: boolean;
215
+ localData: {};
216
+ };
217
+ static widgetClassName: string;
218
+ private label;
219
+ private readonly percentFillMask;
220
+ private readonly maskedVariants;
221
+ private readonly variantsViewGroup;
222
+ private readonly variants;
223
+ private readonly variantsTexts;
224
+ private readonly isInvertedPercentFilledMaskDirection;
225
+ private readonly getUseResponseOnFirstButton;
226
+ private readonly getUseResponseOnSecondButton;
227
+ private readonly showClientTotalResult;
228
+ private selectedVariant;
229
+ private nativeDialogueWasOpened;
230
+ private answerDuration;
231
+ private elementRect;
232
+ /**
233
+ * @throws Error
234
+ * @param element
235
+ * @param options
236
+ * @param onWidgetComplete
237
+ */
238
+ constructor(element: HTMLElement, options: Partial<WidgetPollOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
239
+ /**
240
+ * Start or restart widget
241
+ * @param localData
242
+ */
243
+ onRefreshUserData(localData: Record<string, any>): void;
244
+ private _statEventPollAnswer;
245
+ private _statEventInputSave;
246
+ _selectVariant(index: number, filled?: boolean): void;
247
+ private _clearVariantSelection;
248
+ private selectVariant;
249
+ private _getVariantBoxInPercent;
250
+ displayPercents(selectedVariantIndex: number, filled?: boolean): void;
251
+ setUserText(text: string, buttonPosition: "first_button" | "second_button"): void;
252
+ private completeWidget;
253
+ isDone(): boolean;
254
+ slidePollIsDone(): boolean;
255
+ static api: {
256
+ widgetClassName: string;
257
+ onRefreshUserData: typeof WidgetBase.onRefreshUserData;
258
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
259
+ onStart: (element: HTMLElement) => void;
260
+ onStop: (element: HTMLElement) => void;
261
+ select: (element: HTMLElement) => boolean;
262
+ slidePollIsDone: (element: HTMLElement) => boolean;
263
+ setUserData: (id: string, text: string) => void;
467
264
  };
468
265
  }
469
266
  type WidgetPollLayersOptions = WidgetOptionsBase & {
@@ -477,7 +274,7 @@ declare class WidgetPollLayers extends WidgetBase<WidgetPollLayersOptions> {
477
274
  private variantsTexts;
478
275
  private selectedVariant;
479
276
  private readonly layers;
480
- constructor(element: HTMLElement, options: Partial<WidgetPollLayersOptions>);
277
+ constructor(element: HTMLElement, options: Partial<WidgetPollLayersOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
481
278
  /**
482
279
  * Start or restart widget
483
280
  * @param localData
@@ -491,10 +288,8 @@ declare class WidgetPollLayers extends WidgetBase<WidgetPollLayersOptions> {
491
288
  slidePollIsDone(): boolean;
492
289
  static api: {
493
290
  widgetClassName: string;
494
- refreshUserData: typeof WidgetBase.refreshUserData;
495
291
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
496
- init: (element: HTMLElement, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
497
- initWidget: (element: HTMLElement, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
292
+ init: (element: HTMLElement, layers: Array<HTMLElement>, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
498
293
  onStart: (element: HTMLElement) => void;
499
294
  onStop: (element: HTMLElement) => void;
500
295
  select: (element: HTMLElement) => boolean;
@@ -539,7 +334,7 @@ declare class WidgetProducts extends WidgetBase<WidgetProductsOptions> {
539
334
  private swipeGestureDetector;
540
335
  private isClickCapturedByWidget;
541
336
  private readonly isScreenSupportsTouch;
542
- constructor(element: HTMLElement, options: Partial<WidgetProductsOptions>);
337
+ constructor(element: HTMLElement, options: Partial<WidgetProductsOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
543
338
  /**
544
339
  * Start or restart widget
545
340
  * @param localData
@@ -577,7 +372,7 @@ declare class WidgetProducts extends WidgetBase<WidgetProductsOptions> {
577
372
  static api: {
578
373
  widgetClassName: string;
579
374
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
580
- init: (element: HTMLElement, localData?: Record<string, any>) => void;
375
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
581
376
  onStart: (element: HTMLElement) => void;
582
377
  onStop: (element: HTMLElement) => void;
583
378
  click: (element: HTMLElement) => boolean;
@@ -599,7 +394,7 @@ declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
599
394
  private readonly navigationNextSlide?;
600
395
  private readonly slideDisabledNavigation;
601
396
  private readonly finalSlide;
602
- constructor(element: HTMLElement, options: Partial<WidgetQuestOptions>);
397
+ constructor(element: HTMLElement, options: Partial<WidgetQuestOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
603
398
  /**
604
399
  * Start or restart widget
605
400
  * @param localData
@@ -623,10 +418,8 @@ declare class WidgetQuest extends WidgetBase<WidgetQuestOptions> {
623
418
  private handleRouteClick;
624
419
  static api: {
625
420
  widgetClassName: string;
626
- refreshUserData: typeof WidgetBase.refreshUserData;
627
421
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
628
- init: (element: HTMLElement, localData?: Record<string, any>) => Promise<boolean>;
629
- initWidget: (element: HTMLElement, localData?: Record<string, any>) => Promise<boolean>;
422
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => Promise<boolean>;
630
423
  onStart: (element: HTMLElement) => void;
631
424
  onStop: (element: HTMLElement) => void;
632
425
  select: (element: HTMLElement) => boolean;
@@ -648,7 +441,7 @@ declare class WidgetQuiz extends WidgetBase<WidgetQuizOptions> {
648
441
  private readonly answers;
649
442
  private readonly questionCount;
650
443
  private selectedAnswer;
651
- constructor(element: HTMLElement, options: Partial<WidgetQuizOptions>);
444
+ constructor(element: HTMLElement, options: Partial<WidgetQuizOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
652
445
  /**
653
446
  * Start or restart widget
654
447
  * @param localData
@@ -661,10 +454,8 @@ declare class WidgetQuiz extends WidgetBase<WidgetQuizOptions> {
661
454
  slideQuizIsDone(): boolean;
662
455
  static api: {
663
456
  widgetClassName: string;
664
- refreshUserData: typeof WidgetBase.refreshUserData;
665
457
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
666
- init: (element: HTMLElement, localData?: Record<string, any>) => void;
667
- initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
458
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
668
459
  onStart: (element: HTMLElement) => void;
669
460
  onStop: (element: HTMLElement) => void;
670
461
  select: (element: HTMLElement) => boolean;
@@ -688,8 +479,10 @@ declare class WidgetQuizGrouped extends WidgetBase<WidgetQuizGroupedOptions> {
688
479
  * @throws Error
689
480
  * @param element
690
481
  * @param options
482
+ * @param onWidgetComplete
483
+ * @param sdkApi
691
484
  */
692
- constructor(element: HTMLElement, options: Partial<WidgetQuizGroupedOptions>);
485
+ constructor(element: HTMLElement, options: Partial<WidgetQuizGroupedOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
693
486
  /**
694
487
  * Start or restart widget
695
488
  * @param localData
@@ -703,16 +496,111 @@ declare class WidgetQuizGrouped extends WidgetBase<WidgetQuizGroupedOptions> {
703
496
  slideQuizIsDone(): boolean;
704
497
  static api: {
705
498
  widgetClassName: string;
706
- refreshUserData: typeof WidgetBase.refreshUserData;
707
499
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
708
- init: (element: HTMLElement, localData?: Record<string, any>) => void;
709
- initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
500
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
710
501
  onStart: (element: HTMLElement) => void;
711
502
  onStop: (element: HTMLElement) => void;
712
503
  select: (element: HTMLElement) => boolean;
713
504
  slideQuizIsDone: (element: HTMLElement) => boolean;
714
505
  };
715
506
  }
507
+ type WidgetRangeSliderOptions = WidgetOptionsBase & {
508
+ rangeClass: string;
509
+ rangeBackgroundClass: string;
510
+ activeClass: string;
511
+ horizontalClass: string;
512
+ verticalClass: string;
513
+ fillClass: string;
514
+ handleClass: string;
515
+ };
516
+ type WidgetRangeSliderSharedData = Record<string,
517
+ // element_id
518
+ {
519
+ total_value: number;
520
+ total_user: number;
521
+ }> & {
522
+ ts: number; // unixtimestamp
523
+ };
524
+ declare class WidgetRangeSlider extends WidgetBase<WidgetRangeSliderOptions> {
525
+ static DEFAULTS: WidgetRangeSliderOptions;
526
+ static widgetClassName: string;
527
+ private label;
528
+ private readonly topScale;
529
+ private readonly startValue;
530
+ private readonly snapPosition;
531
+ private readonly hasSubmitButton;
532
+ private elementSlider;
533
+ private readonly elementAverageResult;
534
+ private readonly elementAverageResultTooltip;
535
+ private readonly elementAverageResultTooltipLabelView;
536
+ private readonly orientation;
537
+ private min;
538
+ private max;
539
+ private value;
540
+ private step;
541
+ private readonly toFixed;
542
+ private fill;
543
+ private readonly handle;
544
+ private readonly range;
545
+ private readonly rangeBgView;
546
+ private readonly DIMENSION;
547
+ private readonly DIRECTION;
548
+ private DIRECTION_STYLE;
549
+ private readonly COORDINATE;
550
+ private isClickCapturedBySlider;
551
+ private handleDimension;
552
+ private rangeDimension;
553
+ private maxHandlePos;
554
+ private grabPos;
555
+ private position;
556
+ private prevSnapValue;
557
+ /**
558
+ * @throws Error
559
+ * @param element
560
+ * @param options
561
+ * @param onWidgetComplete
562
+ */
563
+ constructor(element: HTMLElement, options: Partial<WidgetRangeSliderOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
564
+ private isTouchListenersInit;
565
+ private initTouchListeners;
566
+ /**
567
+ * Start or restart widget
568
+ * @param localData
569
+ */
570
+ onRefreshUserData(localData: Record<string, any>): void;
571
+ onStart(): void;
572
+ onStop(): void;
573
+ private _statEventInputSave;
574
+ click(): boolean;
575
+ private completeWidget;
576
+ isDone(): boolean;
577
+ getIsClickCapturedBySlider(): boolean;
578
+ private displayAverageAnswer;
579
+ private init;
580
+ private update;
581
+ private handleDown;
582
+ private handleMove;
583
+ private handleEnd;
584
+ private cap;
585
+ private setPosition;
586
+ // Returns element position relative to the parent
587
+ private getPositionFromNode;
588
+ private getRelativePosition;
589
+ private getPercentageFromValue;
590
+ private getPositionFromValue;
591
+ private getValueFromPosition;
592
+ private setValue;
593
+ private destroy;
594
+ static api: {
595
+ widgetClassName: string;
596
+ onRefreshUserData: typeof WidgetBase.onRefreshUserData;
597
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
598
+ onStart: (element: HTMLElement) => void;
599
+ onStop: (element: HTMLElement) => void;
600
+ click: (element: HTMLElement) => boolean;
601
+ isClickCapturedBySlider: (element: HTMLElement) => boolean;
602
+ };
603
+ }
716
604
  type WidgetRateOptions = WidgetOptionsBase;
717
605
  declare class WidgetRate extends WidgetBase<WidgetRateOptions> {
718
606
  static DEFAULTS: WidgetRateOptions;
@@ -729,7 +617,7 @@ declare class WidgetRate extends WidgetBase<WidgetRateOptions> {
729
617
  private selectedStar;
730
618
  private answerSelectDuration;
731
619
  private elementRect;
732
- constructor(element: HTMLElement, options: Partial<WidgetRateOptions>);
620
+ constructor(element: HTMLElement, options: Partial<WidgetRateOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
733
621
  /**
734
622
  * Start or restart widget
735
623
  * @param localData
@@ -745,10 +633,8 @@ declare class WidgetRate extends WidgetBase<WidgetRateOptions> {
745
633
  slideRateIsDone(): boolean;
746
634
  static api: {
747
635
  widgetClassName: string;
748
- refreshUserData: typeof WidgetBase.refreshUserData;
749
636
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
750
- init: (element: HTMLElement, localData?: Record<string, any>) => void;
751
- initWidget: (nodeList: Iterable<HTMLElement>, localData?: Record<string, any>) => void;
637
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
752
638
  onStart: (element: HTMLElement) => void;
753
639
  onStop: (element: HTMLElement) => void;
754
640
  select: (element: HTMLElement) => boolean;
@@ -767,7 +653,7 @@ declare class WidgetShare extends WidgetBase<WidgetShareOptions> {
767
653
  private readonly shareTarget;
768
654
  private readonly withLayer;
769
655
  private btnDisabled;
770
- constructor(element: HTMLElement, options: Partial<WidgetShareOptions>);
656
+ constructor(element: HTMLElement, options: Partial<WidgetShareOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
771
657
  /**
772
658
  * Start or restart widget
773
659
  * @param localData
@@ -779,10 +665,8 @@ declare class WidgetShare extends WidgetBase<WidgetShareOptions> {
779
665
  isDone(): boolean;
780
666
  static api: {
781
667
  widgetClassName: string;
782
- refreshUserData: typeof WidgetBase.refreshUserData;
783
668
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
784
- init: (element: HTMLElement, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
785
- initWidget: (nodeList: Iterable<HTMLElement>, layers: Array<HTMLElement>, localData?: Record<string, any>) => void;
669
+ init: (element: HTMLElement, layers: Array<HTMLElement>, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
786
670
  onStart: (element: HTMLElement) => void;
787
671
  onStop: (element: HTMLElement) => void;
788
672
  click: (element: HTMLElement) => void;
@@ -807,7 +691,7 @@ declare class WidgetTest extends WidgetBase<WidgetTestOptions> {
807
691
  private timeLeftDefault;
808
692
  private readonly timeline;
809
693
  private isWidgetTimerInit;
810
- constructor(element: HTMLElement, options: Partial<WidgetTestOptions>);
694
+ constructor(element: HTMLElement, options: Partial<WidgetTestOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
811
695
  /**
812
696
  * Start or restart widget
813
697
  * @param localData
@@ -827,10 +711,8 @@ declare class WidgetTest extends WidgetBase<WidgetTestOptions> {
827
711
  slideTestWithTimer(): boolean;
828
712
  static api: {
829
713
  widgetClassName: string;
830
- refreshUserData: typeof WidgetBase.refreshUserData;
831
714
  onRefreshUserData: typeof WidgetBase.onRefreshUserData;
832
- init: (element: HTMLElement, localData?: Record<string, any>) => void;
833
- initWidget: (element: HTMLElement, localData?: Record<string, any>) => void;
715
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
834
716
  onStart: (element: HTMLElement) => void;
835
717
  onStop: (element: HTMLElement) => void;
836
718
  select: (element: HTMLElement) => boolean;
@@ -838,6 +720,68 @@ declare class WidgetTest extends WidgetBase<WidgetTestOptions> {
838
720
  slideTestWithTimer: (element: HTMLElement) => boolean;
839
721
  };
840
722
  }
723
+ type WidgetVoteOptions = WidgetOptionsBase;
724
+ type WidgetVoteSharedData = Record<string, Array<number> // variant_index total count
725
+ > & {
726
+ ts: number; // unixtimestamp
727
+ };
728
+ declare class WidgetVote extends WidgetBase<WidgetVoteOptions> {
729
+ static DEFAULTS: WidgetVoteOptions;
730
+ static widgetClassName: string;
731
+ private question;
732
+ private answers;
733
+ private questionCount;
734
+ private selectedAnswer;
735
+ private label;
736
+ private readonly variants;
737
+ private readonly variantsTexts;
738
+ private selectedVariant;
739
+ private voteAllocation;
740
+ private readonly hideClientTotalResult;
741
+ private readonly multipleChoice;
742
+ /**
743
+ * @throws Error
744
+ * @param element
745
+ * @param options
746
+ * @param onWidgetComplete
747
+ * @param sdkApi
748
+ */
749
+ constructor(element: HTMLElement, options: Partial<WidgetVoteOptions>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
750
+ private _initFromLocalData;
751
+ /**
752
+ * Start or restart widget
753
+ * @param localData
754
+ */
755
+ onRefreshUserData(localData: Record<string, any>): void;
756
+ private _clearSelectedVariants;
757
+ private _statEventVoteVariant;
758
+ // user click on (un)checked (radio btn) variant
759
+ private _checkVariant;
760
+ private _getCheckedVariants;
761
+ private _selectVariant;
762
+ private _fillWidget;
763
+ private _showSubmitBtn;
764
+ private _hideSubmitBtn;
765
+ selectVariant(variant: HTMLElement): boolean;
766
+ private _setInputDone;
767
+ private _removeInputDone;
768
+ private _completeWidget;
769
+ private submitMultipleChoice;
770
+ click(): boolean;
771
+ private displayPercents;
772
+ isDone(): boolean;
773
+ slideVoteIsDone(): boolean;
774
+ static api: {
775
+ widgetClassName: string;
776
+ onRefreshUserData: typeof WidgetBase.onRefreshUserData;
777
+ init: (element: HTMLElement, localData: Record<string, any>, onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi) => void;
778
+ onStart: (element: HTMLElement) => void;
779
+ onStop: (element: HTMLElement) => void;
780
+ select: (element: HTMLElement) => boolean;
781
+ click: (element: HTMLElement) => boolean;
782
+ slideVoteIsDone: (element: HTMLElement) => boolean;
783
+ };
784
+ }
841
785
  interface ILayoutApi {
842
786
  get widgetCopyApi(): typeof WidgetCopy.api | undefined;
843
787
  get widgetBarcodeApi(): typeof WidgetBarcode.api | undefined;
@@ -859,30 +803,38 @@ interface ILayoutApi {
859
803
  }
860
804
  declare class LayoutService {
861
805
  private _env;
862
- private _sdkApi;
863
806
  private _layoutApi;
864
- constructor(_env: Window, _sdkApi: SDKApi, _layoutApi: ILayoutApi);
807
+ constructor(_env: Window, _layoutApi: ILayoutApi);
865
808
  get env(): Window;
866
- get sdkApi(): SDKApi;
867
809
  get layoutApi(): ILayoutApi;
868
810
  }
811
+ // use Promise
812
+ // await Promise()
813
+ // call timeLine api
814
+ // promise - slideReadyPromise
869
815
  declare class SlideTimeline {
870
816
  private readonly slideIndex;
871
817
  private readonly slideDuration;
872
818
  private readonly slideDisabledTimer;
873
819
  private readonly slideReady;
874
820
  private readonly _afterResumeQueuePush;
875
- constructor(slideIndex: number, slideDuration: number, slideDisabledTimer: boolean, slideReady: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void);
821
+ private readonly sdkApi;
822
+ constructor(slideIndex: number, slideDuration: number, slideDisabledTimer: boolean, slideReady: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void, sdkApi: SDKApi);
876
823
  private resumedAt;
877
824
  private timeSpent;
878
825
  private timelineDisabledState;
879
826
  private currentState;
880
827
  static get layoutService(): LayoutService;
881
828
  private get layoutService();
882
- get isSDKSupportUpdateTimeline(): boolean | undefined;
829
+ get isSDKSupportUpdateTimeline(): boolean;
830
+ get isSdkSupportTimelineOnBeforeStart(): boolean;
883
831
  get index(): number;
884
832
  get isTimelineDisabled(): boolean;
885
833
  private updateTimeline;
834
+ /**
835
+ * trigger timeline update for new slide in sdk, before slide strat event (prevent timeout in timeline while we wait for video start)
836
+ */
837
+ triggerSlideLoadState(): void;
886
838
  /**
887
839
  * Start timeline after slide started
888
840
  * Nothing do if old sdk
@@ -920,7 +872,6 @@ type FontDTO = {
920
872
  interface SDKApi {
921
873
  getCardServerData(cardId: number): Record<string, any> | null;
922
874
  updateCardServerDataLocally(cardId: number, data: Record<string, any>): void;
923
- getSlideDuration(cardId: number, slideIndex: number): number | null;
924
875
  showNextSlide(duration: number): void;
925
876
  sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, forceEnableStatisticV2?: boolean): void;
926
877
  getCardLocalData(): Promise<Record<string, any>>;
@@ -972,7 +923,6 @@ interface SDKApi {
972
923
  cardPausedCallback(currentTime: number | null): void;
973
924
  /** @deprecated, used only in native sdk **/
974
925
  cardResumedCallback(currentTime: number | null): void;
975
- startDisabledTimeline(cardId: number, slideIndex: number): void;
976
926
  getCardFonts(): Array<FontDTO>;
977
927
  disableVerticalSwipeGesture(): void;
978
928
  enableVerticalSwipeGesture(): void;
@@ -985,13 +935,47 @@ interface SDKApi {
985
935
  type: "text";
986
936
  textValue: string;
987
937
  }): void;
938
+ isSdkSupportTimelineOnBeforeStart(): boolean;
939
+ }
940
+ declare const enum CARD_TYPE {
941
+ STORY = 1,
942
+ UGC_STORY = 2,
943
+ GAME_CARDS = 3,
944
+ IN_APP_MESSAGING = 4
945
+ }
946
+ type WidgetOptionsBase = {
947
+ slide: HTMLElement | null;
948
+ activateAfterCreate: boolean;
949
+ create: boolean;
950
+ localData: Record<string, any>;
951
+ } & {
952
+ [P in string]: any;
953
+ };
954
+ declare const enum Widgets {
955
+ DataInput = "dataInput",
956
+ Quiz = "quiz",
957
+ QuizGrouped = "quizGrouped",
958
+ RangeSlider = "rangeSlider",
959
+ Poll = "poll",
960
+ PollLayers = "pollLayers",
961
+ Vote = "vote",
962
+ Rate = "rate",
963
+ Test = "test",
964
+ Copy = "copy",
965
+ Share = "share",
966
+ DateCountdown = "dateCountdown",
967
+ Quest = "quest"
968
+ }
969
+ interface WidgetsSharedDataMap {
970
+ rangeSlider: WidgetRangeSliderSharedData;
971
+ poll: WidgetPollSharedData;
972
+ vote: WidgetVoteSharedData;
988
973
  }
974
+ type OnWidgetComplete = (cardId: number, slideIndex: number) => void;
989
975
  declare class WidgetsService {
990
976
  private _env;
991
- private _sdkApi;
992
- constructor(_env: Window, _sdkApi: SDKApi);
977
+ constructor(_env: Window);
993
978
  get env(): Window;
994
- get sdkApi(): SDKApi;
995
979
  }
996
980
  type StatisticEventBaseFieldsShortForm = {
997
981
  i: number;
@@ -1003,6 +987,8 @@ type StatisticEventBaseFieldsFullForm = {
1003
987
  slide_index: number;
1004
988
  };
1005
989
  declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
990
+ private readonly _onWidgetComplete;
991
+ readonly sdkApi: SDKApi;
1006
992
  /**
1007
993
  * @see https://github.com/Microsoft/TypeScript/issues/3841#issuecomment-1488919713
1008
994
  */
@@ -1010,7 +996,6 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
1010
996
  static DEFAULTS: WidgetOptionsBase;
1011
997
  static widgetIndex: number;
1012
998
  protected env: Window;
1013
- protected sdkApi: SDKApi;
1014
999
  protected options: WidgetOptions;
1015
1000
  protected element: HTMLElement;
1016
1001
  protected elementId: string;
@@ -1030,7 +1015,7 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
1030
1015
  protected id: string;
1031
1016
  startReadyPromise: Promise<void>;
1032
1017
  private startReadyResolve;
1033
- constructor(element: HTMLElement, options: Partial<WidgetOptions>, elementIdGetter?: (element: HTMLElement) => string, slideGetter?: (element: HTMLElement) => HTMLElement);
1018
+ constructor(element: HTMLElement, options: Partial<WidgetOptions>, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi, elementIdGetter?: (element: HTMLElement) => string, slideGetter?: (element: HTMLElement) => HTMLElement);
1034
1019
  protected get submitButtonViewHeight(): number;
1035
1020
  private resetStartReadyPromise;
1036
1021
  /**
@@ -1047,30 +1032,26 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
1047
1032
  static getInstance<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(element: HTMLElement): Widget | undefined;
1048
1033
  static getInstanceById<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(id: string): Widget | undefined;
1049
1034
  static createInstance<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(instantiate: (element: HTMLElement, options: Partial<WidgetOptions>) => Widget, element: HTMLElement, options: Partial<WidgetOptions>): Widget;
1050
- static initWidget<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(htmlElement: HTMLElement, localData: Record<string, any> | undefined, instantiate: (element: HTMLElement, options: Partial<WidgetOptions>) => Widget): Promise<Record<string, any>>;
1051
- /** @deprecated */
1052
- static initWidgets<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(instantiate: (element: HTMLElement, options: Partial<WidgetOptions>) => Widget, elements: Array<HTMLElement>, localData?: Record<string, any>): Promise<Record<string, any>>;
1035
+ static initWidget<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(htmlElement: HTMLElement, localData: Record<string, any>, instantiate: (element: HTMLElement, options: Partial<WidgetOptions>) => Widget): Promise<Record<string, any>>;
1053
1036
  static get widgetsService(): WidgetsService;
1054
- static getLocalData(): Promise<Record<string, any>>;
1037
+ static getLocalData(sdkApi: SDKApi): Promise<Record<string, any>>;
1055
1038
  getLocalData(): Promise<Record<string, any>>;
1056
- static setLocalData(keyValue: Record<string, any>, sendToServer?: boolean, syncWithRuntimeLocalData?: boolean): void;
1039
+ static setLocalData(sdkApi: SDKApi, keyValue: Record<string, any>, sendToServer?: boolean, syncWithRuntimeLocalData?: boolean): void;
1057
1040
  setLocalData(keyValue: Record<string, any>, sendToServer?: boolean, syncWithRuntimeLocalData?: boolean): void;
1058
1041
  get statisticEventBaseFieldsShortForm(): StatisticEventBaseFieldsShortForm;
1059
1042
  static getStatisticEventBaseFieldsShortForm(cardId: number, slideIndex: number): StatisticEventBaseFieldsShortForm;
1060
1043
  get statisticEventBaseFieldsFullForm(): StatisticEventBaseFieldsFullForm;
1061
1044
  static getStatisticEventBaseFieldsFullForm(cardId: number, cardType: CARD_TYPE, slideIndex: number): StatisticEventBaseFieldsFullForm;
1062
- static sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
1045
+ static sendStatisticEventToApp(sdkApi: SDKApi, name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
1063
1046
  forceEnableStatisticV2?: boolean;
1064
1047
  }): void;
1065
1048
  sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
1066
1049
  forceEnableStatisticV2?: boolean;
1067
1050
  }): void;
1068
- startDisabledTimeline(): void;
1051
+ onWidgetComplete(): void;
1069
1052
  protected _showLayer(layers: Array<HTMLElement>, selectIndex: number, withStatEvent?: boolean): void;
1070
1053
  protected _statEventLayoutShow(layoutIndex: number): void;
1071
- /** @deprecated */
1072
- static refreshUserData<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(nodes: NodeListOf<HTMLElement>, localData?: Record<string, any>): void;
1073
- static onRefreshUserData<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(element: HTMLElement, localData?: Record<string, any>): void;
1054
+ static onRefreshUserData<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(element: HTMLElement, localData: Record<string, any>): void;
1074
1055
  protected getPromotionalCodeFetchPath(promotionalCodeId: string): string;
1075
1056
  }
1076
1057
  interface SDKInterface {
@@ -1246,9 +1227,11 @@ declare class DataInput implements IElement {
1246
1227
  private readonly _elementNodeRef;
1247
1228
  private readonly _layer;
1248
1229
  private readonly _widgetApi;
1230
+ private readonly _onWidgetComplete;
1231
+ private readonly sdkApi;
1249
1232
  private static readonly _className;
1250
1233
  static className(): string;
1251
- constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetDataInput.api);
1234
+ constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetDataInput.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
1252
1235
  static isTypeOf(element: IElement): element is DataInput;
1253
1236
  mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
1254
1237
  init(localData: LocalData): Promise<boolean>;
@@ -1265,9 +1248,11 @@ declare class Poll implements IElement {
1265
1248
  private readonly _elementNodeRef;
1266
1249
  private readonly _layer;
1267
1250
  private readonly _widgetApi;
1251
+ private readonly _onWidgetComplete;
1252
+ private readonly sdkApi;
1268
1253
  private static readonly _className;
1269
1254
  static className(): string;
1270
- constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetPoll.api);
1255
+ constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetPoll.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
1271
1256
  static isTypeOf(element: IElement): element is Poll;
1272
1257
  mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
1273
1258
  init(localData: LocalData): Promise<boolean>;
@@ -1285,9 +1270,11 @@ declare class PollLayers implements IElement {
1285
1270
  private readonly _layer;
1286
1271
  private readonly _layersNodesRefs;
1287
1272
  private readonly _widgetApi;
1273
+ private readonly _onWidgetComplete;
1274
+ private readonly sdkApi;
1288
1275
  private static readonly _className;
1289
1276
  static className(): string;
1290
- constructor(_elementNodeRef: HTMLElement, _layer: Layer, _layersNodesRefs: Array<HTMLElement>, _widgetApi: typeof WidgetPollLayers.api);
1277
+ constructor(_elementNodeRef: HTMLElement, _layer: Layer, _layersNodesRefs: Array<HTMLElement>, _widgetApi: typeof WidgetPollLayers.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
1291
1278
  static isTypeOf(element: IElement): element is PollLayers;
1292
1279
  mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
1293
1280
  init(localData: LocalData): Promise<boolean>;
@@ -1303,9 +1290,11 @@ declare class Products implements IElement {
1303
1290
  private readonly _elementNodeRef;
1304
1291
  private readonly _layer;
1305
1292
  private readonly _widgetApi;
1293
+ private readonly _onWidgetComplete;
1294
+ private readonly sdkApi;
1306
1295
  private static readonly _className;
1307
1296
  static className(): string;
1308
- constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetProducts.api);
1297
+ constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetProducts.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
1309
1298
  static isTypeOf(element: IElement): element is Products;
1310
1299
  mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
1311
1300
  init(localData: LocalData): Promise<boolean>;
@@ -1324,9 +1313,11 @@ declare class Quest implements IElement {
1324
1313
  private readonly _elementNodeRef;
1325
1314
  private readonly _layer;
1326
1315
  private readonly _widgetApi;
1316
+ private readonly _onWidgetComplete;
1317
+ private readonly sdkApi;
1327
1318
  private static readonly _className;
1328
1319
  static className(): string;
1329
- constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuest.api);
1320
+ constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuest.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
1330
1321
  static isTypeOf(element: IElement): element is Quest;
1331
1322
  mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
1332
1323
  init(localData: LocalData): Promise<boolean>;
@@ -1349,10 +1340,12 @@ declare class Quiz implements IElement {
1349
1340
  private readonly _elementNodeRef;
1350
1341
  private readonly _layer;
1351
1342
  private readonly _widgetApi;
1343
+ private readonly _onWidgetComplete;
1344
+ private readonly sdkApi;
1352
1345
  private static readonly _className;
1353
1346
  static className(): string;
1354
1347
  // widgetApi in ctor
1355
- constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuiz.api);
1348
+ constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuiz.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
1356
1349
  static isTypeOf(element: IElement): element is Quiz;
1357
1350
  mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
1358
1351
  init(localData: LocalData): Promise<boolean>;
@@ -1369,9 +1362,11 @@ declare class QuizGrouped implements IElement {
1369
1362
  private readonly _elementNodeRef;
1370
1363
  private readonly _layer;
1371
1364
  private readonly _widgetApi;
1365
+ private readonly _onWidgetComplete;
1366
+ private readonly sdkApi;
1372
1367
  private static readonly _className;
1373
1368
  static className(): string;
1374
- constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuizGrouped.api);
1369
+ constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuizGrouped.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
1375
1370
  static isTypeOf(element: IElement): element is QuizGrouped;
1376
1371
  mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
1377
1372
  init(localData: LocalData): Promise<boolean>;
@@ -1388,9 +1383,11 @@ declare class RangeSlider implements IElement {
1388
1383
  private readonly _elementNodeRef;
1389
1384
  private readonly _layer;
1390
1385
  private readonly _widgetApi;
1386
+ private readonly _onWidgetComplete;
1387
+ private readonly sdkApi;
1391
1388
  private static readonly _className;
1392
1389
  static className(): string;
1393
- constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetRangeSlider.api);
1390
+ constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetRangeSlider.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
1394
1391
  static isTypeOf(element: IElement): element is RangeSlider;
1395
1392
  mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
1396
1393
  init(localData: LocalData): Promise<boolean>;
@@ -1407,9 +1404,11 @@ declare class Rate implements IElement {
1407
1404
  private readonly _elementNodeRef;
1408
1405
  private readonly _layer;
1409
1406
  private readonly _widgetApi;
1407
+ private readonly _onWidgetComplete;
1408
+ private readonly sdkApi;
1410
1409
  private static readonly _className;
1411
1410
  static className(): string;
1412
- constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetRate.api);
1411
+ constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetRate.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
1413
1412
  static isTypeOf(element: IElement): element is Rate;
1414
1413
  mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
1415
1414
  init(localData: LocalData): Promise<boolean>;
@@ -1427,10 +1426,12 @@ declare class Share implements IElement {
1427
1426
  private readonly _layer;
1428
1427
  private readonly _layersNodesRefs;
1429
1428
  private readonly _widgetApi;
1429
+ private readonly _onWidgetComplete;
1430
+ private readonly sdkApi;
1430
1431
  private static readonly _className;
1431
1432
  private static readonly _widgetApiName;
1432
1433
  static className(): string;
1433
- constructor(_elementNodeRef: HTMLElement, _layer: Layer, _layersNodesRefs: Array<HTMLElement>, _widgetApi: typeof WidgetShare.api);
1434
+ constructor(_elementNodeRef: HTMLElement, _layer: Layer, _layersNodesRefs: Array<HTMLElement>, _widgetApi: typeof WidgetShare.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
1434
1435
  static isTypeOf(element: IElement): element is Share;
1435
1436
  mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
1436
1437
  init(localData: LocalData): Promise<boolean>;
@@ -1483,9 +1484,11 @@ declare class Test implements IElement {
1483
1484
  private readonly _elementNodeRef;
1484
1485
  private readonly _layer;
1485
1486
  private readonly _widgetApi;
1487
+ private readonly _onWidgetComplete;
1488
+ private readonly sdkApi;
1486
1489
  private static readonly _className;
1487
1490
  static className(): string;
1488
- constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetTest.api);
1491
+ constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetTest.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
1489
1492
  static isTypeOf(element: IElement): element is Test;
1490
1493
  mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
1491
1494
  init(localData: LocalData): Promise<boolean>;
@@ -1547,9 +1550,12 @@ declare class Slide {
1547
1550
  private readonly _slidesNodesRefs;
1548
1551
  private readonly _slideReadyPromise;
1549
1552
  private readonly _afterResumeQueuePush;
1553
+ private readonly _afterStartInitQueuePush;
1554
+ private readonly _showNextSlide;
1555
+ readonly sdkApi: SDKApi;
1550
1556
  private readonly _layers;
1551
1557
  private _start;
1552
- constructor(_slidesNodesRefs: Array<HTMLElement>, _slideReadyPromise: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void);
1558
+ constructor(_slidesNodesRefs: Array<HTMLElement>, _slideReadyPromise: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void, _afterStartInitQueuePush: (cb: () => void) => void, _showNextSlide: (duration: number) => void, sdkApi: SDKApi);
1553
1559
  private _activeLayer;
1554
1560
  get activeLayer(): Layer;
1555
1561
  get layers(): Array<Layer>;
@@ -1576,6 +1582,9 @@ declare class Layer {
1576
1582
  private readonly _slide;
1577
1583
  private readonly _slideReadyPromise;
1578
1584
  private readonly _afterResumeQueuePush;
1585
+ private readonly _afterStartInitQueuePush;
1586
+ private readonly _showNextSlide;
1587
+ readonly sdkApi: SDKApi;
1579
1588
  private readonly _slideIndex;
1580
1589
  private readonly _cardId;
1581
1590
  private readonly _cardType;
@@ -1585,14 +1594,13 @@ declare class Layer {
1585
1594
  private readonly _disabledNavigation;
1586
1595
  private _elements;
1587
1596
  private readonly _timeline;
1588
- constructor(_nodeRef: HTMLElement, _slide: Slide, _slideReadyPromise: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void);
1597
+ constructor(_nodeRef: HTMLElement, _slide: Slide, _slideReadyPromise: Promise<void>, _afterResumeQueuePush: (cb: () => void) => void, _afterStartInitQueuePush: (cb: () => void) => void, _showNextSlide: (duration: number) => void, sdkApi: SDKApi);
1589
1598
  init(localData: LocalData): Array<Promise<boolean>>;
1590
1599
  get nodeRef(): HTMLElement;
1591
1600
  get elements(): Array<IElement>;
1592
1601
  get slide(): Slide;
1593
1602
  get timeline(): SlideTimeline;
1594
1603
  get layoutService(): LayoutService;
1595
- get sdkApi(): SDKApi;
1596
1604
  getLocalData(): Promise<LocalData>;
1597
1605
  get isQuest(): boolean;
1598
1606
  private _initTextFit;
@@ -1657,7 +1665,12 @@ declare class SlideApi {
1657
1665
  private static prerenderBoxClassName;
1658
1666
  private readonly _slideWrapper;
1659
1667
  private readonly _viewport;
1668
+ private readonly _getViewportWidth;
1669
+ private readonly _getViewportHeight;
1670
+ private readonly _overlappingActionBarHeight;
1671
+ readonly sdkApi: SDKApi;
1660
1672
  constructor(config: {
1673
+ sdkApi: SDKApi;
1661
1674
  slideWrapper: HTMLElement;
1662
1675
  viewport: Window;
1663
1676
  userResizeHandler?: (data: {
@@ -1672,6 +1685,9 @@ declare class SlideApi {
1672
1685
  result: boolean;
1673
1686
  reason?: string;
1674
1687
  }) => void;
1688
+ getViewportWidth: () => number;
1689
+ getViewportHeight: () => number;
1690
+ overlappingActionBarHeight?: number;
1675
1691
  });
1676
1692
  destroy(): void;
1677
1693
  private initListeners;
@@ -1685,7 +1701,6 @@ declare class SlideApi {
1685
1701
  handleBackpress(): void;
1686
1702
  private get layoutService();
1687
1703
  private getLocalData;
1688
- private get sdkApi();
1689
1704
  private _fontsInit;
1690
1705
  private _initAndLoadFonts;
1691
1706
  private _slide;
@@ -1731,7 +1746,7 @@ declare class SlideApi {
1731
1746
  get activeLayer(): Layer;
1732
1747
  get slide(): Slide;
1733
1748
  showLayer(index: number): void;
1734
- slideClickHandler(targetElement: HTMLElement, navigationDirection: "forward" | "backward"): {
1749
+ slideClickHandler(targetElement: HTMLElement | null, navigationDirection: "forward" | "backward"): {
1735
1750
  // todo rename to continueNavigationClick (or via two flags, continueNavigationForwardClick & continueNavigationBackwardClick)
1736
1751
  canClickNext: boolean;
1737
1752
  };
@@ -1743,6 +1758,7 @@ declare class SlideApi {
1743
1758
  slideSwipeUpHandler(): boolean;
1744
1759
  setTextInputResult(id: string, text: string): void;
1745
1760
  setShareComplete(id: string, isSuccess: boolean): void;
1761
+ setWidgetGoodsComplete(elementId: string): void;
1746
1762
  }
1747
1763
  declare module SlideApiWrapper {
1748
1764
  export { SlideApi };
@@ -1761,6 +1777,7 @@ declare class SlideApi$0 extends BaseSlideApi {
1761
1777
  fontSize: number;
1762
1778
  }) => void;
1763
1779
  VODPlayer?: typeof VODPlayer;
1780
+ overlappingActionBarHeight?: number;
1764
1781
  });
1765
1782
  }
1766
1783
  export type { SDKInterface, WidgetsSharedDataMap, WidgetRangeSliderSharedData, WidgetPollSharedData, WidgetVoteSharedData, FontDTO };