@inappstory/slide-api 0.1.4 → 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 +442 -576
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +361 -348
- package/dist/index.d.ts +361 -348
- package/dist/index.js +442 -576
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -195,41 +195,31 @@ const container = new DIContainer();
|
|
|
195
195
|
|
|
196
196
|
class WidgetsService {
|
|
197
197
|
_env;
|
|
198
|
-
|
|
199
|
-
constructor(_env, _sdkApi) {
|
|
198
|
+
constructor(_env) {
|
|
200
199
|
this._env = _env;
|
|
201
|
-
this._sdkApi = _sdkApi;
|
|
202
200
|
}
|
|
203
201
|
get env() {
|
|
204
202
|
return this._env;
|
|
205
203
|
}
|
|
206
|
-
get
|
|
207
|
-
return this._sdkApi;
|
|
208
|
-
}
|
|
209
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Window`, `SDKApi`]; }
|
|
204
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Window`]; }
|
|
210
205
|
}
|
|
211
206
|
|
|
212
207
|
container.registerSingleton(undefined, { identifier: `WidgetsService`, implementation: WidgetsService });
|
|
213
208
|
|
|
214
209
|
class LayoutService {
|
|
215
210
|
_env;
|
|
216
|
-
_sdkApi;
|
|
217
211
|
_layoutApi;
|
|
218
|
-
constructor(_env,
|
|
212
|
+
constructor(_env, _layoutApi) {
|
|
219
213
|
this._env = _env;
|
|
220
|
-
this._sdkApi = _sdkApi;
|
|
221
214
|
this._layoutApi = _layoutApi;
|
|
222
215
|
}
|
|
223
216
|
get env() {
|
|
224
217
|
return this._env;
|
|
225
218
|
}
|
|
226
|
-
get sdkApi() {
|
|
227
|
-
return this._sdkApi;
|
|
228
|
-
}
|
|
229
219
|
get layoutApi() {
|
|
230
220
|
return this._layoutApi;
|
|
231
221
|
}
|
|
232
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Window`, `
|
|
222
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Window`, `ILayoutApi`]; }
|
|
233
223
|
}
|
|
234
224
|
|
|
235
225
|
container.registerSingleton(undefined, { identifier: `LayoutService`, implementation: LayoutService });
|
|
@@ -241,8 +231,6 @@ container.registerSingleton(undefined, { identifier: `LayoutService`, implementa
|
|
|
241
231
|
// import '../effects/timer/composition';
|
|
242
232
|
container.registerSingleton(() => window, { identifier: `Window` });
|
|
243
233
|
|
|
244
|
-
const DEFAULT_SLIDE_DURATION = 10000;
|
|
245
|
-
|
|
246
234
|
const arPrototype = Array.prototype;
|
|
247
235
|
const obPrototype = Object.prototype;
|
|
248
236
|
const slice = arPrototype.slice;
|
|
@@ -1052,30 +1040,25 @@ class EsModuleSdkApi {
|
|
|
1052
1040
|
this.sdkBinding = sdkBinding;
|
|
1053
1041
|
}
|
|
1054
1042
|
getCardServerData(cardId) {
|
|
1055
|
-
return this.sdkBinding
|
|
1043
|
+
return this.sdkBinding.getCardServerData(cardId);
|
|
1056
1044
|
}
|
|
1057
1045
|
updateCardServerDataLocally(cardId, data) {
|
|
1058
|
-
return this.sdkBinding
|
|
1059
|
-
}
|
|
1060
|
-
getSlideDuration(cardId, slideIndex) {
|
|
1061
|
-
return DEFAULT_SLIDE_DURATION;
|
|
1062
|
-
// unnecessary for es_module (without backward compatibility)
|
|
1063
|
-
// return this.sdkBinding().getSlideDuration(cardId, slideIndex);
|
|
1046
|
+
return this.sdkBinding.updateCardServerDataLocally(data);
|
|
1064
1047
|
}
|
|
1065
1048
|
showNextSlide(duration) {
|
|
1066
|
-
this.sdkBinding
|
|
1049
|
+
this.sdkBinding.showNextSlide();
|
|
1067
1050
|
}
|
|
1068
1051
|
sendStatisticEvent(name, data, devPayload, forceEnableStatisticV2) {
|
|
1069
|
-
this.sdkBinding
|
|
1052
|
+
this.sdkBinding.sendStatisticEvent(name, data, devPayload, forceEnableStatisticV2);
|
|
1070
1053
|
}
|
|
1071
1054
|
getCardLocalData() {
|
|
1072
|
-
return this.sdkBinding
|
|
1055
|
+
return this.sdkBinding.getCardLocalData();
|
|
1073
1056
|
}
|
|
1074
1057
|
isExistsShowLayer() {
|
|
1075
1058
|
return true;
|
|
1076
1059
|
}
|
|
1077
1060
|
showLayer(index) {
|
|
1078
|
-
this.sdkBinding
|
|
1061
|
+
this.sdkBinding.showLayer(index);
|
|
1079
1062
|
}
|
|
1080
1063
|
get cardAnimation() {
|
|
1081
1064
|
return animationApi;
|
|
@@ -1090,37 +1073,37 @@ class EsModuleSdkApi {
|
|
|
1090
1073
|
return true;
|
|
1091
1074
|
}
|
|
1092
1075
|
pauseUI() {
|
|
1093
|
-
this.sdkBinding
|
|
1076
|
+
this.sdkBinding.pauseUI();
|
|
1094
1077
|
}
|
|
1095
1078
|
resumeUI() {
|
|
1096
|
-
this.sdkBinding
|
|
1079
|
+
this.sdkBinding.resumeUI();
|
|
1097
1080
|
}
|
|
1098
1081
|
get isExistsShowCardTextInput() {
|
|
1099
1082
|
return true;
|
|
1100
1083
|
}
|
|
1101
1084
|
showCardTextInput(id, data) {
|
|
1102
|
-
this.sdkBinding
|
|
1085
|
+
this.sdkBinding.showCardTextInput(id, data);
|
|
1103
1086
|
}
|
|
1104
1087
|
setCardLocalData(keyValue, sendToServer) {
|
|
1105
|
-
this.sdkBinding
|
|
1088
|
+
this.sdkBinding.setCardLocalData(keyValue, sendToServer);
|
|
1106
1089
|
}
|
|
1107
1090
|
getWidgetsSharedData(cardId, widget) {
|
|
1108
|
-
return this.sdkBinding
|
|
1091
|
+
return this.sdkBinding.getWidgetsSharedData(cardId, widget);
|
|
1109
1092
|
}
|
|
1110
1093
|
vibrate(pattern) {
|
|
1111
1094
|
navigator.vibrate(pattern);
|
|
1112
1095
|
}
|
|
1113
1096
|
openUrl(data) {
|
|
1114
|
-
this.sdkBinding
|
|
1097
|
+
this.sdkBinding.openUrl(data);
|
|
1115
1098
|
}
|
|
1116
1099
|
sendApiRequest(url, method, params, headers, data, profilingKey) {
|
|
1117
|
-
return this.sdkBinding
|
|
1100
|
+
return this.sdkBinding.sendApiRequest(url, method, params, headers, data, profilingKey);
|
|
1118
1101
|
}
|
|
1119
1102
|
sendApiRequestSupported() {
|
|
1120
1103
|
return true;
|
|
1121
1104
|
}
|
|
1122
1105
|
showToast(text) {
|
|
1123
|
-
this.sdkBinding
|
|
1106
|
+
this.sdkBinding.showToast(text);
|
|
1124
1107
|
}
|
|
1125
1108
|
get sdkCanSendShareComplete() {
|
|
1126
1109
|
return true;
|
|
@@ -1129,83 +1112,81 @@ class EsModuleSdkApi {
|
|
|
1129
1112
|
return true;
|
|
1130
1113
|
}
|
|
1131
1114
|
share(id, config) {
|
|
1132
|
-
this.sdkBinding
|
|
1115
|
+
this.sdkBinding.share(id, config);
|
|
1133
1116
|
}
|
|
1134
1117
|
shareSlideScreenshot(shareId, hideElementsSelector, shareText) {
|
|
1135
|
-
this.sdkBinding
|
|
1118
|
+
this.sdkBinding.shareSlideScreenshot(shareId, hideElementsSelector, shareText);
|
|
1136
1119
|
}
|
|
1137
1120
|
get isExistsShowCardSlide() {
|
|
1138
1121
|
return true;
|
|
1139
1122
|
}
|
|
1140
1123
|
showCardSlide(index) {
|
|
1141
|
-
this.sdkBinding
|
|
1124
|
+
this.sdkBinding.showCardSlide(index);
|
|
1142
1125
|
}
|
|
1143
1126
|
get isExistsShowNextCard() {
|
|
1144
1127
|
return true;
|
|
1145
1128
|
}
|
|
1146
1129
|
cardShowNext() {
|
|
1147
|
-
this.sdkBinding
|
|
1130
|
+
this.sdkBinding.cardShowNext();
|
|
1148
1131
|
}
|
|
1149
1132
|
setCardSessionValue(element, key, value) {
|
|
1150
|
-
this.sdkBinding
|
|
1133
|
+
this.sdkBinding.setCardSessionValue(key, value);
|
|
1151
1134
|
}
|
|
1152
1135
|
getCardSessionValue(element, key) {
|
|
1153
|
-
return this.sdkBinding
|
|
1136
|
+
return this.sdkBinding.getCardSessionValue(key);
|
|
1154
1137
|
}
|
|
1155
1138
|
updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError) {
|
|
1156
|
-
|
|
1157
|
-
if (updateTimeline != null) {
|
|
1158
|
-
updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError);
|
|
1159
|
-
}
|
|
1139
|
+
this.sdkBinding.updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError);
|
|
1160
1140
|
}
|
|
1161
1141
|
cardPausedCallback(currentTime) { }
|
|
1162
1142
|
cardResumedCallback(currentTime) { }
|
|
1163
|
-
startDisabledTimeline(cardId, slideIndex) {
|
|
1164
|
-
// для android sdk важно чтобы этот метод вызывался только после slide_start
|
|
1165
|
-
//@ts-ignore
|
|
1166
|
-
// slideApi.afterStartInitQueuePush(function () {
|
|
1167
|
-
// //@ts-ignore
|
|
1168
|
-
// slideApi.activeLayer.timeline.startDisabledTimeline(() => {});
|
|
1169
|
-
// });
|
|
1170
|
-
}
|
|
1171
1143
|
getCardFonts() {
|
|
1172
|
-
return this.sdkBinding
|
|
1144
|
+
return this.sdkBinding.getCardFonts();
|
|
1173
1145
|
}
|
|
1174
1146
|
disableVerticalSwipeGesture() {
|
|
1175
|
-
this.sdkBinding
|
|
1147
|
+
this.sdkBinding.disableVerticalSwipeGesture();
|
|
1176
1148
|
}
|
|
1177
1149
|
enableVerticalSwipeGesture() {
|
|
1178
|
-
this.sdkBinding
|
|
1150
|
+
this.sdkBinding.enableVerticalSwipeGesture();
|
|
1179
1151
|
}
|
|
1180
1152
|
disableBackpress() { }
|
|
1181
1153
|
enableBackpress() { }
|
|
1182
1154
|
closeCard(reason) {
|
|
1183
|
-
this.sdkBinding
|
|
1155
|
+
this.sdkBinding.closeCard(reason);
|
|
1184
1156
|
}
|
|
1185
1157
|
openStory(id, index) {
|
|
1186
|
-
this.sdkBinding
|
|
1158
|
+
this.sdkBinding.openStory(id, index);
|
|
1187
1159
|
}
|
|
1188
1160
|
openGame(gameInstanceId) {
|
|
1189
|
-
this.sdkBinding
|
|
1161
|
+
this.sdkBinding.openGame(gameInstanceId);
|
|
1190
1162
|
}
|
|
1191
1163
|
writeToClipboard(data) {
|
|
1192
|
-
this.sdkBinding
|
|
1164
|
+
this.sdkBinding.writeToClipboard(data);
|
|
1193
1165
|
}
|
|
1194
|
-
|
|
1166
|
+
isSdkSupportTimelineOnBeforeStart() {
|
|
1167
|
+
return true;
|
|
1168
|
+
}
|
|
1169
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`SDKInterface`]; }
|
|
1195
1170
|
}
|
|
1196
1171
|
|
|
1172
|
+
const DEFAULT_SLIDE_DURATION = 10000;
|
|
1173
|
+
|
|
1197
1174
|
class DataInput {
|
|
1198
1175
|
_elementNodeRef;
|
|
1199
1176
|
_layer;
|
|
1200
1177
|
_widgetApi;
|
|
1178
|
+
_onWidgetComplete;
|
|
1179
|
+
sdkApi;
|
|
1201
1180
|
static _className = "narrative-element-data-input";
|
|
1202
1181
|
static className() {
|
|
1203
1182
|
return DataInput._className;
|
|
1204
1183
|
}
|
|
1205
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1184
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1206
1185
|
this._elementNodeRef = _elementNodeRef;
|
|
1207
1186
|
this._layer = _layer;
|
|
1208
1187
|
this._widgetApi = _widgetApi;
|
|
1188
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1189
|
+
this.sdkApi = sdkApi;
|
|
1209
1190
|
}
|
|
1210
1191
|
static isTypeOf(element) {
|
|
1211
1192
|
return element instanceof DataInput;
|
|
@@ -1213,7 +1194,7 @@ class DataInput {
|
|
|
1213
1194
|
mediaElementsLoadingPromises = [];
|
|
1214
1195
|
init(localData) {
|
|
1215
1196
|
try {
|
|
1216
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1197
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1217
1198
|
}
|
|
1218
1199
|
catch (e) {
|
|
1219
1200
|
console.error(e);
|
|
@@ -1238,26 +1219,30 @@ class DataInput {
|
|
|
1238
1219
|
get isLayerForcePaused() {
|
|
1239
1220
|
return false;
|
|
1240
1221
|
}
|
|
1241
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetDataInput.api`]; }
|
|
1222
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetDataInput.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1242
1223
|
}
|
|
1243
1224
|
|
|
1244
1225
|
class Barcode {
|
|
1245
1226
|
_elementNodeRef;
|
|
1246
1227
|
_layer;
|
|
1247
1228
|
_widgetApi;
|
|
1229
|
+
_onWidgetComplete;
|
|
1230
|
+
sdkApi;
|
|
1248
1231
|
static _className = "narrative-element-barcode";
|
|
1249
1232
|
static className() {
|
|
1250
1233
|
return Barcode._className;
|
|
1251
1234
|
}
|
|
1252
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1235
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1253
1236
|
this._elementNodeRef = _elementNodeRef;
|
|
1254
1237
|
this._layer = _layer;
|
|
1255
1238
|
this._widgetApi = _widgetApi;
|
|
1239
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1240
|
+
this.sdkApi = sdkApi;
|
|
1256
1241
|
}
|
|
1257
1242
|
mediaElementsLoadingPromises = [];
|
|
1258
1243
|
init(localData) {
|
|
1259
1244
|
try {
|
|
1260
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1245
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1261
1246
|
}
|
|
1262
1247
|
catch (e) {
|
|
1263
1248
|
console.error(e);
|
|
@@ -1279,7 +1264,7 @@ class Barcode {
|
|
|
1279
1264
|
get isLayerForcePaused() {
|
|
1280
1265
|
return false;
|
|
1281
1266
|
}
|
|
1282
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetBarcode.api`]; }
|
|
1267
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetBarcode.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1283
1268
|
}
|
|
1284
1269
|
|
|
1285
1270
|
class ClickableBase {
|
|
@@ -1324,19 +1309,23 @@ class Copy {
|
|
|
1324
1309
|
_elementNodeRef;
|
|
1325
1310
|
_layer;
|
|
1326
1311
|
_widgetApi;
|
|
1312
|
+
_onWidgetComplete;
|
|
1313
|
+
sdkApi;
|
|
1327
1314
|
static _className = "narrative-element-copy";
|
|
1328
1315
|
static className() {
|
|
1329
1316
|
return Copy._className;
|
|
1330
1317
|
}
|
|
1331
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1318
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1332
1319
|
this._elementNodeRef = _elementNodeRef;
|
|
1333
1320
|
this._layer = _layer;
|
|
1334
1321
|
this._widgetApi = _widgetApi;
|
|
1322
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1323
|
+
this.sdkApi = sdkApi;
|
|
1335
1324
|
}
|
|
1336
1325
|
mediaElementsLoadingPromises = [];
|
|
1337
1326
|
init(localData) {
|
|
1338
1327
|
try {
|
|
1339
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1328
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1340
1329
|
}
|
|
1341
1330
|
catch (e) {
|
|
1342
1331
|
console.error(e);
|
|
@@ -1358,7 +1347,7 @@ class Copy {
|
|
|
1358
1347
|
get isLayerForcePaused() {
|
|
1359
1348
|
return false;
|
|
1360
1349
|
}
|
|
1361
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetCopy.api`]; }
|
|
1350
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetCopy.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1362
1351
|
}
|
|
1363
1352
|
|
|
1364
1353
|
class DateCountdown {
|
|
@@ -1366,20 +1355,24 @@ class DateCountdown {
|
|
|
1366
1355
|
_layer;
|
|
1367
1356
|
_layersNodesRefs;
|
|
1368
1357
|
_widgetApi;
|
|
1358
|
+
_onWidgetComplete;
|
|
1359
|
+
sdkApi;
|
|
1369
1360
|
static _className = "narrative-element-date-countdown";
|
|
1370
1361
|
static className() {
|
|
1371
1362
|
return DateCountdown._className;
|
|
1372
1363
|
}
|
|
1373
|
-
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi) {
|
|
1364
|
+
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1374
1365
|
this._elementNodeRef = _elementNodeRef;
|
|
1375
1366
|
this._layer = _layer;
|
|
1376
1367
|
this._layersNodesRefs = _layersNodesRefs;
|
|
1377
1368
|
this._widgetApi = _widgetApi;
|
|
1369
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1370
|
+
this.sdkApi = sdkApi;
|
|
1378
1371
|
}
|
|
1379
1372
|
mediaElementsLoadingPromises = [];
|
|
1380
1373
|
init(localData) {
|
|
1381
1374
|
try {
|
|
1382
|
-
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData);
|
|
1375
|
+
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData, this._onWidgetComplete, this.sdkApi);
|
|
1383
1376
|
}
|
|
1384
1377
|
catch (e) {
|
|
1385
1378
|
console.error(e);
|
|
@@ -1405,21 +1398,25 @@ class DateCountdown {
|
|
|
1405
1398
|
get isLayerForcePaused() {
|
|
1406
1399
|
return false;
|
|
1407
1400
|
}
|
|
1408
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetDateCountdown.api`]; }
|
|
1401
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetDateCountdown.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1409
1402
|
}
|
|
1410
1403
|
|
|
1411
1404
|
class Poll {
|
|
1412
1405
|
_elementNodeRef;
|
|
1413
1406
|
_layer;
|
|
1414
1407
|
_widgetApi;
|
|
1408
|
+
_onWidgetComplete;
|
|
1409
|
+
sdkApi;
|
|
1415
1410
|
static _className = "narrative-element-poll";
|
|
1416
1411
|
static className() {
|
|
1417
1412
|
return Poll._className;
|
|
1418
1413
|
}
|
|
1419
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1414
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1420
1415
|
this._elementNodeRef = _elementNodeRef;
|
|
1421
1416
|
this._layer = _layer;
|
|
1422
1417
|
this._widgetApi = _widgetApi;
|
|
1418
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1419
|
+
this.sdkApi = sdkApi;
|
|
1423
1420
|
}
|
|
1424
1421
|
static isTypeOf(element) {
|
|
1425
1422
|
return element instanceof Poll;
|
|
@@ -1427,7 +1424,7 @@ class Poll {
|
|
|
1427
1424
|
mediaElementsLoadingPromises = [];
|
|
1428
1425
|
init(localData) {
|
|
1429
1426
|
try {
|
|
1430
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1427
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1431
1428
|
}
|
|
1432
1429
|
catch (e) {
|
|
1433
1430
|
console.error(e);
|
|
@@ -1452,7 +1449,7 @@ class Poll {
|
|
|
1452
1449
|
get isLayerForcePaused() {
|
|
1453
1450
|
return false;
|
|
1454
1451
|
}
|
|
1455
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetPoll.api`]; }
|
|
1452
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetPoll.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1456
1453
|
}
|
|
1457
1454
|
|
|
1458
1455
|
class PollLayers {
|
|
@@ -1460,15 +1457,19 @@ class PollLayers {
|
|
|
1460
1457
|
_layer;
|
|
1461
1458
|
_layersNodesRefs;
|
|
1462
1459
|
_widgetApi;
|
|
1460
|
+
_onWidgetComplete;
|
|
1461
|
+
sdkApi;
|
|
1463
1462
|
static _className = "narrative-element-poll-layers";
|
|
1464
1463
|
static className() {
|
|
1465
1464
|
return PollLayers._className;
|
|
1466
1465
|
}
|
|
1467
|
-
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi) {
|
|
1466
|
+
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1468
1467
|
this._elementNodeRef = _elementNodeRef;
|
|
1469
1468
|
this._layer = _layer;
|
|
1470
1469
|
this._layersNodesRefs = _layersNodesRefs;
|
|
1471
1470
|
this._widgetApi = _widgetApi;
|
|
1471
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1472
|
+
this.sdkApi = sdkApi;
|
|
1472
1473
|
}
|
|
1473
1474
|
static isTypeOf(element) {
|
|
1474
1475
|
return element instanceof PollLayers;
|
|
@@ -1476,7 +1477,7 @@ class PollLayers {
|
|
|
1476
1477
|
mediaElementsLoadingPromises = [];
|
|
1477
1478
|
init(localData) {
|
|
1478
1479
|
try {
|
|
1479
|
-
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData);
|
|
1480
|
+
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData, this._onWidgetComplete, this.sdkApi);
|
|
1480
1481
|
}
|
|
1481
1482
|
catch (e) {
|
|
1482
1483
|
console.error(e);
|
|
@@ -1498,21 +1499,25 @@ class PollLayers {
|
|
|
1498
1499
|
get isLayerForcePaused() {
|
|
1499
1500
|
return false;
|
|
1500
1501
|
}
|
|
1501
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetPollLayers.api`]; }
|
|
1502
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetPollLayers.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1502
1503
|
}
|
|
1503
1504
|
|
|
1504
1505
|
class Products {
|
|
1505
1506
|
_elementNodeRef;
|
|
1506
1507
|
_layer;
|
|
1507
1508
|
_widgetApi;
|
|
1509
|
+
_onWidgetComplete;
|
|
1510
|
+
sdkApi;
|
|
1508
1511
|
static _className = "narrative-element-products";
|
|
1509
1512
|
static className() {
|
|
1510
1513
|
return Products._className;
|
|
1511
1514
|
}
|
|
1512
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1515
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1513
1516
|
this._elementNodeRef = _elementNodeRef;
|
|
1514
1517
|
this._layer = _layer;
|
|
1515
1518
|
this._widgetApi = _widgetApi;
|
|
1519
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1520
|
+
this.sdkApi = sdkApi;
|
|
1516
1521
|
}
|
|
1517
1522
|
static isTypeOf(element) {
|
|
1518
1523
|
return element instanceof Products;
|
|
@@ -1520,7 +1525,7 @@ class Products {
|
|
|
1520
1525
|
mediaElementsLoadingPromises = [];
|
|
1521
1526
|
init(localData) {
|
|
1522
1527
|
try {
|
|
1523
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1528
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1524
1529
|
}
|
|
1525
1530
|
catch (e) {
|
|
1526
1531
|
console.error(e);
|
|
@@ -1551,28 +1556,32 @@ class Products {
|
|
|
1551
1556
|
get isLayerForcePaused() {
|
|
1552
1557
|
return this._widgetApi.isForcePaused(this._elementNodeRef);
|
|
1553
1558
|
}
|
|
1554
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetProducts.api`]; }
|
|
1559
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetProducts.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1555
1560
|
}
|
|
1556
1561
|
|
|
1557
1562
|
class Quest {
|
|
1558
1563
|
_elementNodeRef;
|
|
1559
1564
|
_layer;
|
|
1560
1565
|
_widgetApi;
|
|
1566
|
+
_onWidgetComplete;
|
|
1567
|
+
sdkApi;
|
|
1561
1568
|
static _className = "narrative-element-quest";
|
|
1562
1569
|
static className() {
|
|
1563
1570
|
return Quest._className;
|
|
1564
1571
|
}
|
|
1565
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1572
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1566
1573
|
this._elementNodeRef = _elementNodeRef;
|
|
1567
1574
|
this._layer = _layer;
|
|
1568
1575
|
this._widgetApi = _widgetApi;
|
|
1576
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1577
|
+
this.sdkApi = sdkApi;
|
|
1569
1578
|
}
|
|
1570
1579
|
static isTypeOf(element) {
|
|
1571
1580
|
return element instanceof Quest;
|
|
1572
1581
|
}
|
|
1573
1582
|
mediaElementsLoadingPromises = [];
|
|
1574
1583
|
init(localData) {
|
|
1575
|
-
return this._widgetApi.init(this._elementNodeRef, localData);
|
|
1584
|
+
return this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1576
1585
|
}
|
|
1577
1586
|
onPause() { }
|
|
1578
1587
|
onResume() { }
|
|
@@ -1592,22 +1601,26 @@ class Quest {
|
|
|
1592
1601
|
get isLayerForcePaused() {
|
|
1593
1602
|
return false;
|
|
1594
1603
|
}
|
|
1595
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuest.api`]; }
|
|
1604
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuest.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1596
1605
|
}
|
|
1597
1606
|
|
|
1598
1607
|
class Quiz {
|
|
1599
1608
|
_elementNodeRef;
|
|
1600
1609
|
_layer;
|
|
1601
1610
|
_widgetApi;
|
|
1611
|
+
_onWidgetComplete;
|
|
1612
|
+
sdkApi;
|
|
1602
1613
|
static _className = "narrative-element-quiz";
|
|
1603
1614
|
static className() {
|
|
1604
1615
|
return Quiz._className;
|
|
1605
1616
|
}
|
|
1606
1617
|
// widgetApi in ctor
|
|
1607
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1618
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1608
1619
|
this._elementNodeRef = _elementNodeRef;
|
|
1609
1620
|
this._layer = _layer;
|
|
1610
1621
|
this._widgetApi = _widgetApi;
|
|
1622
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1623
|
+
this.sdkApi = sdkApi;
|
|
1611
1624
|
}
|
|
1612
1625
|
static isTypeOf(element) {
|
|
1613
1626
|
return element instanceof Quiz;
|
|
@@ -1615,7 +1628,7 @@ class Quiz {
|
|
|
1615
1628
|
mediaElementsLoadingPromises = [];
|
|
1616
1629
|
init(localData) {
|
|
1617
1630
|
try {
|
|
1618
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1631
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1619
1632
|
}
|
|
1620
1633
|
catch (e) {
|
|
1621
1634
|
console.error(e);
|
|
@@ -1640,21 +1653,25 @@ class Quiz {
|
|
|
1640
1653
|
get isLayerForcePaused() {
|
|
1641
1654
|
return false;
|
|
1642
1655
|
}
|
|
1643
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuiz.api`]; }
|
|
1656
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuiz.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1644
1657
|
}
|
|
1645
1658
|
|
|
1646
1659
|
class QuizGrouped {
|
|
1647
1660
|
_elementNodeRef;
|
|
1648
1661
|
_layer;
|
|
1649
1662
|
_widgetApi;
|
|
1663
|
+
_onWidgetComplete;
|
|
1664
|
+
sdkApi;
|
|
1650
1665
|
static _className = "narrative-element-quiz-grouped";
|
|
1651
1666
|
static className() {
|
|
1652
1667
|
return QuizGrouped._className;
|
|
1653
1668
|
}
|
|
1654
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1669
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1655
1670
|
this._elementNodeRef = _elementNodeRef;
|
|
1656
1671
|
this._layer = _layer;
|
|
1657
1672
|
this._widgetApi = _widgetApi;
|
|
1673
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1674
|
+
this.sdkApi = sdkApi;
|
|
1658
1675
|
}
|
|
1659
1676
|
static isTypeOf(element) {
|
|
1660
1677
|
return element instanceof QuizGrouped;
|
|
@@ -1662,7 +1679,7 @@ class QuizGrouped {
|
|
|
1662
1679
|
mediaElementsLoadingPromises = [];
|
|
1663
1680
|
init(localData) {
|
|
1664
1681
|
try {
|
|
1665
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1682
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1666
1683
|
}
|
|
1667
1684
|
catch (e) {
|
|
1668
1685
|
console.error(e);
|
|
@@ -1687,21 +1704,25 @@ class QuizGrouped {
|
|
|
1687
1704
|
get isLayerForcePaused() {
|
|
1688
1705
|
return false;
|
|
1689
1706
|
}
|
|
1690
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuizGrouped.api`]; }
|
|
1707
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuizGrouped.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1691
1708
|
}
|
|
1692
1709
|
|
|
1693
1710
|
class RangeSlider {
|
|
1694
1711
|
_elementNodeRef;
|
|
1695
1712
|
_layer;
|
|
1696
1713
|
_widgetApi;
|
|
1714
|
+
_onWidgetComplete;
|
|
1715
|
+
sdkApi;
|
|
1697
1716
|
static _className = "narrative-element-range-slider";
|
|
1698
1717
|
static className() {
|
|
1699
1718
|
return RangeSlider._className;
|
|
1700
1719
|
}
|
|
1701
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1720
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1702
1721
|
this._elementNodeRef = _elementNodeRef;
|
|
1703
1722
|
this._layer = _layer;
|
|
1704
1723
|
this._widgetApi = _widgetApi;
|
|
1724
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1725
|
+
this.sdkApi = sdkApi;
|
|
1705
1726
|
}
|
|
1706
1727
|
static isTypeOf(element) {
|
|
1707
1728
|
return element instanceof RangeSlider;
|
|
@@ -1709,7 +1730,7 @@ class RangeSlider {
|
|
|
1709
1730
|
mediaElementsLoadingPromises = [];
|
|
1710
1731
|
init(localData) {
|
|
1711
1732
|
try {
|
|
1712
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1733
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1713
1734
|
}
|
|
1714
1735
|
catch (e) {
|
|
1715
1736
|
console.error(e);
|
|
@@ -1734,21 +1755,25 @@ class RangeSlider {
|
|
|
1734
1755
|
get isLayerForcePaused() {
|
|
1735
1756
|
return false;
|
|
1736
1757
|
}
|
|
1737
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetRangeSlider.api`]; }
|
|
1758
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetRangeSlider.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1738
1759
|
}
|
|
1739
1760
|
|
|
1740
1761
|
class Rate {
|
|
1741
1762
|
_elementNodeRef;
|
|
1742
1763
|
_layer;
|
|
1743
1764
|
_widgetApi;
|
|
1765
|
+
_onWidgetComplete;
|
|
1766
|
+
sdkApi;
|
|
1744
1767
|
static _className = "narrative-element-rate";
|
|
1745
1768
|
static className() {
|
|
1746
1769
|
return Rate._className;
|
|
1747
1770
|
}
|
|
1748
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1771
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1749
1772
|
this._elementNodeRef = _elementNodeRef;
|
|
1750
1773
|
this._layer = _layer;
|
|
1751
1774
|
this._widgetApi = _widgetApi;
|
|
1775
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1776
|
+
this.sdkApi = sdkApi;
|
|
1752
1777
|
}
|
|
1753
1778
|
static isTypeOf(element) {
|
|
1754
1779
|
return element instanceof Rate;
|
|
@@ -1756,7 +1781,7 @@ class Rate {
|
|
|
1756
1781
|
mediaElementsLoadingPromises = [];
|
|
1757
1782
|
init(localData) {
|
|
1758
1783
|
try {
|
|
1759
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1784
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1760
1785
|
}
|
|
1761
1786
|
catch (e) {
|
|
1762
1787
|
console.error(e);
|
|
@@ -1781,7 +1806,7 @@ class Rate {
|
|
|
1781
1806
|
get isLayerForcePaused() {
|
|
1782
1807
|
return false;
|
|
1783
1808
|
}
|
|
1784
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetRate.api`]; }
|
|
1809
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetRate.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1785
1810
|
}
|
|
1786
1811
|
|
|
1787
1812
|
class Share {
|
|
@@ -1789,16 +1814,20 @@ class Share {
|
|
|
1789
1814
|
_layer;
|
|
1790
1815
|
_layersNodesRefs;
|
|
1791
1816
|
_widgetApi;
|
|
1817
|
+
_onWidgetComplete;
|
|
1818
|
+
sdkApi;
|
|
1792
1819
|
static _className = "narrative-element-share";
|
|
1793
1820
|
static _widgetApiName = "_narrative_share";
|
|
1794
1821
|
static className() {
|
|
1795
1822
|
return Share._className;
|
|
1796
1823
|
}
|
|
1797
|
-
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi) {
|
|
1824
|
+
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1798
1825
|
this._elementNodeRef = _elementNodeRef;
|
|
1799
1826
|
this._layer = _layer;
|
|
1800
1827
|
this._layersNodesRefs = _layersNodesRefs;
|
|
1801
1828
|
this._widgetApi = _widgetApi;
|
|
1829
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1830
|
+
this.sdkApi = sdkApi;
|
|
1802
1831
|
}
|
|
1803
1832
|
static isTypeOf(element) {
|
|
1804
1833
|
return element instanceof Share;
|
|
@@ -1806,7 +1835,7 @@ class Share {
|
|
|
1806
1835
|
mediaElementsLoadingPromises = [];
|
|
1807
1836
|
init(localData) {
|
|
1808
1837
|
try {
|
|
1809
|
-
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData);
|
|
1838
|
+
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData, this._onWidgetComplete, this.sdkApi);
|
|
1810
1839
|
}
|
|
1811
1840
|
catch (e) {
|
|
1812
1841
|
console.error(e);
|
|
@@ -1831,7 +1860,7 @@ class Share {
|
|
|
1831
1860
|
get isLayerForcePaused() {
|
|
1832
1861
|
return false;
|
|
1833
1862
|
}
|
|
1834
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetShare.api`]; }
|
|
1863
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetShare.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1835
1864
|
}
|
|
1836
1865
|
|
|
1837
1866
|
class SwipeUpItems {
|
|
@@ -1873,14 +1902,18 @@ class Test {
|
|
|
1873
1902
|
_elementNodeRef;
|
|
1874
1903
|
_layer;
|
|
1875
1904
|
_widgetApi;
|
|
1905
|
+
_onWidgetComplete;
|
|
1906
|
+
sdkApi;
|
|
1876
1907
|
static _className = "narrative-element-test";
|
|
1877
1908
|
static className() {
|
|
1878
1909
|
return Test._className;
|
|
1879
1910
|
}
|
|
1880
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1911
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1881
1912
|
this._elementNodeRef = _elementNodeRef;
|
|
1882
1913
|
this._layer = _layer;
|
|
1883
1914
|
this._widgetApi = _widgetApi;
|
|
1915
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1916
|
+
this.sdkApi = sdkApi;
|
|
1884
1917
|
}
|
|
1885
1918
|
static isTypeOf(element) {
|
|
1886
1919
|
return element instanceof Test;
|
|
@@ -1888,7 +1921,7 @@ class Test {
|
|
|
1888
1921
|
mediaElementsLoadingPromises = [];
|
|
1889
1922
|
init(localData) {
|
|
1890
1923
|
try {
|
|
1891
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1924
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1892
1925
|
}
|
|
1893
1926
|
catch (e) {
|
|
1894
1927
|
console.error(e);
|
|
@@ -1916,26 +1949,30 @@ class Test {
|
|
|
1916
1949
|
get isLayerForcePaused() {
|
|
1917
1950
|
return false;
|
|
1918
1951
|
}
|
|
1919
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetTest.api`]; }
|
|
1952
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetTest.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1920
1953
|
}
|
|
1921
1954
|
|
|
1922
1955
|
class Vote {
|
|
1923
1956
|
_elementNodeRef;
|
|
1924
1957
|
_layer;
|
|
1925
1958
|
_widgetApi;
|
|
1959
|
+
_onWidgetComplete;
|
|
1960
|
+
sdkApi;
|
|
1926
1961
|
static _className = "narrative-element-vote";
|
|
1927
1962
|
static className() {
|
|
1928
1963
|
return Vote._className;
|
|
1929
1964
|
}
|
|
1930
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1965
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1931
1966
|
this._elementNodeRef = _elementNodeRef;
|
|
1932
1967
|
this._layer = _layer;
|
|
1933
1968
|
this._widgetApi = _widgetApi;
|
|
1969
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1970
|
+
this.sdkApi = sdkApi;
|
|
1934
1971
|
}
|
|
1935
1972
|
mediaElementsLoadingPromises = [];
|
|
1936
1973
|
init(localData) {
|
|
1937
1974
|
try {
|
|
1938
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1975
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1939
1976
|
}
|
|
1940
1977
|
catch (e) {
|
|
1941
1978
|
console.error(e);
|
|
@@ -1957,7 +1994,7 @@ class Vote {
|
|
|
1957
1994
|
get isLayerForcePaused() {
|
|
1958
1995
|
return false;
|
|
1959
1996
|
}
|
|
1960
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetVote.api`]; }
|
|
1997
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetVote.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1961
1998
|
}
|
|
1962
1999
|
|
|
1963
2000
|
class Text {
|
|
@@ -1992,19 +2029,34 @@ class Text {
|
|
|
1992
2029
|
const waitForImageHtmlElementLoad = async (nodeRef) => {
|
|
1993
2030
|
return new Promise((resolve, reject) => {
|
|
1994
2031
|
const onLoad = function () {
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
nodeRef.
|
|
1998
|
-
|
|
2032
|
+
nodeRef.decoding = "sync";
|
|
2033
|
+
if (nodeRef.decode != null) {
|
|
2034
|
+
nodeRef.decode().then(() => {
|
|
2035
|
+
// @ts-ignore
|
|
2036
|
+
// _log("img loaded 1", true);
|
|
2037
|
+
resolve(nodeRef);
|
|
2038
|
+
nodeRef.removeEventListener("load", onLoad);
|
|
2039
|
+
}, reason => reject(reason));
|
|
2040
|
+
}
|
|
2041
|
+
else {
|
|
2042
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
2043
|
+
// @ts-ignore
|
|
2044
|
+
// _log("img loaded 1", true);
|
|
2045
|
+
resolve(nodeRef);
|
|
2046
|
+
nodeRef.removeEventListener("load", onLoad);
|
|
2047
|
+
}));
|
|
2048
|
+
}
|
|
1999
2049
|
};
|
|
2000
2050
|
nodeRef.addEventListener("load", onLoad);
|
|
2001
|
-
if (nodeRef.complete && 0 !== nodeRef.naturalHeight) {
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
}
|
|
2051
|
+
// if (nodeRef.complete && 0 !== nodeRef.naturalHeight) {
|
|
2052
|
+
// requestAnimationFrame(() => {
|
|
2053
|
+
// requestAnimationFrame(() => {
|
|
2054
|
+
// // @ts-ignore
|
|
2055
|
+
// _log("img loaded 2", true)
|
|
2056
|
+
// resolve(nodeRef);
|
|
2057
|
+
// });
|
|
2058
|
+
// });
|
|
2059
|
+
// }
|
|
2008
2060
|
nodeRef.addEventListener("error", err => reject(err));
|
|
2009
2061
|
});
|
|
2010
2062
|
};
|
|
@@ -2014,6 +2066,8 @@ const waitForVideoHtmlElementLoad = async (nodeRef) => {
|
|
|
2014
2066
|
const onCanplaythrough = () => {
|
|
2015
2067
|
requestAnimationFrame(() => {
|
|
2016
2068
|
requestAnimationFrame(() => {
|
|
2069
|
+
// @ts-ignore
|
|
2070
|
+
// _log("video loaded 1", true)
|
|
2017
2071
|
resolve(nodeRef);
|
|
2018
2072
|
nodeRef.removeEventListener("canplaythrough", onCanplaythrough);
|
|
2019
2073
|
});
|
|
@@ -2026,6 +2080,8 @@ const waitForVideoHtmlElementLoad = async (nodeRef) => {
|
|
|
2026
2080
|
var onCanPlay = function () {
|
|
2027
2081
|
requestAnimationFrame(() => {
|
|
2028
2082
|
requestAnimationFrame(() => {
|
|
2083
|
+
// @ts-ignore
|
|
2084
|
+
// _log("video loaded 2", true)
|
|
2029
2085
|
resolve(nodeRef);
|
|
2030
2086
|
nodeRef.removeEventListener("canplay", onCanPlay);
|
|
2031
2087
|
});
|
|
@@ -2193,6 +2249,8 @@ class Video {
|
|
|
2193
2249
|
onStop() { }
|
|
2194
2250
|
onBeforeUnmount() {
|
|
2195
2251
|
// clean up memory and cpu processes
|
|
2252
|
+
// @ts-ignore
|
|
2253
|
+
// _log("onBeforeUnmount", true)
|
|
2196
2254
|
this._destroyVODPlayer();
|
|
2197
2255
|
}
|
|
2198
2256
|
_initVOD(vodData) {
|
|
@@ -2267,6 +2325,8 @@ class Video {
|
|
|
2267
2325
|
// console.log("_initVOD 5");
|
|
2268
2326
|
this._vodPlayerInstance = player;
|
|
2269
2327
|
// This runs if the asynchronous load is successful.
|
|
2328
|
+
// @ts-ignore
|
|
2329
|
+
_log("vod loaded 1", true);
|
|
2270
2330
|
resolve(this._video);
|
|
2271
2331
|
})
|
|
2272
2332
|
.catch(reason => {
|
|
@@ -2291,6 +2351,8 @@ class Video {
|
|
|
2291
2351
|
if (vodData && vodData.formats != null && Array.isArray(vodData.formats) && vodData.formats.length > 0) {
|
|
2292
2352
|
src = vodData.formats[0].url;
|
|
2293
2353
|
this._video.src = src;
|
|
2354
|
+
// @ts-ignore
|
|
2355
|
+
// _log("vod loaded 2", true)
|
|
2294
2356
|
resolve(this._video);
|
|
2295
2357
|
}
|
|
2296
2358
|
else {
|
|
@@ -2313,6 +2375,8 @@ class Video {
|
|
|
2313
2375
|
return mpd_;
|
|
2314
2376
|
}
|
|
2315
2377
|
async _destroyVODPlayer() {
|
|
2378
|
+
//@ts-ignore
|
|
2379
|
+
// _log("call _destroyVODPlayer", true)
|
|
2316
2380
|
if (this._vodPlayerInstance != null) {
|
|
2317
2381
|
try {
|
|
2318
2382
|
if (this._videoStateAdapter) {
|
|
@@ -2615,7 +2679,7 @@ class VideoStateAdapter {
|
|
|
2615
2679
|
// _log(`_onPlaying, _timeupdate: ${this._timeupdate}`, true);
|
|
2616
2680
|
this._playingCheckerId = window.setTimeout(() => {
|
|
2617
2681
|
// @ts-ignore
|
|
2618
|
-
_log(`_onPlaying cb, _timeupdate: ${this._timeupdate}, now: ${Date.now()}, diff: ${Date.now() - this._timeupdate}`, true);
|
|
2682
|
+
// _log(`_onPlaying cb, _timeupdate: ${this._timeupdate}, now: ${Date.now()}, diff: ${Date.now() - this._timeupdate}`, true);
|
|
2619
2683
|
if (Date.now() - this._timeupdate <= this._maxDiff / 2) {
|
|
2620
2684
|
// @ts-ignore
|
|
2621
2685
|
// _log(`_onPlaying if`, true);
|
|
@@ -2662,7 +2726,7 @@ class VideoStateAdapter {
|
|
|
2662
2726
|
// const
|
|
2663
2727
|
// }
|
|
2664
2728
|
// args nodeRef, elementClassName
|
|
2665
|
-
const tryCreateFromHtmlElement = (nodeRef, layer) => {
|
|
2729
|
+
const tryCreateFromHtmlElement = (nodeRef, layer, onWidgetComplete, sdkApi) => {
|
|
2666
2730
|
const layoutApi = layer.layoutService.layoutApi;
|
|
2667
2731
|
const layersNodesRefs = layer.slide.layersNodesRefs;
|
|
2668
2732
|
for (let elementClassName of nodeRef.classList.values()) {
|
|
@@ -2680,38 +2744,42 @@ const tryCreateFromHtmlElement = (nodeRef, layer) => {
|
|
|
2680
2744
|
case SwipeUpItems.className():
|
|
2681
2745
|
return new SwipeUpItems(nodeRef, layer);
|
|
2682
2746
|
case Video.className():
|
|
2683
|
-
return new Video(nodeRef, layer, layoutApi.VideoPlayer, layer.
|
|
2747
|
+
return new Video(nodeRef, layer, layoutApi.VideoPlayer, layer.sdkApi);
|
|
2684
2748
|
//////// widgets ///////
|
|
2685
2749
|
case Copy.className():
|
|
2686
|
-
return layoutApi.widgetCopyApi ? new Copy(nodeRef, layer, layoutApi.widgetCopyApi) : null;
|
|
2750
|
+
return layoutApi.widgetCopyApi ? new Copy(nodeRef, layer, layoutApi.widgetCopyApi, onWidgetComplete, sdkApi) : null;
|
|
2687
2751
|
case Barcode.className():
|
|
2688
|
-
return layoutApi.widgetBarcodeApi ? new Barcode(nodeRef, layer, layoutApi.widgetBarcodeApi) : null;
|
|
2752
|
+
return layoutApi.widgetBarcodeApi ? new Barcode(nodeRef, layer, layoutApi.widgetBarcodeApi, onWidgetComplete, sdkApi) : null;
|
|
2689
2753
|
case DataInput.className():
|
|
2690
|
-
return layoutApi.widgetDataInputApi ? new DataInput(nodeRef, layer, layoutApi.widgetDataInputApi) : null;
|
|
2754
|
+
return layoutApi.widgetDataInputApi ? new DataInput(nodeRef, layer, layoutApi.widgetDataInputApi, onWidgetComplete, sdkApi) : null;
|
|
2691
2755
|
case DateCountdown.className():
|
|
2692
|
-
return layoutApi.widgetDateCountdownApi
|
|
2756
|
+
return layoutApi.widgetDateCountdownApi
|
|
2757
|
+
? new DateCountdown(nodeRef, layer, layersNodesRefs, layoutApi.widgetDateCountdownApi, onWidgetComplete, sdkApi)
|
|
2758
|
+
: null;
|
|
2693
2759
|
case Poll.className():
|
|
2694
|
-
return layoutApi.widgetPollApi ? new Poll(nodeRef, layer, layoutApi.widgetPollApi) : null;
|
|
2760
|
+
return layoutApi.widgetPollApi ? new Poll(nodeRef, layer, layoutApi.widgetPollApi, onWidgetComplete, sdkApi) : null;
|
|
2695
2761
|
case PollLayers.className():
|
|
2696
|
-
return layoutApi.widgetPollLayersApi
|
|
2762
|
+
return layoutApi.widgetPollLayersApi
|
|
2763
|
+
? new PollLayers(nodeRef, layer, layersNodesRefs, layoutApi.widgetPollLayersApi, onWidgetComplete, sdkApi)
|
|
2764
|
+
: null;
|
|
2697
2765
|
case Quest.className():
|
|
2698
|
-
return layoutApi.widgetQuestApi ? new Quest(nodeRef, layer, layoutApi.widgetQuestApi) : null;
|
|
2766
|
+
return layoutApi.widgetQuestApi ? new Quest(nodeRef, layer, layoutApi.widgetQuestApi, onWidgetComplete, sdkApi) : null;
|
|
2699
2767
|
case Quiz.className():
|
|
2700
|
-
return layoutApi.widgetQuizApi ? new Quiz(nodeRef, layer, layoutApi.widgetQuizApi) : null;
|
|
2768
|
+
return layoutApi.widgetQuizApi ? new Quiz(nodeRef, layer, layoutApi.widgetQuizApi, onWidgetComplete, sdkApi) : null;
|
|
2701
2769
|
case QuizGrouped.className():
|
|
2702
|
-
return layoutApi.widgetQuizGroupedApi ? new QuizGrouped(nodeRef, layer, layoutApi.widgetQuizGroupedApi) : null;
|
|
2770
|
+
return layoutApi.widgetQuizGroupedApi ? new QuizGrouped(nodeRef, layer, layoutApi.widgetQuizGroupedApi, onWidgetComplete, sdkApi) : null;
|
|
2703
2771
|
case RangeSlider.className():
|
|
2704
|
-
return layoutApi.widgetRangeSliderApi ? new RangeSlider(nodeRef, layer, layoutApi.widgetRangeSliderApi) : null;
|
|
2772
|
+
return layoutApi.widgetRangeSliderApi ? new RangeSlider(nodeRef, layer, layoutApi.widgetRangeSliderApi, onWidgetComplete, sdkApi) : null;
|
|
2705
2773
|
case Rate.className():
|
|
2706
|
-
return layoutApi.widgetRateApi ? new Rate(nodeRef, layer, layoutApi.widgetRateApi) : null;
|
|
2774
|
+
return layoutApi.widgetRateApi ? new Rate(nodeRef, layer, layoutApi.widgetRateApi, onWidgetComplete, sdkApi) : null;
|
|
2707
2775
|
case Share.className():
|
|
2708
|
-
return layoutApi.widgetShareApi ? new Share(nodeRef, layer, layersNodesRefs, layoutApi.widgetShareApi) : null;
|
|
2776
|
+
return layoutApi.widgetShareApi ? new Share(nodeRef, layer, layersNodesRefs, layoutApi.widgetShareApi, onWidgetComplete, sdkApi) : null;
|
|
2709
2777
|
case Test.className():
|
|
2710
|
-
return layoutApi.widgetTestApi ? new Test(nodeRef, layer, layoutApi.widgetTestApi) : null;
|
|
2778
|
+
return layoutApi.widgetTestApi ? new Test(nodeRef, layer, layoutApi.widgetTestApi, onWidgetComplete, sdkApi) : null;
|
|
2711
2779
|
case Vote.className():
|
|
2712
|
-
return layoutApi.widgetVoteApi ? new Vote(nodeRef, layer, layoutApi.widgetVoteApi) : null;
|
|
2780
|
+
return layoutApi.widgetVoteApi ? new Vote(nodeRef, layer, layoutApi.widgetVoteApi, onWidgetComplete, sdkApi) : null;
|
|
2713
2781
|
case Products.className():
|
|
2714
|
-
return layoutApi.widgetProductsApi ? new Products(nodeRef, layer, layoutApi.widgetProductsApi) : null;
|
|
2782
|
+
return layoutApi.widgetProductsApi ? new Products(nodeRef, layer, layoutApi.widgetProductsApi, onWidgetComplete, sdkApi) : null;
|
|
2715
2783
|
}
|
|
2716
2784
|
}
|
|
2717
2785
|
return null;
|
|
@@ -2722,18 +2790,24 @@ var TimelineDisabledState;
|
|
|
2722
2790
|
TimelineDisabledState[TimelineDisabledState["disabled"] = 0] = "disabled";
|
|
2723
2791
|
TimelineDisabledState[TimelineDisabledState["enabled"] = 1] = "enabled";
|
|
2724
2792
|
})(TimelineDisabledState || (TimelineDisabledState = {}));
|
|
2793
|
+
// use Promise
|
|
2794
|
+
// await Promise()
|
|
2795
|
+
// call timeLine api
|
|
2796
|
+
// promise - slideReadyPromise
|
|
2725
2797
|
class SlideTimeline {
|
|
2726
2798
|
slideIndex;
|
|
2727
2799
|
slideDuration;
|
|
2728
2800
|
slideDisabledTimer;
|
|
2729
2801
|
slideReady;
|
|
2730
2802
|
_afterResumeQueuePush;
|
|
2731
|
-
|
|
2803
|
+
sdkApi;
|
|
2804
|
+
constructor(slideIndex, slideDuration, slideDisabledTimer, slideReady, _afterResumeQueuePush, sdkApi) {
|
|
2732
2805
|
this.slideIndex = slideIndex;
|
|
2733
2806
|
this.slideDuration = slideDuration;
|
|
2734
2807
|
this.slideDisabledTimer = slideDisabledTimer;
|
|
2735
2808
|
this.slideReady = slideReady;
|
|
2736
2809
|
this._afterResumeQueuePush = _afterResumeQueuePush;
|
|
2810
|
+
this.sdkApi = sdkApi;
|
|
2737
2811
|
this.timelineDisabledState = this.slideDisabledTimer ? TimelineDisabledState.disabled : TimelineDisabledState.enabled;
|
|
2738
2812
|
}
|
|
2739
2813
|
resumedAt = new Date().getTime();
|
|
@@ -2747,17 +2821,23 @@ class SlideTimeline {
|
|
|
2747
2821
|
return SlideTimeline.layoutService;
|
|
2748
2822
|
}
|
|
2749
2823
|
get isSDKSupportUpdateTimeline() {
|
|
2750
|
-
if (
|
|
2751
|
-
return SlideTimeline.layoutService.env.Android && "updateTimeline" in SlideTimeline.layoutService.env.Android;
|
|
2824
|
+
if (this.sdkApi.isAndroid) {
|
|
2825
|
+
return Boolean(SlideTimeline.layoutService.env.Android && "updateTimeline" in SlideTimeline.layoutService.env.Android);
|
|
2752
2826
|
}
|
|
2753
|
-
else if (
|
|
2827
|
+
else if (this.sdkApi.isIOS) {
|
|
2754
2828
|
const mh = SlideTimeline.layoutService.env?.webkit?.messageHandlers ?? {};
|
|
2755
2829
|
return "updateTimeline" in mh;
|
|
2756
2830
|
}
|
|
2831
|
+
else if (this.sdkApi.isWeb) {
|
|
2832
|
+
return true;
|
|
2833
|
+
}
|
|
2757
2834
|
else {
|
|
2758
2835
|
return false;
|
|
2759
2836
|
}
|
|
2760
2837
|
}
|
|
2838
|
+
get isSdkSupportTimelineOnBeforeStart() {
|
|
2839
|
+
return this.sdkApi.isSdkSupportTimelineOnBeforeStart();
|
|
2840
|
+
}
|
|
2761
2841
|
get index() {
|
|
2762
2842
|
return this.slideIndex;
|
|
2763
2843
|
}
|
|
@@ -2795,7 +2875,24 @@ class SlideTimeline {
|
|
|
2795
2875
|
//@ts-ignore
|
|
2796
2876
|
// window._log(`updateTimeline, a: ${action} ct: ${currentTime} d: ${duration} tds: ${this.timelineDisabledState}`, true);
|
|
2797
2877
|
// console.trace(`updateTimeline ${action} slideIndex: ${this.slideIndex} currentTime:${currentTime} duration:${duration} tds: ${this.timelineDisabledState}`);
|
|
2798
|
-
|
|
2878
|
+
this.sdkApi.updateTimeline(this.slideIndex, action, currentTime, duration, showLoader, showError);
|
|
2879
|
+
}
|
|
2880
|
+
/**
|
|
2881
|
+
* trigger timeline update for new slide in sdk, before slide strat event (prevent timeout in timeline while we wait for video start)
|
|
2882
|
+
*/
|
|
2883
|
+
triggerSlideLoadState() {
|
|
2884
|
+
if (this.isSDKSupportUpdateTimeline && this.isSdkSupportTimelineOnBeforeStart) {
|
|
2885
|
+
let duration = this.slideDuration;
|
|
2886
|
+
// tmp
|
|
2887
|
+
// todo брать из модели
|
|
2888
|
+
if (!duration) {
|
|
2889
|
+
duration = DEFAULT_SLIDE_DURATION;
|
|
2890
|
+
}
|
|
2891
|
+
if (this.timelineDisabledState === TimelineDisabledState.disabled) {
|
|
2892
|
+
duration = 0;
|
|
2893
|
+
}
|
|
2894
|
+
this.sdkApi.updateTimeline(this.slideIndex, "before_start" /* TIMELINE_ACTION.BEFORE_START */, 0, duration, false, false);
|
|
2895
|
+
}
|
|
2799
2896
|
}
|
|
2800
2897
|
/**
|
|
2801
2898
|
* Start timeline after slide started
|
|
@@ -2834,7 +2931,7 @@ class SlideTimeline {
|
|
|
2834
2931
|
this.updateTimeline("pause" /* TIMELINE_ACTION.PAUSE */);
|
|
2835
2932
|
}
|
|
2836
2933
|
else {
|
|
2837
|
-
this.
|
|
2934
|
+
this.sdkApi.cardPausedCallback(videoCurrentTime);
|
|
2838
2935
|
}
|
|
2839
2936
|
}
|
|
2840
2937
|
slideResumed(videoCurrentTime) {
|
|
@@ -2849,7 +2946,7 @@ class SlideTimeline {
|
|
|
2849
2946
|
this.updateTimeline("start" /* TIMELINE_ACTION.START */);
|
|
2850
2947
|
}
|
|
2851
2948
|
else {
|
|
2852
|
-
this.
|
|
2949
|
+
this.sdkApi.cardResumedCallback(videoCurrentTime);
|
|
2853
2950
|
}
|
|
2854
2951
|
}
|
|
2855
2952
|
slideStopped() {
|
|
@@ -2906,7 +3003,7 @@ class SlideTimeline {
|
|
|
2906
3003
|
}
|
|
2907
3004
|
this.updateTimeline("stop" /* TIMELINE_ACTION.STOP */, false, true);
|
|
2908
3005
|
}
|
|
2909
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`number`, `number`, `boolean`, `Promise`, `(cb: () => void) => void`]; }
|
|
3006
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`number`, `number`, `boolean`, `Promise`, `(cb: () => void) => void`, `SDKApi`]; }
|
|
2910
3007
|
}
|
|
2911
3008
|
|
|
2912
3009
|
class Layer {
|
|
@@ -2914,6 +3011,9 @@ class Layer {
|
|
|
2914
3011
|
_slide;
|
|
2915
3012
|
_slideReadyPromise;
|
|
2916
3013
|
_afterResumeQueuePush;
|
|
3014
|
+
_afterStartInitQueuePush;
|
|
3015
|
+
_showNextSlide;
|
|
3016
|
+
sdkApi;
|
|
2917
3017
|
_slideIndex;
|
|
2918
3018
|
_cardId;
|
|
2919
3019
|
_cardType;
|
|
@@ -2923,11 +3023,14 @@ class Layer {
|
|
|
2923
3023
|
_disabledNavigation;
|
|
2924
3024
|
_elements = [];
|
|
2925
3025
|
_timeline;
|
|
2926
|
-
constructor(_nodeRef, _slide, _slideReadyPromise, _afterResumeQueuePush) {
|
|
3026
|
+
constructor(_nodeRef, _slide, _slideReadyPromise, _afterResumeQueuePush, _afterStartInitQueuePush, _showNextSlide, sdkApi) {
|
|
2927
3027
|
this._nodeRef = _nodeRef;
|
|
2928
3028
|
this._slide = _slide;
|
|
2929
3029
|
this._slideReadyPromise = _slideReadyPromise;
|
|
2930
3030
|
this._afterResumeQueuePush = _afterResumeQueuePush;
|
|
3031
|
+
this._afterStartInitQueuePush = _afterStartInitQueuePush;
|
|
3032
|
+
this._showNextSlide = _showNextSlide;
|
|
3033
|
+
this.sdkApi = sdkApi;
|
|
2931
3034
|
this._slideIndex = parseInt(this._nodeRef.getAttribute("data-index") ?? "0");
|
|
2932
3035
|
this._cardId = parseInt(this._nodeRef.getAttribute("data-id") ?? "0");
|
|
2933
3036
|
this._cardType = parseInt(this._nodeRef.getAttribute("data-card-type") ?? "1") || 1 /* CARD_TYPE.STORY */;
|
|
@@ -2935,11 +3038,19 @@ class Layer {
|
|
|
2935
3038
|
this._duration = parseInt(this._nodeRef.getAttribute("data-duration") ?? "") || DEFAULT_SLIDE_DURATION;
|
|
2936
3039
|
this._disabledTimer = this._nodeRef.getAttribute("data-disable-timer") === "1";
|
|
2937
3040
|
this._disabledNavigation = this._nodeRef.getAttribute("data-disable-navigation") === "1";
|
|
2938
|
-
this._timeline = new SlideTimeline(this._slideIndex, this._duration, this._disabledTimer, this._slideReadyPromise, this._afterResumeQueuePush);
|
|
3041
|
+
this._timeline = new SlideTimeline(this._slideIndex, this._duration, this._disabledTimer, this._slideReadyPromise, this._afterResumeQueuePush, this.sdkApi);
|
|
3042
|
+
const onWidgetComplete = (cardId, slideIndex) => {
|
|
3043
|
+
// todo if nothing more widgets with disabled timers - we can start layer timeline
|
|
3044
|
+
const fallback = () => this._showNextSlide(DEFAULT_SLIDE_DURATION);
|
|
3045
|
+
// для android sdk важно чтобы этот метод вызывался только после slide_start
|
|
3046
|
+
this._afterStartInitQueuePush(() => {
|
|
3047
|
+
this._timeline.startDisabledTimeline(fallback);
|
|
3048
|
+
});
|
|
3049
|
+
};
|
|
2939
3050
|
const _elementsNodes = this._nodeRef.querySelectorAll(".narrative-slide-elements .narrative-element");
|
|
2940
3051
|
let layerWithWidgetQuest = false;
|
|
2941
3052
|
_elementsNodes.forEach(item => {
|
|
2942
|
-
let element = tryCreateFromHtmlElement(item, this);
|
|
3053
|
+
let element = tryCreateFromHtmlElement(item, this, onWidgetComplete, this.sdkApi);
|
|
2943
3054
|
if (element) {
|
|
2944
3055
|
this._elements.push(element);
|
|
2945
3056
|
if (element instanceof Quest) {
|
|
@@ -2954,7 +3065,7 @@ class Layer {
|
|
|
2954
3065
|
* - then init WidgetQuest with layer instead of WidgetQuest element (required for WidgetQuest slides navigation)
|
|
2955
3066
|
*/
|
|
2956
3067
|
if (this.isQuest && !layerWithWidgetQuest && this.layoutService.layoutApi.widgetQuestApi != null) {
|
|
2957
|
-
this._elements.push(new Quest(this._nodeRef, this, this.layoutService.layoutApi.widgetQuestApi));
|
|
3068
|
+
this._elements.push(new Quest(this._nodeRef, this, this.layoutService.layoutApi.widgetQuestApi, onWidgetComplete, this.sdkApi));
|
|
2958
3069
|
}
|
|
2959
3070
|
}
|
|
2960
3071
|
init(localData) {
|
|
@@ -2983,11 +3094,8 @@ class Layer {
|
|
|
2983
3094
|
get layoutService() {
|
|
2984
3095
|
return container.get({ identifier: "LayoutService" });
|
|
2985
3096
|
}
|
|
2986
|
-
get sdkApi() {
|
|
2987
|
-
return container.get({ identifier: "SDKApi" });
|
|
2988
|
-
}
|
|
2989
3097
|
getLocalData() {
|
|
2990
|
-
return this.
|
|
3098
|
+
return this.sdkApi.getCardLocalData();
|
|
2991
3099
|
}
|
|
2992
3100
|
get isQuest() {
|
|
2993
3101
|
return this._nodeRef.getAttribute("data-quest-count") != null;
|
|
@@ -3251,7 +3359,7 @@ class Layer {
|
|
|
3251
3359
|
get isLayerForcePaused() {
|
|
3252
3360
|
return this.elements.some(element => element.isLayerForcePaused);
|
|
3253
3361
|
}
|
|
3254
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Slide`, `Promise`, `(cb: () => void) => void`]; }
|
|
3362
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Slide`, `Promise`, `(cb: () => void) => void`, `(cb: () => void) => void`, `(duration: number) => void`, `SDKApi`]; }
|
|
3255
3363
|
}
|
|
3256
3364
|
const TextFit = (function () {
|
|
3257
3365
|
const defaultSettings = {
|
|
@@ -3425,17 +3533,23 @@ class Slide {
|
|
|
3425
3533
|
_slidesNodesRefs;
|
|
3426
3534
|
_slideReadyPromise;
|
|
3427
3535
|
_afterResumeQueuePush;
|
|
3536
|
+
_afterStartInitQueuePush;
|
|
3537
|
+
_showNextSlide;
|
|
3538
|
+
sdkApi;
|
|
3428
3539
|
_layers;
|
|
3429
3540
|
_start;
|
|
3430
|
-
constructor(_slidesNodesRefs, _slideReadyPromise, _afterResumeQueuePush) {
|
|
3541
|
+
constructor(_slidesNodesRefs, _slideReadyPromise, _afterResumeQueuePush, _afterStartInitQueuePush, _showNextSlide, sdkApi) {
|
|
3431
3542
|
this._slidesNodesRefs = _slidesNodesRefs;
|
|
3432
3543
|
this._slideReadyPromise = _slideReadyPromise;
|
|
3433
3544
|
this._afterResumeQueuePush = _afterResumeQueuePush;
|
|
3545
|
+
this._afterStartInitQueuePush = _afterStartInitQueuePush;
|
|
3546
|
+
this._showNextSlide = _showNextSlide;
|
|
3547
|
+
this.sdkApi = sdkApi;
|
|
3434
3548
|
this._start = window.performance.now();
|
|
3435
3549
|
if (!this._slidesNodesRefs.length) {
|
|
3436
3550
|
throw new Error("No slides found.");
|
|
3437
3551
|
}
|
|
3438
|
-
this._layers = this._slidesNodesRefs.map(item => new Layer(item, this, this._slideReadyPromise, this._afterResumeQueuePush));
|
|
3552
|
+
this._layers = this._slidesNodesRefs.map(item => new Layer(item, this, this._slideReadyPromise, this._afterResumeQueuePush, this._afterStartInitQueuePush, this._showNextSlide, this.sdkApi));
|
|
3439
3553
|
this._activeLayer = this._layers[0];
|
|
3440
3554
|
}
|
|
3441
3555
|
_activeLayer;
|
|
@@ -3454,7 +3568,7 @@ class Slide {
|
|
|
3454
3568
|
const multiSlideApi = this.layoutService.layoutApi.widgetMultiSlideApi;
|
|
3455
3569
|
if (multiSlideApi != null && this.layers.length > 1) {
|
|
3456
3570
|
try {
|
|
3457
|
-
multiSlideApi.init(this.layersNodesRefs, localData);
|
|
3571
|
+
multiSlideApi.init(this.layersNodesRefs, localData, this.sdkApi);
|
|
3458
3572
|
}
|
|
3459
3573
|
catch (e) {
|
|
3460
3574
|
console.error(e);
|
|
@@ -3526,7 +3640,7 @@ class Slide {
|
|
|
3526
3640
|
get disabledNavigation() {
|
|
3527
3641
|
return this._activeLayer.disabledNavigation;
|
|
3528
3642
|
}
|
|
3529
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Array`, `Promise`, `(cb: () => void) => void`]; }
|
|
3643
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Array`, `Promise`, `(cb: () => void) => void`, `(cb: () => void) => void`, `(duration: number) => void`, `SDKApi`]; }
|
|
3530
3644
|
}
|
|
3531
3645
|
|
|
3532
3646
|
let SlideApi$1 = class SlideApi {
|
|
@@ -3539,10 +3653,16 @@ let SlideApi$1 = class SlideApi {
|
|
|
3539
3653
|
static prerenderBoxClassName = "narrative-slide-box-prerender";
|
|
3540
3654
|
_slideWrapper;
|
|
3541
3655
|
_viewport;
|
|
3656
|
+
_getViewportWidth;
|
|
3657
|
+
_getViewportHeight;
|
|
3658
|
+
sdkApi;
|
|
3542
3659
|
constructor(config) {
|
|
3543
3660
|
this.config = config;
|
|
3661
|
+
this.sdkApi = config.sdkApi;
|
|
3544
3662
|
this._slideWrapper = config.slideWrapper;
|
|
3545
3663
|
this._viewport = config.viewport;
|
|
3664
|
+
this._getViewportWidth = config.getViewportWidth;
|
|
3665
|
+
this._getViewportHeight = config.getViewportHeight;
|
|
3546
3666
|
this.refreshSizes = proxy(this.refreshSizes, this);
|
|
3547
3667
|
this.initListeners();
|
|
3548
3668
|
this.refreshSizes();
|
|
@@ -3572,10 +3692,8 @@ let SlideApi$1 = class SlideApi {
|
|
|
3572
3692
|
this._viewport.removeEventListener("resize", this.refreshSizes);
|
|
3573
3693
|
}
|
|
3574
3694
|
refreshSizes() {
|
|
3575
|
-
|
|
3576
|
-
const
|
|
3577
|
-
// const viewportHeight = getViewportHeight(this._viewport);
|
|
3578
|
-
const viewportHeight = this._slideWrapper.clientHeight;
|
|
3695
|
+
const viewportWidth = this._getViewportWidth();
|
|
3696
|
+
const viewportHeight = this._getViewportHeight();
|
|
3579
3697
|
const viewportRatio = viewportWidth / viewportHeight;
|
|
3580
3698
|
let slideWidth = 0;
|
|
3581
3699
|
let slideHeight = 0;
|
|
@@ -3639,7 +3757,6 @@ let SlideApi$1 = class SlideApi {
|
|
|
3639
3757
|
if (_isFullscreen) {
|
|
3640
3758
|
slideOffset?.classList.add("narrative-slide-offset-fullscreen");
|
|
3641
3759
|
}
|
|
3642
|
-
console.log({ fontSize, slideWidth });
|
|
3643
3760
|
if (this.config.userResizeHandler != null) {
|
|
3644
3761
|
this.config.userResizeHandler({ viewportWidth, viewportHeight, fontSize });
|
|
3645
3762
|
}
|
|
@@ -3672,10 +3789,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
3672
3789
|
return container.get({ identifier: "LayoutService" });
|
|
3673
3790
|
}
|
|
3674
3791
|
getLocalData() {
|
|
3675
|
-
return this.
|
|
3676
|
-
}
|
|
3677
|
-
get sdkApi() {
|
|
3678
|
-
return container.get({ identifier: "SDKApi" });
|
|
3792
|
+
return this.sdkApi.getCardLocalData();
|
|
3679
3793
|
}
|
|
3680
3794
|
_fontsInit = false;
|
|
3681
3795
|
_initAndLoadFonts(fonts) {
|
|
@@ -3730,6 +3844,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
3730
3844
|
async _onAllMediaLoaded(slide) {
|
|
3731
3845
|
return new Promise((resolve, reject) => {
|
|
3732
3846
|
const promises = slide.layers.flatMap(layer => layer.elements.flatMap(element => element.mediaElementsLoadingPromises));
|
|
3847
|
+
console.log({ promises });
|
|
3733
3848
|
let checkerTimerId = undefined;
|
|
3734
3849
|
let timeOutFired = false;
|
|
3735
3850
|
if (promises.length > 0) {
|
|
@@ -3771,15 +3886,16 @@ let SlideApi$1 = class SlideApi {
|
|
|
3771
3886
|
slideReadyResolve = resolve;
|
|
3772
3887
|
slideReadyReject = reject;
|
|
3773
3888
|
});
|
|
3774
|
-
const slide = new Slide(slidesNodesRefs, slideReadyPromise, this.afterResumeQueuePush.bind(this));
|
|
3889
|
+
const slide = new Slide(slidesNodesRefs, slideReadyPromise, this.afterResumeQueuePush.bind(this), this.afterStartInitQueuePush.bind(this), this.sdkApi.showNextSlide.bind(this), this.sdkApi);
|
|
3775
3890
|
this._slideInInit = slide;
|
|
3891
|
+
slide.activeLayer.timeline.triggerSlideLoadState();
|
|
3776
3892
|
const onAllMediaLoaded = this._onAllMediaLoaded(slide);
|
|
3777
3893
|
if (this.sdkApi.isAndroid) {
|
|
3778
3894
|
this._afterStartInitQueue = [];
|
|
3779
3895
|
}
|
|
3780
3896
|
this._afterResumeQueue = [];
|
|
3781
3897
|
const result = { slide, result: false, reason: "" };
|
|
3782
|
-
await this._initAndLoadFonts(this.
|
|
3898
|
+
await this._initAndLoadFonts(this.sdkApi.getCardFonts());
|
|
3783
3899
|
const localData = await this.getLocalData();
|
|
3784
3900
|
const finishRender = await slide.init(localData);
|
|
3785
3901
|
/**
|
|
@@ -3827,8 +3943,15 @@ let SlideApi$1 = class SlideApi {
|
|
|
3827
3943
|
slideBoxPrerender.classList.remove(SlideApi.prerenderBoxClassName);
|
|
3828
3944
|
slideBox.classList.remove(SlideApi.renderedBoxClassName);
|
|
3829
3945
|
slideBox.classList.add(SlideApi.prerenderBoxClassName);
|
|
3830
|
-
|
|
3831
|
-
|
|
3946
|
+
// 2 RAF - wait for browser render complete (CSS changes, etc.)
|
|
3947
|
+
this.layoutService.env.requestAnimationFrame(() => {
|
|
3948
|
+
this.layoutService.env.requestAnimationFrame(() => {
|
|
3949
|
+
prevSlide?.onBeforeUnmount();
|
|
3950
|
+
// @ts-ignore
|
|
3951
|
+
// _log("clear innerHTML", true);
|
|
3952
|
+
slideBox.innerHTML = "";
|
|
3953
|
+
});
|
|
3954
|
+
});
|
|
3832
3955
|
slideBoxPrerender.classList.add(SlideApi.renderedBoxClassName);
|
|
3833
3956
|
}
|
|
3834
3957
|
this._slideInRender = false;
|
|
@@ -4583,10 +4706,9 @@ let SlideApi$1 = class SlideApi {
|
|
|
4583
4706
|
this.activeLayer.shareElement.complete(id, isSuccess);
|
|
4584
4707
|
}
|
|
4585
4708
|
}
|
|
4586
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`{\n slideWrapper: HTMLElement;\n viewport: Window;\n userResizeHandler?: (data: { viewportWidth: number; viewportHeight: number; fontSize: number }) => void;\n slideRatio: number;\n isFullscreen: boolean;\n slideLoadedCb?: (data: { slide: Slide; result: boolean; reason?: string }) => void;\n }`]; }
|
|
4709
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`{\n sdkApi: SDKApi;\n slideWrapper: HTMLElement;\n viewport: Window;\n userResizeHandler?: (data: { viewportWidth: number; viewportHeight: number; fontSize: number }) => void;\n slideRatio: number;\n isFullscreen: boolean;\n slideLoadedCb?: (data: { slide: Slide; result: boolean; reason?: string }) => void;\n getViewportWidth: () => number;\n getViewportHeight: () => number;\n }`]; }
|
|
4587
4710
|
};
|
|
4588
4711
|
|
|
4589
|
-
let sdkInterface;
|
|
4590
4712
|
const slideApiPeerDeps = {};
|
|
4591
4713
|
const createSlideWrapper = ({ slideBoxRatio, nonce }) => {
|
|
4592
4714
|
const slideWrapper = document.createElement("div");
|
|
@@ -4611,7 +4733,6 @@ const createSlideWrapper = ({ slideBoxRatio, nonce }) => {
|
|
|
4611
4733
|
// style.sheet?.insertRule(`.narrative-slide-box {padding: ${paddingTop} 0 0 0;`);
|
|
4612
4734
|
slideBoxRendered.style.padding = `${paddingTop} 0 0 0`;
|
|
4613
4735
|
slideBoxPrerender.style.padding = `${paddingTop} 0 0 0`;
|
|
4614
|
-
console.log({ paddingTop });
|
|
4615
4736
|
slideOffset.appendChild(slideBoxPrerender);
|
|
4616
4737
|
slideOffset.appendChild(slideBoxRendered);
|
|
4617
4738
|
slideWrapper.appendChild(slideOffset);
|
|
@@ -4620,24 +4741,24 @@ const createSlideWrapper = ({ slideBoxRatio, nonce }) => {
|
|
|
4620
4741
|
};
|
|
4621
4742
|
class SlideApi extends SlideApi$1 {
|
|
4622
4743
|
constructor(_sdkInterface, config) {
|
|
4623
|
-
sdkInterface = _sdkInterface;
|
|
4624
4744
|
slideApiPeerDeps.VODPlayer = config.VODPlayer;
|
|
4625
4745
|
const slideWrapper = createSlideWrapper({ slideBoxRatio: config.slideRatio, nonce: config.nonce });
|
|
4626
4746
|
// todo need to clear root node before append slideWrapper?
|
|
4627
4747
|
config.root.appendChild(slideWrapper);
|
|
4628
4748
|
super({
|
|
4749
|
+
sdkApi: new EsModuleSdkApi(_sdkInterface),
|
|
4629
4750
|
slideWrapper,
|
|
4630
4751
|
viewport: config.viewport,
|
|
4631
4752
|
slideRatio: config.slideRatio,
|
|
4632
4753
|
isFullscreen: config.isFullscreen,
|
|
4633
4754
|
userResizeHandler: config.userResizeHandler,
|
|
4755
|
+
getViewportWidth: () => slideWrapper.clientWidth,
|
|
4756
|
+
getViewportHeight: () => slideWrapper.clientHeight,
|
|
4634
4757
|
});
|
|
4635
4758
|
}
|
|
4636
4759
|
static get [Symbol.for("___CTOR_ARGS___")]() { return [`SDKInterface`, `{\n root: HTMLElement;\n slideRatio: number;\n isFullscreen: boolean;\n nonce?: string;\n viewport: Window;\n userResizeHandler?: (data: { viewportWidth: number; viewportHeight: number; fontSize: number }) => void;\n VODPlayer?: typeof VODPlayer;\n }`]; }
|
|
4637
4760
|
}
|
|
4638
4761
|
|
|
4639
|
-
container.registerSingleton(() => new EsModuleSdkApi(() => sdkInterface), { identifier: `SDKApi` });
|
|
4640
|
-
|
|
4641
4762
|
// This file is part of the bwip-js project available at:
|
|
4642
4763
|
//
|
|
4643
4764
|
// http://metafloor.github.io/bwip-js
|
|
@@ -13994,6 +14115,8 @@ FontLib.loadFont("OCR-B", 96, 100, "AAEAAAAPAIAAAwBwRkZUTXxHn14AADmUAAAAHEdERUYA
|
|
|
13994
14115
|
function ean13(opts,dwg) { return _ToAny(bwipp_ean13,opts,dwg); }function pdf417(opts,dwg) { return _ToAny(bwipp_pdf417,opts,dwg); }function qrcode(opts,dwg) { return _ToAny(bwipp_qrcode,opts,dwg); }
|
|
13995
14116
|
|
|
13996
14117
|
class WidgetBase {
|
|
14118
|
+
_onWidgetComplete;
|
|
14119
|
+
sdkApi;
|
|
13997
14120
|
static DEFAULTS = {
|
|
13998
14121
|
slide: null,
|
|
13999
14122
|
activateAfterCreate: false,
|
|
@@ -14002,7 +14125,6 @@ class WidgetBase {
|
|
|
14002
14125
|
};
|
|
14003
14126
|
static widgetIndex = 0;
|
|
14004
14127
|
env = WidgetBase.widgetsService.env;
|
|
14005
|
-
sdkApi = WidgetBase.widgetsService.sdkApi;
|
|
14006
14128
|
options = null;
|
|
14007
14129
|
element = null;
|
|
14008
14130
|
elementId = null;
|
|
@@ -14022,7 +14144,9 @@ class WidgetBase {
|
|
|
14022
14144
|
id;
|
|
14023
14145
|
startReadyPromise = null;
|
|
14024
14146
|
startReadyResolve = null;
|
|
14025
|
-
constructor(element, options, elementIdGetter, slideGetter) {
|
|
14147
|
+
constructor(element, options, _onWidgetComplete, sdkApi, elementIdGetter, slideGetter) {
|
|
14148
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
14149
|
+
this.sdkApi = sdkApi;
|
|
14026
14150
|
this.options = extend({}, this.constructor.DEFAULTS, options);
|
|
14027
14151
|
this.element = element;
|
|
14028
14152
|
if (elementIdGetter) {
|
|
@@ -14130,68 +14254,24 @@ class WidgetBase {
|
|
|
14130
14254
|
return instance;
|
|
14131
14255
|
}
|
|
14132
14256
|
static initWidget(htmlElement, localData, instantiate) {
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
return Promise.resolve(localData);
|
|
14141
|
-
}
|
|
14142
|
-
else {
|
|
14143
|
-
return new Promise(resolve => {
|
|
14144
|
-
this.getLocalData().then(localData => {
|
|
14145
|
-
const widget = this.createInstance(instantiate, htmlElement, {
|
|
14146
|
-
slide: null,
|
|
14147
|
-
localData,
|
|
14148
|
-
});
|
|
14149
|
-
// start widget (just created or cached instance)
|
|
14150
|
-
widget.onRefreshUserData(localData);
|
|
14151
|
-
resolve(localData);
|
|
14152
|
-
});
|
|
14153
|
-
});
|
|
14154
|
-
}
|
|
14155
|
-
}
|
|
14156
|
-
/** @deprecated */
|
|
14157
|
-
static initWidgets(instantiate, elements, localData) {
|
|
14158
|
-
if (localData != null) {
|
|
14159
|
-
forEach(elements, element => {
|
|
14160
|
-
const widget = this.createInstance(instantiate, element, {
|
|
14161
|
-
slide: null,
|
|
14162
|
-
localData,
|
|
14163
|
-
});
|
|
14164
|
-
// start widget (just created or cached instance)
|
|
14165
|
-
widget.onRefreshUserData(localData);
|
|
14166
|
-
});
|
|
14167
|
-
return Promise.resolve(localData);
|
|
14168
|
-
}
|
|
14169
|
-
else {
|
|
14170
|
-
return new Promise(resolve => {
|
|
14171
|
-
this.getLocalData().then(localData => {
|
|
14172
|
-
forEach(elements, element => {
|
|
14173
|
-
const widget = this.createInstance(instantiate, element, {
|
|
14174
|
-
slide: null,
|
|
14175
|
-
localData,
|
|
14176
|
-
});
|
|
14177
|
-
// start widget (just created or cached instance)
|
|
14178
|
-
widget.onRefreshUserData(localData);
|
|
14179
|
-
});
|
|
14180
|
-
resolve(localData);
|
|
14181
|
-
});
|
|
14182
|
-
});
|
|
14183
|
-
}
|
|
14257
|
+
const widget = this.createInstance(instantiate, htmlElement, {
|
|
14258
|
+
slide: null,
|
|
14259
|
+
localData,
|
|
14260
|
+
});
|
|
14261
|
+
// start widget (just created or cached instance)
|
|
14262
|
+
widget.onRefreshUserData(localData);
|
|
14263
|
+
return Promise.resolve(localData);
|
|
14184
14264
|
}
|
|
14185
14265
|
static get widgetsService() {
|
|
14186
14266
|
return container.get({ identifier: "WidgetsService" });
|
|
14187
14267
|
}
|
|
14188
|
-
static getLocalData() {
|
|
14189
|
-
return
|
|
14268
|
+
static getLocalData(sdkApi) {
|
|
14269
|
+
return sdkApi.getCardLocalData();
|
|
14190
14270
|
}
|
|
14191
14271
|
getLocalData() {
|
|
14192
|
-
return this.constructor.getLocalData();
|
|
14272
|
+
return this.constructor.getLocalData(this.sdkApi);
|
|
14193
14273
|
}
|
|
14194
|
-
static setLocalData(keyValue, sendToServer, syncWithRuntimeLocalData) {
|
|
14274
|
+
static setLocalData(sdkApi, keyValue, sendToServer, syncWithRuntimeLocalData) {
|
|
14195
14275
|
// push json object as string
|
|
14196
14276
|
if (sendToServer === undefined) {
|
|
14197
14277
|
sendToServer = true;
|
|
@@ -14206,20 +14286,20 @@ class WidgetBase {
|
|
|
14206
14286
|
syncWithRuntimeLocalData = Boolean(syncWithRuntimeLocalData);
|
|
14207
14287
|
}
|
|
14208
14288
|
if (syncWithRuntimeLocalData) {
|
|
14209
|
-
this.getLocalData().then(localData => {
|
|
14289
|
+
this.getLocalData(sdkApi).then(localData => {
|
|
14210
14290
|
// 1 - old values, 2 - new values
|
|
14211
14291
|
keyValue = extend({}, localData, keyValue);
|
|
14212
14292
|
// todo make async via promise or async
|
|
14213
|
-
|
|
14293
|
+
sdkApi.setCardLocalData(keyValue, sendToServer);
|
|
14214
14294
|
});
|
|
14215
14295
|
}
|
|
14216
14296
|
else {
|
|
14217
14297
|
// todo make async via promise or async
|
|
14218
|
-
|
|
14298
|
+
sdkApi.setCardLocalData(keyValue, sendToServer);
|
|
14219
14299
|
}
|
|
14220
14300
|
}
|
|
14221
14301
|
setLocalData(keyValue, sendToServer, syncWithRuntimeLocalData) {
|
|
14222
|
-
return this.constructor.setLocalData(keyValue, sendToServer, syncWithRuntimeLocalData);
|
|
14302
|
+
return this.constructor.setLocalData(this.sdkApi, keyValue, sendToServer, syncWithRuntimeLocalData);
|
|
14223
14303
|
}
|
|
14224
14304
|
get statisticEventBaseFieldsShortForm() {
|
|
14225
14305
|
return WidgetBase.getStatisticEventBaseFieldsShortForm(this.cardId, this.slideIndex);
|
|
@@ -14246,14 +14326,14 @@ class WidgetBase {
|
|
|
14246
14326
|
}
|
|
14247
14327
|
return data;
|
|
14248
14328
|
}
|
|
14249
|
-
static sendStatisticEventToApp(name, data, devPayload, options) {
|
|
14250
|
-
sendStatisticEventToApp(
|
|
14329
|
+
static sendStatisticEventToApp(sdkApi, name, data, devPayload, options) {
|
|
14330
|
+
sendStatisticEventToApp(sdkApi, name, data, devPayload, options);
|
|
14251
14331
|
}
|
|
14252
14332
|
sendStatisticEventToApp(name, data, devPayload, options) {
|
|
14253
|
-
this.constructor.sendStatisticEventToApp(name, data, devPayload, options);
|
|
14333
|
+
this.constructor.sendStatisticEventToApp(this.sdkApi, name, data, devPayload, options);
|
|
14254
14334
|
}
|
|
14255
|
-
|
|
14256
|
-
this.
|
|
14335
|
+
onWidgetComplete() {
|
|
14336
|
+
this._onWidgetComplete(this.cardId, this.slideIndex);
|
|
14257
14337
|
}
|
|
14258
14338
|
_showLayer(layers, selectIndex, withStatEvent = false) {
|
|
14259
14339
|
if (this.sdkApi.isExistsShowLayer()) {
|
|
@@ -14288,45 +14368,13 @@ class WidgetBase {
|
|
|
14288
14368
|
console.error(error);
|
|
14289
14369
|
}
|
|
14290
14370
|
}
|
|
14291
|
-
/** @deprecated */
|
|
14292
|
-
static refreshUserData(nodes, localData) {
|
|
14293
|
-
const cb = (el, localData) => {
|
|
14294
|
-
const widgetElement = el.closest(`.${this.widgetClassName}`);
|
|
14295
|
-
if (widgetElement) {
|
|
14296
|
-
const widget = WidgetBase.getInstance(widgetElement);
|
|
14297
|
-
if (widget) {
|
|
14298
|
-
widget.onRefreshUserData(localData);
|
|
14299
|
-
}
|
|
14300
|
-
}
|
|
14301
|
-
};
|
|
14302
|
-
if (localData != null) {
|
|
14303
|
-
const elements = slice.call(nodes);
|
|
14304
|
-
forEach(elements, el => cb(el, localData));
|
|
14305
|
-
}
|
|
14306
|
-
else {
|
|
14307
|
-
WidgetBase.getLocalData().then(localData => {
|
|
14308
|
-
const elements = slice.call(nodes);
|
|
14309
|
-
forEach(elements, el => cb(el, localData));
|
|
14310
|
-
});
|
|
14311
|
-
}
|
|
14312
|
-
}
|
|
14313
14371
|
static onRefreshUserData(element, localData) {
|
|
14314
|
-
const
|
|
14315
|
-
|
|
14316
|
-
|
|
14317
|
-
|
|
14318
|
-
|
|
14319
|
-
widget.onRefreshUserData(localData);
|
|
14320
|
-
}
|
|
14372
|
+
const widgetElement = element.closest(`.${this.widgetClassName}`);
|
|
14373
|
+
if (widgetElement) {
|
|
14374
|
+
const widget = WidgetBase.getInstance(widgetElement);
|
|
14375
|
+
if (widget) {
|
|
14376
|
+
widget.onRefreshUserData(localData);
|
|
14321
14377
|
}
|
|
14322
|
-
};
|
|
14323
|
-
if (localData != null) {
|
|
14324
|
-
cb(element, localData);
|
|
14325
|
-
}
|
|
14326
|
-
else {
|
|
14327
|
-
WidgetBase.getLocalData().then(localData => {
|
|
14328
|
-
cb(element, localData);
|
|
14329
|
-
});
|
|
14330
14378
|
}
|
|
14331
14379
|
}
|
|
14332
14380
|
getPromotionalCodeFetchPath(promotionalCodeId) {
|
|
@@ -14337,7 +14385,7 @@ class WidgetBase {
|
|
|
14337
14385
|
return `story/${this.cardId}/widget/${this.elementId}/promo-code/${promotionalCodeId}`;
|
|
14338
14386
|
}
|
|
14339
14387
|
}
|
|
14340
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `(element: HTMLElement) => string`, `(element: HTMLElement) => HTMLElement`]; }
|
|
14388
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`, `(element: HTMLElement) => string`, `(element: HTMLElement) => HTMLElement`]; }
|
|
14341
14389
|
}
|
|
14342
14390
|
|
|
14343
14391
|
class WidgetBarcode extends WidgetBase {
|
|
@@ -14361,8 +14409,8 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14361
14409
|
msgNoMoreCodes;
|
|
14362
14410
|
msgTryAgain;
|
|
14363
14411
|
msgBarcodeRenderError;
|
|
14364
|
-
constructor(element, options) {
|
|
14365
|
-
super(element, options);
|
|
14412
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
14413
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
14366
14414
|
this.captionView = this.element.querySelector(".narrative-element-text-lines");
|
|
14367
14415
|
this.clipboardTarget = getTagData(element, "clipboardTarget");
|
|
14368
14416
|
this.isPromotionalCode = getTagData(element, "clipboardType") === "promocode";
|
|
@@ -14585,7 +14633,7 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14585
14633
|
// флаг - что таймер уже стартанул (в layout или добавить объект sharedMemory)
|
|
14586
14634
|
// смотрим что прозрачный текст - тогда и лоадер прозрачный
|
|
14587
14635
|
// _log("_showNarrativeNextSlide: " + getSlideDuration(this.narrativeId, this.slideIndex), true);
|
|
14588
|
-
this.
|
|
14636
|
+
this.onWidgetComplete();
|
|
14589
14637
|
}
|
|
14590
14638
|
});
|
|
14591
14639
|
if (this.copiedText) {
|
|
@@ -14610,18 +14658,9 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14610
14658
|
}
|
|
14611
14659
|
static api = {
|
|
14612
14660
|
widgetClassName: WidgetBarcode.widgetClassName,
|
|
14613
|
-
/** @deprecated */
|
|
14614
|
-
refreshUserData: WidgetBarcode.refreshUserData,
|
|
14615
14661
|
onRefreshUserData: WidgetBarcode.onRefreshUserData,
|
|
14616
|
-
init: function (element, localData) {
|
|
14617
|
-
WidgetBarcode.initWidget(element, localData, (element, options) => new WidgetBarcode(element, options));
|
|
14618
|
-
},
|
|
14619
|
-
/** @deprecated */
|
|
14620
|
-
initWidget: function (nodeList, localData) {
|
|
14621
|
-
const elements = slice.call(nodeList);
|
|
14622
|
-
WidgetBarcode.initWidgets((element, options) => new WidgetBarcode(element, options), elements, localData).then(() => {
|
|
14623
|
-
elements.forEach(element => WidgetBarcode.getInstance(element)?.onStart());
|
|
14624
|
-
});
|
|
14662
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
14663
|
+
WidgetBarcode.initWidget(element, localData, (element, options) => new WidgetBarcode(element, options, onWidgetComplete, sdkApi));
|
|
14625
14664
|
},
|
|
14626
14665
|
onStart: function (element) {
|
|
14627
14666
|
WidgetBarcode.getInstance(element)?.onStart();
|
|
@@ -14648,7 +14687,7 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14648
14687
|
return false;
|
|
14649
14688
|
},
|
|
14650
14689
|
};
|
|
14651
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
14690
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
14652
14691
|
}
|
|
14653
14692
|
|
|
14654
14693
|
class WidgetCopy extends WidgetBase {
|
|
@@ -14670,8 +14709,8 @@ class WidgetCopy extends WidgetBase {
|
|
|
14670
14709
|
geometry;
|
|
14671
14710
|
resultLayer;
|
|
14672
14711
|
resultLayerGeometry;
|
|
14673
|
-
constructor(element, options) {
|
|
14674
|
-
super(element, options);
|
|
14712
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
14713
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
14675
14714
|
this.button = this.element.querySelector(".narrative-element-text-lines");
|
|
14676
14715
|
this.clipboardTarget = getTagData(element, "clipboardTarget");
|
|
14677
14716
|
this.isPromotionalCode = getTagData(element, "clipboardType") === "promocode";
|
|
@@ -14855,7 +14894,7 @@ class WidgetCopy extends WidgetBase {
|
|
|
14855
14894
|
// флаг - что таймер уже стартанул (в layout или добавить объект sharedMemory)
|
|
14856
14895
|
// смотрим что прозрачный текст - тогда и лоадер прозрачный
|
|
14857
14896
|
// _log("_showNarrativeNextSlide: " + getSlideDuration(this.narrativeId, this.slideIndex), true);
|
|
14858
|
-
this.
|
|
14897
|
+
this.onWidgetComplete();
|
|
14859
14898
|
}
|
|
14860
14899
|
});
|
|
14861
14900
|
}
|
|
@@ -14877,23 +14916,13 @@ class WidgetCopy extends WidgetBase {
|
|
|
14877
14916
|
}
|
|
14878
14917
|
static api = {
|
|
14879
14918
|
widgetClassName: WidgetCopy.widgetClassName,
|
|
14880
|
-
/** @deprecated */
|
|
14881
|
-
refreshUserData: WidgetCopy.refreshUserData,
|
|
14882
14919
|
onRefreshUserData: WidgetCopy.onRefreshUserData,
|
|
14883
|
-
init: function (element, localData) {
|
|
14920
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
14884
14921
|
// prevent initWidget for result layer
|
|
14885
14922
|
if (!element.classList.contains("narrative-element-copy-result-variant")) {
|
|
14886
|
-
WidgetCopy.initWidget(element, localData, (element, options) => new WidgetCopy(element, options));
|
|
14923
|
+
WidgetCopy.initWidget(element, localData, (element, options) => new WidgetCopy(element, options, onWidgetComplete, sdkApi));
|
|
14887
14924
|
}
|
|
14888
14925
|
},
|
|
14889
|
-
/** @deprecated */
|
|
14890
|
-
initWidget: function (nodeList, localData) {
|
|
14891
|
-
// prevent initWidget for result layer
|
|
14892
|
-
const elements = slice.call(nodeList).filter(element => !element.classList.contains("narrative-element-copy-result-variant"));
|
|
14893
|
-
WidgetCopy.initWidgets((element, options) => new WidgetCopy(element, options), elements, localData).then(() => {
|
|
14894
|
-
elements.forEach(element => WidgetCopy.getInstance(element)?.onStart());
|
|
14895
|
-
});
|
|
14896
|
-
},
|
|
14897
14926
|
onStart: function (element) {
|
|
14898
14927
|
WidgetCopy.getInstance(element)?.onStart();
|
|
14899
14928
|
},
|
|
@@ -14919,10 +14948,9 @@ class WidgetCopy extends WidgetBase {
|
|
|
14919
14948
|
return false;
|
|
14920
14949
|
},
|
|
14921
14950
|
};
|
|
14922
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
14951
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
14923
14952
|
}
|
|
14924
14953
|
|
|
14925
|
-
/** QUIZ */
|
|
14926
14954
|
class WidgetDataInput extends WidgetBase {
|
|
14927
14955
|
static DEFAULTS = {
|
|
14928
14956
|
slide: null,
|
|
@@ -14940,9 +14968,11 @@ class WidgetDataInput extends WidgetBase {
|
|
|
14940
14968
|
* @throws Error
|
|
14941
14969
|
* @param element
|
|
14942
14970
|
* @param options
|
|
14971
|
+
* @param onWidgetComplete
|
|
14972
|
+
* @param sdkApi
|
|
14943
14973
|
*/
|
|
14944
|
-
constructor(element, options) {
|
|
14945
|
-
super(element, options);
|
|
14974
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
14975
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
14946
14976
|
this.label = this.element.querySelector(".label-view .label");
|
|
14947
14977
|
this.elementRect = this.element.getBoundingClientRect();
|
|
14948
14978
|
this.inputElement = getValueOrException(this.element.querySelector(".input-view .input"), "Empty .input-view .input");
|
|
@@ -14961,7 +14991,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
14961
14991
|
this.element.classList.add("done");
|
|
14962
14992
|
this.startReadyPromise.then(() => {
|
|
14963
14993
|
if (this.disableTimer) {
|
|
14964
|
-
this.
|
|
14994
|
+
this.onWidgetComplete();
|
|
14965
14995
|
}
|
|
14966
14996
|
});
|
|
14967
14997
|
}
|
|
@@ -15078,7 +15108,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
15078
15108
|
this.setLocalData(this.localData, true);
|
|
15079
15109
|
this._statEventInputSave(text);
|
|
15080
15110
|
if (this.disableTimer) {
|
|
15081
|
-
this.
|
|
15111
|
+
this.onWidgetComplete();
|
|
15082
15112
|
needResumeUITimer = false;
|
|
15083
15113
|
}
|
|
15084
15114
|
}
|
|
@@ -15088,18 +15118,9 @@ class WidgetDataInput extends WidgetBase {
|
|
|
15088
15118
|
}
|
|
15089
15119
|
static api = {
|
|
15090
15120
|
widgetClassName: WidgetDataInput.widgetClassName,
|
|
15091
|
-
/** @deprecated */
|
|
15092
|
-
refreshUserData: WidgetDataInput.refreshUserData,
|
|
15093
15121
|
onRefreshUserData: WidgetDataInput.onRefreshUserData,
|
|
15094
|
-
init: function (element, localData) {
|
|
15095
|
-
WidgetDataInput.initWidget(element, localData, (element, options) => new WidgetDataInput(element, options));
|
|
15096
|
-
},
|
|
15097
|
-
/** @deprecated */
|
|
15098
|
-
initWidget: function (nodeList, localData) {
|
|
15099
|
-
const elements = slice.call(nodeList);
|
|
15100
|
-
WidgetDataInput.initWidgets((element, options) => new WidgetDataInput(element, options), slice.call(nodeList), localData).then(() => {
|
|
15101
|
-
elements.forEach(element => WidgetDataInput.getInstance(element)?.onStart());
|
|
15102
|
-
});
|
|
15122
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
15123
|
+
WidgetDataInput.initWidget(element, localData, (element, options) => new WidgetDataInput(element, options, onWidgetComplete, sdkApi));
|
|
15103
15124
|
},
|
|
15104
15125
|
onStart: function (element) {
|
|
15105
15126
|
WidgetDataInput.getInstance(element)?.onStart();
|
|
@@ -15121,7 +15142,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
15121
15142
|
WidgetDataInput.getInstanceById(id)?.setUserText(text);
|
|
15122
15143
|
},
|
|
15123
15144
|
};
|
|
15124
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
15145
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
15125
15146
|
}
|
|
15126
15147
|
|
|
15127
15148
|
class WidgetDateCountdown extends WidgetBase {
|
|
@@ -15149,8 +15170,8 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
15149
15170
|
thirdGroup1;
|
|
15150
15171
|
thirdGroup2;
|
|
15151
15172
|
thirdGroupCaption;
|
|
15152
|
-
constructor(element, options) {
|
|
15153
|
-
super(element, options);
|
|
15173
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
15174
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
15154
15175
|
this.label = this.element.querySelector(".label-view .label");
|
|
15155
15176
|
this.messages = {
|
|
15156
15177
|
days: getTagData(this.element, "tDays") ?? "",
|
|
@@ -15327,18 +15348,9 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
15327
15348
|
}
|
|
15328
15349
|
static api = {
|
|
15329
15350
|
widgetClassName: WidgetDateCountdown.widgetClassName,
|
|
15330
|
-
/** @deprecated */
|
|
15331
|
-
refreshUserData: WidgetDateCountdown.refreshUserData,
|
|
15332
15351
|
onRefreshUserData: WidgetDateCountdown.onRefreshUserData,
|
|
15333
|
-
init: function (element, layers, localData) {
|
|
15334
|
-
WidgetDateCountdown.initWidget(element, localData, (element, options) => new WidgetDateCountdown(element, { ...options, layers }));
|
|
15335
|
-
},
|
|
15336
|
-
/** @deprecated */
|
|
15337
|
-
initWidget: function (nodeList, layers, localData) {
|
|
15338
|
-
const elements = slice.call(nodeList);
|
|
15339
|
-
WidgetDateCountdown.initWidgets((element, options) => new WidgetDateCountdown(element, { ...options, layers }), elements, localData).then(() => {
|
|
15340
|
-
elements.forEach(element => WidgetDateCountdown.getInstance(element)?.onStart());
|
|
15341
|
-
});
|
|
15352
|
+
init: function (element, layers, localData, onWidgetComplete, sdkApi) {
|
|
15353
|
+
WidgetDateCountdown.initWidget(element, localData, (element, options) => new WidgetDateCountdown(element, { ...options, layers }, onWidgetComplete, sdkApi));
|
|
15342
15354
|
},
|
|
15343
15355
|
onStart: function (element) {
|
|
15344
15356
|
WidgetDateCountdown.getInstance(element)?.onStart();
|
|
@@ -15352,23 +15364,11 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
15352
15364
|
onResume: function (element) {
|
|
15353
15365
|
WidgetDateCountdown.getInstance(element)?.onResume();
|
|
15354
15366
|
},
|
|
15355
|
-
/** @deprecated */
|
|
15356
|
-
pause: function (nodeList) {
|
|
15357
|
-
forEach(slice.call(nodeList), function (el, index) {
|
|
15358
|
-
WidgetDateCountdown.getInstance(el)?.onPause();
|
|
15359
|
-
});
|
|
15360
|
-
},
|
|
15361
|
-
/** @deprecated */
|
|
15362
|
-
resume: function (nodeList) {
|
|
15363
|
-
forEach(slice.call(nodeList), function (el, index) {
|
|
15364
|
-
WidgetDateCountdown.getInstance(el)?.onResume();
|
|
15365
|
-
});
|
|
15366
|
-
},
|
|
15367
15367
|
};
|
|
15368
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
15368
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
15369
15369
|
}
|
|
15370
15370
|
|
|
15371
|
-
const displaySlide = function (slides, localData) {
|
|
15371
|
+
const displaySlide = function (slides, localData, sdkApi) {
|
|
15372
15372
|
const multiSlideItem = slides[0];
|
|
15373
15373
|
let cardId = undefined;
|
|
15374
15374
|
let cardType = 1 /* CARD_TYPE.STORY */;
|
|
@@ -15433,7 +15433,7 @@ const displaySlide = function (slides, localData) {
|
|
|
15433
15433
|
if (slides.length > 0) {
|
|
15434
15434
|
var slide = slides[0];
|
|
15435
15435
|
slide.classList.remove("hidden");
|
|
15436
|
-
|
|
15436
|
+
sdkApi.cardAnimation?.start(slide);
|
|
15437
15437
|
return;
|
|
15438
15438
|
}
|
|
15439
15439
|
score = 0;
|
|
@@ -15462,19 +15462,19 @@ const displaySlide = function (slides, localData) {
|
|
|
15462
15462
|
if (index === selectedIndex) {
|
|
15463
15463
|
slide.classList.remove("hidden");
|
|
15464
15464
|
undefinedResult = false;
|
|
15465
|
-
|
|
15466
|
-
_sendStatEvent(cardId, cardType, slideIndex, selectedIndex);
|
|
15465
|
+
sdkApi.cardAnimation?.start(slide);
|
|
15466
|
+
_sendStatEvent(sdkApi, cardId, cardType, slideIndex, selectedIndex);
|
|
15467
15467
|
}
|
|
15468
15468
|
});
|
|
15469
15469
|
}
|
|
15470
15470
|
if (undefinedResult) {
|
|
15471
15471
|
console.warn("undefinedResult layer index");
|
|
15472
|
-
|
|
15472
|
+
sdkApi.showLayer(0);
|
|
15473
15473
|
}
|
|
15474
15474
|
};
|
|
15475
|
-
const _sendStatEvent = function (cardId, cardType, slideIndex, layerIndex) {
|
|
15475
|
+
const _sendStatEvent = function (sdkApi, cardId, cardType, slideIndex, layerIndex) {
|
|
15476
15476
|
try {
|
|
15477
|
-
WidgetBase.sendStatisticEventToApp("layout-show", {
|
|
15477
|
+
WidgetBase.sendStatisticEventToApp(sdkApi, "layout-show", {
|
|
15478
15478
|
...WidgetBase.getStatisticEventBaseFieldsShortForm(cardId, slideIndex),
|
|
15479
15479
|
li: layerIndex,
|
|
15480
15480
|
}, {
|
|
@@ -15488,15 +15488,8 @@ const _sendStatEvent = function (cardId, cardType, slideIndex, layerIndex) {
|
|
|
15488
15488
|
};
|
|
15489
15489
|
class WidgetMultiSlide {
|
|
15490
15490
|
static api = {
|
|
15491
|
-
init: function (slides, localData) {
|
|
15492
|
-
|
|
15493
|
-
displaySlide(slides, localData);
|
|
15494
|
-
}
|
|
15495
|
-
else {
|
|
15496
|
-
WidgetBase.getLocalData().then(function (localData) {
|
|
15497
|
-
displaySlide(slides, localData);
|
|
15498
|
-
});
|
|
15499
|
-
}
|
|
15491
|
+
init: function (slides, localData, sdkApi) {
|
|
15492
|
+
displaySlide(slides, localData, sdkApi);
|
|
15500
15493
|
},
|
|
15501
15494
|
};
|
|
15502
15495
|
}
|
|
@@ -15527,9 +15520,10 @@ class WidgetPoll extends WidgetBase {
|
|
|
15527
15520
|
* @throws Error
|
|
15528
15521
|
* @param element
|
|
15529
15522
|
* @param options
|
|
15523
|
+
* @param onWidgetComplete
|
|
15530
15524
|
*/
|
|
15531
|
-
constructor(element, options) {
|
|
15532
|
-
super(element, options);
|
|
15525
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
15526
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
15533
15527
|
this.label = this.element.querySelector(".label-view .label");
|
|
15534
15528
|
this.percentFillMask = this.element.querySelector(".percent-filled-variants-view-group-mask");
|
|
15535
15529
|
this.maskedVariants = slice.call(this.element.querySelectorAll(".variants-box .variants-view-group.percent-filled-variants-view-group .variant-view"));
|
|
@@ -15638,7 +15632,7 @@ class WidgetPoll extends WidgetBase {
|
|
|
15638
15632
|
}
|
|
15639
15633
|
this.startReadyPromise.then(() => {
|
|
15640
15634
|
if (this.disableTimer) {
|
|
15641
|
-
this.
|
|
15635
|
+
this.onWidgetComplete();
|
|
15642
15636
|
}
|
|
15643
15637
|
});
|
|
15644
15638
|
}
|
|
@@ -15978,17 +15972,9 @@ class WidgetPoll extends WidgetBase {
|
|
|
15978
15972
|
}
|
|
15979
15973
|
static api = {
|
|
15980
15974
|
widgetClassName: WidgetPoll.widgetClassName,
|
|
15981
|
-
/** @deprecated */
|
|
15982
|
-
refreshUserData: WidgetPoll.refreshUserData,
|
|
15983
15975
|
onRefreshUserData: WidgetPoll.onRefreshUserData,
|
|
15984
|
-
init: function (element, localData) {
|
|
15985
|
-
WidgetPoll.initWidget(element, localData, (element, options) => new WidgetPoll(element, options));
|
|
15986
|
-
},
|
|
15987
|
-
/** @deprecated */
|
|
15988
|
-
initWidget: function (element, localData) {
|
|
15989
|
-
WidgetPoll.initWidgets((element, options) => new WidgetPoll(element, options), [element], localData).then(() => {
|
|
15990
|
-
WidgetPoll.getInstance(element)?.onStart();
|
|
15991
|
-
});
|
|
15976
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
15977
|
+
WidgetPoll.initWidget(element, localData, (element, options) => new WidgetPoll(element, options, onWidgetComplete, sdkApi));
|
|
15992
15978
|
},
|
|
15993
15979
|
onStart: function (element) {
|
|
15994
15980
|
WidgetPoll.getInstance(element)?.onStart();
|
|
@@ -16034,7 +16020,7 @@ class WidgetPoll extends WidgetBase {
|
|
|
16034
16020
|
}
|
|
16035
16021
|
},
|
|
16036
16022
|
};
|
|
16037
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
16023
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
16038
16024
|
}
|
|
16039
16025
|
|
|
16040
16026
|
class WidgetPollLayers extends WidgetBase {
|
|
@@ -16051,8 +16037,8 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16051
16037
|
variantsTexts;
|
|
16052
16038
|
selectedVariant;
|
|
16053
16039
|
layers;
|
|
16054
|
-
constructor(element, options) {
|
|
16055
|
-
super(element, options);
|
|
16040
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
16041
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
16056
16042
|
this.layers = this.options.layers;
|
|
16057
16043
|
this.label = this.element.querySelector(".label-view .label");
|
|
16058
16044
|
this.variants = slice.call(this.element.querySelectorAll(".variants-box .variant-view"));
|
|
@@ -16124,7 +16110,7 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16124
16110
|
this._showLayer(this.layers, layerIndex, userAction);
|
|
16125
16111
|
this.startReadyPromise.then(() => {
|
|
16126
16112
|
if (this.disableTimer) {
|
|
16127
|
-
this.
|
|
16113
|
+
this.onWidgetComplete();
|
|
16128
16114
|
}
|
|
16129
16115
|
});
|
|
16130
16116
|
}
|
|
@@ -16163,28 +16149,9 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16163
16149
|
}
|
|
16164
16150
|
static api = {
|
|
16165
16151
|
widgetClassName: WidgetPollLayers.widgetClassName,
|
|
16166
|
-
/** @deprecated */
|
|
16167
|
-
refreshUserData: WidgetPollLayers.refreshUserData,
|
|
16168
16152
|
onRefreshUserData: WidgetPollLayers.onRefreshUserData,
|
|
16169
|
-
init: function (element, layers, localData) {
|
|
16170
|
-
WidgetPollLayers.initWidget(element, localData, (element, options) => new WidgetPollLayers(element, { ...options, layers }));
|
|
16171
|
-
},
|
|
16172
|
-
/** @deprecated
|
|
16173
|
-
*
|
|
16174
|
-
* signature variants
|
|
16175
|
-
* (widget, layers, undefined) - modern web sdk
|
|
16176
|
-
* (widget, undefined, layers) - old web sdk and rn
|
|
16177
|
-
* (widget, layers, localData) - native sdk
|
|
16178
|
-
*/
|
|
16179
|
-
initWidget: function (element, layers, localData) {
|
|
16180
|
-
if (layers === undefined && localData !== undefined) {
|
|
16181
|
-
// @ts-ignore
|
|
16182
|
-
layers = localData;
|
|
16183
|
-
localData = undefined;
|
|
16184
|
-
}
|
|
16185
|
-
WidgetPollLayers.initWidgets((element, options) => new WidgetPollLayers(element, { ...options, layers }), [element], localData).then(() => {
|
|
16186
|
-
WidgetPollLayers.getInstance(element)?.onStart();
|
|
16187
|
-
});
|
|
16153
|
+
init: function (element, layers, localData, onWidgetComplete, sdkApi) {
|
|
16154
|
+
WidgetPollLayers.initWidget(element, localData, (element, options) => new WidgetPollLayers(element, { ...options, layers }, onWidgetComplete, sdkApi));
|
|
16188
16155
|
},
|
|
16189
16156
|
onStart: function (element) {
|
|
16190
16157
|
WidgetPollLayers.getInstance(element)?.onStart();
|
|
@@ -16208,7 +16175,7 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16208
16175
|
return false;
|
|
16209
16176
|
},
|
|
16210
16177
|
};
|
|
16211
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
16178
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
16212
16179
|
}
|
|
16213
16180
|
|
|
16214
16181
|
class Formatter {
|
|
@@ -16835,8 +16802,8 @@ class WidgetProducts extends WidgetBase {
|
|
|
16835
16802
|
swipeGestureDetector = null;
|
|
16836
16803
|
isClickCapturedByWidget = false;
|
|
16837
16804
|
isScreenSupportsTouch = false;
|
|
16838
|
-
constructor(element, options) {
|
|
16839
|
-
super(element, options);
|
|
16805
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
16806
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
16840
16807
|
this.captionView = this.element.querySelector(".narrative-element-text-lines");
|
|
16841
16808
|
const linkTarget = decodeURIComponent(getTagData(element, "linkTarget") ?? "[]");
|
|
16842
16809
|
try {
|
|
@@ -17311,8 +17278,8 @@ class WidgetProducts extends WidgetBase {
|
|
|
17311
17278
|
static api = {
|
|
17312
17279
|
widgetClassName: WidgetProducts.widgetClassName,
|
|
17313
17280
|
onRefreshUserData: WidgetProducts.onRefreshUserData,
|
|
17314
|
-
init: function (element, localData) {
|
|
17315
|
-
WidgetProducts.initWidget(element, localData, (element, options) => new WidgetProducts(element, options));
|
|
17281
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
17282
|
+
WidgetProducts.initWidget(element, localData, (element, options) => new WidgetProducts(element, options, onWidgetComplete, sdkApi));
|
|
17316
17283
|
},
|
|
17317
17284
|
onStart: function (element) {
|
|
17318
17285
|
WidgetProducts.getInstance(element)?.onStart();
|
|
@@ -17361,7 +17328,7 @@ class WidgetProducts extends WidgetBase {
|
|
|
17361
17328
|
return false;
|
|
17362
17329
|
},
|
|
17363
17330
|
};
|
|
17364
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
17331
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
17365
17332
|
}
|
|
17366
17333
|
|
|
17367
17334
|
class WidgetQuest extends WidgetBase {
|
|
@@ -17381,11 +17348,11 @@ class WidgetQuest extends WidgetBase {
|
|
|
17381
17348
|
navigationNextSlide;
|
|
17382
17349
|
slideDisabledNavigation;
|
|
17383
17350
|
finalSlide;
|
|
17384
|
-
constructor(element, options) {
|
|
17351
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
17385
17352
|
const isWidget = !hasClass(element, "narrative-slide");
|
|
17386
17353
|
const elementIdGetter = (element) => getValueOrDefault(getTagData(element, "elementId"), "");
|
|
17387
17354
|
const slideGetter = (element) => isWidget ? getValueOrException(element.closest(".narrative-slide"), "Empty slide") : element;
|
|
17388
|
-
super(element, options, elementIdGetter, slideGetter);
|
|
17355
|
+
super(element, options, onWidgetComplete, sdkApi, elementIdGetter, slideGetter);
|
|
17389
17356
|
this.isWidget = isWidget;
|
|
17390
17357
|
this.slideCount = getTagDataAsNumber(this.slide, "slideCount") ?? 0;
|
|
17391
17358
|
const nonFinalSlide = getTagDataAsNumber(this.slide, "nonFinalSlide");
|
|
@@ -17582,6 +17549,14 @@ class WidgetQuest extends WidgetBase {
|
|
|
17582
17549
|
if (this.nonFinalSlide == null) {
|
|
17583
17550
|
// widget v2 (with navigationNextSlide)
|
|
17584
17551
|
if (directionForward) {
|
|
17552
|
+
if (this.navigationNextSlide === -1) {
|
|
17553
|
+
// this is the final slide - exit from this quest
|
|
17554
|
+
if (this.sdkApi.isExistsShowNextCard) {
|
|
17555
|
+
this.sdkApi.cardShowNext();
|
|
17556
|
+
}
|
|
17557
|
+
result.continueDefaultNavigation = false;
|
|
17558
|
+
return result;
|
|
17559
|
+
}
|
|
17585
17560
|
const nextSlideIndex = this.navigationNextSlide ?? event.slideIndex + 1;
|
|
17586
17561
|
if (nextSlideIndex < this.slideCount) {
|
|
17587
17562
|
this._addNewRouteHistory(nextSlideIndex);
|
|
@@ -17683,12 +17658,10 @@ class WidgetQuest extends WidgetBase {
|
|
|
17683
17658
|
}
|
|
17684
17659
|
static api = {
|
|
17685
17660
|
widgetClassName: WidgetQuest.widgetClassName,
|
|
17686
|
-
/** @deprecated */
|
|
17687
|
-
refreshUserData: WidgetQuest.refreshUserData,
|
|
17688
17661
|
onRefreshUserData: WidgetQuest.onRefreshUserData,
|
|
17689
|
-
init: function (element, localData) {
|
|
17662
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
17690
17663
|
return new Promise(function (resolve, reject) {
|
|
17691
|
-
WidgetQuest.initWidget(element, localData, (element, options) => new WidgetQuest(element, options)).then(localData => {
|
|
17664
|
+
WidgetQuest.initWidget(element, localData, (element, options) => new WidgetQuest(element, options, onWidgetComplete, sdkApi)).then(localData => {
|
|
17692
17665
|
const widget = WidgetQuest.getInstance(element);
|
|
17693
17666
|
if (widget) {
|
|
17694
17667
|
resolve(widget.init());
|
|
@@ -17699,22 +17672,6 @@ class WidgetQuest extends WidgetBase {
|
|
|
17699
17672
|
});
|
|
17700
17673
|
});
|
|
17701
17674
|
},
|
|
17702
|
-
/** @deprecated */
|
|
17703
|
-
initWidget: function (element, localData) {
|
|
17704
|
-
return new Promise(function (resolve, reject) {
|
|
17705
|
-
WidgetQuest.initWidgets((element, options) => new WidgetQuest(element, options), [element], localData).then(localData => {
|
|
17706
|
-
const widget = WidgetQuest.getInstance(element);
|
|
17707
|
-
if (widget) {
|
|
17708
|
-
const result = widget.init();
|
|
17709
|
-
widget.onStart();
|
|
17710
|
-
resolve(result);
|
|
17711
|
-
}
|
|
17712
|
-
else {
|
|
17713
|
-
resolve(true);
|
|
17714
|
-
}
|
|
17715
|
-
});
|
|
17716
|
-
});
|
|
17717
|
-
},
|
|
17718
17675
|
onStart: function (element) {
|
|
17719
17676
|
WidgetQuest.getInstance(element)?.onStart();
|
|
17720
17677
|
},
|
|
@@ -17746,7 +17703,7 @@ class WidgetQuest extends WidgetBase {
|
|
|
17746
17703
|
return { continueDefaultNavigation: true };
|
|
17747
17704
|
},
|
|
17748
17705
|
};
|
|
17749
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
17706
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
17750
17707
|
}
|
|
17751
17708
|
|
|
17752
17709
|
class WidgetQuiz extends WidgetBase {
|
|
@@ -17761,8 +17718,8 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17761
17718
|
answers;
|
|
17762
17719
|
questionCount;
|
|
17763
17720
|
selectedAnswer;
|
|
17764
|
-
constructor(element, options) {
|
|
17765
|
-
super(element, options);
|
|
17721
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
17722
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
17766
17723
|
this.question = this.element.querySelector(".label-view .label");
|
|
17767
17724
|
this.answers = slice.call(this.element.querySelectorAll(".variants-box .variant-view-group"));
|
|
17768
17725
|
this.questionCount = getValueOrException(getTagDataAsNumber(this.slide, "quizCount"), "Empty quizCount");
|
|
@@ -17817,7 +17774,7 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17817
17774
|
// }
|
|
17818
17775
|
this.startReadyPromise.then(() => {
|
|
17819
17776
|
if (this.disableTimer) {
|
|
17820
|
-
this.
|
|
17777
|
+
this.onWidgetComplete();
|
|
17821
17778
|
}
|
|
17822
17779
|
});
|
|
17823
17780
|
}
|
|
@@ -17909,17 +17866,9 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17909
17866
|
}
|
|
17910
17867
|
static api = {
|
|
17911
17868
|
widgetClassName: WidgetQuiz.widgetClassName,
|
|
17912
|
-
/** @deprecated */
|
|
17913
|
-
refreshUserData: WidgetQuiz.refreshUserData,
|
|
17914
17869
|
onRefreshUserData: WidgetQuiz.onRefreshUserData,
|
|
17915
|
-
init: function (element, localData) {
|
|
17916
|
-
WidgetQuiz.initWidget(element, localData, (element, options) => new WidgetQuiz(element, options));
|
|
17917
|
-
},
|
|
17918
|
-
/** @deprecated */
|
|
17919
|
-
initWidget: function (element, localData) {
|
|
17920
|
-
WidgetQuiz.initWidgets((element, options) => new WidgetQuiz(element, options), [element], localData).then(() => {
|
|
17921
|
-
WidgetQuiz.getInstance(element)?.onStart();
|
|
17922
|
-
});
|
|
17870
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
17871
|
+
WidgetQuiz.initWidget(element, localData, (element, options) => new WidgetQuiz(element, options, onWidgetComplete, sdkApi));
|
|
17923
17872
|
},
|
|
17924
17873
|
onStart: function (element) {
|
|
17925
17874
|
WidgetQuiz.getInstance(element)?.onStart();
|
|
@@ -17948,7 +17897,7 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17948
17897
|
return true;
|
|
17949
17898
|
},
|
|
17950
17899
|
};
|
|
17951
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
17900
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
17952
17901
|
}
|
|
17953
17902
|
|
|
17954
17903
|
class WidgetQuizGrouped extends WidgetBase {
|
|
@@ -17967,9 +17916,11 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
17967
17916
|
* @throws Error
|
|
17968
17917
|
* @param element
|
|
17969
17918
|
* @param options
|
|
17919
|
+
* @param onWidgetComplete
|
|
17920
|
+
* @param sdkApi
|
|
17970
17921
|
*/
|
|
17971
|
-
constructor(element, options) {
|
|
17972
|
-
super(element, options);
|
|
17922
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
17923
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
17973
17924
|
this.question = this.element.querySelector(".label-view .label");
|
|
17974
17925
|
this.answers = slice.call(this.element.querySelectorAll(".variants-box .variant-view-group"));
|
|
17975
17926
|
this.questionCount = getValueOrException(getTagDataAsNumber(this.slide, "quizCount"), "Empty quizCount");
|
|
@@ -18011,7 +17962,7 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
18011
17962
|
});
|
|
18012
17963
|
this.startReadyPromise.then(() => {
|
|
18013
17964
|
if (this.disableTimer) {
|
|
18014
|
-
this.
|
|
17965
|
+
this.onWidgetComplete();
|
|
18015
17966
|
}
|
|
18016
17967
|
});
|
|
18017
17968
|
}
|
|
@@ -18120,17 +18071,9 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
18120
18071
|
}
|
|
18121
18072
|
static api = {
|
|
18122
18073
|
widgetClassName: WidgetQuizGrouped.widgetClassName,
|
|
18123
|
-
/** @deprecated */
|
|
18124
|
-
refreshUserData: WidgetQuizGrouped.refreshUserData,
|
|
18125
18074
|
onRefreshUserData: WidgetQuizGrouped.onRefreshUserData,
|
|
18126
|
-
init: function (element, localData) {
|
|
18127
|
-
WidgetQuizGrouped.initWidget(element, localData, (element, options) => new WidgetQuizGrouped(element, options));
|
|
18128
|
-
},
|
|
18129
|
-
/** @deprecated */
|
|
18130
|
-
initWidget: function (element, localData) {
|
|
18131
|
-
WidgetQuizGrouped.initWidgets((element, options) => new WidgetQuizGrouped(element, options), [element], localData).then(() => {
|
|
18132
|
-
WidgetQuizGrouped.getInstance(element)?.onStart();
|
|
18133
|
-
});
|
|
18075
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
18076
|
+
WidgetQuizGrouped.initWidget(element, localData, (element, options) => new WidgetQuizGrouped(element, options, onWidgetComplete, sdkApi));
|
|
18134
18077
|
},
|
|
18135
18078
|
onStart: function (element) {
|
|
18136
18079
|
WidgetQuizGrouped.getInstance(element)?.onStart();
|
|
@@ -18159,7 +18102,7 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
18159
18102
|
return true;
|
|
18160
18103
|
},
|
|
18161
18104
|
};
|
|
18162
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
18105
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
18163
18106
|
}
|
|
18164
18107
|
|
|
18165
18108
|
// Polyfill Number.isNaN(value)
|
|
@@ -18329,9 +18272,10 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18329
18272
|
* @throws Error
|
|
18330
18273
|
* @param element
|
|
18331
18274
|
* @param options
|
|
18275
|
+
* @param onWidgetComplete
|
|
18332
18276
|
*/
|
|
18333
|
-
constructor(element, options) {
|
|
18334
|
-
super(element, options);
|
|
18277
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
18278
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
18335
18279
|
this.hasSubmitButton = Boolean(this.element.querySelector(".submit-button-view"));
|
|
18336
18280
|
this.topScale = this.element.querySelector(".top-scale-bar-view-group");
|
|
18337
18281
|
this.snapPosition = false;
|
|
@@ -18400,7 +18344,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18400
18344
|
this.displayAverageAnswer();
|
|
18401
18345
|
this.startReadyPromise.then(() => {
|
|
18402
18346
|
if (this.disableTimer) {
|
|
18403
|
-
this.
|
|
18347
|
+
this.onWidgetComplete();
|
|
18404
18348
|
}
|
|
18405
18349
|
});
|
|
18406
18350
|
}
|
|
@@ -18476,7 +18420,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18476
18420
|
}
|
|
18477
18421
|
});
|
|
18478
18422
|
// if (this.disableTimer) {
|
|
18479
|
-
this.
|
|
18423
|
+
this.onWidgetComplete();
|
|
18480
18424
|
// }
|
|
18481
18425
|
this.setLocalData(this.localData, true);
|
|
18482
18426
|
this._statEventInputSave(this.localData["_rs_g_" + this.elementId + "_v"]);
|
|
@@ -18773,17 +18717,9 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18773
18717
|
}
|
|
18774
18718
|
static api = {
|
|
18775
18719
|
widgetClassName: WidgetRangeSlider.widgetClassName,
|
|
18776
|
-
/** @deprecated */
|
|
18777
|
-
refreshUserData: WidgetRangeSlider.refreshUserData,
|
|
18778
18720
|
onRefreshUserData: WidgetRangeSlider.onRefreshUserData,
|
|
18779
|
-
init: function (element, localData) {
|
|
18780
|
-
WidgetRangeSlider.initWidget(element, localData, (element, options) => new WidgetRangeSlider(element, options));
|
|
18781
|
-
},
|
|
18782
|
-
/** @deprecated */
|
|
18783
|
-
initWidget: function (element, localData) {
|
|
18784
|
-
WidgetRangeSlider.initWidgets((element, options) => new WidgetRangeSlider(element, options), [element], localData).then(() => {
|
|
18785
|
-
WidgetRangeSlider.getInstance(element)?.onStart();
|
|
18786
|
-
});
|
|
18721
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
18722
|
+
WidgetRangeSlider.initWidget(element, localData, (element, options) => new WidgetRangeSlider(element, options, onWidgetComplete, sdkApi));
|
|
18787
18723
|
},
|
|
18788
18724
|
onStart: function (element) {
|
|
18789
18725
|
WidgetRangeSlider.getInstance(element)?.onStart();
|
|
@@ -18812,7 +18748,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18812
18748
|
return false;
|
|
18813
18749
|
},
|
|
18814
18750
|
};
|
|
18815
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
18751
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
18816
18752
|
}
|
|
18817
18753
|
|
|
18818
18754
|
class WidgetRate extends WidgetBase {
|
|
@@ -18835,8 +18771,8 @@ class WidgetRate extends WidgetBase {
|
|
|
18835
18771
|
selectedStar;
|
|
18836
18772
|
answerSelectDuration;
|
|
18837
18773
|
elementRect;
|
|
18838
|
-
constructor(element, options) {
|
|
18839
|
-
super(element, options);
|
|
18774
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
18775
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
18840
18776
|
this.label = this.element.querySelector(".label-view .label");
|
|
18841
18777
|
this.stars = slice.call(this.element.querySelectorAll(".input-view"));
|
|
18842
18778
|
this.submitToStores = Boolean(getValueOrDefault(getTagDataAsNumber(this.element, "submitToStores"), 0));
|
|
@@ -18911,7 +18847,7 @@ class WidgetRate extends WidgetBase {
|
|
|
18911
18847
|
this.element.classList.add("done");
|
|
18912
18848
|
this.startReadyPromise.then(() => {
|
|
18913
18849
|
if (this.disableTimer && runTimer) {
|
|
18914
|
-
this.
|
|
18850
|
+
this.onWidgetComplete();
|
|
18915
18851
|
}
|
|
18916
18852
|
});
|
|
18917
18853
|
}
|
|
@@ -19038,18 +18974,9 @@ class WidgetRate extends WidgetBase {
|
|
|
19038
18974
|
}
|
|
19039
18975
|
static api = {
|
|
19040
18976
|
widgetClassName: WidgetRate.widgetClassName,
|
|
19041
|
-
/** @deprecated */
|
|
19042
|
-
refreshUserData: WidgetRate.refreshUserData,
|
|
19043
18977
|
onRefreshUserData: WidgetRate.onRefreshUserData,
|
|
19044
|
-
init: function (element, localData) {
|
|
19045
|
-
WidgetRate.initWidget(element, localData, (element, options) => new WidgetRate(element, options));
|
|
19046
|
-
},
|
|
19047
|
-
/** @deprecated */
|
|
19048
|
-
initWidget: function (nodeList, localData) {
|
|
19049
|
-
const elements = slice.call(nodeList);
|
|
19050
|
-
WidgetRate.initWidgets((element, options) => new WidgetRate(element, options), elements, localData).then(() => {
|
|
19051
|
-
elements.forEach(element => WidgetRate.getInstance(element)?.onStart());
|
|
19052
|
-
});
|
|
18978
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
18979
|
+
WidgetRate.initWidget(element, localData, (element, options) => new WidgetRate(element, options, onWidgetComplete, sdkApi));
|
|
19053
18980
|
},
|
|
19054
18981
|
onStart: function (element) {
|
|
19055
18982
|
WidgetRate.getInstance(element)?.onStart();
|
|
@@ -19078,7 +19005,7 @@ class WidgetRate extends WidgetBase {
|
|
|
19078
19005
|
WidgetRate.getInstanceById(id)?.setUserText(text);
|
|
19079
19006
|
},
|
|
19080
19007
|
};
|
|
19081
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19008
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
19082
19009
|
}
|
|
19083
19010
|
|
|
19084
19011
|
class WidgetShare extends WidgetBase {
|
|
@@ -19095,8 +19022,8 @@ class WidgetShare extends WidgetBase {
|
|
|
19095
19022
|
shareTarget;
|
|
19096
19023
|
withLayer;
|
|
19097
19024
|
btnDisabled;
|
|
19098
|
-
constructor(element, options) {
|
|
19099
|
-
super(element, options);
|
|
19025
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
19026
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
19100
19027
|
this.shareType = getTagData(this.element, "shareType");
|
|
19101
19028
|
this.shareTarget = getTagData(this.element, "shareTarget");
|
|
19102
19029
|
this.layers = this.options.layers;
|
|
@@ -19118,7 +19045,7 @@ class WidgetShare extends WidgetBase {
|
|
|
19118
19045
|
}
|
|
19119
19046
|
this.startReadyPromise.then(() => {
|
|
19120
19047
|
if (this.isDone() && this.disableTimer) {
|
|
19121
|
-
this.
|
|
19048
|
+
this.onWidgetComplete();
|
|
19122
19049
|
}
|
|
19123
19050
|
});
|
|
19124
19051
|
this.btnDisabled = false;
|
|
@@ -19178,7 +19105,7 @@ class WidgetShare extends WidgetBase {
|
|
|
19178
19105
|
this._showLayer(this.layers, 1, true);
|
|
19179
19106
|
}
|
|
19180
19107
|
if (this.disableTimer) {
|
|
19181
|
-
this.
|
|
19108
|
+
this.onWidgetComplete();
|
|
19182
19109
|
}
|
|
19183
19110
|
this.btnDisabled = false;
|
|
19184
19111
|
}
|
|
@@ -19187,31 +19114,12 @@ class WidgetShare extends WidgetBase {
|
|
|
19187
19114
|
}
|
|
19188
19115
|
static api = {
|
|
19189
19116
|
widgetClassName: WidgetShare.widgetClassName,
|
|
19190
|
-
/** @deprecated */
|
|
19191
|
-
refreshUserData: WidgetShare.refreshUserData,
|
|
19192
19117
|
onRefreshUserData: WidgetShare.onRefreshUserData,
|
|
19193
|
-
init: function (element, layers, localData) {
|
|
19118
|
+
init: function (element, layers, localData, onWidgetComplete, sdkApi) {
|
|
19194
19119
|
WidgetShare.initWidget(element, localData, (element, options) => new WidgetShare(element, {
|
|
19195
19120
|
...options,
|
|
19196
19121
|
layers,
|
|
19197
|
-
}));
|
|
19198
|
-
},
|
|
19199
|
-
/** @deprecated
|
|
19200
|
-
* signature variants
|
|
19201
|
-
* (widget, layers, undefined) - modern web sdk
|
|
19202
|
-
* (widget, undefined, layers) - old web sdk and rn
|
|
19203
|
-
* (widget, layers, localData) - native sdk
|
|
19204
|
-
*/
|
|
19205
|
-
initWidget: function (nodeList, layers, localData) {
|
|
19206
|
-
if (layers === undefined && localData !== undefined) {
|
|
19207
|
-
// @ts-ignore
|
|
19208
|
-
layers = localData;
|
|
19209
|
-
localData = undefined;
|
|
19210
|
-
}
|
|
19211
|
-
const elements = slice.call(nodeList);
|
|
19212
|
-
WidgetShare.initWidgets((element, options) => new WidgetShare(element, { ...options, layers }), elements, localData).then(() => {
|
|
19213
|
-
elements.forEach(element => WidgetShare.getInstance(element)?.onStart());
|
|
19214
|
-
});
|
|
19122
|
+
}, onWidgetComplete, sdkApi));
|
|
19215
19123
|
},
|
|
19216
19124
|
onStart: function (element) {
|
|
19217
19125
|
WidgetShare.getInstance(element)?.onStart();
|
|
@@ -19232,7 +19140,7 @@ class WidgetShare extends WidgetBase {
|
|
|
19232
19140
|
WidgetShare.getInstanceById(id)?._complete(isSuccess);
|
|
19233
19141
|
},
|
|
19234
19142
|
};
|
|
19235
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19143
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
19236
19144
|
}
|
|
19237
19145
|
|
|
19238
19146
|
class WidgetTest extends WidgetBase {
|
|
@@ -19257,8 +19165,8 @@ class WidgetTest extends WidgetBase {
|
|
|
19257
19165
|
timeLeftDefault;
|
|
19258
19166
|
timeline;
|
|
19259
19167
|
isWidgetTimerInit = false;
|
|
19260
|
-
constructor(element, options) {
|
|
19261
|
-
super(element, options);
|
|
19168
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
19169
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
19262
19170
|
this.label = this.element.querySelector(".label-view .label");
|
|
19263
19171
|
this.variants = slice.call(this.element.querySelectorAll(".variants-box .variant-view"));
|
|
19264
19172
|
this.testCount = getValueOrException(getTagDataAsNumber(this.slide, "testCount"), "Empty testCount");
|
|
@@ -19413,7 +19321,7 @@ class WidgetTest extends WidgetBase {
|
|
|
19413
19321
|
});
|
|
19414
19322
|
this.startReadyPromise.then(() => {
|
|
19415
19323
|
if (this.disableTimer) {
|
|
19416
|
-
this.
|
|
19324
|
+
this.onWidgetComplete();
|
|
19417
19325
|
}
|
|
19418
19326
|
});
|
|
19419
19327
|
}
|
|
@@ -19485,17 +19393,9 @@ class WidgetTest extends WidgetBase {
|
|
|
19485
19393
|
}
|
|
19486
19394
|
static api = {
|
|
19487
19395
|
widgetClassName: WidgetTest.widgetClassName,
|
|
19488
|
-
/** @deprecated */
|
|
19489
|
-
refreshUserData: WidgetTest.refreshUserData,
|
|
19490
19396
|
onRefreshUserData: WidgetTest.onRefreshUserData,
|
|
19491
|
-
init: function (element, localData) {
|
|
19492
|
-
WidgetTest.initWidget(element, localData, (element, options) => new WidgetTest(element, options));
|
|
19493
|
-
},
|
|
19494
|
-
/** @deprecated */
|
|
19495
|
-
initWidget: function (element, localData) {
|
|
19496
|
-
WidgetTest.initWidgets((element, options) => new WidgetTest(element, options), [element], localData).then(() => {
|
|
19497
|
-
WidgetTest.getInstance(element)?.onStart();
|
|
19498
|
-
});
|
|
19397
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
19398
|
+
WidgetTest.initWidget(element, localData, (element, options) => new WidgetTest(element, options, onWidgetComplete, sdkApi));
|
|
19499
19399
|
},
|
|
19500
19400
|
onStart: function (element) {
|
|
19501
19401
|
WidgetTest.getInstance(element)?.onStart();
|
|
@@ -19531,7 +19431,7 @@ class WidgetTest extends WidgetBase {
|
|
|
19531
19431
|
return true;
|
|
19532
19432
|
},
|
|
19533
19433
|
};
|
|
19534
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19434
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
19535
19435
|
}
|
|
19536
19436
|
|
|
19537
19437
|
class WidgetVote extends WidgetBase {
|
|
@@ -19557,9 +19457,11 @@ class WidgetVote extends WidgetBase {
|
|
|
19557
19457
|
* @throws Error
|
|
19558
19458
|
* @param element
|
|
19559
19459
|
* @param options
|
|
19460
|
+
* @param onWidgetComplete
|
|
19461
|
+
* @param sdkApi
|
|
19560
19462
|
*/
|
|
19561
|
-
constructor(element, options) {
|
|
19562
|
-
super(element, options);
|
|
19463
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
19464
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
19563
19465
|
this.voteAllocation = getTagData(this.slide, "voteAllocation");
|
|
19564
19466
|
this.label = this.element.querySelector(".label-view .label");
|
|
19565
19467
|
this.variants = slice.call(this.element.querySelectorAll(".variants-box .variant-view-group"));
|
|
@@ -19743,7 +19645,7 @@ class WidgetVote extends WidgetBase {
|
|
|
19743
19645
|
}
|
|
19744
19646
|
this.startReadyPromise.then(() => {
|
|
19745
19647
|
if (this.disableTimer) {
|
|
19746
|
-
this.
|
|
19648
|
+
this.onWidgetComplete();
|
|
19747
19649
|
}
|
|
19748
19650
|
});
|
|
19749
19651
|
}
|
|
@@ -19941,45 +19843,9 @@ class WidgetVote extends WidgetBase {
|
|
|
19941
19843
|
}
|
|
19942
19844
|
static api = {
|
|
19943
19845
|
widgetClassName: WidgetVote.widgetClassName,
|
|
19944
|
-
/** @deprecated */
|
|
19945
|
-
refreshUserData: WidgetVote.refreshUserData,
|
|
19946
19846
|
onRefreshUserData: WidgetVote.onRefreshUserData,
|
|
19947
|
-
init: function (element, localData) {
|
|
19948
|
-
WidgetVote.initWidget(element, localData, (element, options) => new WidgetVote(element, options));
|
|
19949
|
-
},
|
|
19950
|
-
/** @deprecated
|
|
19951
|
-
*
|
|
19952
|
-
* fix for WidgetVote on every layer of multilayers story
|
|
19953
|
-
*/
|
|
19954
|
-
fallbackInitOnMultiSlide: function (element, localData) {
|
|
19955
|
-
if (element.dataset.fallbackInitOnMultiSlide) {
|
|
19956
|
-
return;
|
|
19957
|
-
}
|
|
19958
|
-
const multiSlide = element.closest(".narrative-multi-slide");
|
|
19959
|
-
if (multiSlide != null) {
|
|
19960
|
-
const container = multiSlide.parentElement;
|
|
19961
|
-
const widgetElements = container?.querySelectorAll(`.${WidgetVote.widgetClassName}`);
|
|
19962
|
-
if (widgetElements != null) {
|
|
19963
|
-
for (let i = 0; i < widgetElements.length; ++i) {
|
|
19964
|
-
const widgetElement = widgetElements[i];
|
|
19965
|
-
const widget = WidgetVote.getInstance(widgetElement);
|
|
19966
|
-
if (!widget) {
|
|
19967
|
-
WidgetVote.initWidgets((element, options) => new WidgetVote(element, options), [widgetElement], localData);
|
|
19968
|
-
}
|
|
19969
|
-
}
|
|
19970
|
-
}
|
|
19971
|
-
}
|
|
19972
|
-
element.dataset.fallbackInitOnMultiSlide = "1";
|
|
19973
|
-
},
|
|
19974
|
-
/** @deprecated */
|
|
19975
|
-
initWidget: function (element, localData) {
|
|
19976
|
-
WidgetVote.initWidgets((element, options) => new WidgetVote(element, options), [element], localData)
|
|
19977
|
-
.then(localData => {
|
|
19978
|
-
WidgetVote.api.fallbackInitOnMultiSlide(element, localData);
|
|
19979
|
-
})
|
|
19980
|
-
.then(() => {
|
|
19981
|
-
WidgetVote.getInstance(element)?.onStart();
|
|
19982
|
-
});
|
|
19847
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
19848
|
+
WidgetVote.initWidget(element, localData, (element, options) => new WidgetVote(element, options, onWidgetComplete, sdkApi));
|
|
19983
19849
|
},
|
|
19984
19850
|
onStart: function (element) {
|
|
19985
19851
|
WidgetVote.getInstance(element)?.onStart();
|
|
@@ -20015,7 +19881,7 @@ class WidgetVote extends WidgetBase {
|
|
|
20015
19881
|
return true;
|
|
20016
19882
|
},
|
|
20017
19883
|
};
|
|
20018
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19884
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
20019
19885
|
}
|
|
20020
19886
|
|
|
20021
19887
|
class EsModuleLayoutApi {
|