@inappstory/slide-api 0.1.3 → 0.1.5
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 +645 -756
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +407 -375
- package/dist/index.d.ts +407 -375
- package/dist/index.js +645 -756
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,29 +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,
|
|
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
|
-
|
|
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
|
|
829
|
+
get isSDKSupportUpdateTimeline(): boolean;
|
|
830
|
+
get isSdkSupportTimelineOnBeforeStart(): boolean;
|
|
883
831
|
get index(): number;
|
|
832
|
+
get isTimelineDisabled(): boolean;
|
|
884
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;
|
|
885
838
|
/**
|
|
886
839
|
* Start timeline after slide started
|
|
887
840
|
* Nothing do if old sdk
|
|
@@ -919,7 +872,6 @@ type FontDTO = {
|
|
|
919
872
|
interface SDKApi {
|
|
920
873
|
getCardServerData(cardId: number): Record<string, any> | null;
|
|
921
874
|
updateCardServerDataLocally(cardId: number, data: Record<string, any>): void;
|
|
922
|
-
getSlideDuration(cardId: number, slideIndex: number): number | null;
|
|
923
875
|
showNextSlide(duration: number): void;
|
|
924
876
|
sendStatisticEvent(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, forceEnableStatisticV2?: boolean): void;
|
|
925
877
|
getCardLocalData(): Promise<Record<string, any>>;
|
|
@@ -971,7 +923,6 @@ interface SDKApi {
|
|
|
971
923
|
cardPausedCallback(currentTime: number | null): void;
|
|
972
924
|
/** @deprecated, used only in native sdk **/
|
|
973
925
|
cardResumedCallback(currentTime: number | null): void;
|
|
974
|
-
startDisabledTimeline(cardId: number, slideIndex: number): void;
|
|
975
926
|
getCardFonts(): Array<FontDTO>;
|
|
976
927
|
disableVerticalSwipeGesture(): void;
|
|
977
928
|
enableVerticalSwipeGesture(): void;
|
|
@@ -984,13 +935,47 @@ interface SDKApi {
|
|
|
984
935
|
type: "text";
|
|
985
936
|
textValue: string;
|
|
986
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
|
|
987
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;
|
|
973
|
+
}
|
|
974
|
+
type OnWidgetComplete = (cardId: number, slideIndex: number) => void;
|
|
988
975
|
declare class WidgetsService {
|
|
989
976
|
private _env;
|
|
990
|
-
|
|
991
|
-
constructor(_env: Window, _sdkApi: SDKApi);
|
|
977
|
+
constructor(_env: Window);
|
|
992
978
|
get env(): Window;
|
|
993
|
-
get sdkApi(): SDKApi;
|
|
994
979
|
}
|
|
995
980
|
type StatisticEventBaseFieldsShortForm = {
|
|
996
981
|
i: number;
|
|
@@ -1002,6 +987,8 @@ type StatisticEventBaseFieldsFullForm = {
|
|
|
1002
987
|
slide_index: number;
|
|
1003
988
|
};
|
|
1004
989
|
declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
|
|
990
|
+
private readonly _onWidgetComplete;
|
|
991
|
+
readonly sdkApi: SDKApi;
|
|
1005
992
|
/**
|
|
1006
993
|
* @see https://github.com/Microsoft/TypeScript/issues/3841#issuecomment-1488919713
|
|
1007
994
|
*/
|
|
@@ -1009,7 +996,6 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
|
|
|
1009
996
|
static DEFAULTS: WidgetOptionsBase;
|
|
1010
997
|
static widgetIndex: number;
|
|
1011
998
|
protected env: Window;
|
|
1012
|
-
protected sdkApi: SDKApi;
|
|
1013
999
|
protected options: WidgetOptions;
|
|
1014
1000
|
protected element: HTMLElement;
|
|
1015
1001
|
protected elementId: string;
|
|
@@ -1029,7 +1015,7 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
|
|
|
1029
1015
|
protected id: string;
|
|
1030
1016
|
startReadyPromise: Promise<void>;
|
|
1031
1017
|
private startReadyResolve;
|
|
1032
|
-
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);
|
|
1033
1019
|
protected get submitButtonViewHeight(): number;
|
|
1034
1020
|
private resetStartReadyPromise;
|
|
1035
1021
|
/**
|
|
@@ -1046,30 +1032,26 @@ declare class WidgetBase<WidgetOptions extends WidgetOptionsBase> {
|
|
|
1046
1032
|
static getInstance<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(element: HTMLElement): Widget | undefined;
|
|
1047
1033
|
static getInstanceById<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(id: string): Widget | undefined;
|
|
1048
1034
|
static createInstance<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(instantiate: (element: HTMLElement, options: Partial<WidgetOptions>) => Widget, element: HTMLElement, options: Partial<WidgetOptions>): Widget;
|
|
1049
|
-
static initWidget<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(htmlElement: HTMLElement, localData: Record<string, any
|
|
1050
|
-
/** @deprecated */
|
|
1051
|
-
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>>;
|
|
1052
1036
|
static get widgetsService(): WidgetsService;
|
|
1053
|
-
static getLocalData(): Promise<Record<string, any>>;
|
|
1037
|
+
static getLocalData(sdkApi: SDKApi): Promise<Record<string, any>>;
|
|
1054
1038
|
getLocalData(): Promise<Record<string, any>>;
|
|
1055
|
-
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;
|
|
1056
1040
|
setLocalData(keyValue: Record<string, any>, sendToServer?: boolean, syncWithRuntimeLocalData?: boolean): void;
|
|
1057
1041
|
get statisticEventBaseFieldsShortForm(): StatisticEventBaseFieldsShortForm;
|
|
1058
1042
|
static getStatisticEventBaseFieldsShortForm(cardId: number, slideIndex: number): StatisticEventBaseFieldsShortForm;
|
|
1059
1043
|
get statisticEventBaseFieldsFullForm(): StatisticEventBaseFieldsFullForm;
|
|
1060
1044
|
static getStatisticEventBaseFieldsFullForm(cardId: number, cardType: CARD_TYPE, slideIndex: number): StatisticEventBaseFieldsFullForm;
|
|
1061
|
-
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?: {
|
|
1062
1046
|
forceEnableStatisticV2?: boolean;
|
|
1063
1047
|
}): void;
|
|
1064
1048
|
sendStatisticEventToApp(name: string, data: Record<string, string | number | Array<string | number>>, devPayload?: Record<string, string | number | Array<string | number>>, options?: {
|
|
1065
1049
|
forceEnableStatisticV2?: boolean;
|
|
1066
1050
|
}): void;
|
|
1067
|
-
|
|
1051
|
+
onWidgetComplete(): void;
|
|
1068
1052
|
protected _showLayer(layers: Array<HTMLElement>, selectIndex: number, withStatEvent?: boolean): void;
|
|
1069
1053
|
protected _statEventLayoutShow(layoutIndex: number): void;
|
|
1070
|
-
|
|
1071
|
-
static refreshUserData<Widget extends WidgetBase<WidgetOptions>, WidgetOptions extends WidgetOptionsBase>(nodes: NodeListOf<HTMLElement>, localData?: Record<string, any>): void;
|
|
1072
|
-
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;
|
|
1073
1055
|
protected getPromotionalCodeFetchPath(promotionalCodeId: string): string;
|
|
1074
1056
|
}
|
|
1075
1057
|
interface SDKInterface {
|
|
@@ -1083,22 +1065,7 @@ interface SDKInterface {
|
|
|
1083
1065
|
*/
|
|
1084
1066
|
getCardServerData(cardId: number): Record<string, any> | null;
|
|
1085
1067
|
updateCardServerDataLocally(data: Record<string, any>): void;
|
|
1086
|
-
|
|
1087
|
-
* Return slide duration or null
|
|
1088
|
-
*
|
|
1089
|
-
* Possible implementation
|
|
1090
|
-
* if (
|
|
1091
|
-
* "_narrative_slides_duration" in window &&
|
|
1092
|
-
* window._narrative_slides_duration[cardId] != null &&
|
|
1093
|
-
* isArray(window._narrative_slides_duration[cardId]) &&
|
|
1094
|
-
* window._narrative_slides_duration[cardId][slideIndex] != null &&
|
|
1095
|
-
* isNumber(window._narrative_slides_duration[cardId][slideIndex])
|
|
1096
|
-
* ) {
|
|
1097
|
-
* return window._narrative_slides_duration[cardId][slideIndex];
|
|
1098
|
-
* }
|
|
1099
|
-
*/
|
|
1100
|
-
getSlideDuration(cardId: number, slideIndex: number): number | null;
|
|
1101
|
-
showNextSlide(duration: number): void;
|
|
1068
|
+
showNextSlide(): void;
|
|
1102
1069
|
/**
|
|
1103
1070
|
* From native sdk, do`t implement in web|react-sdk
|
|
1104
1071
|
*/
|
|
@@ -1250,6 +1217,7 @@ interface IElement {
|
|
|
1250
1217
|
onResume(): void;
|
|
1251
1218
|
onStop(): void;
|
|
1252
1219
|
onStart(): void;
|
|
1220
|
+
onBeforeUnmount(): void;
|
|
1253
1221
|
handleClick(): boolean;
|
|
1254
1222
|
// is Layer on pause (by opened WidgetProducts for instance)
|
|
1255
1223
|
isLayerForcePaused: boolean;
|
|
@@ -1259,9 +1227,11 @@ declare class DataInput implements IElement {
|
|
|
1259
1227
|
private readonly _elementNodeRef;
|
|
1260
1228
|
private readonly _layer;
|
|
1261
1229
|
private readonly _widgetApi;
|
|
1230
|
+
private readonly _onWidgetComplete;
|
|
1231
|
+
private readonly sdkApi;
|
|
1262
1232
|
private static readonly _className;
|
|
1263
1233
|
static className(): string;
|
|
1264
|
-
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetDataInput.api);
|
|
1234
|
+
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetDataInput.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
|
|
1265
1235
|
static isTypeOf(element: IElement): element is DataInput;
|
|
1266
1236
|
mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
|
|
1267
1237
|
init(localData: LocalData): Promise<boolean>;
|
|
@@ -1269,6 +1239,7 @@ declare class DataInput implements IElement {
|
|
|
1269
1239
|
onResume(): void;
|
|
1270
1240
|
onStart(): void;
|
|
1271
1241
|
onStop(): void;
|
|
1242
|
+
onBeforeUnmount(): void;
|
|
1272
1243
|
handleClick(): boolean;
|
|
1273
1244
|
setUserData(id: string, text: string): void;
|
|
1274
1245
|
get isLayerForcePaused(): boolean;
|
|
@@ -1277,9 +1248,11 @@ declare class Poll implements IElement {
|
|
|
1277
1248
|
private readonly _elementNodeRef;
|
|
1278
1249
|
private readonly _layer;
|
|
1279
1250
|
private readonly _widgetApi;
|
|
1251
|
+
private readonly _onWidgetComplete;
|
|
1252
|
+
private readonly sdkApi;
|
|
1280
1253
|
private static readonly _className;
|
|
1281
1254
|
static className(): string;
|
|
1282
|
-
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetPoll.api);
|
|
1255
|
+
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetPoll.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
|
|
1283
1256
|
static isTypeOf(element: IElement): element is Poll;
|
|
1284
1257
|
mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
|
|
1285
1258
|
init(localData: LocalData): Promise<boolean>;
|
|
@@ -1287,6 +1260,7 @@ declare class Poll implements IElement {
|
|
|
1287
1260
|
onResume(): void;
|
|
1288
1261
|
onStart(): void;
|
|
1289
1262
|
onStop(): void;
|
|
1263
|
+
onBeforeUnmount(): void;
|
|
1290
1264
|
handleClick(): boolean;
|
|
1291
1265
|
setUserData(id: string, text: string): void;
|
|
1292
1266
|
get isLayerForcePaused(): boolean;
|
|
@@ -1296,9 +1270,11 @@ declare class PollLayers implements IElement {
|
|
|
1296
1270
|
private readonly _layer;
|
|
1297
1271
|
private readonly _layersNodesRefs;
|
|
1298
1272
|
private readonly _widgetApi;
|
|
1273
|
+
private readonly _onWidgetComplete;
|
|
1274
|
+
private readonly sdkApi;
|
|
1299
1275
|
private static readonly _className;
|
|
1300
1276
|
static className(): string;
|
|
1301
|
-
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);
|
|
1302
1278
|
static isTypeOf(element: IElement): element is PollLayers;
|
|
1303
1279
|
mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
|
|
1304
1280
|
init(localData: LocalData): Promise<boolean>;
|
|
@@ -1306,6 +1282,7 @@ declare class PollLayers implements IElement {
|
|
|
1306
1282
|
onResume(): void;
|
|
1307
1283
|
onStart(): void;
|
|
1308
1284
|
onStop(): void;
|
|
1285
|
+
onBeforeUnmount(): void;
|
|
1309
1286
|
handleClick(): boolean;
|
|
1310
1287
|
get isLayerForcePaused(): boolean;
|
|
1311
1288
|
}
|
|
@@ -1313,9 +1290,11 @@ declare class Products implements IElement {
|
|
|
1313
1290
|
private readonly _elementNodeRef;
|
|
1314
1291
|
private readonly _layer;
|
|
1315
1292
|
private readonly _widgetApi;
|
|
1293
|
+
private readonly _onWidgetComplete;
|
|
1294
|
+
private readonly sdkApi;
|
|
1316
1295
|
private static readonly _className;
|
|
1317
1296
|
static className(): string;
|
|
1318
|
-
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetProducts.api);
|
|
1297
|
+
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetProducts.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
|
|
1319
1298
|
static isTypeOf(element: IElement): element is Products;
|
|
1320
1299
|
mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
|
|
1321
1300
|
init(localData: LocalData): Promise<boolean>;
|
|
@@ -1323,6 +1302,7 @@ declare class Products implements IElement {
|
|
|
1323
1302
|
onResume(): void;
|
|
1324
1303
|
onStart(): void;
|
|
1325
1304
|
onStop(): void;
|
|
1305
|
+
onBeforeUnmount(): void;
|
|
1326
1306
|
handleClick(): boolean;
|
|
1327
1307
|
handleBackpress(): void;
|
|
1328
1308
|
get elementNodeRef(): HTMLElement;
|
|
@@ -1333,9 +1313,11 @@ declare class Quest implements IElement {
|
|
|
1333
1313
|
private readonly _elementNodeRef;
|
|
1334
1314
|
private readonly _layer;
|
|
1335
1315
|
private readonly _widgetApi;
|
|
1316
|
+
private readonly _onWidgetComplete;
|
|
1317
|
+
private readonly sdkApi;
|
|
1336
1318
|
private static readonly _className;
|
|
1337
1319
|
static className(): string;
|
|
1338
|
-
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuest.api);
|
|
1320
|
+
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuest.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
|
|
1339
1321
|
static isTypeOf(element: IElement): element is Quest;
|
|
1340
1322
|
mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
|
|
1341
1323
|
init(localData: LocalData): Promise<boolean>;
|
|
@@ -1343,6 +1325,7 @@ declare class Quest implements IElement {
|
|
|
1343
1325
|
onResume(): void;
|
|
1344
1326
|
onStart(): void;
|
|
1345
1327
|
onStop(): void;
|
|
1328
|
+
onBeforeUnmount(): void;
|
|
1346
1329
|
handleClick(): boolean;
|
|
1347
1330
|
handleRouteClick(options: {
|
|
1348
1331
|
direction: "backward" | "forward";
|
|
@@ -1357,10 +1340,12 @@ declare class Quiz implements IElement {
|
|
|
1357
1340
|
private readonly _elementNodeRef;
|
|
1358
1341
|
private readonly _layer;
|
|
1359
1342
|
private readonly _widgetApi;
|
|
1343
|
+
private readonly _onWidgetComplete;
|
|
1344
|
+
private readonly sdkApi;
|
|
1360
1345
|
private static readonly _className;
|
|
1361
1346
|
static className(): string;
|
|
1362
1347
|
// widgetApi in ctor
|
|
1363
|
-
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuiz.api);
|
|
1348
|
+
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuiz.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
|
|
1364
1349
|
static isTypeOf(element: IElement): element is Quiz;
|
|
1365
1350
|
mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
|
|
1366
1351
|
init(localData: LocalData): Promise<boolean>;
|
|
@@ -1368,6 +1353,7 @@ declare class Quiz implements IElement {
|
|
|
1368
1353
|
onResume(): void;
|
|
1369
1354
|
onStart(): void;
|
|
1370
1355
|
onStop(): void;
|
|
1356
|
+
onBeforeUnmount(): void;
|
|
1371
1357
|
handleClick(): boolean;
|
|
1372
1358
|
get slideQuizIsDone(): boolean;
|
|
1373
1359
|
get isLayerForcePaused(): boolean;
|
|
@@ -1376,9 +1362,11 @@ declare class QuizGrouped implements IElement {
|
|
|
1376
1362
|
private readonly _elementNodeRef;
|
|
1377
1363
|
private readonly _layer;
|
|
1378
1364
|
private readonly _widgetApi;
|
|
1365
|
+
private readonly _onWidgetComplete;
|
|
1366
|
+
private readonly sdkApi;
|
|
1379
1367
|
private static readonly _className;
|
|
1380
1368
|
static className(): string;
|
|
1381
|
-
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuizGrouped.api);
|
|
1369
|
+
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetQuizGrouped.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
|
|
1382
1370
|
static isTypeOf(element: IElement): element is QuizGrouped;
|
|
1383
1371
|
mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
|
|
1384
1372
|
init(localData: LocalData): Promise<boolean>;
|
|
@@ -1386,6 +1374,7 @@ declare class QuizGrouped implements IElement {
|
|
|
1386
1374
|
onResume(): void;
|
|
1387
1375
|
onStart(): void;
|
|
1388
1376
|
onStop(): void;
|
|
1377
|
+
onBeforeUnmount(): void;
|
|
1389
1378
|
handleClick(): boolean;
|
|
1390
1379
|
get slideQuizGroupedIsDone(): boolean;
|
|
1391
1380
|
get isLayerForcePaused(): boolean;
|
|
@@ -1394,9 +1383,11 @@ declare class RangeSlider implements IElement {
|
|
|
1394
1383
|
private readonly _elementNodeRef;
|
|
1395
1384
|
private readonly _layer;
|
|
1396
1385
|
private readonly _widgetApi;
|
|
1386
|
+
private readonly _onWidgetComplete;
|
|
1387
|
+
private readonly sdkApi;
|
|
1397
1388
|
private static readonly _className;
|
|
1398
1389
|
static className(): string;
|
|
1399
|
-
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetRangeSlider.api);
|
|
1390
|
+
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetRangeSlider.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
|
|
1400
1391
|
static isTypeOf(element: IElement): element is RangeSlider;
|
|
1401
1392
|
mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
|
|
1402
1393
|
init(localData: LocalData): Promise<boolean>;
|
|
@@ -1404,6 +1395,7 @@ declare class RangeSlider implements IElement {
|
|
|
1404
1395
|
onResume(): void;
|
|
1405
1396
|
onStart(): void;
|
|
1406
1397
|
onStop(): void;
|
|
1398
|
+
onBeforeUnmount(): void;
|
|
1407
1399
|
get isClickCapturedBySlider(): boolean;
|
|
1408
1400
|
handleClick(): boolean;
|
|
1409
1401
|
get isLayerForcePaused(): boolean;
|
|
@@ -1412,9 +1404,11 @@ declare class Rate implements IElement {
|
|
|
1412
1404
|
private readonly _elementNodeRef;
|
|
1413
1405
|
private readonly _layer;
|
|
1414
1406
|
private readonly _widgetApi;
|
|
1407
|
+
private readonly _onWidgetComplete;
|
|
1408
|
+
private readonly sdkApi;
|
|
1415
1409
|
private static readonly _className;
|
|
1416
1410
|
static className(): string;
|
|
1417
|
-
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetRate.api);
|
|
1411
|
+
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetRate.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
|
|
1418
1412
|
static isTypeOf(element: IElement): element is Rate;
|
|
1419
1413
|
mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
|
|
1420
1414
|
init(localData: LocalData): Promise<boolean>;
|
|
@@ -1422,6 +1416,7 @@ declare class Rate implements IElement {
|
|
|
1422
1416
|
onResume(): void;
|
|
1423
1417
|
onStart(): void;
|
|
1424
1418
|
onStop(): void;
|
|
1419
|
+
onBeforeUnmount(): void;
|
|
1425
1420
|
handleClick(): boolean;
|
|
1426
1421
|
setUserData(id: string, text: string): void;
|
|
1427
1422
|
get isLayerForcePaused(): boolean;
|
|
@@ -1431,10 +1426,12 @@ declare class Share implements IElement {
|
|
|
1431
1426
|
private readonly _layer;
|
|
1432
1427
|
private readonly _layersNodesRefs;
|
|
1433
1428
|
private readonly _widgetApi;
|
|
1429
|
+
private readonly _onWidgetComplete;
|
|
1430
|
+
private readonly sdkApi;
|
|
1434
1431
|
private static readonly _className;
|
|
1435
1432
|
private static readonly _widgetApiName;
|
|
1436
1433
|
static className(): string;
|
|
1437
|
-
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);
|
|
1438
1435
|
static isTypeOf(element: IElement): element is Share;
|
|
1439
1436
|
mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
|
|
1440
1437
|
init(localData: LocalData): Promise<boolean>;
|
|
@@ -1442,6 +1439,7 @@ declare class Share implements IElement {
|
|
|
1442
1439
|
onResume(): void;
|
|
1443
1440
|
onStart(): void;
|
|
1444
1441
|
onStop(): void;
|
|
1442
|
+
onBeforeUnmount(): void;
|
|
1445
1443
|
handleClick(): boolean;
|
|
1446
1444
|
complete(id: string, isSuccess: boolean): void;
|
|
1447
1445
|
get isLayerForcePaused(): boolean;
|
|
@@ -1459,6 +1457,7 @@ declare class SwipeUp implements IElement {
|
|
|
1459
1457
|
onResume(): void;
|
|
1460
1458
|
onStart(): void;
|
|
1461
1459
|
onStop(): void;
|
|
1460
|
+
onBeforeUnmount(): void;
|
|
1462
1461
|
handleClick(): boolean;
|
|
1463
1462
|
get elementNodeRef(): HTMLElement;
|
|
1464
1463
|
get isLayerForcePaused(): boolean;
|
|
@@ -1476,6 +1475,7 @@ declare class SwipeUpItems implements IElement {
|
|
|
1476
1475
|
onResume(): void;
|
|
1477
1476
|
onStart(): void;
|
|
1478
1477
|
onStop(): void;
|
|
1478
|
+
onBeforeUnmount(): void;
|
|
1479
1479
|
handleClick(): boolean;
|
|
1480
1480
|
get elementNodeRef(): HTMLElement;
|
|
1481
1481
|
get isLayerForcePaused(): boolean;
|
|
@@ -1484,9 +1484,11 @@ declare class Test implements IElement {
|
|
|
1484
1484
|
private readonly _elementNodeRef;
|
|
1485
1485
|
private readonly _layer;
|
|
1486
1486
|
private readonly _widgetApi;
|
|
1487
|
+
private readonly _onWidgetComplete;
|
|
1488
|
+
private readonly sdkApi;
|
|
1487
1489
|
private static readonly _className;
|
|
1488
1490
|
static className(): string;
|
|
1489
|
-
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetTest.api);
|
|
1491
|
+
constructor(_elementNodeRef: HTMLElement, _layer: Layer, _widgetApi: typeof WidgetTest.api, _onWidgetComplete: OnWidgetComplete, sdkApi: SDKApi);
|
|
1490
1492
|
static isTypeOf(element: IElement): element is Test;
|
|
1491
1493
|
mediaElementsLoadingPromises: Array<Promise<HTMLImageElement | HTMLVideoElement>>;
|
|
1492
1494
|
init(localData: LocalData): Promise<boolean>;
|
|
@@ -1494,6 +1496,7 @@ declare class Test implements IElement {
|
|
|
1494
1496
|
onResume(): void;
|
|
1495
1497
|
onStart(): void;
|
|
1496
1498
|
onStop(): void;
|
|
1499
|
+
onBeforeUnmount(): void;
|
|
1497
1500
|
handleClick(): boolean;
|
|
1498
1501
|
get slideTestIsDone(): boolean;
|
|
1499
1502
|
get slideTestWithTimer(): boolean;
|
|
@@ -1520,22 +1523,26 @@ declare class Video implements IElement {
|
|
|
1520
1523
|
onResume(): void;
|
|
1521
1524
|
onStart(): void;
|
|
1522
1525
|
onStop(): void;
|
|
1526
|
+
onBeforeUnmount(): void;
|
|
1523
1527
|
private _initVOD;
|
|
1524
1528
|
private _convertMpdUrls;
|
|
1529
|
+
private _destroyVODPlayer;
|
|
1525
1530
|
handleClick(): boolean;
|
|
1526
1531
|
get isLayerForcePaused(): boolean;
|
|
1527
1532
|
private _videoStartedPromise;
|
|
1528
1533
|
get videoStartedPromise(): Promise<{
|
|
1529
1534
|
currentTime: number;
|
|
1530
1535
|
}> | null;
|
|
1531
|
-
start(muted?: boolean): Promise<{
|
|
1536
|
+
start(muted?: boolean, loop?: boolean): Promise<{
|
|
1532
1537
|
currentTime: number;
|
|
1533
1538
|
}>;
|
|
1534
1539
|
pause(resetVideoTime?: boolean): number | null;
|
|
1535
1540
|
resume(): Promise<{
|
|
1536
1541
|
currentTime: number;
|
|
1537
1542
|
}>;
|
|
1538
|
-
stop(
|
|
1543
|
+
stop({ prepareForRestart }: {
|
|
1544
|
+
prepareForRestart: ON_SLIDE_STOP_PREPARE_FOR_RESTART;
|
|
1545
|
+
}): Promise<void>;
|
|
1539
1546
|
enableAudio(): void;
|
|
1540
1547
|
disableAudio(): void;
|
|
1541
1548
|
}
|
|
@@ -1543,9 +1550,12 @@ declare class Slide {
|
|
|
1543
1550
|
private readonly _slidesNodesRefs;
|
|
1544
1551
|
private readonly _slideReadyPromise;
|
|
1545
1552
|
private readonly _afterResumeQueuePush;
|
|
1553
|
+
private readonly _afterStartInitQueuePush;
|
|
1554
|
+
private readonly _showNextSlide;
|
|
1555
|
+
readonly sdkApi: SDKApi;
|
|
1546
1556
|
private readonly _layers;
|
|
1547
1557
|
private _start;
|
|
1548
|
-
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);
|
|
1549
1559
|
private _activeLayer;
|
|
1550
1560
|
get activeLayer(): Layer;
|
|
1551
1561
|
get layers(): Array<Layer>;
|
|
@@ -1554,6 +1564,7 @@ declare class Slide {
|
|
|
1554
1564
|
init(localData: LocalData): Promise<boolean>;
|
|
1555
1565
|
refreshActiveLayer(): void;
|
|
1556
1566
|
showLayer(showIndex: number, muted?: boolean): void;
|
|
1567
|
+
onBeforeUnmount(): void;
|
|
1557
1568
|
get layoutService(): LayoutService;
|
|
1558
1569
|
get slideIndex(): number;
|
|
1559
1570
|
get cardId(): number;
|
|
@@ -1561,11 +1572,19 @@ declare class Slide {
|
|
|
1561
1572
|
get slideCount(): number;
|
|
1562
1573
|
get disabledNavigation(): boolean;
|
|
1563
1574
|
}
|
|
1575
|
+
declare const enum ON_SLIDE_STOP_PREPARE_FOR_RESTART {
|
|
1576
|
+
UNKNOWN = 0,
|
|
1577
|
+
PREPARE = 1,
|
|
1578
|
+
NOT_PREPARE = 2
|
|
1579
|
+
}
|
|
1564
1580
|
declare class Layer {
|
|
1565
1581
|
private readonly _nodeRef;
|
|
1566
1582
|
private readonly _slide;
|
|
1567
1583
|
private readonly _slideReadyPromise;
|
|
1568
1584
|
private readonly _afterResumeQueuePush;
|
|
1585
|
+
private readonly _afterStartInitQueuePush;
|
|
1586
|
+
private readonly _showNextSlide;
|
|
1587
|
+
readonly sdkApi: SDKApi;
|
|
1569
1588
|
private readonly _slideIndex;
|
|
1570
1589
|
private readonly _cardId;
|
|
1571
1590
|
private readonly _cardType;
|
|
@@ -1575,14 +1594,13 @@ declare class Layer {
|
|
|
1575
1594
|
private readonly _disabledNavigation;
|
|
1576
1595
|
private _elements;
|
|
1577
1596
|
private readonly _timeline;
|
|
1578
|
-
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);
|
|
1579
1598
|
init(localData: LocalData): Array<Promise<boolean>>;
|
|
1580
1599
|
get nodeRef(): HTMLElement;
|
|
1581
1600
|
get elements(): Array<IElement>;
|
|
1582
1601
|
get slide(): Slide;
|
|
1583
1602
|
get timeline(): SlideTimeline;
|
|
1584
1603
|
get layoutService(): LayoutService;
|
|
1585
|
-
get sdkApi(): SDKApi;
|
|
1586
1604
|
getLocalData(): Promise<LocalData>;
|
|
1587
1605
|
get isQuest(): boolean;
|
|
1588
1606
|
private _initTextFit;
|
|
@@ -1612,14 +1630,19 @@ declare class Layer {
|
|
|
1612
1630
|
start(muted?: boolean): Promise<{
|
|
1613
1631
|
currentTime: number;
|
|
1614
1632
|
}>;
|
|
1615
|
-
stop(
|
|
1616
|
-
|
|
1633
|
+
stop(options: {
|
|
1634
|
+
prepareForRestart: ON_SLIDE_STOP_PREPARE_FOR_RESTART;
|
|
1635
|
+
}): Promise<void>;
|
|
1636
|
+
stopInternal(options: {
|
|
1637
|
+
prepareForRestart: ON_SLIDE_STOP_PREPARE_FOR_RESTART;
|
|
1638
|
+
}): void;
|
|
1617
1639
|
pause(resetVideoTime?: boolean, stopAnimation?: boolean): Promise<{
|
|
1618
1640
|
currentTime: number | null;
|
|
1619
1641
|
}>;
|
|
1620
1642
|
resume(): Promise<unknown>;
|
|
1621
1643
|
enableAudio(): void;
|
|
1622
1644
|
disableAudio(): void;
|
|
1645
|
+
onBeforeUnmount(): void;
|
|
1623
1646
|
get isLayerForcePaused(): boolean;
|
|
1624
1647
|
}
|
|
1625
1648
|
declare const enum STATE {
|
|
@@ -1642,7 +1665,11 @@ declare class SlideApi {
|
|
|
1642
1665
|
private static prerenderBoxClassName;
|
|
1643
1666
|
private readonly _slideWrapper;
|
|
1644
1667
|
private readonly _viewport;
|
|
1668
|
+
private readonly _getViewportWidth;
|
|
1669
|
+
private readonly _getViewportHeight;
|
|
1670
|
+
readonly sdkApi: SDKApi;
|
|
1645
1671
|
constructor(config: {
|
|
1672
|
+
sdkApi: SDKApi;
|
|
1646
1673
|
slideWrapper: HTMLElement;
|
|
1647
1674
|
viewport: Window;
|
|
1648
1675
|
userResizeHandler?: (data: {
|
|
@@ -1657,6 +1684,8 @@ declare class SlideApi {
|
|
|
1657
1684
|
result: boolean;
|
|
1658
1685
|
reason?: string;
|
|
1659
1686
|
}) => void;
|
|
1687
|
+
getViewportWidth: () => number;
|
|
1688
|
+
getViewportHeight: () => number;
|
|
1660
1689
|
});
|
|
1661
1690
|
destroy(): void;
|
|
1662
1691
|
private initListeners;
|
|
@@ -1670,7 +1699,6 @@ declare class SlideApi {
|
|
|
1670
1699
|
handleBackpress(): void;
|
|
1671
1700
|
private get layoutService();
|
|
1672
1701
|
private getLocalData;
|
|
1673
|
-
private get sdkApi();
|
|
1674
1702
|
private _fontsInit;
|
|
1675
1703
|
private _initAndLoadFonts;
|
|
1676
1704
|
private _slide;
|
|
@@ -1684,7 +1712,6 @@ declare class SlideApi {
|
|
|
1684
1712
|
private _slideInRender;
|
|
1685
1713
|
private _slideBoxRenderComplete;
|
|
1686
1714
|
private _slideBoxRenderError;
|
|
1687
|
-
private _startVideo;
|
|
1688
1715
|
private _slideConfig;
|
|
1689
1716
|
slideStart(config: {
|
|
1690
1717
|
muted?: boolean;
|
|
@@ -1699,7 +1726,9 @@ declare class SlideApi {
|
|
|
1699
1726
|
private _pauseCbTimer;
|
|
1700
1727
|
slidePause(): Promise<void>;
|
|
1701
1728
|
slideResume(): Promise<void>;
|
|
1702
|
-
slideStop(
|
|
1729
|
+
slideStop(options: {
|
|
1730
|
+
prepareForRestart: ON_SLIDE_STOP_PREPARE_FOR_RESTART;
|
|
1731
|
+
}): Promise<void>;
|
|
1703
1732
|
slideTimerEnd(): void;
|
|
1704
1733
|
// for call from SlideApi internals (from widgets)
|
|
1705
1734
|
// skip state checking and sdk issues
|
|
@@ -1716,12 +1745,15 @@ declare class SlideApi {
|
|
|
1716
1745
|
get slide(): Slide;
|
|
1717
1746
|
showLayer(index: number): void;
|
|
1718
1747
|
slideClickHandler(targetElement: HTMLElement, navigationDirection: "forward" | "backward"): {
|
|
1748
|
+
// todo rename to continueNavigationClick (or via two flags, continueNavigationForwardClick & continueNavigationBackwardClick)
|
|
1719
1749
|
canClickNext: boolean;
|
|
1720
1750
|
};
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1751
|
+
/**
|
|
1752
|
+
* Handle click or swipeUp on linkable elements (elements with data: linkType & linkTarget)
|
|
1753
|
+
* And click or swipeUp on SwipeUp elements (WidgetProducts, WidgetGoods)
|
|
1754
|
+
*/
|
|
1755
|
+
private _handleLinkAndSwipeUpActivation;
|
|
1756
|
+
slideSwipeUpHandler(): boolean;
|
|
1725
1757
|
setTextInputResult(id: string, text: string): void;
|
|
1726
1758
|
setShareComplete(id: string, isSuccess: boolean): void;
|
|
1727
1759
|
}
|
|
@@ -1745,4 +1777,4 @@ declare class SlideApi$0 extends BaseSlideApi {
|
|
|
1745
1777
|
});
|
|
1746
1778
|
}
|
|
1747
1779
|
export type { SDKInterface, WidgetsSharedDataMap, WidgetRangeSliderSharedData, WidgetPollSharedData, WidgetVoteSharedData, FontDTO };
|
|
1748
|
-
export { SlideApi$0 as SlideApi, Widgets, TIMELINE_ACTION };
|
|
1780
|
+
export { SlideApi$0 as SlideApi, Widgets, TIMELINE_ACTION, ON_SLIDE_STOP_PREPARE_FOR_RESTART };
|