@inappstory/slide-api 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +798 -880
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +366 -349
- package/dist/index.d.ts +366 -349
- package/dist/index.js +798 -880
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -197,41 +197,31 @@ const container = new DIContainer();
|
|
|
197
197
|
|
|
198
198
|
class WidgetsService {
|
|
199
199
|
_env;
|
|
200
|
-
|
|
201
|
-
constructor(_env, _sdkApi) {
|
|
200
|
+
constructor(_env) {
|
|
202
201
|
this._env = _env;
|
|
203
|
-
this._sdkApi = _sdkApi;
|
|
204
202
|
}
|
|
205
203
|
get env() {
|
|
206
204
|
return this._env;
|
|
207
205
|
}
|
|
208
|
-
get
|
|
209
|
-
return this._sdkApi;
|
|
210
|
-
}
|
|
211
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Window`, `SDKApi`]; }
|
|
206
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Window`]; }
|
|
212
207
|
}
|
|
213
208
|
|
|
214
209
|
container.registerSingleton(undefined, { identifier: `WidgetsService`, implementation: WidgetsService });
|
|
215
210
|
|
|
216
211
|
class LayoutService {
|
|
217
212
|
_env;
|
|
218
|
-
_sdkApi;
|
|
219
213
|
_layoutApi;
|
|
220
|
-
constructor(_env,
|
|
214
|
+
constructor(_env, _layoutApi) {
|
|
221
215
|
this._env = _env;
|
|
222
|
-
this._sdkApi = _sdkApi;
|
|
223
216
|
this._layoutApi = _layoutApi;
|
|
224
217
|
}
|
|
225
218
|
get env() {
|
|
226
219
|
return this._env;
|
|
227
220
|
}
|
|
228
|
-
get sdkApi() {
|
|
229
|
-
return this._sdkApi;
|
|
230
|
-
}
|
|
231
221
|
get layoutApi() {
|
|
232
222
|
return this._layoutApi;
|
|
233
223
|
}
|
|
234
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Window`, `
|
|
224
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Window`, `ILayoutApi`]; }
|
|
235
225
|
}
|
|
236
226
|
|
|
237
227
|
container.registerSingleton(undefined, { identifier: `LayoutService`, implementation: LayoutService });
|
|
@@ -243,8 +233,6 @@ container.registerSingleton(undefined, { identifier: `LayoutService`, implementa
|
|
|
243
233
|
// import '../effects/timer/composition';
|
|
244
234
|
container.registerSingleton(() => window, { identifier: `Window` });
|
|
245
235
|
|
|
246
|
-
const DEFAULT_SLIDE_DURATION = 10000;
|
|
247
|
-
|
|
248
236
|
const arPrototype = Array.prototype;
|
|
249
237
|
const obPrototype = Object.prototype;
|
|
250
238
|
const slice = arPrototype.slice;
|
|
@@ -1054,30 +1042,25 @@ class EsModuleSdkApi {
|
|
|
1054
1042
|
this.sdkBinding = sdkBinding;
|
|
1055
1043
|
}
|
|
1056
1044
|
getCardServerData(cardId) {
|
|
1057
|
-
return this.sdkBinding
|
|
1045
|
+
return this.sdkBinding.getCardServerData(cardId);
|
|
1058
1046
|
}
|
|
1059
1047
|
updateCardServerDataLocally(cardId, data) {
|
|
1060
|
-
return this.sdkBinding
|
|
1061
|
-
}
|
|
1062
|
-
getSlideDuration(cardId, slideIndex) {
|
|
1063
|
-
return DEFAULT_SLIDE_DURATION;
|
|
1064
|
-
// unnecessary for es_module (without backward compatibility)
|
|
1065
|
-
// return this.sdkBinding().getSlideDuration(cardId, slideIndex);
|
|
1048
|
+
return this.sdkBinding.updateCardServerDataLocally(data);
|
|
1066
1049
|
}
|
|
1067
1050
|
showNextSlide(duration) {
|
|
1068
|
-
this.sdkBinding
|
|
1051
|
+
this.sdkBinding.showNextSlide();
|
|
1069
1052
|
}
|
|
1070
1053
|
sendStatisticEvent(name, data, devPayload, forceEnableStatisticV2) {
|
|
1071
|
-
this.sdkBinding
|
|
1054
|
+
this.sdkBinding.sendStatisticEvent(name, data, devPayload, forceEnableStatisticV2);
|
|
1072
1055
|
}
|
|
1073
1056
|
getCardLocalData() {
|
|
1074
|
-
return this.sdkBinding
|
|
1057
|
+
return this.sdkBinding.getCardLocalData();
|
|
1075
1058
|
}
|
|
1076
1059
|
isExistsShowLayer() {
|
|
1077
1060
|
return true;
|
|
1078
1061
|
}
|
|
1079
1062
|
showLayer(index) {
|
|
1080
|
-
this.sdkBinding
|
|
1063
|
+
this.sdkBinding.showLayer(index);
|
|
1081
1064
|
}
|
|
1082
1065
|
get cardAnimation() {
|
|
1083
1066
|
return animationApi;
|
|
@@ -1092,37 +1075,37 @@ class EsModuleSdkApi {
|
|
|
1092
1075
|
return true;
|
|
1093
1076
|
}
|
|
1094
1077
|
pauseUI() {
|
|
1095
|
-
this.sdkBinding
|
|
1078
|
+
this.sdkBinding.pauseUI();
|
|
1096
1079
|
}
|
|
1097
1080
|
resumeUI() {
|
|
1098
|
-
this.sdkBinding
|
|
1081
|
+
this.sdkBinding.resumeUI();
|
|
1099
1082
|
}
|
|
1100
1083
|
get isExistsShowCardTextInput() {
|
|
1101
1084
|
return true;
|
|
1102
1085
|
}
|
|
1103
1086
|
showCardTextInput(id, data) {
|
|
1104
|
-
this.sdkBinding
|
|
1087
|
+
this.sdkBinding.showCardTextInput(id, data);
|
|
1105
1088
|
}
|
|
1106
1089
|
setCardLocalData(keyValue, sendToServer) {
|
|
1107
|
-
this.sdkBinding
|
|
1090
|
+
this.sdkBinding.setCardLocalData(keyValue, sendToServer);
|
|
1108
1091
|
}
|
|
1109
1092
|
getWidgetsSharedData(cardId, widget) {
|
|
1110
|
-
return this.sdkBinding
|
|
1093
|
+
return this.sdkBinding.getWidgetsSharedData(cardId, widget);
|
|
1111
1094
|
}
|
|
1112
1095
|
vibrate(pattern) {
|
|
1113
1096
|
navigator.vibrate(pattern);
|
|
1114
1097
|
}
|
|
1115
1098
|
openUrl(data) {
|
|
1116
|
-
this.sdkBinding
|
|
1099
|
+
this.sdkBinding.openUrl(data);
|
|
1117
1100
|
}
|
|
1118
1101
|
sendApiRequest(url, method, params, headers, data, profilingKey) {
|
|
1119
|
-
return this.sdkBinding
|
|
1102
|
+
return this.sdkBinding.sendApiRequest(url, method, params, headers, data, profilingKey);
|
|
1120
1103
|
}
|
|
1121
1104
|
sendApiRequestSupported() {
|
|
1122
1105
|
return true;
|
|
1123
1106
|
}
|
|
1124
1107
|
showToast(text) {
|
|
1125
|
-
this.sdkBinding
|
|
1108
|
+
this.sdkBinding.showToast(text);
|
|
1126
1109
|
}
|
|
1127
1110
|
get sdkCanSendShareComplete() {
|
|
1128
1111
|
return true;
|
|
@@ -1131,83 +1114,81 @@ class EsModuleSdkApi {
|
|
|
1131
1114
|
return true;
|
|
1132
1115
|
}
|
|
1133
1116
|
share(id, config) {
|
|
1134
|
-
this.sdkBinding
|
|
1117
|
+
this.sdkBinding.share(id, config);
|
|
1135
1118
|
}
|
|
1136
1119
|
shareSlideScreenshot(shareId, hideElementsSelector, shareText) {
|
|
1137
|
-
this.sdkBinding
|
|
1120
|
+
this.sdkBinding.shareSlideScreenshot(shareId, hideElementsSelector, shareText);
|
|
1138
1121
|
}
|
|
1139
1122
|
get isExistsShowCardSlide() {
|
|
1140
1123
|
return true;
|
|
1141
1124
|
}
|
|
1142
1125
|
showCardSlide(index) {
|
|
1143
|
-
this.sdkBinding
|
|
1126
|
+
this.sdkBinding.showCardSlide(index);
|
|
1144
1127
|
}
|
|
1145
1128
|
get isExistsShowNextCard() {
|
|
1146
1129
|
return true;
|
|
1147
1130
|
}
|
|
1148
1131
|
cardShowNext() {
|
|
1149
|
-
this.sdkBinding
|
|
1132
|
+
this.sdkBinding.cardShowNext();
|
|
1150
1133
|
}
|
|
1151
1134
|
setCardSessionValue(element, key, value) {
|
|
1152
|
-
this.sdkBinding
|
|
1135
|
+
this.sdkBinding.setCardSessionValue(key, value);
|
|
1153
1136
|
}
|
|
1154
1137
|
getCardSessionValue(element, key) {
|
|
1155
|
-
return this.sdkBinding
|
|
1138
|
+
return this.sdkBinding.getCardSessionValue(key);
|
|
1156
1139
|
}
|
|
1157
1140
|
updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError) {
|
|
1158
|
-
|
|
1159
|
-
if (updateTimeline != null) {
|
|
1160
|
-
updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError);
|
|
1161
|
-
}
|
|
1141
|
+
this.sdkBinding.updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError);
|
|
1162
1142
|
}
|
|
1163
1143
|
cardPausedCallback(currentTime) { }
|
|
1164
1144
|
cardResumedCallback(currentTime) { }
|
|
1165
|
-
startDisabledTimeline(cardId, slideIndex) {
|
|
1166
|
-
// для android sdk важно чтобы этот метод вызывался только после slide_start
|
|
1167
|
-
//@ts-ignore
|
|
1168
|
-
// slideApi.afterStartInitQueuePush(function () {
|
|
1169
|
-
// //@ts-ignore
|
|
1170
|
-
// slideApi.activeLayer.timeline.startDisabledTimeline(() => {});
|
|
1171
|
-
// });
|
|
1172
|
-
}
|
|
1173
1145
|
getCardFonts() {
|
|
1174
|
-
return this.sdkBinding
|
|
1146
|
+
return this.sdkBinding.getCardFonts();
|
|
1175
1147
|
}
|
|
1176
1148
|
disableVerticalSwipeGesture() {
|
|
1177
|
-
this.sdkBinding
|
|
1149
|
+
this.sdkBinding.disableVerticalSwipeGesture();
|
|
1178
1150
|
}
|
|
1179
1151
|
enableVerticalSwipeGesture() {
|
|
1180
|
-
this.sdkBinding
|
|
1152
|
+
this.sdkBinding.enableVerticalSwipeGesture();
|
|
1181
1153
|
}
|
|
1182
1154
|
disableBackpress() { }
|
|
1183
1155
|
enableBackpress() { }
|
|
1184
1156
|
closeCard(reason) {
|
|
1185
|
-
this.sdkBinding
|
|
1157
|
+
this.sdkBinding.closeCard(reason);
|
|
1186
1158
|
}
|
|
1187
1159
|
openStory(id, index) {
|
|
1188
|
-
this.sdkBinding
|
|
1160
|
+
this.sdkBinding.openStory(id, index);
|
|
1189
1161
|
}
|
|
1190
1162
|
openGame(gameInstanceId) {
|
|
1191
|
-
this.sdkBinding
|
|
1163
|
+
this.sdkBinding.openGame(gameInstanceId);
|
|
1192
1164
|
}
|
|
1193
1165
|
writeToClipboard(data) {
|
|
1194
|
-
this.sdkBinding
|
|
1166
|
+
this.sdkBinding.writeToClipboard(data);
|
|
1167
|
+
}
|
|
1168
|
+
isSdkSupportTimelineOnBeforeStart() {
|
|
1169
|
+
return true;
|
|
1195
1170
|
}
|
|
1196
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`
|
|
1171
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`SDKInterface`]; }
|
|
1197
1172
|
}
|
|
1198
1173
|
|
|
1174
|
+
const DEFAULT_SLIDE_DURATION = 10000;
|
|
1175
|
+
|
|
1199
1176
|
class DataInput {
|
|
1200
1177
|
_elementNodeRef;
|
|
1201
1178
|
_layer;
|
|
1202
1179
|
_widgetApi;
|
|
1180
|
+
_onWidgetComplete;
|
|
1181
|
+
sdkApi;
|
|
1203
1182
|
static _className = "narrative-element-data-input";
|
|
1204
1183
|
static className() {
|
|
1205
1184
|
return DataInput._className;
|
|
1206
1185
|
}
|
|
1207
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1186
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1208
1187
|
this._elementNodeRef = _elementNodeRef;
|
|
1209
1188
|
this._layer = _layer;
|
|
1210
1189
|
this._widgetApi = _widgetApi;
|
|
1190
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1191
|
+
this.sdkApi = sdkApi;
|
|
1211
1192
|
}
|
|
1212
1193
|
static isTypeOf(element) {
|
|
1213
1194
|
return element instanceof DataInput;
|
|
@@ -1215,7 +1196,7 @@ class DataInput {
|
|
|
1215
1196
|
mediaElementsLoadingPromises = [];
|
|
1216
1197
|
init(localData) {
|
|
1217
1198
|
try {
|
|
1218
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1199
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1219
1200
|
}
|
|
1220
1201
|
catch (e) {
|
|
1221
1202
|
console.error(e);
|
|
@@ -1240,26 +1221,30 @@ class DataInput {
|
|
|
1240
1221
|
get isLayerForcePaused() {
|
|
1241
1222
|
return false;
|
|
1242
1223
|
}
|
|
1243
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetDataInput.api`]; }
|
|
1224
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetDataInput.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1244
1225
|
}
|
|
1245
1226
|
|
|
1246
1227
|
class Barcode {
|
|
1247
1228
|
_elementNodeRef;
|
|
1248
1229
|
_layer;
|
|
1249
1230
|
_widgetApi;
|
|
1231
|
+
_onWidgetComplete;
|
|
1232
|
+
sdkApi;
|
|
1250
1233
|
static _className = "narrative-element-barcode";
|
|
1251
1234
|
static className() {
|
|
1252
1235
|
return Barcode._className;
|
|
1253
1236
|
}
|
|
1254
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1237
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1255
1238
|
this._elementNodeRef = _elementNodeRef;
|
|
1256
1239
|
this._layer = _layer;
|
|
1257
1240
|
this._widgetApi = _widgetApi;
|
|
1241
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1242
|
+
this.sdkApi = sdkApi;
|
|
1258
1243
|
}
|
|
1259
1244
|
mediaElementsLoadingPromises = [];
|
|
1260
1245
|
init(localData) {
|
|
1261
1246
|
try {
|
|
1262
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1247
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1263
1248
|
}
|
|
1264
1249
|
catch (e) {
|
|
1265
1250
|
console.error(e);
|
|
@@ -1281,7 +1266,7 @@ class Barcode {
|
|
|
1281
1266
|
get isLayerForcePaused() {
|
|
1282
1267
|
return false;
|
|
1283
1268
|
}
|
|
1284
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetBarcode.api`]; }
|
|
1269
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetBarcode.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1285
1270
|
}
|
|
1286
1271
|
|
|
1287
1272
|
class ClickableBase {
|
|
@@ -1326,19 +1311,23 @@ class Copy {
|
|
|
1326
1311
|
_elementNodeRef;
|
|
1327
1312
|
_layer;
|
|
1328
1313
|
_widgetApi;
|
|
1314
|
+
_onWidgetComplete;
|
|
1315
|
+
sdkApi;
|
|
1329
1316
|
static _className = "narrative-element-copy";
|
|
1330
1317
|
static className() {
|
|
1331
1318
|
return Copy._className;
|
|
1332
1319
|
}
|
|
1333
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1320
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1334
1321
|
this._elementNodeRef = _elementNodeRef;
|
|
1335
1322
|
this._layer = _layer;
|
|
1336
1323
|
this._widgetApi = _widgetApi;
|
|
1324
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1325
|
+
this.sdkApi = sdkApi;
|
|
1337
1326
|
}
|
|
1338
1327
|
mediaElementsLoadingPromises = [];
|
|
1339
1328
|
init(localData) {
|
|
1340
1329
|
try {
|
|
1341
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1330
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1342
1331
|
}
|
|
1343
1332
|
catch (e) {
|
|
1344
1333
|
console.error(e);
|
|
@@ -1360,7 +1349,7 @@ class Copy {
|
|
|
1360
1349
|
get isLayerForcePaused() {
|
|
1361
1350
|
return false;
|
|
1362
1351
|
}
|
|
1363
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetCopy.api`]; }
|
|
1352
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetCopy.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1364
1353
|
}
|
|
1365
1354
|
|
|
1366
1355
|
class DateCountdown {
|
|
@@ -1368,20 +1357,24 @@ class DateCountdown {
|
|
|
1368
1357
|
_layer;
|
|
1369
1358
|
_layersNodesRefs;
|
|
1370
1359
|
_widgetApi;
|
|
1360
|
+
_onWidgetComplete;
|
|
1361
|
+
sdkApi;
|
|
1371
1362
|
static _className = "narrative-element-date-countdown";
|
|
1372
1363
|
static className() {
|
|
1373
1364
|
return DateCountdown._className;
|
|
1374
1365
|
}
|
|
1375
|
-
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi) {
|
|
1366
|
+
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1376
1367
|
this._elementNodeRef = _elementNodeRef;
|
|
1377
1368
|
this._layer = _layer;
|
|
1378
1369
|
this._layersNodesRefs = _layersNodesRefs;
|
|
1379
1370
|
this._widgetApi = _widgetApi;
|
|
1371
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1372
|
+
this.sdkApi = sdkApi;
|
|
1380
1373
|
}
|
|
1381
1374
|
mediaElementsLoadingPromises = [];
|
|
1382
1375
|
init(localData) {
|
|
1383
1376
|
try {
|
|
1384
|
-
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData);
|
|
1377
|
+
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData, this._onWidgetComplete, this.sdkApi);
|
|
1385
1378
|
}
|
|
1386
1379
|
catch (e) {
|
|
1387
1380
|
console.error(e);
|
|
@@ -1407,21 +1400,25 @@ class DateCountdown {
|
|
|
1407
1400
|
get isLayerForcePaused() {
|
|
1408
1401
|
return false;
|
|
1409
1402
|
}
|
|
1410
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetDateCountdown.api`]; }
|
|
1403
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetDateCountdown.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1411
1404
|
}
|
|
1412
1405
|
|
|
1413
1406
|
class Poll {
|
|
1414
1407
|
_elementNodeRef;
|
|
1415
1408
|
_layer;
|
|
1416
1409
|
_widgetApi;
|
|
1410
|
+
_onWidgetComplete;
|
|
1411
|
+
sdkApi;
|
|
1417
1412
|
static _className = "narrative-element-poll";
|
|
1418
1413
|
static className() {
|
|
1419
1414
|
return Poll._className;
|
|
1420
1415
|
}
|
|
1421
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1416
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1422
1417
|
this._elementNodeRef = _elementNodeRef;
|
|
1423
1418
|
this._layer = _layer;
|
|
1424
1419
|
this._widgetApi = _widgetApi;
|
|
1420
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1421
|
+
this.sdkApi = sdkApi;
|
|
1425
1422
|
}
|
|
1426
1423
|
static isTypeOf(element) {
|
|
1427
1424
|
return element instanceof Poll;
|
|
@@ -1429,7 +1426,7 @@ class Poll {
|
|
|
1429
1426
|
mediaElementsLoadingPromises = [];
|
|
1430
1427
|
init(localData) {
|
|
1431
1428
|
try {
|
|
1432
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1429
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1433
1430
|
}
|
|
1434
1431
|
catch (e) {
|
|
1435
1432
|
console.error(e);
|
|
@@ -1454,7 +1451,7 @@ class Poll {
|
|
|
1454
1451
|
get isLayerForcePaused() {
|
|
1455
1452
|
return false;
|
|
1456
1453
|
}
|
|
1457
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetPoll.api`]; }
|
|
1454
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetPoll.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1458
1455
|
}
|
|
1459
1456
|
|
|
1460
1457
|
class PollLayers {
|
|
@@ -1462,15 +1459,19 @@ class PollLayers {
|
|
|
1462
1459
|
_layer;
|
|
1463
1460
|
_layersNodesRefs;
|
|
1464
1461
|
_widgetApi;
|
|
1462
|
+
_onWidgetComplete;
|
|
1463
|
+
sdkApi;
|
|
1465
1464
|
static _className = "narrative-element-poll-layers";
|
|
1466
1465
|
static className() {
|
|
1467
1466
|
return PollLayers._className;
|
|
1468
1467
|
}
|
|
1469
|
-
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi) {
|
|
1468
|
+
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1470
1469
|
this._elementNodeRef = _elementNodeRef;
|
|
1471
1470
|
this._layer = _layer;
|
|
1472
1471
|
this._layersNodesRefs = _layersNodesRefs;
|
|
1473
1472
|
this._widgetApi = _widgetApi;
|
|
1473
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1474
|
+
this.sdkApi = sdkApi;
|
|
1474
1475
|
}
|
|
1475
1476
|
static isTypeOf(element) {
|
|
1476
1477
|
return element instanceof PollLayers;
|
|
@@ -1478,7 +1479,7 @@ class PollLayers {
|
|
|
1478
1479
|
mediaElementsLoadingPromises = [];
|
|
1479
1480
|
init(localData) {
|
|
1480
1481
|
try {
|
|
1481
|
-
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData);
|
|
1482
|
+
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData, this._onWidgetComplete, this.sdkApi);
|
|
1482
1483
|
}
|
|
1483
1484
|
catch (e) {
|
|
1484
1485
|
console.error(e);
|
|
@@ -1500,21 +1501,25 @@ class PollLayers {
|
|
|
1500
1501
|
get isLayerForcePaused() {
|
|
1501
1502
|
return false;
|
|
1502
1503
|
}
|
|
1503
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetPollLayers.api`]; }
|
|
1504
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetPollLayers.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1504
1505
|
}
|
|
1505
1506
|
|
|
1506
1507
|
class Products {
|
|
1507
1508
|
_elementNodeRef;
|
|
1508
1509
|
_layer;
|
|
1509
1510
|
_widgetApi;
|
|
1511
|
+
_onWidgetComplete;
|
|
1512
|
+
sdkApi;
|
|
1510
1513
|
static _className = "narrative-element-products";
|
|
1511
1514
|
static className() {
|
|
1512
1515
|
return Products._className;
|
|
1513
1516
|
}
|
|
1514
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1517
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1515
1518
|
this._elementNodeRef = _elementNodeRef;
|
|
1516
1519
|
this._layer = _layer;
|
|
1517
1520
|
this._widgetApi = _widgetApi;
|
|
1521
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1522
|
+
this.sdkApi = sdkApi;
|
|
1518
1523
|
}
|
|
1519
1524
|
static isTypeOf(element) {
|
|
1520
1525
|
return element instanceof Products;
|
|
@@ -1522,7 +1527,7 @@ class Products {
|
|
|
1522
1527
|
mediaElementsLoadingPromises = [];
|
|
1523
1528
|
init(localData) {
|
|
1524
1529
|
try {
|
|
1525
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1530
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1526
1531
|
}
|
|
1527
1532
|
catch (e) {
|
|
1528
1533
|
console.error(e);
|
|
@@ -1553,28 +1558,32 @@ class Products {
|
|
|
1553
1558
|
get isLayerForcePaused() {
|
|
1554
1559
|
return this._widgetApi.isForcePaused(this._elementNodeRef);
|
|
1555
1560
|
}
|
|
1556
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetProducts.api`]; }
|
|
1561
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetProducts.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1557
1562
|
}
|
|
1558
1563
|
|
|
1559
1564
|
class Quest {
|
|
1560
1565
|
_elementNodeRef;
|
|
1561
1566
|
_layer;
|
|
1562
1567
|
_widgetApi;
|
|
1568
|
+
_onWidgetComplete;
|
|
1569
|
+
sdkApi;
|
|
1563
1570
|
static _className = "narrative-element-quest";
|
|
1564
1571
|
static className() {
|
|
1565
1572
|
return Quest._className;
|
|
1566
1573
|
}
|
|
1567
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1574
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1568
1575
|
this._elementNodeRef = _elementNodeRef;
|
|
1569
1576
|
this._layer = _layer;
|
|
1570
1577
|
this._widgetApi = _widgetApi;
|
|
1578
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1579
|
+
this.sdkApi = sdkApi;
|
|
1571
1580
|
}
|
|
1572
1581
|
static isTypeOf(element) {
|
|
1573
1582
|
return element instanceof Quest;
|
|
1574
1583
|
}
|
|
1575
1584
|
mediaElementsLoadingPromises = [];
|
|
1576
1585
|
init(localData) {
|
|
1577
|
-
return this._widgetApi.init(this._elementNodeRef, localData);
|
|
1586
|
+
return this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1578
1587
|
}
|
|
1579
1588
|
onPause() { }
|
|
1580
1589
|
onResume() { }
|
|
@@ -1594,22 +1603,26 @@ class Quest {
|
|
|
1594
1603
|
get isLayerForcePaused() {
|
|
1595
1604
|
return false;
|
|
1596
1605
|
}
|
|
1597
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuest.api`]; }
|
|
1606
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuest.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1598
1607
|
}
|
|
1599
1608
|
|
|
1600
1609
|
class Quiz {
|
|
1601
1610
|
_elementNodeRef;
|
|
1602
1611
|
_layer;
|
|
1603
1612
|
_widgetApi;
|
|
1613
|
+
_onWidgetComplete;
|
|
1614
|
+
sdkApi;
|
|
1604
1615
|
static _className = "narrative-element-quiz";
|
|
1605
1616
|
static className() {
|
|
1606
1617
|
return Quiz._className;
|
|
1607
1618
|
}
|
|
1608
1619
|
// widgetApi in ctor
|
|
1609
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1620
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1610
1621
|
this._elementNodeRef = _elementNodeRef;
|
|
1611
1622
|
this._layer = _layer;
|
|
1612
1623
|
this._widgetApi = _widgetApi;
|
|
1624
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1625
|
+
this.sdkApi = sdkApi;
|
|
1613
1626
|
}
|
|
1614
1627
|
static isTypeOf(element) {
|
|
1615
1628
|
return element instanceof Quiz;
|
|
@@ -1617,7 +1630,7 @@ class Quiz {
|
|
|
1617
1630
|
mediaElementsLoadingPromises = [];
|
|
1618
1631
|
init(localData) {
|
|
1619
1632
|
try {
|
|
1620
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1633
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1621
1634
|
}
|
|
1622
1635
|
catch (e) {
|
|
1623
1636
|
console.error(e);
|
|
@@ -1642,21 +1655,25 @@ class Quiz {
|
|
|
1642
1655
|
get isLayerForcePaused() {
|
|
1643
1656
|
return false;
|
|
1644
1657
|
}
|
|
1645
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuiz.api`]; }
|
|
1658
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuiz.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1646
1659
|
}
|
|
1647
1660
|
|
|
1648
1661
|
class QuizGrouped {
|
|
1649
1662
|
_elementNodeRef;
|
|
1650
1663
|
_layer;
|
|
1651
1664
|
_widgetApi;
|
|
1665
|
+
_onWidgetComplete;
|
|
1666
|
+
sdkApi;
|
|
1652
1667
|
static _className = "narrative-element-quiz-grouped";
|
|
1653
1668
|
static className() {
|
|
1654
1669
|
return QuizGrouped._className;
|
|
1655
1670
|
}
|
|
1656
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1671
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1657
1672
|
this._elementNodeRef = _elementNodeRef;
|
|
1658
1673
|
this._layer = _layer;
|
|
1659
1674
|
this._widgetApi = _widgetApi;
|
|
1675
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1676
|
+
this.sdkApi = sdkApi;
|
|
1660
1677
|
}
|
|
1661
1678
|
static isTypeOf(element) {
|
|
1662
1679
|
return element instanceof QuizGrouped;
|
|
@@ -1664,7 +1681,7 @@ class QuizGrouped {
|
|
|
1664
1681
|
mediaElementsLoadingPromises = [];
|
|
1665
1682
|
init(localData) {
|
|
1666
1683
|
try {
|
|
1667
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1684
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1668
1685
|
}
|
|
1669
1686
|
catch (e) {
|
|
1670
1687
|
console.error(e);
|
|
@@ -1689,21 +1706,25 @@ class QuizGrouped {
|
|
|
1689
1706
|
get isLayerForcePaused() {
|
|
1690
1707
|
return false;
|
|
1691
1708
|
}
|
|
1692
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuizGrouped.api`]; }
|
|
1709
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetQuizGrouped.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1693
1710
|
}
|
|
1694
1711
|
|
|
1695
1712
|
class RangeSlider {
|
|
1696
1713
|
_elementNodeRef;
|
|
1697
1714
|
_layer;
|
|
1698
1715
|
_widgetApi;
|
|
1716
|
+
_onWidgetComplete;
|
|
1717
|
+
sdkApi;
|
|
1699
1718
|
static _className = "narrative-element-range-slider";
|
|
1700
1719
|
static className() {
|
|
1701
1720
|
return RangeSlider._className;
|
|
1702
1721
|
}
|
|
1703
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1722
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1704
1723
|
this._elementNodeRef = _elementNodeRef;
|
|
1705
1724
|
this._layer = _layer;
|
|
1706
1725
|
this._widgetApi = _widgetApi;
|
|
1726
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1727
|
+
this.sdkApi = sdkApi;
|
|
1707
1728
|
}
|
|
1708
1729
|
static isTypeOf(element) {
|
|
1709
1730
|
return element instanceof RangeSlider;
|
|
@@ -1711,7 +1732,7 @@ class RangeSlider {
|
|
|
1711
1732
|
mediaElementsLoadingPromises = [];
|
|
1712
1733
|
init(localData) {
|
|
1713
1734
|
try {
|
|
1714
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1735
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1715
1736
|
}
|
|
1716
1737
|
catch (e) {
|
|
1717
1738
|
console.error(e);
|
|
@@ -1736,21 +1757,25 @@ class RangeSlider {
|
|
|
1736
1757
|
get isLayerForcePaused() {
|
|
1737
1758
|
return false;
|
|
1738
1759
|
}
|
|
1739
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetRangeSlider.api`]; }
|
|
1760
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetRangeSlider.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1740
1761
|
}
|
|
1741
1762
|
|
|
1742
1763
|
class Rate {
|
|
1743
1764
|
_elementNodeRef;
|
|
1744
1765
|
_layer;
|
|
1745
1766
|
_widgetApi;
|
|
1767
|
+
_onWidgetComplete;
|
|
1768
|
+
sdkApi;
|
|
1746
1769
|
static _className = "narrative-element-rate";
|
|
1747
1770
|
static className() {
|
|
1748
1771
|
return Rate._className;
|
|
1749
1772
|
}
|
|
1750
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1773
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1751
1774
|
this._elementNodeRef = _elementNodeRef;
|
|
1752
1775
|
this._layer = _layer;
|
|
1753
1776
|
this._widgetApi = _widgetApi;
|
|
1777
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1778
|
+
this.sdkApi = sdkApi;
|
|
1754
1779
|
}
|
|
1755
1780
|
static isTypeOf(element) {
|
|
1756
1781
|
return element instanceof Rate;
|
|
@@ -1758,7 +1783,7 @@ class Rate {
|
|
|
1758
1783
|
mediaElementsLoadingPromises = [];
|
|
1759
1784
|
init(localData) {
|
|
1760
1785
|
try {
|
|
1761
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1786
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1762
1787
|
}
|
|
1763
1788
|
catch (e) {
|
|
1764
1789
|
console.error(e);
|
|
@@ -1783,7 +1808,7 @@ class Rate {
|
|
|
1783
1808
|
get isLayerForcePaused() {
|
|
1784
1809
|
return false;
|
|
1785
1810
|
}
|
|
1786
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetRate.api`]; }
|
|
1811
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetRate.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1787
1812
|
}
|
|
1788
1813
|
|
|
1789
1814
|
class Share {
|
|
@@ -1791,16 +1816,20 @@ class Share {
|
|
|
1791
1816
|
_layer;
|
|
1792
1817
|
_layersNodesRefs;
|
|
1793
1818
|
_widgetApi;
|
|
1819
|
+
_onWidgetComplete;
|
|
1820
|
+
sdkApi;
|
|
1794
1821
|
static _className = "narrative-element-share";
|
|
1795
1822
|
static _widgetApiName = "_narrative_share";
|
|
1796
1823
|
static className() {
|
|
1797
1824
|
return Share._className;
|
|
1798
1825
|
}
|
|
1799
|
-
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi) {
|
|
1826
|
+
constructor(_elementNodeRef, _layer, _layersNodesRefs, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1800
1827
|
this._elementNodeRef = _elementNodeRef;
|
|
1801
1828
|
this._layer = _layer;
|
|
1802
1829
|
this._layersNodesRefs = _layersNodesRefs;
|
|
1803
1830
|
this._widgetApi = _widgetApi;
|
|
1831
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1832
|
+
this.sdkApi = sdkApi;
|
|
1804
1833
|
}
|
|
1805
1834
|
static isTypeOf(element) {
|
|
1806
1835
|
return element instanceof Share;
|
|
@@ -1808,7 +1837,7 @@ class Share {
|
|
|
1808
1837
|
mediaElementsLoadingPromises = [];
|
|
1809
1838
|
init(localData) {
|
|
1810
1839
|
try {
|
|
1811
|
-
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData);
|
|
1840
|
+
this._widgetApi.init(this._elementNodeRef, this._layersNodesRefs, localData, this._onWidgetComplete, this.sdkApi);
|
|
1812
1841
|
}
|
|
1813
1842
|
catch (e) {
|
|
1814
1843
|
console.error(e);
|
|
@@ -1833,7 +1862,7 @@ class Share {
|
|
|
1833
1862
|
get isLayerForcePaused() {
|
|
1834
1863
|
return false;
|
|
1835
1864
|
}
|
|
1836
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetShare.api`]; }
|
|
1865
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `Array`, `typeof WidgetShare.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1837
1866
|
}
|
|
1838
1867
|
|
|
1839
1868
|
class SwipeUpItems {
|
|
@@ -1875,14 +1904,18 @@ class Test {
|
|
|
1875
1904
|
_elementNodeRef;
|
|
1876
1905
|
_layer;
|
|
1877
1906
|
_widgetApi;
|
|
1907
|
+
_onWidgetComplete;
|
|
1908
|
+
sdkApi;
|
|
1878
1909
|
static _className = "narrative-element-test";
|
|
1879
1910
|
static className() {
|
|
1880
1911
|
return Test._className;
|
|
1881
1912
|
}
|
|
1882
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1913
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1883
1914
|
this._elementNodeRef = _elementNodeRef;
|
|
1884
1915
|
this._layer = _layer;
|
|
1885
1916
|
this._widgetApi = _widgetApi;
|
|
1917
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1918
|
+
this.sdkApi = sdkApi;
|
|
1886
1919
|
}
|
|
1887
1920
|
static isTypeOf(element) {
|
|
1888
1921
|
return element instanceof Test;
|
|
@@ -1890,7 +1923,7 @@ class Test {
|
|
|
1890
1923
|
mediaElementsLoadingPromises = [];
|
|
1891
1924
|
init(localData) {
|
|
1892
1925
|
try {
|
|
1893
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1926
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1894
1927
|
}
|
|
1895
1928
|
catch (e) {
|
|
1896
1929
|
console.error(e);
|
|
@@ -1918,26 +1951,30 @@ class Test {
|
|
|
1918
1951
|
get isLayerForcePaused() {
|
|
1919
1952
|
return false;
|
|
1920
1953
|
}
|
|
1921
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetTest.api`]; }
|
|
1954
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetTest.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1922
1955
|
}
|
|
1923
1956
|
|
|
1924
1957
|
class Vote {
|
|
1925
1958
|
_elementNodeRef;
|
|
1926
1959
|
_layer;
|
|
1927
1960
|
_widgetApi;
|
|
1961
|
+
_onWidgetComplete;
|
|
1962
|
+
sdkApi;
|
|
1928
1963
|
static _className = "narrative-element-vote";
|
|
1929
1964
|
static className() {
|
|
1930
1965
|
return Vote._className;
|
|
1931
1966
|
}
|
|
1932
|
-
constructor(_elementNodeRef, _layer, _widgetApi) {
|
|
1967
|
+
constructor(_elementNodeRef, _layer, _widgetApi, _onWidgetComplete, sdkApi) {
|
|
1933
1968
|
this._elementNodeRef = _elementNodeRef;
|
|
1934
1969
|
this._layer = _layer;
|
|
1935
1970
|
this._widgetApi = _widgetApi;
|
|
1971
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
1972
|
+
this.sdkApi = sdkApi;
|
|
1936
1973
|
}
|
|
1937
1974
|
mediaElementsLoadingPromises = [];
|
|
1938
1975
|
init(localData) {
|
|
1939
1976
|
try {
|
|
1940
|
-
this._widgetApi.init(this._elementNodeRef, localData);
|
|
1977
|
+
this._widgetApi.init(this._elementNodeRef, localData, this._onWidgetComplete, this.sdkApi);
|
|
1941
1978
|
}
|
|
1942
1979
|
catch (e) {
|
|
1943
1980
|
console.error(e);
|
|
@@ -1959,7 +1996,7 @@ class Vote {
|
|
|
1959
1996
|
get isLayerForcePaused() {
|
|
1960
1997
|
return false;
|
|
1961
1998
|
}
|
|
1962
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetVote.api`]; }
|
|
1999
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Layer`, `typeof WidgetVote.api`, `OnWidgetComplete`, `SDKApi`]; }
|
|
1963
2000
|
}
|
|
1964
2001
|
|
|
1965
2002
|
class Text {
|
|
@@ -1994,28 +2031,71 @@ class Text {
|
|
|
1994
2031
|
const waitForImageHtmlElementLoad = async (nodeRef) => {
|
|
1995
2032
|
return new Promise((resolve, reject) => {
|
|
1996
2033
|
const onLoad = function () {
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
};
|
|
2002
|
-
nodeRef.addEventListener("load", onLoad);
|
|
2003
|
-
if (nodeRef.complete && 0 !== nodeRef.naturalHeight) {
|
|
2004
|
-
requestAnimationFrame(() => {
|
|
2034
|
+
// this is already in HTML markup
|
|
2035
|
+
// nodeRef.decoding = "sync";
|
|
2036
|
+
if (nodeRef.decode != null) {
|
|
2037
|
+
// requestAnimationFrame(() =>
|
|
2005
2038
|
requestAnimationFrame(() => {
|
|
2006
|
-
|
|
2039
|
+
nodeRef.decode().then(() => {
|
|
2040
|
+
// @ts-ignore
|
|
2041
|
+
// _log("img loaded 1", true);
|
|
2042
|
+
resolve(nodeRef);
|
|
2043
|
+
nodeRef.removeEventListener("load", onLoad);
|
|
2044
|
+
}, reason => reject(reason));
|
|
2007
2045
|
});
|
|
2008
|
-
|
|
2009
|
-
|
|
2046
|
+
// );
|
|
2047
|
+
}
|
|
2048
|
+
else {
|
|
2049
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
2050
|
+
// @ts-ignore
|
|
2051
|
+
// _log("img loaded 1", true);
|
|
2052
|
+
resolve(nodeRef);
|
|
2053
|
+
nodeRef.removeEventListener("load", onLoad);
|
|
2054
|
+
}));
|
|
2055
|
+
}
|
|
2056
|
+
};
|
|
2057
|
+
nodeRef.addEventListener("load", onLoad);
|
|
2058
|
+
// if (nodeRef.complete && 0 !== nodeRef.naturalHeight) {
|
|
2059
|
+
// requestAnimationFrame(() => {
|
|
2060
|
+
// requestAnimationFrame(() => {
|
|
2061
|
+
// // @ts-ignore
|
|
2062
|
+
// _log("img loaded 2", true)
|
|
2063
|
+
// resolve(nodeRef);
|
|
2064
|
+
// });
|
|
2065
|
+
// });
|
|
2066
|
+
// }
|
|
2010
2067
|
nodeRef.addEventListener("error", err => reject(err));
|
|
2011
2068
|
});
|
|
2012
2069
|
};
|
|
2070
|
+
// export const waitForImageHtmlElementLoad = async (nodeRef: HTMLImageElement): Promise<HTMLImageElement> => {
|
|
2071
|
+
// return new Promise((resolve, reject) => {
|
|
2072
|
+
// const onLoad = function () {
|
|
2073
|
+
// requestAnimationFrame(() =>
|
|
2074
|
+
// requestAnimationFrame(() => {
|
|
2075
|
+
// resolve(nodeRef);
|
|
2076
|
+
// nodeRef.removeEventListener("load", onLoad);
|
|
2077
|
+
// })
|
|
2078
|
+
// );
|
|
2079
|
+
// };
|
|
2080
|
+
// nodeRef.addEventListener("load", onLoad);
|
|
2081
|
+
// if (nodeRef.complete && 0 !== nodeRef.naturalHeight) {
|
|
2082
|
+
// requestAnimationFrame(() => {
|
|
2083
|
+
// requestAnimationFrame(() => {
|
|
2084
|
+
// resolve(nodeRef);
|
|
2085
|
+
// });
|
|
2086
|
+
// });
|
|
2087
|
+
// }
|
|
2088
|
+
// nodeRef.addEventListener("error", err => reject(err));
|
|
2089
|
+
// });
|
|
2090
|
+
// };
|
|
2013
2091
|
const waitForVideoHtmlElementLoad = async (nodeRef) => {
|
|
2014
2092
|
return new Promise((resolve, reject) => {
|
|
2015
2093
|
if (void 0 !== nodeRef.oncanplaythrough) {
|
|
2016
2094
|
const onCanplaythrough = () => {
|
|
2017
2095
|
requestAnimationFrame(() => {
|
|
2018
2096
|
requestAnimationFrame(() => {
|
|
2097
|
+
// @ts-ignore
|
|
2098
|
+
// _log("video loaded 1", true)
|
|
2019
2099
|
resolve(nodeRef);
|
|
2020
2100
|
nodeRef.removeEventListener("canplaythrough", onCanplaythrough);
|
|
2021
2101
|
});
|
|
@@ -2028,6 +2108,8 @@ const waitForVideoHtmlElementLoad = async (nodeRef) => {
|
|
|
2028
2108
|
var onCanPlay = function () {
|
|
2029
2109
|
requestAnimationFrame(() => {
|
|
2030
2110
|
requestAnimationFrame(() => {
|
|
2111
|
+
// @ts-ignore
|
|
2112
|
+
// _log("video loaded 2", true)
|
|
2031
2113
|
resolve(nodeRef);
|
|
2032
2114
|
nodeRef.removeEventListener("canplay", onCanPlay);
|
|
2033
2115
|
});
|
|
@@ -2195,6 +2277,8 @@ class Video {
|
|
|
2195
2277
|
onStop() { }
|
|
2196
2278
|
onBeforeUnmount() {
|
|
2197
2279
|
// clean up memory and cpu processes
|
|
2280
|
+
// @ts-ignore
|
|
2281
|
+
// _log("onBeforeUnmount", true)
|
|
2198
2282
|
this._destroyVODPlayer();
|
|
2199
2283
|
}
|
|
2200
2284
|
_initVOD(vodData) {
|
|
@@ -2269,6 +2353,8 @@ class Video {
|
|
|
2269
2353
|
// console.log("_initVOD 5");
|
|
2270
2354
|
this._vodPlayerInstance = player;
|
|
2271
2355
|
// This runs if the asynchronous load is successful.
|
|
2356
|
+
// @ts-ignore
|
|
2357
|
+
_log("vod loaded 1", true);
|
|
2272
2358
|
resolve(this._video);
|
|
2273
2359
|
})
|
|
2274
2360
|
.catch(reason => {
|
|
@@ -2293,6 +2379,8 @@ class Video {
|
|
|
2293
2379
|
if (vodData && vodData.formats != null && Array.isArray(vodData.formats) && vodData.formats.length > 0) {
|
|
2294
2380
|
src = vodData.formats[0].url;
|
|
2295
2381
|
this._video.src = src;
|
|
2382
|
+
// @ts-ignore
|
|
2383
|
+
// _log("vod loaded 2", true)
|
|
2296
2384
|
resolve(this._video);
|
|
2297
2385
|
}
|
|
2298
2386
|
else {
|
|
@@ -2315,6 +2403,8 @@ class Video {
|
|
|
2315
2403
|
return mpd_;
|
|
2316
2404
|
}
|
|
2317
2405
|
async _destroyVODPlayer() {
|
|
2406
|
+
//@ts-ignore
|
|
2407
|
+
// _log("call _destroyVODPlayer", true)
|
|
2318
2408
|
if (this._vodPlayerInstance != null) {
|
|
2319
2409
|
try {
|
|
2320
2410
|
if (this._videoStateAdapter) {
|
|
@@ -2617,7 +2707,7 @@ class VideoStateAdapter {
|
|
|
2617
2707
|
// _log(`_onPlaying, _timeupdate: ${this._timeupdate}`, true);
|
|
2618
2708
|
this._playingCheckerId = window.setTimeout(() => {
|
|
2619
2709
|
// @ts-ignore
|
|
2620
|
-
_log(`_onPlaying cb, _timeupdate: ${this._timeupdate}, now: ${Date.now()}, diff: ${Date.now() - this._timeupdate}`, true);
|
|
2710
|
+
// _log(`_onPlaying cb, _timeupdate: ${this._timeupdate}, now: ${Date.now()}, diff: ${Date.now() - this._timeupdate}`, true);
|
|
2621
2711
|
if (Date.now() - this._timeupdate <= this._maxDiff / 2) {
|
|
2622
2712
|
// @ts-ignore
|
|
2623
2713
|
// _log(`_onPlaying if`, true);
|
|
@@ -2664,7 +2754,7 @@ class VideoStateAdapter {
|
|
|
2664
2754
|
// const
|
|
2665
2755
|
// }
|
|
2666
2756
|
// args nodeRef, elementClassName
|
|
2667
|
-
const tryCreateFromHtmlElement = (nodeRef, layer) => {
|
|
2757
|
+
const tryCreateFromHtmlElement = (nodeRef, layer, onWidgetComplete, sdkApi) => {
|
|
2668
2758
|
const layoutApi = layer.layoutService.layoutApi;
|
|
2669
2759
|
const layersNodesRefs = layer.slide.layersNodesRefs;
|
|
2670
2760
|
for (let elementClassName of nodeRef.classList.values()) {
|
|
@@ -2682,38 +2772,42 @@ const tryCreateFromHtmlElement = (nodeRef, layer) => {
|
|
|
2682
2772
|
case SwipeUpItems.className():
|
|
2683
2773
|
return new SwipeUpItems(nodeRef, layer);
|
|
2684
2774
|
case Video.className():
|
|
2685
|
-
return new Video(nodeRef, layer, layoutApi.VideoPlayer, layer.
|
|
2775
|
+
return new Video(nodeRef, layer, layoutApi.VideoPlayer, layer.sdkApi);
|
|
2686
2776
|
//////// widgets ///////
|
|
2687
2777
|
case Copy.className():
|
|
2688
|
-
return layoutApi.widgetCopyApi ? new Copy(nodeRef, layer, layoutApi.widgetCopyApi) : null;
|
|
2778
|
+
return layoutApi.widgetCopyApi ? new Copy(nodeRef, layer, layoutApi.widgetCopyApi, onWidgetComplete, sdkApi) : null;
|
|
2689
2779
|
case Barcode.className():
|
|
2690
|
-
return layoutApi.widgetBarcodeApi ? new Barcode(nodeRef, layer, layoutApi.widgetBarcodeApi) : null;
|
|
2780
|
+
return layoutApi.widgetBarcodeApi ? new Barcode(nodeRef, layer, layoutApi.widgetBarcodeApi, onWidgetComplete, sdkApi) : null;
|
|
2691
2781
|
case DataInput.className():
|
|
2692
|
-
return layoutApi.widgetDataInputApi ? new DataInput(nodeRef, layer, layoutApi.widgetDataInputApi) : null;
|
|
2782
|
+
return layoutApi.widgetDataInputApi ? new DataInput(nodeRef, layer, layoutApi.widgetDataInputApi, onWidgetComplete, sdkApi) : null;
|
|
2693
2783
|
case DateCountdown.className():
|
|
2694
|
-
return layoutApi.widgetDateCountdownApi
|
|
2784
|
+
return layoutApi.widgetDateCountdownApi
|
|
2785
|
+
? new DateCountdown(nodeRef, layer, layersNodesRefs, layoutApi.widgetDateCountdownApi, onWidgetComplete, sdkApi)
|
|
2786
|
+
: null;
|
|
2695
2787
|
case Poll.className():
|
|
2696
|
-
return layoutApi.widgetPollApi ? new Poll(nodeRef, layer, layoutApi.widgetPollApi) : null;
|
|
2788
|
+
return layoutApi.widgetPollApi ? new Poll(nodeRef, layer, layoutApi.widgetPollApi, onWidgetComplete, sdkApi) : null;
|
|
2697
2789
|
case PollLayers.className():
|
|
2698
|
-
return layoutApi.widgetPollLayersApi
|
|
2790
|
+
return layoutApi.widgetPollLayersApi
|
|
2791
|
+
? new PollLayers(nodeRef, layer, layersNodesRefs, layoutApi.widgetPollLayersApi, onWidgetComplete, sdkApi)
|
|
2792
|
+
: null;
|
|
2699
2793
|
case Quest.className():
|
|
2700
|
-
return layoutApi.widgetQuestApi ? new Quest(nodeRef, layer, layoutApi.widgetQuestApi) : null;
|
|
2794
|
+
return layoutApi.widgetQuestApi ? new Quest(nodeRef, layer, layoutApi.widgetQuestApi, onWidgetComplete, sdkApi) : null;
|
|
2701
2795
|
case Quiz.className():
|
|
2702
|
-
return layoutApi.widgetQuizApi ? new Quiz(nodeRef, layer, layoutApi.widgetQuizApi) : null;
|
|
2796
|
+
return layoutApi.widgetQuizApi ? new Quiz(nodeRef, layer, layoutApi.widgetQuizApi, onWidgetComplete, sdkApi) : null;
|
|
2703
2797
|
case QuizGrouped.className():
|
|
2704
|
-
return layoutApi.widgetQuizGroupedApi ? new QuizGrouped(nodeRef, layer, layoutApi.widgetQuizGroupedApi) : null;
|
|
2798
|
+
return layoutApi.widgetQuizGroupedApi ? new QuizGrouped(nodeRef, layer, layoutApi.widgetQuizGroupedApi, onWidgetComplete, sdkApi) : null;
|
|
2705
2799
|
case RangeSlider.className():
|
|
2706
|
-
return layoutApi.widgetRangeSliderApi ? new RangeSlider(nodeRef, layer, layoutApi.widgetRangeSliderApi) : null;
|
|
2800
|
+
return layoutApi.widgetRangeSliderApi ? new RangeSlider(nodeRef, layer, layoutApi.widgetRangeSliderApi, onWidgetComplete, sdkApi) : null;
|
|
2707
2801
|
case Rate.className():
|
|
2708
|
-
return layoutApi.widgetRateApi ? new Rate(nodeRef, layer, layoutApi.widgetRateApi) : null;
|
|
2802
|
+
return layoutApi.widgetRateApi ? new Rate(nodeRef, layer, layoutApi.widgetRateApi, onWidgetComplete, sdkApi) : null;
|
|
2709
2803
|
case Share.className():
|
|
2710
|
-
return layoutApi.widgetShareApi ? new Share(nodeRef, layer, layersNodesRefs, layoutApi.widgetShareApi) : null;
|
|
2804
|
+
return layoutApi.widgetShareApi ? new Share(nodeRef, layer, layersNodesRefs, layoutApi.widgetShareApi, onWidgetComplete, sdkApi) : null;
|
|
2711
2805
|
case Test.className():
|
|
2712
|
-
return layoutApi.widgetTestApi ? new Test(nodeRef, layer, layoutApi.widgetTestApi) : null;
|
|
2806
|
+
return layoutApi.widgetTestApi ? new Test(nodeRef, layer, layoutApi.widgetTestApi, onWidgetComplete, sdkApi) : null;
|
|
2713
2807
|
case Vote.className():
|
|
2714
|
-
return layoutApi.widgetVoteApi ? new Vote(nodeRef, layer, layoutApi.widgetVoteApi) : null;
|
|
2808
|
+
return layoutApi.widgetVoteApi ? new Vote(nodeRef, layer, layoutApi.widgetVoteApi, onWidgetComplete, sdkApi) : null;
|
|
2715
2809
|
case Products.className():
|
|
2716
|
-
return layoutApi.widgetProductsApi ? new Products(nodeRef, layer, layoutApi.widgetProductsApi) : null;
|
|
2810
|
+
return layoutApi.widgetProductsApi ? new Products(nodeRef, layer, layoutApi.widgetProductsApi, onWidgetComplete, sdkApi) : null;
|
|
2717
2811
|
}
|
|
2718
2812
|
}
|
|
2719
2813
|
return null;
|
|
@@ -2724,18 +2818,24 @@ var TimelineDisabledState;
|
|
|
2724
2818
|
TimelineDisabledState[TimelineDisabledState["disabled"] = 0] = "disabled";
|
|
2725
2819
|
TimelineDisabledState[TimelineDisabledState["enabled"] = 1] = "enabled";
|
|
2726
2820
|
})(TimelineDisabledState || (TimelineDisabledState = {}));
|
|
2821
|
+
// use Promise
|
|
2822
|
+
// await Promise()
|
|
2823
|
+
// call timeLine api
|
|
2824
|
+
// promise - slideReadyPromise
|
|
2727
2825
|
class SlideTimeline {
|
|
2728
2826
|
slideIndex;
|
|
2729
2827
|
slideDuration;
|
|
2730
2828
|
slideDisabledTimer;
|
|
2731
2829
|
slideReady;
|
|
2732
2830
|
_afterResumeQueuePush;
|
|
2733
|
-
|
|
2831
|
+
sdkApi;
|
|
2832
|
+
constructor(slideIndex, slideDuration, slideDisabledTimer, slideReady, _afterResumeQueuePush, sdkApi) {
|
|
2734
2833
|
this.slideIndex = slideIndex;
|
|
2735
2834
|
this.slideDuration = slideDuration;
|
|
2736
2835
|
this.slideDisabledTimer = slideDisabledTimer;
|
|
2737
2836
|
this.slideReady = slideReady;
|
|
2738
2837
|
this._afterResumeQueuePush = _afterResumeQueuePush;
|
|
2838
|
+
this.sdkApi = sdkApi;
|
|
2739
2839
|
this.timelineDisabledState = this.slideDisabledTimer ? TimelineDisabledState.disabled : TimelineDisabledState.enabled;
|
|
2740
2840
|
}
|
|
2741
2841
|
resumedAt = new Date().getTime();
|
|
@@ -2749,17 +2849,23 @@ class SlideTimeline {
|
|
|
2749
2849
|
return SlideTimeline.layoutService;
|
|
2750
2850
|
}
|
|
2751
2851
|
get isSDKSupportUpdateTimeline() {
|
|
2752
|
-
if (
|
|
2753
|
-
return SlideTimeline.layoutService.env.Android && "updateTimeline" in SlideTimeline.layoutService.env.Android;
|
|
2852
|
+
if (this.sdkApi.isAndroid) {
|
|
2853
|
+
return Boolean(SlideTimeline.layoutService.env.Android && "updateTimeline" in SlideTimeline.layoutService.env.Android);
|
|
2754
2854
|
}
|
|
2755
|
-
else if (
|
|
2855
|
+
else if (this.sdkApi.isIOS) {
|
|
2756
2856
|
const mh = SlideTimeline.layoutService.env?.webkit?.messageHandlers ?? {};
|
|
2757
2857
|
return "updateTimeline" in mh;
|
|
2758
2858
|
}
|
|
2859
|
+
else if (this.sdkApi.isWeb) {
|
|
2860
|
+
return true;
|
|
2861
|
+
}
|
|
2759
2862
|
else {
|
|
2760
2863
|
return false;
|
|
2761
2864
|
}
|
|
2762
2865
|
}
|
|
2866
|
+
get isSdkSupportTimelineOnBeforeStart() {
|
|
2867
|
+
return this.sdkApi.isSdkSupportTimelineOnBeforeStart();
|
|
2868
|
+
}
|
|
2763
2869
|
get index() {
|
|
2764
2870
|
return this.slideIndex;
|
|
2765
2871
|
}
|
|
@@ -2797,7 +2903,24 @@ class SlideTimeline {
|
|
|
2797
2903
|
//@ts-ignore
|
|
2798
2904
|
// window._log(`updateTimeline, a: ${action} ct: ${currentTime} d: ${duration} tds: ${this.timelineDisabledState}`, true);
|
|
2799
2905
|
// console.trace(`updateTimeline ${action} slideIndex: ${this.slideIndex} currentTime:${currentTime} duration:${duration} tds: ${this.timelineDisabledState}`);
|
|
2800
|
-
|
|
2906
|
+
this.sdkApi.updateTimeline(this.slideIndex, action, currentTime, duration, showLoader, showError);
|
|
2907
|
+
}
|
|
2908
|
+
/**
|
|
2909
|
+
* trigger timeline update for new slide in sdk, before slide strat event (prevent timeout in timeline while we wait for video start)
|
|
2910
|
+
*/
|
|
2911
|
+
triggerSlideLoadState() {
|
|
2912
|
+
if (this.isSDKSupportUpdateTimeline && this.isSdkSupportTimelineOnBeforeStart) {
|
|
2913
|
+
let duration = this.slideDuration;
|
|
2914
|
+
// tmp
|
|
2915
|
+
// todo брать из модели
|
|
2916
|
+
if (!duration) {
|
|
2917
|
+
duration = DEFAULT_SLIDE_DURATION;
|
|
2918
|
+
}
|
|
2919
|
+
if (this.timelineDisabledState === TimelineDisabledState.disabled) {
|
|
2920
|
+
duration = 0;
|
|
2921
|
+
}
|
|
2922
|
+
this.sdkApi.updateTimeline(this.slideIndex, "before_start" /* TIMELINE_ACTION.BEFORE_START */, 0, duration, false, false);
|
|
2923
|
+
}
|
|
2801
2924
|
}
|
|
2802
2925
|
/**
|
|
2803
2926
|
* Start timeline after slide started
|
|
@@ -2836,7 +2959,7 @@ class SlideTimeline {
|
|
|
2836
2959
|
this.updateTimeline("pause" /* TIMELINE_ACTION.PAUSE */);
|
|
2837
2960
|
}
|
|
2838
2961
|
else {
|
|
2839
|
-
this.
|
|
2962
|
+
this.sdkApi.cardPausedCallback(videoCurrentTime);
|
|
2840
2963
|
}
|
|
2841
2964
|
}
|
|
2842
2965
|
slideResumed(videoCurrentTime) {
|
|
@@ -2851,7 +2974,7 @@ class SlideTimeline {
|
|
|
2851
2974
|
this.updateTimeline("start" /* TIMELINE_ACTION.START */);
|
|
2852
2975
|
}
|
|
2853
2976
|
else {
|
|
2854
|
-
this.
|
|
2977
|
+
this.sdkApi.cardResumedCallback(videoCurrentTime);
|
|
2855
2978
|
}
|
|
2856
2979
|
}
|
|
2857
2980
|
slideStopped() {
|
|
@@ -2908,7 +3031,7 @@ class SlideTimeline {
|
|
|
2908
3031
|
}
|
|
2909
3032
|
this.updateTimeline("stop" /* TIMELINE_ACTION.STOP */, false, true);
|
|
2910
3033
|
}
|
|
2911
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`number`, `number`, `boolean`, `Promise`, `(cb: () => void) => void`]; }
|
|
3034
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`number`, `number`, `boolean`, `Promise`, `(cb: () => void) => void`, `SDKApi`]; }
|
|
2912
3035
|
}
|
|
2913
3036
|
|
|
2914
3037
|
class Layer {
|
|
@@ -2916,6 +3039,9 @@ class Layer {
|
|
|
2916
3039
|
_slide;
|
|
2917
3040
|
_slideReadyPromise;
|
|
2918
3041
|
_afterResumeQueuePush;
|
|
3042
|
+
_afterStartInitQueuePush;
|
|
3043
|
+
_showNextSlide;
|
|
3044
|
+
sdkApi;
|
|
2919
3045
|
_slideIndex;
|
|
2920
3046
|
_cardId;
|
|
2921
3047
|
_cardType;
|
|
@@ -2925,11 +3051,14 @@ class Layer {
|
|
|
2925
3051
|
_disabledNavigation;
|
|
2926
3052
|
_elements = [];
|
|
2927
3053
|
_timeline;
|
|
2928
|
-
constructor(_nodeRef, _slide, _slideReadyPromise, _afterResumeQueuePush) {
|
|
3054
|
+
constructor(_nodeRef, _slide, _slideReadyPromise, _afterResumeQueuePush, _afterStartInitQueuePush, _showNextSlide, sdkApi) {
|
|
2929
3055
|
this._nodeRef = _nodeRef;
|
|
2930
3056
|
this._slide = _slide;
|
|
2931
3057
|
this._slideReadyPromise = _slideReadyPromise;
|
|
2932
3058
|
this._afterResumeQueuePush = _afterResumeQueuePush;
|
|
3059
|
+
this._afterStartInitQueuePush = _afterStartInitQueuePush;
|
|
3060
|
+
this._showNextSlide = _showNextSlide;
|
|
3061
|
+
this.sdkApi = sdkApi;
|
|
2933
3062
|
this._slideIndex = parseInt(this._nodeRef.getAttribute("data-index") ?? "0");
|
|
2934
3063
|
this._cardId = parseInt(this._nodeRef.getAttribute("data-id") ?? "0");
|
|
2935
3064
|
this._cardType = parseInt(this._nodeRef.getAttribute("data-card-type") ?? "1") || 1 /* CARD_TYPE.STORY */;
|
|
@@ -2937,11 +3066,19 @@ class Layer {
|
|
|
2937
3066
|
this._duration = parseInt(this._nodeRef.getAttribute("data-duration") ?? "") || DEFAULT_SLIDE_DURATION;
|
|
2938
3067
|
this._disabledTimer = this._nodeRef.getAttribute("data-disable-timer") === "1";
|
|
2939
3068
|
this._disabledNavigation = this._nodeRef.getAttribute("data-disable-navigation") === "1";
|
|
2940
|
-
this._timeline = new SlideTimeline(this._slideIndex, this._duration, this._disabledTimer, this._slideReadyPromise, this._afterResumeQueuePush);
|
|
3069
|
+
this._timeline = new SlideTimeline(this._slideIndex, this._duration, this._disabledTimer, this._slideReadyPromise, this._afterResumeQueuePush, this.sdkApi);
|
|
3070
|
+
const onWidgetComplete = (cardId, slideIndex) => {
|
|
3071
|
+
// todo if nothing more widgets with disabled timers - we can start layer timeline
|
|
3072
|
+
const fallback = () => this._showNextSlide(DEFAULT_SLIDE_DURATION);
|
|
3073
|
+
// для android sdk важно чтобы этот метод вызывался только после slide_start
|
|
3074
|
+
this._afterStartInitQueuePush(() => {
|
|
3075
|
+
this._timeline.startDisabledTimeline(fallback);
|
|
3076
|
+
});
|
|
3077
|
+
};
|
|
2941
3078
|
const _elementsNodes = this._nodeRef.querySelectorAll(".narrative-slide-elements .narrative-element");
|
|
2942
3079
|
let layerWithWidgetQuest = false;
|
|
2943
3080
|
_elementsNodes.forEach(item => {
|
|
2944
|
-
let element = tryCreateFromHtmlElement(item, this);
|
|
3081
|
+
let element = tryCreateFromHtmlElement(item, this, onWidgetComplete, this.sdkApi);
|
|
2945
3082
|
if (element) {
|
|
2946
3083
|
this._elements.push(element);
|
|
2947
3084
|
if (element instanceof Quest) {
|
|
@@ -2956,7 +3093,7 @@ class Layer {
|
|
|
2956
3093
|
* - then init WidgetQuest with layer instead of WidgetQuest element (required for WidgetQuest slides navigation)
|
|
2957
3094
|
*/
|
|
2958
3095
|
if (this.isQuest && !layerWithWidgetQuest && this.layoutService.layoutApi.widgetQuestApi != null) {
|
|
2959
|
-
this._elements.push(new Quest(this._nodeRef, this, this.layoutService.layoutApi.widgetQuestApi));
|
|
3096
|
+
this._elements.push(new Quest(this._nodeRef, this, this.layoutService.layoutApi.widgetQuestApi, onWidgetComplete, this.sdkApi));
|
|
2960
3097
|
}
|
|
2961
3098
|
}
|
|
2962
3099
|
init(localData) {
|
|
@@ -2985,11 +3122,8 @@ class Layer {
|
|
|
2985
3122
|
get layoutService() {
|
|
2986
3123
|
return container.get({ identifier: "LayoutService" });
|
|
2987
3124
|
}
|
|
2988
|
-
get sdkApi() {
|
|
2989
|
-
return container.get({ identifier: "SDKApi" });
|
|
2990
|
-
}
|
|
2991
3125
|
getLocalData() {
|
|
2992
|
-
return this.
|
|
3126
|
+
return this.sdkApi.getCardLocalData();
|
|
2993
3127
|
}
|
|
2994
3128
|
get isQuest() {
|
|
2995
3129
|
return this._nodeRef.getAttribute("data-quest-count") != null;
|
|
@@ -3253,7 +3387,7 @@ class Layer {
|
|
|
3253
3387
|
get isLayerForcePaused() {
|
|
3254
3388
|
return this.elements.some(element => element.isLayerForcePaused);
|
|
3255
3389
|
}
|
|
3256
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Slide`, `Promise`, `(cb: () => void) => void`]; }
|
|
3390
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Slide`, `Promise`, `(cb: () => void) => void`, `(cb: () => void) => void`, `(duration: number) => void`, `SDKApi`]; }
|
|
3257
3391
|
}
|
|
3258
3392
|
const TextFit = (function () {
|
|
3259
3393
|
const defaultSettings = {
|
|
@@ -3427,17 +3561,23 @@ class Slide {
|
|
|
3427
3561
|
_slidesNodesRefs;
|
|
3428
3562
|
_slideReadyPromise;
|
|
3429
3563
|
_afterResumeQueuePush;
|
|
3564
|
+
_afterStartInitQueuePush;
|
|
3565
|
+
_showNextSlide;
|
|
3566
|
+
sdkApi;
|
|
3430
3567
|
_layers;
|
|
3431
3568
|
_start;
|
|
3432
|
-
constructor(_slidesNodesRefs, _slideReadyPromise, _afterResumeQueuePush) {
|
|
3569
|
+
constructor(_slidesNodesRefs, _slideReadyPromise, _afterResumeQueuePush, _afterStartInitQueuePush, _showNextSlide, sdkApi) {
|
|
3433
3570
|
this._slidesNodesRefs = _slidesNodesRefs;
|
|
3434
3571
|
this._slideReadyPromise = _slideReadyPromise;
|
|
3435
3572
|
this._afterResumeQueuePush = _afterResumeQueuePush;
|
|
3573
|
+
this._afterStartInitQueuePush = _afterStartInitQueuePush;
|
|
3574
|
+
this._showNextSlide = _showNextSlide;
|
|
3575
|
+
this.sdkApi = sdkApi;
|
|
3436
3576
|
this._start = window.performance.now();
|
|
3437
3577
|
if (!this._slidesNodesRefs.length) {
|
|
3438
3578
|
throw new Error("No slides found.");
|
|
3439
3579
|
}
|
|
3440
|
-
this._layers = this._slidesNodesRefs.map(item => new Layer(item, this, this._slideReadyPromise, this._afterResumeQueuePush));
|
|
3580
|
+
this._layers = this._slidesNodesRefs.map(item => new Layer(item, this, this._slideReadyPromise, this._afterResumeQueuePush, this._afterStartInitQueuePush, this._showNextSlide, this.sdkApi));
|
|
3441
3581
|
this._activeLayer = this._layers[0];
|
|
3442
3582
|
}
|
|
3443
3583
|
_activeLayer;
|
|
@@ -3456,7 +3596,7 @@ class Slide {
|
|
|
3456
3596
|
const multiSlideApi = this.layoutService.layoutApi.widgetMultiSlideApi;
|
|
3457
3597
|
if (multiSlideApi != null && this.layers.length > 1) {
|
|
3458
3598
|
try {
|
|
3459
|
-
multiSlideApi.init(this.layersNodesRefs, localData);
|
|
3599
|
+
multiSlideApi.init(this.layersNodesRefs, localData, this.sdkApi);
|
|
3460
3600
|
}
|
|
3461
3601
|
catch (e) {
|
|
3462
3602
|
console.error(e);
|
|
@@ -3528,7 +3668,7 @@ class Slide {
|
|
|
3528
3668
|
get disabledNavigation() {
|
|
3529
3669
|
return this._activeLayer.disabledNavigation;
|
|
3530
3670
|
}
|
|
3531
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Array`, `Promise`, `(cb: () => void) => void`]; }
|
|
3671
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Array`, `Promise`, `(cb: () => void) => void`, `(cb: () => void) => void`, `(duration: number) => void`, `SDKApi`]; }
|
|
3532
3672
|
}
|
|
3533
3673
|
|
|
3534
3674
|
let SlideApi$1 = class SlideApi {
|
|
@@ -3541,10 +3681,18 @@ let SlideApi$1 = class SlideApi {
|
|
|
3541
3681
|
static prerenderBoxClassName = "narrative-slide-box-prerender";
|
|
3542
3682
|
_slideWrapper;
|
|
3543
3683
|
_viewport;
|
|
3684
|
+
_getViewportWidth;
|
|
3685
|
+
_getViewportHeight;
|
|
3686
|
+
_overlappingActionBarHeight;
|
|
3687
|
+
sdkApi;
|
|
3544
3688
|
constructor(config) {
|
|
3545
3689
|
this.config = config;
|
|
3690
|
+
this.sdkApi = config.sdkApi;
|
|
3546
3691
|
this._slideWrapper = config.slideWrapper;
|
|
3547
3692
|
this._viewport = config.viewport;
|
|
3693
|
+
this._getViewportWidth = config.getViewportWidth;
|
|
3694
|
+
this._getViewportHeight = config.getViewportHeight;
|
|
3695
|
+
this._overlappingActionBarHeight = config.overlappingActionBarHeight ?? 0;
|
|
3548
3696
|
this.refreshSizes = proxy(this.refreshSizes, this);
|
|
3549
3697
|
this.initListeners();
|
|
3550
3698
|
this.refreshSizes();
|
|
@@ -3574,10 +3722,8 @@ let SlideApi$1 = class SlideApi {
|
|
|
3574
3722
|
this._viewport.removeEventListener("resize", this.refreshSizes);
|
|
3575
3723
|
}
|
|
3576
3724
|
refreshSizes() {
|
|
3577
|
-
|
|
3578
|
-
const
|
|
3579
|
-
// const viewportHeight = getViewportHeight(this._viewport);
|
|
3580
|
-
const viewportHeight = this._slideWrapper.clientHeight;
|
|
3725
|
+
const viewportWidth = this._getViewportWidth();
|
|
3726
|
+
const viewportHeight = this._getViewportHeight();
|
|
3581
3727
|
const viewportRatio = viewportWidth / viewportHeight;
|
|
3582
3728
|
let slideWidth = 0;
|
|
3583
3729
|
let slideHeight = 0;
|
|
@@ -3603,7 +3749,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
3603
3749
|
slideOffset.style.margin = -1 * offset + "px" + " 0 ";
|
|
3604
3750
|
}
|
|
3605
3751
|
// offset from viewport bottom to StoryBottom plus safe area offset bottom
|
|
3606
|
-
yOffset = `calc(${offset}px + env(safe-area-inset-bottom))`;
|
|
3752
|
+
yOffset = `calc(${offset + this._overlappingActionBarHeight}px + env(safe-area-inset-bottom))`;
|
|
3607
3753
|
// detect safe area offset
|
|
3608
3754
|
}
|
|
3609
3755
|
else {
|
|
@@ -3616,7 +3762,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
3616
3762
|
if (slideOffset != null) {
|
|
3617
3763
|
slideOffset.style.margin = -offset + "px" + " 0 ";
|
|
3618
3764
|
}
|
|
3619
|
-
yOffset = offset + "px";
|
|
3765
|
+
yOffset = offset + this._overlappingActionBarHeight + "px";
|
|
3620
3766
|
}
|
|
3621
3767
|
else {
|
|
3622
3768
|
// вьюпорт более вытянутый чем надо
|
|
@@ -3641,7 +3787,6 @@ let SlideApi$1 = class SlideApi {
|
|
|
3641
3787
|
if (_isFullscreen) {
|
|
3642
3788
|
slideOffset?.classList.add("narrative-slide-offset-fullscreen");
|
|
3643
3789
|
}
|
|
3644
|
-
console.log({ fontSize, slideWidth });
|
|
3645
3790
|
if (this.config.userResizeHandler != null) {
|
|
3646
3791
|
this.config.userResizeHandler({ viewportWidth, viewportHeight, fontSize });
|
|
3647
3792
|
}
|
|
@@ -3674,10 +3819,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
3674
3819
|
return container.get({ identifier: "LayoutService" });
|
|
3675
3820
|
}
|
|
3676
3821
|
getLocalData() {
|
|
3677
|
-
return this.
|
|
3678
|
-
}
|
|
3679
|
-
get sdkApi() {
|
|
3680
|
-
return container.get({ identifier: "SDKApi" });
|
|
3822
|
+
return this.sdkApi.getCardLocalData();
|
|
3681
3823
|
}
|
|
3682
3824
|
_fontsInit = false;
|
|
3683
3825
|
_initAndLoadFonts(fonts) {
|
|
@@ -3732,6 +3874,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
3732
3874
|
async _onAllMediaLoaded(slide) {
|
|
3733
3875
|
return new Promise((resolve, reject) => {
|
|
3734
3876
|
const promises = slide.layers.flatMap(layer => layer.elements.flatMap(element => element.mediaElementsLoadingPromises));
|
|
3877
|
+
console.log({ promises });
|
|
3735
3878
|
let checkerTimerId = undefined;
|
|
3736
3879
|
let timeOutFired = false;
|
|
3737
3880
|
if (promises.length > 0) {
|
|
@@ -3773,15 +3916,16 @@ let SlideApi$1 = class SlideApi {
|
|
|
3773
3916
|
slideReadyResolve = resolve;
|
|
3774
3917
|
slideReadyReject = reject;
|
|
3775
3918
|
});
|
|
3776
|
-
const slide = new Slide(slidesNodesRefs, slideReadyPromise, this.afterResumeQueuePush.bind(this));
|
|
3919
|
+
const slide = new Slide(slidesNodesRefs, slideReadyPromise, this.afterResumeQueuePush.bind(this), this.afterStartInitQueuePush.bind(this), this.sdkApi.showNextSlide.bind(this), this.sdkApi);
|
|
3777
3920
|
this._slideInInit = slide;
|
|
3921
|
+
slide.activeLayer.timeline.triggerSlideLoadState();
|
|
3778
3922
|
const onAllMediaLoaded = this._onAllMediaLoaded(slide);
|
|
3779
3923
|
if (this.sdkApi.isAndroid) {
|
|
3780
3924
|
this._afterStartInitQueue = [];
|
|
3781
3925
|
}
|
|
3782
3926
|
this._afterResumeQueue = [];
|
|
3783
3927
|
const result = { slide, result: false, reason: "" };
|
|
3784
|
-
await this._initAndLoadFonts(this.
|
|
3928
|
+
await this._initAndLoadFonts(this.sdkApi.getCardFonts());
|
|
3785
3929
|
const localData = await this.getLocalData();
|
|
3786
3930
|
const finishRender = await slide.init(localData);
|
|
3787
3931
|
/**
|
|
@@ -3829,8 +3973,15 @@ let SlideApi$1 = class SlideApi {
|
|
|
3829
3973
|
slideBoxPrerender.classList.remove(SlideApi.prerenderBoxClassName);
|
|
3830
3974
|
slideBox.classList.remove(SlideApi.renderedBoxClassName);
|
|
3831
3975
|
slideBox.classList.add(SlideApi.prerenderBoxClassName);
|
|
3832
|
-
|
|
3833
|
-
|
|
3976
|
+
// 2 RAF - wait for browser render complete (CSS changes, etc.)
|
|
3977
|
+
this.layoutService.env.requestAnimationFrame(() => {
|
|
3978
|
+
this.layoutService.env.requestAnimationFrame(() => {
|
|
3979
|
+
prevSlide?.onBeforeUnmount();
|
|
3980
|
+
// @ts-ignore
|
|
3981
|
+
// _log("clear innerHTML", true);
|
|
3982
|
+
slideBox.innerHTML = "";
|
|
3983
|
+
});
|
|
3984
|
+
});
|
|
3834
3985
|
slideBoxPrerender.classList.add(SlideApi.renderedBoxClassName);
|
|
3835
3986
|
}
|
|
3836
3987
|
this._slideInRender = false;
|
|
@@ -4056,6 +4207,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
4056
4207
|
if (target?.classList.contains("narrative-element-geometry")) {
|
|
4057
4208
|
target = target?.querySelector(".narrative-element");
|
|
4058
4209
|
}
|
|
4210
|
+
/** Button */
|
|
4059
4211
|
if (target?.classList.contains("narrative-element-link")) {
|
|
4060
4212
|
element = target;
|
|
4061
4213
|
}
|
|
@@ -4064,320 +4216,328 @@ let SlideApi$1 = class SlideApi {
|
|
|
4064
4216
|
}
|
|
4065
4217
|
if (element) {
|
|
4066
4218
|
const { handled } = this._handleLinkAndSwipeUpActivation(element);
|
|
4067
|
-
|
|
4068
|
-
|
|
4219
|
+
if (handled) {
|
|
4220
|
+
result.canClickNext = false;
|
|
4221
|
+
return result;
|
|
4222
|
+
}
|
|
4223
|
+
}
|
|
4224
|
+
/** Image */
|
|
4225
|
+
if (target?.classList.contains("narrative-element-image")) {
|
|
4226
|
+
element = target;
|
|
4069
4227
|
}
|
|
4070
4228
|
else {
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
}
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
}
|
|
4078
|
-
if (element) {
|
|
4079
|
-
const { handled } = this._handleLinkAndSwipeUpActivation(element);
|
|
4080
|
-
result.canClickNext = !handled;
|
|
4229
|
+
element = target?.closest(".narrative-element-image");
|
|
4230
|
+
}
|
|
4231
|
+
if (element) {
|
|
4232
|
+
const { handled } = this._handleLinkAndSwipeUpActivation(element);
|
|
4233
|
+
if (handled) {
|
|
4234
|
+
result.canClickNext = false;
|
|
4081
4235
|
return result;
|
|
4082
4236
|
}
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
return result;
|
|
4095
|
-
}
|
|
4096
|
-
}
|
|
4097
|
-
/** Swipe Up Items */
|
|
4098
|
-
if (target?.classList.contains("narrative-element-swipe-up-items")) {
|
|
4099
|
-
element = target;
|
|
4100
|
-
}
|
|
4101
|
-
else {
|
|
4102
|
-
element = target?.closest(".narrative-element-swipe-up-items");
|
|
4103
|
-
}
|
|
4104
|
-
if (element) {
|
|
4105
|
-
const { handled } = this._handleLinkAndSwipeUpActivation(element);
|
|
4106
|
-
if (handled) {
|
|
4107
|
-
result.canClickNext = false;
|
|
4108
|
-
return result;
|
|
4109
|
-
}
|
|
4110
|
-
}
|
|
4111
|
-
/** Products */
|
|
4112
|
-
if (target?.classList.contains("narrative-element-products")) {
|
|
4113
|
-
element = target;
|
|
4114
|
-
}
|
|
4115
|
-
else {
|
|
4116
|
-
element = target?.closest(".narrative-element-products");
|
|
4117
|
-
}
|
|
4118
|
-
if (element) {
|
|
4119
|
-
const { handled } = this._handleLinkAndSwipeUpActivation(element);
|
|
4120
|
-
if (handled) {
|
|
4121
|
-
result.canClickNext = false;
|
|
4122
|
-
return result;
|
|
4123
|
-
}
|
|
4124
|
-
}
|
|
4125
|
-
/** Vote complete button (multiple choice) */
|
|
4126
|
-
if (target?.classList.contains("narrative-element-vote-next-button")) {
|
|
4127
|
-
element = target;
|
|
4128
|
-
}
|
|
4129
|
-
else {
|
|
4130
|
-
element = target?.closest(".narrative-element-vote-next-button");
|
|
4131
|
-
}
|
|
4132
|
-
if (element) {
|
|
4133
|
-
// if is widget file connected to Window
|
|
4134
|
-
if (this.layoutService.layoutApi.widgetVoteApi) {
|
|
4135
|
-
if (this.layoutService.layoutApi.widgetVoteApi.click(element)) {
|
|
4136
|
-
this.layoutService.env.setTimeout(() => {
|
|
4137
|
-
this.sdkApi.showNextSlide(0);
|
|
4138
|
-
});
|
|
4139
|
-
}
|
|
4140
|
-
result.canClickNext = false;
|
|
4141
|
-
return result;
|
|
4142
|
-
}
|
|
4143
|
-
}
|
|
4144
|
-
/** Next button */
|
|
4145
|
-
if (target?.classList.contains("narrative-element-quiz-next-button")) {
|
|
4146
|
-
element = target;
|
|
4147
|
-
}
|
|
4148
|
-
else {
|
|
4149
|
-
element = target?.closest(".narrative-element-quiz-next-button");
|
|
4150
|
-
}
|
|
4151
|
-
if (!element) {
|
|
4152
|
-
if (target?.classList.contains("narrative-element-test-next-button")) {
|
|
4153
|
-
element = target;
|
|
4154
|
-
}
|
|
4155
|
-
else {
|
|
4156
|
-
element = target?.closest(".narrative-element-test-next-button");
|
|
4157
|
-
}
|
|
4158
|
-
}
|
|
4159
|
-
if (element) {
|
|
4160
|
-
this.layoutService.env.setTimeout(() => {
|
|
4161
|
-
this.sdkApi.showNextSlide(0);
|
|
4162
|
-
});
|
|
4237
|
+
}
|
|
4238
|
+
/** Swipe Up */
|
|
4239
|
+
if (target?.classList.contains("narrative-element-swipe-up")) {
|
|
4240
|
+
element = target;
|
|
4241
|
+
}
|
|
4242
|
+
else {
|
|
4243
|
+
element = target?.closest(".narrative-element-swipe-up");
|
|
4244
|
+
}
|
|
4245
|
+
if (element) {
|
|
4246
|
+
const { handled } = this._handleLinkAndSwipeUpActivation(element);
|
|
4247
|
+
if (handled) {
|
|
4163
4248
|
result.canClickNext = false;
|
|
4164
4249
|
return result;
|
|
4165
4250
|
}
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
if (target?.classList.contains("narrative-element-range-slider-next-button")) {
|
|
4180
|
-
element = target;
|
|
4251
|
+
}
|
|
4252
|
+
/** Swipe Up Items */
|
|
4253
|
+
if (target?.classList.contains("narrative-element-swipe-up-items")) {
|
|
4254
|
+
element = target;
|
|
4255
|
+
}
|
|
4256
|
+
else {
|
|
4257
|
+
element = target?.closest(".narrative-element-swipe-up-items");
|
|
4258
|
+
}
|
|
4259
|
+
if (element) {
|
|
4260
|
+
const { handled } = this._handleLinkAndSwipeUpActivation(element);
|
|
4261
|
+
if (handled) {
|
|
4262
|
+
result.canClickNext = false;
|
|
4263
|
+
return result;
|
|
4181
4264
|
}
|
|
4182
|
-
|
|
4183
|
-
|
|
4265
|
+
}
|
|
4266
|
+
/** Products */
|
|
4267
|
+
if (target?.classList.contains("narrative-element-products")) {
|
|
4268
|
+
element = target;
|
|
4269
|
+
}
|
|
4270
|
+
else {
|
|
4271
|
+
element = target?.closest(".narrative-element-products");
|
|
4272
|
+
}
|
|
4273
|
+
if (element) {
|
|
4274
|
+
const { handled } = this._handleLinkAndSwipeUpActivation(element);
|
|
4275
|
+
if (handled) {
|
|
4276
|
+
result.canClickNext = false;
|
|
4277
|
+
return result;
|
|
4184
4278
|
}
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4279
|
+
}
|
|
4280
|
+
/** Vote complete button (multiple choice) */
|
|
4281
|
+
if (target?.classList.contains("narrative-element-vote-next-button")) {
|
|
4282
|
+
element = target;
|
|
4283
|
+
}
|
|
4284
|
+
else {
|
|
4285
|
+
element = target?.closest(".narrative-element-vote-next-button");
|
|
4286
|
+
}
|
|
4287
|
+
if (element) {
|
|
4288
|
+
// if is widget file connected to Window
|
|
4289
|
+
if (this.layoutService.layoutApi.widgetVoteApi) {
|
|
4290
|
+
if (this.layoutService.layoutApi.widgetVoteApi.click(element)) {
|
|
4291
|
+
this.layoutService.env.setTimeout(() => {
|
|
4292
|
+
this.sdkApi.showNextSlide(0);
|
|
4293
|
+
});
|
|
4194
4294
|
}
|
|
4295
|
+
result.canClickNext = false;
|
|
4296
|
+
return result;
|
|
4195
4297
|
}
|
|
4196
|
-
|
|
4197
|
-
|
|
4298
|
+
}
|
|
4299
|
+
/** Next button */
|
|
4300
|
+
if (target?.classList.contains("narrative-element-quiz-next-button")) {
|
|
4301
|
+
element = target;
|
|
4302
|
+
}
|
|
4303
|
+
else {
|
|
4304
|
+
element = target?.closest(".narrative-element-quiz-next-button");
|
|
4305
|
+
}
|
|
4306
|
+
if (!element) {
|
|
4307
|
+
if (target?.classList.contains("narrative-element-test-next-button")) {
|
|
4198
4308
|
element = target;
|
|
4199
4309
|
}
|
|
4200
4310
|
else {
|
|
4201
|
-
element = target?.closest(".narrative-element-
|
|
4202
|
-
}
|
|
4203
|
-
if (element) {
|
|
4204
|
-
if (this.layoutService.layoutApi.widgetDataInputApi) {
|
|
4205
|
-
result.canClickNext = this.layoutService.layoutApi.widgetDataInputApi.click(element);
|
|
4206
|
-
return result;
|
|
4207
|
-
}
|
|
4311
|
+
element = target?.closest(".narrative-element-test-next-button");
|
|
4208
4312
|
}
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4313
|
+
}
|
|
4314
|
+
if (element) {
|
|
4315
|
+
this.layoutService.env.setTimeout(() => {
|
|
4316
|
+
this.sdkApi.showNextSlide(0);
|
|
4317
|
+
});
|
|
4318
|
+
result.canClickNext = false;
|
|
4319
|
+
return result;
|
|
4320
|
+
}
|
|
4321
|
+
/** Range slider */
|
|
4322
|
+
let rangeSliderBorderBoxView = target;
|
|
4323
|
+
if (target?.classList.contains("border-box-view") || (rangeSliderBorderBoxView = target?.closest(".border-box-view"))) {
|
|
4324
|
+
if (rangeSliderBorderBoxView?.parentElement && rangeSliderBorderBoxView.parentElement.classList.contains("narrative-element-range-slider")) {
|
|
4325
|
+
// skip click on .border-box-view inside .narrative-element-range-slider - prevent navigation trigger at click inside widget body (expect NextButton)
|
|
4326
|
+
result.canClickNext = false;
|
|
4327
|
+
return result;
|
|
4215
4328
|
}
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4329
|
+
}
|
|
4330
|
+
// if (_hasClass(target, "rangeslider") || target.closest(".rangeslider")) {
|
|
4331
|
+
// return;
|
|
4332
|
+
// }
|
|
4333
|
+
/** Range slider complete button */
|
|
4334
|
+
if (target?.classList.contains("narrative-element-range-slider-next-button")) {
|
|
4335
|
+
element = target;
|
|
4336
|
+
}
|
|
4337
|
+
else {
|
|
4338
|
+
element = target?.closest(".narrative-element-range-slider-next-button");
|
|
4339
|
+
}
|
|
4340
|
+
if (element) {
|
|
4341
|
+
if (this.layoutService.layoutApi.widgetRangeSliderApi) {
|
|
4342
|
+
if (this.layoutService.layoutApi.widgetRangeSliderApi.click(element)) {
|
|
4343
|
+
this.layoutService.env.setTimeout(() => {
|
|
4344
|
+
this.sdkApi.showNextSlide(0);
|
|
4345
|
+
});
|
|
4230
4346
|
}
|
|
4347
|
+
result.canClickNext = false;
|
|
4348
|
+
return result;
|
|
4231
4349
|
}
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4350
|
+
}
|
|
4351
|
+
/** Data input widget расширенный охват на весь виджет */
|
|
4352
|
+
if (target?.classList.contains("narrative-element-data-input")) {
|
|
4353
|
+
element = target;
|
|
4354
|
+
}
|
|
4355
|
+
else {
|
|
4356
|
+
element = target?.closest(".narrative-element-data-input");
|
|
4357
|
+
}
|
|
4358
|
+
if (element) {
|
|
4359
|
+
if (this.layoutService.layoutApi.widgetDataInputApi) {
|
|
4360
|
+
result.canClickNext = this.layoutService.layoutApi.widgetDataInputApi.click(element);
|
|
4361
|
+
return result;
|
|
4238
4362
|
}
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4363
|
+
}
|
|
4364
|
+
/** quiz */
|
|
4365
|
+
if (target?.classList.contains("narrative-element-quiz-answer")) {
|
|
4366
|
+
element = target;
|
|
4367
|
+
}
|
|
4368
|
+
else {
|
|
4369
|
+
element = target?.closest(".narrative-element-quiz-answer");
|
|
4370
|
+
}
|
|
4371
|
+
if (element) {
|
|
4372
|
+
if (element.closest(".narrative-element-quiz")) {
|
|
4373
|
+
/* quiz */
|
|
4374
|
+
if (this.layoutService.layoutApi.widgetQuizApi) {
|
|
4375
|
+
propagation = this.layoutService.layoutApi.widgetQuizApi.select(element);
|
|
4376
|
+
propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4251
4377
|
}
|
|
4252
4378
|
}
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
else {
|
|
4258
|
-
element = target?.closest(".narrative-element-vote-answer");
|
|
4259
|
-
}
|
|
4260
|
-
if (element) {
|
|
4261
|
-
if (this.layoutService.layoutApi.widgetVoteApi) {
|
|
4262
|
-
propagation = this.layoutService.layoutApi.widgetVoteApi.select(element);
|
|
4379
|
+
else if (element.closest(".narrative-element-quiz-grouped")) {
|
|
4380
|
+
/* quiz-grouped */
|
|
4381
|
+
if (this.layoutService.layoutApi.widgetQuizGroupedApi) {
|
|
4382
|
+
propagation = this.layoutService.layoutApi.widgetQuizGroupedApi.select(element);
|
|
4263
4383
|
propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4264
4384
|
}
|
|
4265
4385
|
}
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4386
|
+
}
|
|
4387
|
+
/** poll or poll layers */
|
|
4388
|
+
if (target?.classList.contains("narrative-element-poll-button")) {
|
|
4389
|
+
element = target;
|
|
4390
|
+
}
|
|
4391
|
+
else {
|
|
4392
|
+
element = target?.closest(".narrative-element-poll-button");
|
|
4393
|
+
}
|
|
4394
|
+
if (element) {
|
|
4395
|
+
if (this.activeLayer.pollElement) {
|
|
4396
|
+
if (this.layoutService.layoutApi.widgetPollApi) {
|
|
4397
|
+
this.layoutService.layoutApi.widgetPollApi.select(element);
|
|
4276
4398
|
propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4277
4399
|
}
|
|
4278
4400
|
}
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
else {
|
|
4284
|
-
element = target?.closest(".narrative-element-test-answer");
|
|
4285
|
-
}
|
|
4286
|
-
if (element) {
|
|
4287
|
-
if (element.closest(".narrative-element-test")) {
|
|
4288
|
-
/* test */
|
|
4289
|
-
if (this.layoutService.layoutApi.widgetTestApi) {
|
|
4290
|
-
propagation = this.layoutService.layoutApi.widgetTestApi.select(element);
|
|
4291
|
-
propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4292
|
-
}
|
|
4293
|
-
}
|
|
4294
|
-
else if (element.closest(".narrative-element-quest")) {
|
|
4295
|
-
/* quest */
|
|
4296
|
-
if (this.layoutService.layoutApi.widgetQuestApi) {
|
|
4297
|
-
propagation = this.layoutService.layoutApi.widgetQuestApi.select(element);
|
|
4298
|
-
propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4299
|
-
}
|
|
4401
|
+
if (this.activeLayer.pollLayersElement) {
|
|
4402
|
+
if (this.layoutService.layoutApi.widgetPollLayersApi) {
|
|
4403
|
+
this.layoutService.layoutApi.widgetPollLayersApi.select(element);
|
|
4404
|
+
propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4300
4405
|
}
|
|
4301
4406
|
}
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4407
|
+
}
|
|
4408
|
+
/** vote */
|
|
4409
|
+
if (target?.classList.contains("narrative-element-vote-answer")) {
|
|
4410
|
+
element = target;
|
|
4411
|
+
}
|
|
4412
|
+
else {
|
|
4413
|
+
element = target?.closest(".narrative-element-vote-answer");
|
|
4414
|
+
}
|
|
4415
|
+
if (element) {
|
|
4416
|
+
if (this.layoutService.layoutApi.widgetVoteApi) {
|
|
4417
|
+
propagation = this.layoutService.layoutApi.widgetVoteApi.select(element);
|
|
4418
|
+
propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4305
4419
|
}
|
|
4306
|
-
|
|
4307
|
-
|
|
4420
|
+
}
|
|
4421
|
+
/** rate */
|
|
4422
|
+
if (target?.classList.contains("narrative-element-rate-input")) {
|
|
4423
|
+
element = target;
|
|
4424
|
+
}
|
|
4425
|
+
else {
|
|
4426
|
+
element = target?.closest(".narrative-element-rate-input");
|
|
4427
|
+
}
|
|
4428
|
+
if (element) {
|
|
4429
|
+
if (this.layoutService.layoutApi.widgetRateApi) {
|
|
4430
|
+
propagation = this.layoutService.layoutApi.widgetRateApi.select(element);
|
|
4431
|
+
propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4308
4432
|
}
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4433
|
+
}
|
|
4434
|
+
/** test */
|
|
4435
|
+
if (target?.classList.contains("narrative-element-test-answer")) {
|
|
4436
|
+
element = target;
|
|
4437
|
+
}
|
|
4438
|
+
else {
|
|
4439
|
+
element = target?.closest(".narrative-element-test-answer");
|
|
4440
|
+
}
|
|
4441
|
+
if (element) {
|
|
4442
|
+
if (element.closest(".narrative-element-test")) {
|
|
4443
|
+
/* test */
|
|
4444
|
+
if (this.layoutService.layoutApi.widgetTestApi) {
|
|
4445
|
+
propagation = this.layoutService.layoutApi.widgetTestApi.select(element);
|
|
4446
|
+
propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4317
4447
|
}
|
|
4318
|
-
// copyToClipboard(element.getAttribute('data-clipboard-target'));
|
|
4319
|
-
// propagation = false;
|
|
4320
|
-
}
|
|
4321
|
-
/** barcode */
|
|
4322
|
-
if (target?.classList.contains("narrative-element-barcode")) {
|
|
4323
|
-
element = target;
|
|
4324
4448
|
}
|
|
4325
|
-
else {
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
// propagation = window._narrative_test.select(element);
|
|
4331
|
-
// propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4332
|
-
// }
|
|
4333
|
-
if (this.layoutService.layoutApi.widgetBarcodeApi) {
|
|
4334
|
-
propagation = this.layoutService.layoutApi.widgetBarcodeApi.click(element);
|
|
4335
|
-
propagation = false; // по клику на Копировать не делаем клик на слайде
|
|
4449
|
+
else if (element.closest(".narrative-element-quest")) {
|
|
4450
|
+
/* quest */
|
|
4451
|
+
if (this.layoutService.layoutApi.widgetQuestApi) {
|
|
4452
|
+
propagation = this.layoutService.layoutApi.widgetQuestApi.select(element);
|
|
4453
|
+
propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4336
4454
|
}
|
|
4337
|
-
// copyToClipboard(element.getAttribute('data-clipboard-target'));
|
|
4338
|
-
// propagation = false;
|
|
4339
4455
|
}
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4456
|
+
}
|
|
4457
|
+
/** copy */
|
|
4458
|
+
if (target?.classList.contains("narrative-element-copy")) {
|
|
4459
|
+
element = target;
|
|
4460
|
+
}
|
|
4461
|
+
else {
|
|
4462
|
+
element = target?.closest(".narrative-element-copy");
|
|
4463
|
+
}
|
|
4464
|
+
if (element) {
|
|
4465
|
+
// if ("_narrative_test" in window) {
|
|
4466
|
+
// propagation = window._narrative_test.select(element);
|
|
4467
|
+
// propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4468
|
+
// }
|
|
4469
|
+
if (this.layoutService.layoutApi.widgetCopyApi) {
|
|
4470
|
+
propagation = this.layoutService.layoutApi.widgetCopyApi.click(element);
|
|
4471
|
+
propagation = false; // по клику на Копировать не делаем клик на слайде
|
|
4343
4472
|
}
|
|
4344
|
-
|
|
4345
|
-
|
|
4473
|
+
// copyToClipboard(element.getAttribute('data-clipboard-target'));
|
|
4474
|
+
// propagation = false;
|
|
4475
|
+
}
|
|
4476
|
+
/** barcode */
|
|
4477
|
+
if (target?.classList.contains("narrative-element-barcode")) {
|
|
4478
|
+
element = target;
|
|
4479
|
+
}
|
|
4480
|
+
else {
|
|
4481
|
+
element = target?.closest(".narrative-element-barcode");
|
|
4482
|
+
}
|
|
4483
|
+
if (element) {
|
|
4484
|
+
// if ("_narrative_test" in window) {
|
|
4485
|
+
// propagation = window._narrative_test.select(element);
|
|
4486
|
+
// propagation = false; // по клику на варианты ответа(даже на законченной викторине) не делаем клик на слайде
|
|
4487
|
+
// }
|
|
4488
|
+
if (this.layoutService.layoutApi.widgetBarcodeApi) {
|
|
4489
|
+
propagation = this.layoutService.layoutApi.widgetBarcodeApi.click(element);
|
|
4490
|
+
propagation = false; // по клику на Копировать не делаем клик на слайде
|
|
4346
4491
|
}
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4492
|
+
// copyToClipboard(element.getAttribute('data-clipboard-target'));
|
|
4493
|
+
// propagation = false;
|
|
4494
|
+
}
|
|
4495
|
+
/** share */
|
|
4496
|
+
if (target?.classList.contains("narrative-element-share")) {
|
|
4497
|
+
element = target;
|
|
4498
|
+
}
|
|
4499
|
+
else {
|
|
4500
|
+
element = target?.closest(".narrative-element-share");
|
|
4501
|
+
}
|
|
4502
|
+
if (element) {
|
|
4503
|
+
if (this.layoutService.layoutApi.widgetShareApi) {
|
|
4504
|
+
this.layoutService.layoutApi.widgetShareApi.click(element);
|
|
4505
|
+
propagation = false;
|
|
4352
4506
|
}
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4507
|
+
}
|
|
4508
|
+
/** story-repeat */
|
|
4509
|
+
if (target?.classList.contains("narrative-element-story-repeat")) {
|
|
4510
|
+
element = target;
|
|
4511
|
+
}
|
|
4512
|
+
else {
|
|
4513
|
+
element = target?.closest(".narrative-element-story-repeat");
|
|
4514
|
+
}
|
|
4515
|
+
if (element) {
|
|
4516
|
+
propagation = false;
|
|
4517
|
+
this.sdkApi.setCardLocalData({}, true);
|
|
4518
|
+
this.sdkApi.updateCardServerDataLocally(this.slide.cardId, {});
|
|
4519
|
+
// window._resetTimers();
|
|
4520
|
+
// сделать async в ios
|
|
4521
|
+
let slideIndex = this.slide.slideIndex;
|
|
4522
|
+
// prevent simultaneous call _showNarrativeSlide and _showLayer - prevent 2 calls of initAfterLoad (break video start on iOS)
|
|
4523
|
+
if (slideIndex === 0) {
|
|
4524
|
+
// for story repeat on the first slide with layers
|
|
4525
|
+
this.sdkApi.showLayer(0);
|
|
4356
4526
|
}
|
|
4357
4527
|
else {
|
|
4358
|
-
|
|
4359
|
-
}
|
|
4360
|
-
if (element) {
|
|
4361
|
-
propagation = false;
|
|
4362
|
-
this.sdkApi.setCardLocalData({}, true);
|
|
4363
|
-
this.sdkApi.updateCardServerDataLocally(this.slide.cardId, {});
|
|
4364
|
-
// window._resetTimers();
|
|
4365
|
-
// сделать async в ios
|
|
4366
|
-
let slideIndex = this.slide.slideIndex;
|
|
4367
|
-
// prevent simultaneous call _showNarrativeSlide and _showLayer - prevent 2 calls of initAfterLoad (break video start on iOS)
|
|
4368
|
-
if (slideIndex === 0) {
|
|
4369
|
-
// for story repeat on the first slide with layers
|
|
4370
|
-
this.sdkApi.showLayer(0);
|
|
4371
|
-
}
|
|
4372
|
-
else {
|
|
4373
|
-
this.sdkApi.showCardSlide(0); // сделать ее async
|
|
4374
|
-
}
|
|
4375
|
-
}
|
|
4376
|
-
if (!propagation) {
|
|
4377
|
-
result.canClickNext = false;
|
|
4378
|
-
return result;
|
|
4528
|
+
this.sdkApi.showCardSlide(0); // сделать ее async
|
|
4379
4529
|
}
|
|
4380
4530
|
}
|
|
4531
|
+
// todo в каждом виджете делать выход через
|
|
4532
|
+
// if (handled) {
|
|
4533
|
+
// result.canClickNext = false;
|
|
4534
|
+
// return result;
|
|
4535
|
+
// }
|
|
4536
|
+
// убрать propagation
|
|
4537
|
+
if (!propagation) {
|
|
4538
|
+
result.canClickNext = false;
|
|
4539
|
+
return result;
|
|
4540
|
+
}
|
|
4381
4541
|
/** can tap to next slide */
|
|
4382
4542
|
if (this.activeLayer.quizElement) {
|
|
4383
4543
|
if (!this.activeLayer.quizElement.slideQuizIsDone && navigationDirection === "forward") {
|
|
@@ -4441,6 +4601,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
4441
4601
|
const linkTargetAndroid = element.getAttribute("data-link-target-android");
|
|
4442
4602
|
const linkTargetWeb = element.getAttribute("data-link-target-web");
|
|
4443
4603
|
const elementId = element.getAttribute("data-element-id") ?? "";
|
|
4604
|
+
// element without URI data
|
|
4444
4605
|
let handled = false;
|
|
4445
4606
|
if (this.sdkApi.isAndroid && linkTargetAndroid) {
|
|
4446
4607
|
linkTarget = linkTargetAndroid;
|
|
@@ -4527,36 +4688,38 @@ let SlideApi$1 = class SlideApi {
|
|
|
4527
4688
|
handled = true;
|
|
4528
4689
|
}
|
|
4529
4690
|
}
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4691
|
+
if (handled) {
|
|
4692
|
+
try {
|
|
4693
|
+
const cardId = this.slide.cardId;
|
|
4694
|
+
const cardType = this.slide.cardType;
|
|
4695
|
+
const slideIndex = this.slide.slideIndex;
|
|
4696
|
+
let baseFields = {};
|
|
4697
|
+
switch (cardType) {
|
|
4698
|
+
case 1 /* CARD_TYPE.STORY */:
|
|
4699
|
+
case 2 /* CARD_TYPE.UGC_STORY */:
|
|
4700
|
+
baseFields.story_id = cardId;
|
|
4701
|
+
break;
|
|
4702
|
+
case 4 /* CARD_TYPE.IN_APP_MESSAGING */:
|
|
4703
|
+
baseFields.message_id = cardId;
|
|
4704
|
+
break;
|
|
4705
|
+
}
|
|
4706
|
+
this.sdkApi.sendStatisticEvent(statisticWidgetEventType, {
|
|
4707
|
+
i: cardId,
|
|
4708
|
+
si: slideIndex,
|
|
4709
|
+
wi: elementId,
|
|
4710
|
+
wl: element.textContent ?? "",
|
|
4711
|
+
wv: statisticWidgetValue ?? "",
|
|
4712
|
+
}, {
|
|
4713
|
+
...baseFields,
|
|
4714
|
+
slide_index: slideIndex,
|
|
4715
|
+
widget_id: elementId,
|
|
4716
|
+
widget_label: element.textContent ?? "",
|
|
4717
|
+
widget_value: statisticWidgetValue ?? "",
|
|
4718
|
+
});
|
|
4719
|
+
}
|
|
4720
|
+
catch (error) {
|
|
4721
|
+
console.error(error);
|
|
4543
4722
|
}
|
|
4544
|
-
this.sdkApi.sendStatisticEvent(statisticWidgetEventType, {
|
|
4545
|
-
i: cardId,
|
|
4546
|
-
si: slideIndex,
|
|
4547
|
-
wi: elementId,
|
|
4548
|
-
wl: element.textContent ?? "",
|
|
4549
|
-
wv: statisticWidgetValue ?? "",
|
|
4550
|
-
}, {
|
|
4551
|
-
...baseFields,
|
|
4552
|
-
slide_index: slideIndex,
|
|
4553
|
-
widget_id: elementId,
|
|
4554
|
-
widget_label: element.textContent ?? "",
|
|
4555
|
-
widget_value: statisticWidgetValue ?? "",
|
|
4556
|
-
});
|
|
4557
|
-
}
|
|
4558
|
-
catch (error) {
|
|
4559
|
-
console.error(error);
|
|
4560
4723
|
}
|
|
4561
4724
|
return { handled };
|
|
4562
4725
|
}
|
|
@@ -4585,10 +4748,20 @@ let SlideApi$1 = class SlideApi {
|
|
|
4585
4748
|
this.activeLayer.shareElement.complete(id, isSuccess);
|
|
4586
4749
|
}
|
|
4587
4750
|
}
|
|
4588
|
-
|
|
4751
|
+
setWidgetGoodsComplete(elementId) {
|
|
4752
|
+
const element = document.querySelector('[data-element-id="' + elementId + '"]');
|
|
4753
|
+
if (element != null) {
|
|
4754
|
+
try {
|
|
4755
|
+
element.style.setProperty("opacity", "1");
|
|
4756
|
+
}
|
|
4757
|
+
catch (e) {
|
|
4758
|
+
console.error(e);
|
|
4759
|
+
}
|
|
4760
|
+
}
|
|
4761
|
+
}
|
|
4762
|
+
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 overlappingActionBarHeight?: number;\n }`]; }
|
|
4589
4763
|
};
|
|
4590
4764
|
|
|
4591
|
-
let sdkInterface;
|
|
4592
4765
|
const slideApiPeerDeps = {};
|
|
4593
4766
|
const createSlideWrapper = ({ slideBoxRatio, nonce }) => {
|
|
4594
4767
|
const slideWrapper = document.createElement("div");
|
|
@@ -4613,7 +4786,6 @@ const createSlideWrapper = ({ slideBoxRatio, nonce }) => {
|
|
|
4613
4786
|
// style.sheet?.insertRule(`.narrative-slide-box {padding: ${paddingTop} 0 0 0;`);
|
|
4614
4787
|
slideBoxRendered.style.padding = `${paddingTop} 0 0 0`;
|
|
4615
4788
|
slideBoxPrerender.style.padding = `${paddingTop} 0 0 0`;
|
|
4616
|
-
console.log({ paddingTop });
|
|
4617
4789
|
slideOffset.appendChild(slideBoxPrerender);
|
|
4618
4790
|
slideOffset.appendChild(slideBoxRendered);
|
|
4619
4791
|
slideWrapper.appendChild(slideOffset);
|
|
@@ -4622,24 +4794,25 @@ const createSlideWrapper = ({ slideBoxRatio, nonce }) => {
|
|
|
4622
4794
|
};
|
|
4623
4795
|
class SlideApi extends SlideApi$1 {
|
|
4624
4796
|
constructor(_sdkInterface, config) {
|
|
4625
|
-
sdkInterface = _sdkInterface;
|
|
4626
4797
|
slideApiPeerDeps.VODPlayer = config.VODPlayer;
|
|
4627
4798
|
const slideWrapper = createSlideWrapper({ slideBoxRatio: config.slideRatio, nonce: config.nonce });
|
|
4628
4799
|
// todo need to clear root node before append slideWrapper?
|
|
4629
4800
|
config.root.appendChild(slideWrapper);
|
|
4630
4801
|
super({
|
|
4802
|
+
sdkApi: new EsModuleSdkApi(_sdkInterface),
|
|
4631
4803
|
slideWrapper,
|
|
4632
4804
|
viewport: config.viewport,
|
|
4633
4805
|
slideRatio: config.slideRatio,
|
|
4634
4806
|
isFullscreen: config.isFullscreen,
|
|
4635
4807
|
userResizeHandler: config.userResizeHandler,
|
|
4808
|
+
getViewportWidth: () => slideWrapper.clientWidth,
|
|
4809
|
+
getViewportHeight: () => slideWrapper.clientHeight,
|
|
4810
|
+
overlappingActionBarHeight: config.overlappingActionBarHeight,
|
|
4636
4811
|
});
|
|
4637
4812
|
}
|
|
4638
|
-
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 }`]; }
|
|
4813
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`SDKInterface`, `{\n root: HTMLElement;\n slideRatio: number;\n isFullscreen: boolean;\n nonce?: string;\n viewport: Window;\n userResizeHandler?: (data: { viewportWidth: number; viewportHeight: number; fontSize: number }) => void;\n VODPlayer?: typeof VODPlayer;\n overlappingActionBarHeight?: number;\n }`]; }
|
|
4639
4814
|
}
|
|
4640
4815
|
|
|
4641
|
-
container.registerSingleton(() => new EsModuleSdkApi(() => sdkInterface), { identifier: `SDKApi` });
|
|
4642
|
-
|
|
4643
4816
|
// This file is part of the bwip-js project available at:
|
|
4644
4817
|
//
|
|
4645
4818
|
// http://metafloor.github.io/bwip-js
|
|
@@ -13996,6 +14169,8 @@ FontLib.loadFont("OCR-B", 96, 100, "AAEAAAAPAIAAAwBwRkZUTXxHn14AADmUAAAAHEdERUYA
|
|
|
13996
14169
|
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); }
|
|
13997
14170
|
|
|
13998
14171
|
class WidgetBase {
|
|
14172
|
+
_onWidgetComplete;
|
|
14173
|
+
sdkApi;
|
|
13999
14174
|
static DEFAULTS = {
|
|
14000
14175
|
slide: null,
|
|
14001
14176
|
activateAfterCreate: false,
|
|
@@ -14004,7 +14179,6 @@ class WidgetBase {
|
|
|
14004
14179
|
};
|
|
14005
14180
|
static widgetIndex = 0;
|
|
14006
14181
|
env = WidgetBase.widgetsService.env;
|
|
14007
|
-
sdkApi = WidgetBase.widgetsService.sdkApi;
|
|
14008
14182
|
options = null;
|
|
14009
14183
|
element = null;
|
|
14010
14184
|
elementId = null;
|
|
@@ -14024,7 +14198,9 @@ class WidgetBase {
|
|
|
14024
14198
|
id;
|
|
14025
14199
|
startReadyPromise = null;
|
|
14026
14200
|
startReadyResolve = null;
|
|
14027
|
-
constructor(element, options, elementIdGetter, slideGetter) {
|
|
14201
|
+
constructor(element, options, _onWidgetComplete, sdkApi, elementIdGetter, slideGetter) {
|
|
14202
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
14203
|
+
this.sdkApi = sdkApi;
|
|
14028
14204
|
this.options = extend({}, this.constructor.DEFAULTS, options);
|
|
14029
14205
|
this.element = element;
|
|
14030
14206
|
if (elementIdGetter) {
|
|
@@ -14132,68 +14308,24 @@ class WidgetBase {
|
|
|
14132
14308
|
return instance;
|
|
14133
14309
|
}
|
|
14134
14310
|
static initWidget(htmlElement, localData, instantiate) {
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
return Promise.resolve(localData);
|
|
14143
|
-
}
|
|
14144
|
-
else {
|
|
14145
|
-
return new Promise(resolve => {
|
|
14146
|
-
this.getLocalData().then(localData => {
|
|
14147
|
-
const widget = this.createInstance(instantiate, htmlElement, {
|
|
14148
|
-
slide: null,
|
|
14149
|
-
localData,
|
|
14150
|
-
});
|
|
14151
|
-
// start widget (just created or cached instance)
|
|
14152
|
-
widget.onRefreshUserData(localData);
|
|
14153
|
-
resolve(localData);
|
|
14154
|
-
});
|
|
14155
|
-
});
|
|
14156
|
-
}
|
|
14157
|
-
}
|
|
14158
|
-
/** @deprecated */
|
|
14159
|
-
static initWidgets(instantiate, elements, localData) {
|
|
14160
|
-
if (localData != null) {
|
|
14161
|
-
forEach(elements, element => {
|
|
14162
|
-
const widget = this.createInstance(instantiate, element, {
|
|
14163
|
-
slide: null,
|
|
14164
|
-
localData,
|
|
14165
|
-
});
|
|
14166
|
-
// start widget (just created or cached instance)
|
|
14167
|
-
widget.onRefreshUserData(localData);
|
|
14168
|
-
});
|
|
14169
|
-
return Promise.resolve(localData);
|
|
14170
|
-
}
|
|
14171
|
-
else {
|
|
14172
|
-
return new Promise(resolve => {
|
|
14173
|
-
this.getLocalData().then(localData => {
|
|
14174
|
-
forEach(elements, element => {
|
|
14175
|
-
const widget = this.createInstance(instantiate, element, {
|
|
14176
|
-
slide: null,
|
|
14177
|
-
localData,
|
|
14178
|
-
});
|
|
14179
|
-
// start widget (just created or cached instance)
|
|
14180
|
-
widget.onRefreshUserData(localData);
|
|
14181
|
-
});
|
|
14182
|
-
resolve(localData);
|
|
14183
|
-
});
|
|
14184
|
-
});
|
|
14185
|
-
}
|
|
14311
|
+
const widget = this.createInstance(instantiate, htmlElement, {
|
|
14312
|
+
slide: null,
|
|
14313
|
+
localData,
|
|
14314
|
+
});
|
|
14315
|
+
// start widget (just created or cached instance)
|
|
14316
|
+
widget.onRefreshUserData(localData);
|
|
14317
|
+
return Promise.resolve(localData);
|
|
14186
14318
|
}
|
|
14187
14319
|
static get widgetsService() {
|
|
14188
14320
|
return container.get({ identifier: "WidgetsService" });
|
|
14189
14321
|
}
|
|
14190
|
-
static getLocalData() {
|
|
14191
|
-
return
|
|
14322
|
+
static getLocalData(sdkApi) {
|
|
14323
|
+
return sdkApi.getCardLocalData();
|
|
14192
14324
|
}
|
|
14193
14325
|
getLocalData() {
|
|
14194
|
-
return this.constructor.getLocalData();
|
|
14326
|
+
return this.constructor.getLocalData(this.sdkApi);
|
|
14195
14327
|
}
|
|
14196
|
-
static setLocalData(keyValue, sendToServer, syncWithRuntimeLocalData) {
|
|
14328
|
+
static setLocalData(sdkApi, keyValue, sendToServer, syncWithRuntimeLocalData) {
|
|
14197
14329
|
// push json object as string
|
|
14198
14330
|
if (sendToServer === undefined) {
|
|
14199
14331
|
sendToServer = true;
|
|
@@ -14208,20 +14340,20 @@ class WidgetBase {
|
|
|
14208
14340
|
syncWithRuntimeLocalData = Boolean(syncWithRuntimeLocalData);
|
|
14209
14341
|
}
|
|
14210
14342
|
if (syncWithRuntimeLocalData) {
|
|
14211
|
-
this.getLocalData().then(localData => {
|
|
14343
|
+
this.getLocalData(sdkApi).then(localData => {
|
|
14212
14344
|
// 1 - old values, 2 - new values
|
|
14213
14345
|
keyValue = extend({}, localData, keyValue);
|
|
14214
14346
|
// todo make async via promise or async
|
|
14215
|
-
|
|
14347
|
+
sdkApi.setCardLocalData(keyValue, sendToServer);
|
|
14216
14348
|
});
|
|
14217
14349
|
}
|
|
14218
14350
|
else {
|
|
14219
14351
|
// todo make async via promise or async
|
|
14220
|
-
|
|
14352
|
+
sdkApi.setCardLocalData(keyValue, sendToServer);
|
|
14221
14353
|
}
|
|
14222
14354
|
}
|
|
14223
14355
|
setLocalData(keyValue, sendToServer, syncWithRuntimeLocalData) {
|
|
14224
|
-
return this.constructor.setLocalData(keyValue, sendToServer, syncWithRuntimeLocalData);
|
|
14356
|
+
return this.constructor.setLocalData(this.sdkApi, keyValue, sendToServer, syncWithRuntimeLocalData);
|
|
14225
14357
|
}
|
|
14226
14358
|
get statisticEventBaseFieldsShortForm() {
|
|
14227
14359
|
return WidgetBase.getStatisticEventBaseFieldsShortForm(this.cardId, this.slideIndex);
|
|
@@ -14248,14 +14380,14 @@ class WidgetBase {
|
|
|
14248
14380
|
}
|
|
14249
14381
|
return data;
|
|
14250
14382
|
}
|
|
14251
|
-
static sendStatisticEventToApp(name, data, devPayload, options) {
|
|
14252
|
-
sendStatisticEventToApp(
|
|
14383
|
+
static sendStatisticEventToApp(sdkApi, name, data, devPayload, options) {
|
|
14384
|
+
sendStatisticEventToApp(sdkApi, name, data, devPayload, options);
|
|
14253
14385
|
}
|
|
14254
14386
|
sendStatisticEventToApp(name, data, devPayload, options) {
|
|
14255
|
-
this.constructor.sendStatisticEventToApp(name, data, devPayload, options);
|
|
14387
|
+
this.constructor.sendStatisticEventToApp(this.sdkApi, name, data, devPayload, options);
|
|
14256
14388
|
}
|
|
14257
|
-
|
|
14258
|
-
this.
|
|
14389
|
+
onWidgetComplete() {
|
|
14390
|
+
this._onWidgetComplete(this.cardId, this.slideIndex);
|
|
14259
14391
|
}
|
|
14260
14392
|
_showLayer(layers, selectIndex, withStatEvent = false) {
|
|
14261
14393
|
if (this.sdkApi.isExistsShowLayer()) {
|
|
@@ -14290,45 +14422,13 @@ class WidgetBase {
|
|
|
14290
14422
|
console.error(error);
|
|
14291
14423
|
}
|
|
14292
14424
|
}
|
|
14293
|
-
/** @deprecated */
|
|
14294
|
-
static refreshUserData(nodes, localData) {
|
|
14295
|
-
const cb = (el, localData) => {
|
|
14296
|
-
const widgetElement = el.closest(`.${this.widgetClassName}`);
|
|
14297
|
-
if (widgetElement) {
|
|
14298
|
-
const widget = WidgetBase.getInstance(widgetElement);
|
|
14299
|
-
if (widget) {
|
|
14300
|
-
widget.onRefreshUserData(localData);
|
|
14301
|
-
}
|
|
14302
|
-
}
|
|
14303
|
-
};
|
|
14304
|
-
if (localData != null) {
|
|
14305
|
-
const elements = slice.call(nodes);
|
|
14306
|
-
forEach(elements, el => cb(el, localData));
|
|
14307
|
-
}
|
|
14308
|
-
else {
|
|
14309
|
-
WidgetBase.getLocalData().then(localData => {
|
|
14310
|
-
const elements = slice.call(nodes);
|
|
14311
|
-
forEach(elements, el => cb(el, localData));
|
|
14312
|
-
});
|
|
14313
|
-
}
|
|
14314
|
-
}
|
|
14315
14425
|
static onRefreshUserData(element, localData) {
|
|
14316
|
-
const
|
|
14317
|
-
|
|
14318
|
-
|
|
14319
|
-
|
|
14320
|
-
|
|
14321
|
-
widget.onRefreshUserData(localData);
|
|
14322
|
-
}
|
|
14426
|
+
const widgetElement = element.closest(`.${this.widgetClassName}`);
|
|
14427
|
+
if (widgetElement) {
|
|
14428
|
+
const widget = WidgetBase.getInstance(widgetElement);
|
|
14429
|
+
if (widget) {
|
|
14430
|
+
widget.onRefreshUserData(localData);
|
|
14323
14431
|
}
|
|
14324
|
-
};
|
|
14325
|
-
if (localData != null) {
|
|
14326
|
-
cb(element, localData);
|
|
14327
|
-
}
|
|
14328
|
-
else {
|
|
14329
|
-
WidgetBase.getLocalData().then(localData => {
|
|
14330
|
-
cb(element, localData);
|
|
14331
|
-
});
|
|
14332
14432
|
}
|
|
14333
14433
|
}
|
|
14334
14434
|
getPromotionalCodeFetchPath(promotionalCodeId) {
|
|
@@ -14339,7 +14439,7 @@ class WidgetBase {
|
|
|
14339
14439
|
return `story/${this.cardId}/widget/${this.elementId}/promo-code/${promotionalCodeId}`;
|
|
14340
14440
|
}
|
|
14341
14441
|
}
|
|
14342
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `(element: HTMLElement) => string`, `(element: HTMLElement) => HTMLElement`]; }
|
|
14442
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`, `(element: HTMLElement) => string`, `(element: HTMLElement) => HTMLElement`]; }
|
|
14343
14443
|
}
|
|
14344
14444
|
|
|
14345
14445
|
class WidgetBarcode extends WidgetBase {
|
|
@@ -14363,8 +14463,8 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14363
14463
|
msgNoMoreCodes;
|
|
14364
14464
|
msgTryAgain;
|
|
14365
14465
|
msgBarcodeRenderError;
|
|
14366
|
-
constructor(element, options) {
|
|
14367
|
-
super(element, options);
|
|
14466
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
14467
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
14368
14468
|
this.captionView = this.element.querySelector(".narrative-element-text-lines");
|
|
14369
14469
|
this.clipboardTarget = getTagData(element, "clipboardTarget");
|
|
14370
14470
|
this.isPromotionalCode = getTagData(element, "clipboardType") === "promocode";
|
|
@@ -14587,7 +14687,7 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14587
14687
|
// флаг - что таймер уже стартанул (в layout или добавить объект sharedMemory)
|
|
14588
14688
|
// смотрим что прозрачный текст - тогда и лоадер прозрачный
|
|
14589
14689
|
// _log("_showNarrativeNextSlide: " + getSlideDuration(this.narrativeId, this.slideIndex), true);
|
|
14590
|
-
this.
|
|
14690
|
+
this.onWidgetComplete();
|
|
14591
14691
|
}
|
|
14592
14692
|
});
|
|
14593
14693
|
if (this.copiedText) {
|
|
@@ -14612,18 +14712,9 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14612
14712
|
}
|
|
14613
14713
|
static api = {
|
|
14614
14714
|
widgetClassName: WidgetBarcode.widgetClassName,
|
|
14615
|
-
/** @deprecated */
|
|
14616
|
-
refreshUserData: WidgetBarcode.refreshUserData,
|
|
14617
14715
|
onRefreshUserData: WidgetBarcode.onRefreshUserData,
|
|
14618
|
-
init: function (element, localData) {
|
|
14619
|
-
WidgetBarcode.initWidget(element, localData, (element, options) => new WidgetBarcode(element, options));
|
|
14620
|
-
},
|
|
14621
|
-
/** @deprecated */
|
|
14622
|
-
initWidget: function (nodeList, localData) {
|
|
14623
|
-
const elements = slice.call(nodeList);
|
|
14624
|
-
WidgetBarcode.initWidgets((element, options) => new WidgetBarcode(element, options), elements, localData).then(() => {
|
|
14625
|
-
elements.forEach(element => WidgetBarcode.getInstance(element)?.onStart());
|
|
14626
|
-
});
|
|
14716
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
14717
|
+
WidgetBarcode.initWidget(element, localData, (element, options) => new WidgetBarcode(element, options, onWidgetComplete, sdkApi));
|
|
14627
14718
|
},
|
|
14628
14719
|
onStart: function (element) {
|
|
14629
14720
|
WidgetBarcode.getInstance(element)?.onStart();
|
|
@@ -14650,7 +14741,7 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14650
14741
|
return false;
|
|
14651
14742
|
},
|
|
14652
14743
|
};
|
|
14653
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
14744
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
14654
14745
|
}
|
|
14655
14746
|
|
|
14656
14747
|
class WidgetCopy extends WidgetBase {
|
|
@@ -14672,8 +14763,8 @@ class WidgetCopy extends WidgetBase {
|
|
|
14672
14763
|
geometry;
|
|
14673
14764
|
resultLayer;
|
|
14674
14765
|
resultLayerGeometry;
|
|
14675
|
-
constructor(element, options) {
|
|
14676
|
-
super(element, options);
|
|
14766
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
14767
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
14677
14768
|
this.button = this.element.querySelector(".narrative-element-text-lines");
|
|
14678
14769
|
this.clipboardTarget = getTagData(element, "clipboardTarget");
|
|
14679
14770
|
this.isPromotionalCode = getTagData(element, "clipboardType") === "promocode";
|
|
@@ -14857,7 +14948,7 @@ class WidgetCopy extends WidgetBase {
|
|
|
14857
14948
|
// флаг - что таймер уже стартанул (в layout или добавить объект sharedMemory)
|
|
14858
14949
|
// смотрим что прозрачный текст - тогда и лоадер прозрачный
|
|
14859
14950
|
// _log("_showNarrativeNextSlide: " + getSlideDuration(this.narrativeId, this.slideIndex), true);
|
|
14860
|
-
this.
|
|
14951
|
+
this.onWidgetComplete();
|
|
14861
14952
|
}
|
|
14862
14953
|
});
|
|
14863
14954
|
}
|
|
@@ -14879,23 +14970,13 @@ class WidgetCopy extends WidgetBase {
|
|
|
14879
14970
|
}
|
|
14880
14971
|
static api = {
|
|
14881
14972
|
widgetClassName: WidgetCopy.widgetClassName,
|
|
14882
|
-
/** @deprecated */
|
|
14883
|
-
refreshUserData: WidgetCopy.refreshUserData,
|
|
14884
14973
|
onRefreshUserData: WidgetCopy.onRefreshUserData,
|
|
14885
|
-
init: function (element, localData) {
|
|
14974
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
14886
14975
|
// prevent initWidget for result layer
|
|
14887
14976
|
if (!element.classList.contains("narrative-element-copy-result-variant")) {
|
|
14888
|
-
WidgetCopy.initWidget(element, localData, (element, options) => new WidgetCopy(element, options));
|
|
14977
|
+
WidgetCopy.initWidget(element, localData, (element, options) => new WidgetCopy(element, options, onWidgetComplete, sdkApi));
|
|
14889
14978
|
}
|
|
14890
14979
|
},
|
|
14891
|
-
/** @deprecated */
|
|
14892
|
-
initWidget: function (nodeList, localData) {
|
|
14893
|
-
// prevent initWidget for result layer
|
|
14894
|
-
const elements = slice.call(nodeList).filter(element => !element.classList.contains("narrative-element-copy-result-variant"));
|
|
14895
|
-
WidgetCopy.initWidgets((element, options) => new WidgetCopy(element, options), elements, localData).then(() => {
|
|
14896
|
-
elements.forEach(element => WidgetCopy.getInstance(element)?.onStart());
|
|
14897
|
-
});
|
|
14898
|
-
},
|
|
14899
14980
|
onStart: function (element) {
|
|
14900
14981
|
WidgetCopy.getInstance(element)?.onStart();
|
|
14901
14982
|
},
|
|
@@ -14921,10 +15002,9 @@ class WidgetCopy extends WidgetBase {
|
|
|
14921
15002
|
return false;
|
|
14922
15003
|
},
|
|
14923
15004
|
};
|
|
14924
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
15005
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
14925
15006
|
}
|
|
14926
15007
|
|
|
14927
|
-
/** QUIZ */
|
|
14928
15008
|
class WidgetDataInput extends WidgetBase {
|
|
14929
15009
|
static DEFAULTS = {
|
|
14930
15010
|
slide: null,
|
|
@@ -14942,9 +15022,11 @@ class WidgetDataInput extends WidgetBase {
|
|
|
14942
15022
|
* @throws Error
|
|
14943
15023
|
* @param element
|
|
14944
15024
|
* @param options
|
|
15025
|
+
* @param onWidgetComplete
|
|
15026
|
+
* @param sdkApi
|
|
14945
15027
|
*/
|
|
14946
|
-
constructor(element, options) {
|
|
14947
|
-
super(element, options);
|
|
15028
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
15029
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
14948
15030
|
this.label = this.element.querySelector(".label-view .label");
|
|
14949
15031
|
this.elementRect = this.element.getBoundingClientRect();
|
|
14950
15032
|
this.inputElement = getValueOrException(this.element.querySelector(".input-view .input"), "Empty .input-view .input");
|
|
@@ -14963,7 +15045,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
14963
15045
|
this.element.classList.add("done");
|
|
14964
15046
|
this.startReadyPromise.then(() => {
|
|
14965
15047
|
if (this.disableTimer) {
|
|
14966
|
-
this.
|
|
15048
|
+
this.onWidgetComplete();
|
|
14967
15049
|
}
|
|
14968
15050
|
});
|
|
14969
15051
|
}
|
|
@@ -15080,7 +15162,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
15080
15162
|
this.setLocalData(this.localData, true);
|
|
15081
15163
|
this._statEventInputSave(text);
|
|
15082
15164
|
if (this.disableTimer) {
|
|
15083
|
-
this.
|
|
15165
|
+
this.onWidgetComplete();
|
|
15084
15166
|
needResumeUITimer = false;
|
|
15085
15167
|
}
|
|
15086
15168
|
}
|
|
@@ -15090,18 +15172,9 @@ class WidgetDataInput extends WidgetBase {
|
|
|
15090
15172
|
}
|
|
15091
15173
|
static api = {
|
|
15092
15174
|
widgetClassName: WidgetDataInput.widgetClassName,
|
|
15093
|
-
/** @deprecated */
|
|
15094
|
-
refreshUserData: WidgetDataInput.refreshUserData,
|
|
15095
15175
|
onRefreshUserData: WidgetDataInput.onRefreshUserData,
|
|
15096
|
-
init: function (element, localData) {
|
|
15097
|
-
WidgetDataInput.initWidget(element, localData, (element, options) => new WidgetDataInput(element, options));
|
|
15098
|
-
},
|
|
15099
|
-
/** @deprecated */
|
|
15100
|
-
initWidget: function (nodeList, localData) {
|
|
15101
|
-
const elements = slice.call(nodeList);
|
|
15102
|
-
WidgetDataInput.initWidgets((element, options) => new WidgetDataInput(element, options), slice.call(nodeList), localData).then(() => {
|
|
15103
|
-
elements.forEach(element => WidgetDataInput.getInstance(element)?.onStart());
|
|
15104
|
-
});
|
|
15176
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
15177
|
+
WidgetDataInput.initWidget(element, localData, (element, options) => new WidgetDataInput(element, options, onWidgetComplete, sdkApi));
|
|
15105
15178
|
},
|
|
15106
15179
|
onStart: function (element) {
|
|
15107
15180
|
WidgetDataInput.getInstance(element)?.onStart();
|
|
@@ -15123,7 +15196,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
15123
15196
|
WidgetDataInput.getInstanceById(id)?.setUserText(text);
|
|
15124
15197
|
},
|
|
15125
15198
|
};
|
|
15126
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
15199
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
15127
15200
|
}
|
|
15128
15201
|
|
|
15129
15202
|
class WidgetDateCountdown extends WidgetBase {
|
|
@@ -15151,8 +15224,8 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
15151
15224
|
thirdGroup1;
|
|
15152
15225
|
thirdGroup2;
|
|
15153
15226
|
thirdGroupCaption;
|
|
15154
|
-
constructor(element, options) {
|
|
15155
|
-
super(element, options);
|
|
15227
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
15228
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
15156
15229
|
this.label = this.element.querySelector(".label-view .label");
|
|
15157
15230
|
this.messages = {
|
|
15158
15231
|
days: getTagData(this.element, "tDays") ?? "",
|
|
@@ -15329,18 +15402,9 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
15329
15402
|
}
|
|
15330
15403
|
static api = {
|
|
15331
15404
|
widgetClassName: WidgetDateCountdown.widgetClassName,
|
|
15332
|
-
/** @deprecated */
|
|
15333
|
-
refreshUserData: WidgetDateCountdown.refreshUserData,
|
|
15334
15405
|
onRefreshUserData: WidgetDateCountdown.onRefreshUserData,
|
|
15335
|
-
init: function (element, layers, localData) {
|
|
15336
|
-
WidgetDateCountdown.initWidget(element, localData, (element, options) => new WidgetDateCountdown(element, { ...options, layers }));
|
|
15337
|
-
},
|
|
15338
|
-
/** @deprecated */
|
|
15339
|
-
initWidget: function (nodeList, layers, localData) {
|
|
15340
|
-
const elements = slice.call(nodeList);
|
|
15341
|
-
WidgetDateCountdown.initWidgets((element, options) => new WidgetDateCountdown(element, { ...options, layers }), elements, localData).then(() => {
|
|
15342
|
-
elements.forEach(element => WidgetDateCountdown.getInstance(element)?.onStart());
|
|
15343
|
-
});
|
|
15406
|
+
init: function (element, layers, localData, onWidgetComplete, sdkApi) {
|
|
15407
|
+
WidgetDateCountdown.initWidget(element, localData, (element, options) => new WidgetDateCountdown(element, { ...options, layers }, onWidgetComplete, sdkApi));
|
|
15344
15408
|
},
|
|
15345
15409
|
onStart: function (element) {
|
|
15346
15410
|
WidgetDateCountdown.getInstance(element)?.onStart();
|
|
@@ -15354,23 +15418,11 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
15354
15418
|
onResume: function (element) {
|
|
15355
15419
|
WidgetDateCountdown.getInstance(element)?.onResume();
|
|
15356
15420
|
},
|
|
15357
|
-
/** @deprecated */
|
|
15358
|
-
pause: function (nodeList) {
|
|
15359
|
-
forEach(slice.call(nodeList), function (el, index) {
|
|
15360
|
-
WidgetDateCountdown.getInstance(el)?.onPause();
|
|
15361
|
-
});
|
|
15362
|
-
},
|
|
15363
|
-
/** @deprecated */
|
|
15364
|
-
resume: function (nodeList) {
|
|
15365
|
-
forEach(slice.call(nodeList), function (el, index) {
|
|
15366
|
-
WidgetDateCountdown.getInstance(el)?.onResume();
|
|
15367
|
-
});
|
|
15368
|
-
},
|
|
15369
15421
|
};
|
|
15370
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
15422
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
15371
15423
|
}
|
|
15372
15424
|
|
|
15373
|
-
const displaySlide = function (slides, localData) {
|
|
15425
|
+
const displaySlide = function (slides, localData, sdkApi) {
|
|
15374
15426
|
const multiSlideItem = slides[0];
|
|
15375
15427
|
let cardId = undefined;
|
|
15376
15428
|
let cardType = 1 /* CARD_TYPE.STORY */;
|
|
@@ -15435,7 +15487,7 @@ const displaySlide = function (slides, localData) {
|
|
|
15435
15487
|
if (slides.length > 0) {
|
|
15436
15488
|
var slide = slides[0];
|
|
15437
15489
|
slide.classList.remove("hidden");
|
|
15438
|
-
|
|
15490
|
+
sdkApi.cardAnimation?.start(slide);
|
|
15439
15491
|
return;
|
|
15440
15492
|
}
|
|
15441
15493
|
score = 0;
|
|
@@ -15464,19 +15516,19 @@ const displaySlide = function (slides, localData) {
|
|
|
15464
15516
|
if (index === selectedIndex) {
|
|
15465
15517
|
slide.classList.remove("hidden");
|
|
15466
15518
|
undefinedResult = false;
|
|
15467
|
-
|
|
15468
|
-
_sendStatEvent(cardId, cardType, slideIndex, selectedIndex);
|
|
15519
|
+
sdkApi.cardAnimation?.start(slide);
|
|
15520
|
+
_sendStatEvent(sdkApi, cardId, cardType, slideIndex, selectedIndex);
|
|
15469
15521
|
}
|
|
15470
15522
|
});
|
|
15471
15523
|
}
|
|
15472
15524
|
if (undefinedResult) {
|
|
15473
15525
|
console.warn("undefinedResult layer index");
|
|
15474
|
-
|
|
15526
|
+
sdkApi.showLayer(0);
|
|
15475
15527
|
}
|
|
15476
15528
|
};
|
|
15477
|
-
const _sendStatEvent = function (cardId, cardType, slideIndex, layerIndex) {
|
|
15529
|
+
const _sendStatEvent = function (sdkApi, cardId, cardType, slideIndex, layerIndex) {
|
|
15478
15530
|
try {
|
|
15479
|
-
WidgetBase.sendStatisticEventToApp("layout-show", {
|
|
15531
|
+
WidgetBase.sendStatisticEventToApp(sdkApi, "layout-show", {
|
|
15480
15532
|
...WidgetBase.getStatisticEventBaseFieldsShortForm(cardId, slideIndex),
|
|
15481
15533
|
li: layerIndex,
|
|
15482
15534
|
}, {
|
|
@@ -15490,15 +15542,8 @@ const _sendStatEvent = function (cardId, cardType, slideIndex, layerIndex) {
|
|
|
15490
15542
|
};
|
|
15491
15543
|
class WidgetMultiSlide {
|
|
15492
15544
|
static api = {
|
|
15493
|
-
init: function (slides, localData) {
|
|
15494
|
-
|
|
15495
|
-
displaySlide(slides, localData);
|
|
15496
|
-
}
|
|
15497
|
-
else {
|
|
15498
|
-
WidgetBase.getLocalData().then(function (localData) {
|
|
15499
|
-
displaySlide(slides, localData);
|
|
15500
|
-
});
|
|
15501
|
-
}
|
|
15545
|
+
init: function (slides, localData, sdkApi) {
|
|
15546
|
+
displaySlide(slides, localData, sdkApi);
|
|
15502
15547
|
},
|
|
15503
15548
|
};
|
|
15504
15549
|
}
|
|
@@ -15529,9 +15574,10 @@ class WidgetPoll extends WidgetBase {
|
|
|
15529
15574
|
* @throws Error
|
|
15530
15575
|
* @param element
|
|
15531
15576
|
* @param options
|
|
15577
|
+
* @param onWidgetComplete
|
|
15532
15578
|
*/
|
|
15533
|
-
constructor(element, options) {
|
|
15534
|
-
super(element, options);
|
|
15579
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
15580
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
15535
15581
|
this.label = this.element.querySelector(".label-view .label");
|
|
15536
15582
|
this.percentFillMask = this.element.querySelector(".percent-filled-variants-view-group-mask");
|
|
15537
15583
|
this.maskedVariants = slice.call(this.element.querySelectorAll(".variants-box .variants-view-group.percent-filled-variants-view-group .variant-view"));
|
|
@@ -15640,7 +15686,7 @@ class WidgetPoll extends WidgetBase {
|
|
|
15640
15686
|
}
|
|
15641
15687
|
this.startReadyPromise.then(() => {
|
|
15642
15688
|
if (this.disableTimer) {
|
|
15643
|
-
this.
|
|
15689
|
+
this.onWidgetComplete();
|
|
15644
15690
|
}
|
|
15645
15691
|
});
|
|
15646
15692
|
}
|
|
@@ -15980,17 +16026,9 @@ class WidgetPoll extends WidgetBase {
|
|
|
15980
16026
|
}
|
|
15981
16027
|
static api = {
|
|
15982
16028
|
widgetClassName: WidgetPoll.widgetClassName,
|
|
15983
|
-
/** @deprecated */
|
|
15984
|
-
refreshUserData: WidgetPoll.refreshUserData,
|
|
15985
16029
|
onRefreshUserData: WidgetPoll.onRefreshUserData,
|
|
15986
|
-
init: function (element, localData) {
|
|
15987
|
-
WidgetPoll.initWidget(element, localData, (element, options) => new WidgetPoll(element, options));
|
|
15988
|
-
},
|
|
15989
|
-
/** @deprecated */
|
|
15990
|
-
initWidget: function (element, localData) {
|
|
15991
|
-
WidgetPoll.initWidgets((element, options) => new WidgetPoll(element, options), [element], localData).then(() => {
|
|
15992
|
-
WidgetPoll.getInstance(element)?.onStart();
|
|
15993
|
-
});
|
|
16030
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
16031
|
+
WidgetPoll.initWidget(element, localData, (element, options) => new WidgetPoll(element, options, onWidgetComplete, sdkApi));
|
|
15994
16032
|
},
|
|
15995
16033
|
onStart: function (element) {
|
|
15996
16034
|
WidgetPoll.getInstance(element)?.onStart();
|
|
@@ -16036,7 +16074,7 @@ class WidgetPoll extends WidgetBase {
|
|
|
16036
16074
|
}
|
|
16037
16075
|
},
|
|
16038
16076
|
};
|
|
16039
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
16077
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
16040
16078
|
}
|
|
16041
16079
|
|
|
16042
16080
|
class WidgetPollLayers extends WidgetBase {
|
|
@@ -16053,8 +16091,8 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16053
16091
|
variantsTexts;
|
|
16054
16092
|
selectedVariant;
|
|
16055
16093
|
layers;
|
|
16056
|
-
constructor(element, options) {
|
|
16057
|
-
super(element, options);
|
|
16094
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
16095
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
16058
16096
|
this.layers = this.options.layers;
|
|
16059
16097
|
this.label = this.element.querySelector(".label-view .label");
|
|
16060
16098
|
this.variants = slice.call(this.element.querySelectorAll(".variants-box .variant-view"));
|
|
@@ -16126,7 +16164,7 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16126
16164
|
this._showLayer(this.layers, layerIndex, userAction);
|
|
16127
16165
|
this.startReadyPromise.then(() => {
|
|
16128
16166
|
if (this.disableTimer) {
|
|
16129
|
-
this.
|
|
16167
|
+
this.onWidgetComplete();
|
|
16130
16168
|
}
|
|
16131
16169
|
});
|
|
16132
16170
|
}
|
|
@@ -16165,28 +16203,9 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16165
16203
|
}
|
|
16166
16204
|
static api = {
|
|
16167
16205
|
widgetClassName: WidgetPollLayers.widgetClassName,
|
|
16168
|
-
/** @deprecated */
|
|
16169
|
-
refreshUserData: WidgetPollLayers.refreshUserData,
|
|
16170
16206
|
onRefreshUserData: WidgetPollLayers.onRefreshUserData,
|
|
16171
|
-
init: function (element, layers, localData) {
|
|
16172
|
-
WidgetPollLayers.initWidget(element, localData, (element, options) => new WidgetPollLayers(element, { ...options, layers }));
|
|
16173
|
-
},
|
|
16174
|
-
/** @deprecated
|
|
16175
|
-
*
|
|
16176
|
-
* signature variants
|
|
16177
|
-
* (widget, layers, undefined) - modern web sdk
|
|
16178
|
-
* (widget, undefined, layers) - old web sdk and rn
|
|
16179
|
-
* (widget, layers, localData) - native sdk
|
|
16180
|
-
*/
|
|
16181
|
-
initWidget: function (element, layers, localData) {
|
|
16182
|
-
if (layers === undefined && localData !== undefined) {
|
|
16183
|
-
// @ts-ignore
|
|
16184
|
-
layers = localData;
|
|
16185
|
-
localData = undefined;
|
|
16186
|
-
}
|
|
16187
|
-
WidgetPollLayers.initWidgets((element, options) => new WidgetPollLayers(element, { ...options, layers }), [element], localData).then(() => {
|
|
16188
|
-
WidgetPollLayers.getInstance(element)?.onStart();
|
|
16189
|
-
});
|
|
16207
|
+
init: function (element, layers, localData, onWidgetComplete, sdkApi) {
|
|
16208
|
+
WidgetPollLayers.initWidget(element, localData, (element, options) => new WidgetPollLayers(element, { ...options, layers }, onWidgetComplete, sdkApi));
|
|
16190
16209
|
},
|
|
16191
16210
|
onStart: function (element) {
|
|
16192
16211
|
WidgetPollLayers.getInstance(element)?.onStart();
|
|
@@ -16210,7 +16229,7 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16210
16229
|
return false;
|
|
16211
16230
|
},
|
|
16212
16231
|
};
|
|
16213
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
16232
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
16214
16233
|
}
|
|
16215
16234
|
|
|
16216
16235
|
class Formatter {
|
|
@@ -16837,8 +16856,8 @@ class WidgetProducts extends WidgetBase {
|
|
|
16837
16856
|
swipeGestureDetector = null;
|
|
16838
16857
|
isClickCapturedByWidget = false;
|
|
16839
16858
|
isScreenSupportsTouch = false;
|
|
16840
|
-
constructor(element, options) {
|
|
16841
|
-
super(element, options);
|
|
16859
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
16860
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
16842
16861
|
this.captionView = this.element.querySelector(".narrative-element-text-lines");
|
|
16843
16862
|
const linkTarget = decodeURIComponent(getTagData(element, "linkTarget") ?? "[]");
|
|
16844
16863
|
try {
|
|
@@ -17313,8 +17332,8 @@ class WidgetProducts extends WidgetBase {
|
|
|
17313
17332
|
static api = {
|
|
17314
17333
|
widgetClassName: WidgetProducts.widgetClassName,
|
|
17315
17334
|
onRefreshUserData: WidgetProducts.onRefreshUserData,
|
|
17316
|
-
init: function (element, localData) {
|
|
17317
|
-
WidgetProducts.initWidget(element, localData, (element, options) => new WidgetProducts(element, options));
|
|
17335
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
17336
|
+
WidgetProducts.initWidget(element, localData, (element, options) => new WidgetProducts(element, options, onWidgetComplete, sdkApi));
|
|
17318
17337
|
},
|
|
17319
17338
|
onStart: function (element) {
|
|
17320
17339
|
WidgetProducts.getInstance(element)?.onStart();
|
|
@@ -17363,7 +17382,7 @@ class WidgetProducts extends WidgetBase {
|
|
|
17363
17382
|
return false;
|
|
17364
17383
|
},
|
|
17365
17384
|
};
|
|
17366
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
17385
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
17367
17386
|
}
|
|
17368
17387
|
|
|
17369
17388
|
class WidgetQuest extends WidgetBase {
|
|
@@ -17383,11 +17402,11 @@ class WidgetQuest extends WidgetBase {
|
|
|
17383
17402
|
navigationNextSlide;
|
|
17384
17403
|
slideDisabledNavigation;
|
|
17385
17404
|
finalSlide;
|
|
17386
|
-
constructor(element, options) {
|
|
17405
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
17387
17406
|
const isWidget = !hasClass(element, "narrative-slide");
|
|
17388
17407
|
const elementIdGetter = (element) => getValueOrDefault(getTagData(element, "elementId"), "");
|
|
17389
17408
|
const slideGetter = (element) => isWidget ? getValueOrException(element.closest(".narrative-slide"), "Empty slide") : element;
|
|
17390
|
-
super(element, options, elementIdGetter, slideGetter);
|
|
17409
|
+
super(element, options, onWidgetComplete, sdkApi, elementIdGetter, slideGetter);
|
|
17391
17410
|
this.isWidget = isWidget;
|
|
17392
17411
|
this.slideCount = getTagDataAsNumber(this.slide, "slideCount") ?? 0;
|
|
17393
17412
|
const nonFinalSlide = getTagDataAsNumber(this.slide, "nonFinalSlide");
|
|
@@ -17584,6 +17603,14 @@ class WidgetQuest extends WidgetBase {
|
|
|
17584
17603
|
if (this.nonFinalSlide == null) {
|
|
17585
17604
|
// widget v2 (with navigationNextSlide)
|
|
17586
17605
|
if (directionForward) {
|
|
17606
|
+
if (this.navigationNextSlide === -1) {
|
|
17607
|
+
// this is the final slide - exit from this quest
|
|
17608
|
+
if (this.sdkApi.isExistsShowNextCard) {
|
|
17609
|
+
this.sdkApi.cardShowNext();
|
|
17610
|
+
}
|
|
17611
|
+
result.continueDefaultNavigation = false;
|
|
17612
|
+
return result;
|
|
17613
|
+
}
|
|
17587
17614
|
const nextSlideIndex = this.navigationNextSlide ?? event.slideIndex + 1;
|
|
17588
17615
|
if (nextSlideIndex < this.slideCount) {
|
|
17589
17616
|
this._addNewRouteHistory(nextSlideIndex);
|
|
@@ -17685,12 +17712,10 @@ class WidgetQuest extends WidgetBase {
|
|
|
17685
17712
|
}
|
|
17686
17713
|
static api = {
|
|
17687
17714
|
widgetClassName: WidgetQuest.widgetClassName,
|
|
17688
|
-
/** @deprecated */
|
|
17689
|
-
refreshUserData: WidgetQuest.refreshUserData,
|
|
17690
17715
|
onRefreshUserData: WidgetQuest.onRefreshUserData,
|
|
17691
|
-
init: function (element, localData) {
|
|
17716
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
17692
17717
|
return new Promise(function (resolve, reject) {
|
|
17693
|
-
WidgetQuest.initWidget(element, localData, (element, options) => new WidgetQuest(element, options)).then(localData => {
|
|
17718
|
+
WidgetQuest.initWidget(element, localData, (element, options) => new WidgetQuest(element, options, onWidgetComplete, sdkApi)).then(localData => {
|
|
17694
17719
|
const widget = WidgetQuest.getInstance(element);
|
|
17695
17720
|
if (widget) {
|
|
17696
17721
|
resolve(widget.init());
|
|
@@ -17701,22 +17726,6 @@ class WidgetQuest extends WidgetBase {
|
|
|
17701
17726
|
});
|
|
17702
17727
|
});
|
|
17703
17728
|
},
|
|
17704
|
-
/** @deprecated */
|
|
17705
|
-
initWidget: function (element, localData) {
|
|
17706
|
-
return new Promise(function (resolve, reject) {
|
|
17707
|
-
WidgetQuest.initWidgets((element, options) => new WidgetQuest(element, options), [element], localData).then(localData => {
|
|
17708
|
-
const widget = WidgetQuest.getInstance(element);
|
|
17709
|
-
if (widget) {
|
|
17710
|
-
const result = widget.init();
|
|
17711
|
-
widget.onStart();
|
|
17712
|
-
resolve(result);
|
|
17713
|
-
}
|
|
17714
|
-
else {
|
|
17715
|
-
resolve(true);
|
|
17716
|
-
}
|
|
17717
|
-
});
|
|
17718
|
-
});
|
|
17719
|
-
},
|
|
17720
17729
|
onStart: function (element) {
|
|
17721
17730
|
WidgetQuest.getInstance(element)?.onStart();
|
|
17722
17731
|
},
|
|
@@ -17748,7 +17757,7 @@ class WidgetQuest extends WidgetBase {
|
|
|
17748
17757
|
return { continueDefaultNavigation: true };
|
|
17749
17758
|
},
|
|
17750
17759
|
};
|
|
17751
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
17760
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
17752
17761
|
}
|
|
17753
17762
|
|
|
17754
17763
|
class WidgetQuiz extends WidgetBase {
|
|
@@ -17763,8 +17772,8 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17763
17772
|
answers;
|
|
17764
17773
|
questionCount;
|
|
17765
17774
|
selectedAnswer;
|
|
17766
|
-
constructor(element, options) {
|
|
17767
|
-
super(element, options);
|
|
17775
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
17776
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
17768
17777
|
this.question = this.element.querySelector(".label-view .label");
|
|
17769
17778
|
this.answers = slice.call(this.element.querySelectorAll(".variants-box .variant-view-group"));
|
|
17770
17779
|
this.questionCount = getValueOrException(getTagDataAsNumber(this.slide, "quizCount"), "Empty quizCount");
|
|
@@ -17819,7 +17828,7 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17819
17828
|
// }
|
|
17820
17829
|
this.startReadyPromise.then(() => {
|
|
17821
17830
|
if (this.disableTimer) {
|
|
17822
|
-
this.
|
|
17831
|
+
this.onWidgetComplete();
|
|
17823
17832
|
}
|
|
17824
17833
|
});
|
|
17825
17834
|
}
|
|
@@ -17911,17 +17920,9 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17911
17920
|
}
|
|
17912
17921
|
static api = {
|
|
17913
17922
|
widgetClassName: WidgetQuiz.widgetClassName,
|
|
17914
|
-
/** @deprecated */
|
|
17915
|
-
refreshUserData: WidgetQuiz.refreshUserData,
|
|
17916
17923
|
onRefreshUserData: WidgetQuiz.onRefreshUserData,
|
|
17917
|
-
init: function (element, localData) {
|
|
17918
|
-
WidgetQuiz.initWidget(element, localData, (element, options) => new WidgetQuiz(element, options));
|
|
17919
|
-
},
|
|
17920
|
-
/** @deprecated */
|
|
17921
|
-
initWidget: function (element, localData) {
|
|
17922
|
-
WidgetQuiz.initWidgets((element, options) => new WidgetQuiz(element, options), [element], localData).then(() => {
|
|
17923
|
-
WidgetQuiz.getInstance(element)?.onStart();
|
|
17924
|
-
});
|
|
17924
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
17925
|
+
WidgetQuiz.initWidget(element, localData, (element, options) => new WidgetQuiz(element, options, onWidgetComplete, sdkApi));
|
|
17925
17926
|
},
|
|
17926
17927
|
onStart: function (element) {
|
|
17927
17928
|
WidgetQuiz.getInstance(element)?.onStart();
|
|
@@ -17950,7 +17951,7 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17950
17951
|
return true;
|
|
17951
17952
|
},
|
|
17952
17953
|
};
|
|
17953
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
17954
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
17954
17955
|
}
|
|
17955
17956
|
|
|
17956
17957
|
class WidgetQuizGrouped extends WidgetBase {
|
|
@@ -17969,9 +17970,11 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
17969
17970
|
* @throws Error
|
|
17970
17971
|
* @param element
|
|
17971
17972
|
* @param options
|
|
17973
|
+
* @param onWidgetComplete
|
|
17974
|
+
* @param sdkApi
|
|
17972
17975
|
*/
|
|
17973
|
-
constructor(element, options) {
|
|
17974
|
-
super(element, options);
|
|
17976
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
17977
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
17975
17978
|
this.question = this.element.querySelector(".label-view .label");
|
|
17976
17979
|
this.answers = slice.call(this.element.querySelectorAll(".variants-box .variant-view-group"));
|
|
17977
17980
|
this.questionCount = getValueOrException(getTagDataAsNumber(this.slide, "quizCount"), "Empty quizCount");
|
|
@@ -18013,7 +18016,7 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
18013
18016
|
});
|
|
18014
18017
|
this.startReadyPromise.then(() => {
|
|
18015
18018
|
if (this.disableTimer) {
|
|
18016
|
-
this.
|
|
18019
|
+
this.onWidgetComplete();
|
|
18017
18020
|
}
|
|
18018
18021
|
});
|
|
18019
18022
|
}
|
|
@@ -18122,17 +18125,9 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
18122
18125
|
}
|
|
18123
18126
|
static api = {
|
|
18124
18127
|
widgetClassName: WidgetQuizGrouped.widgetClassName,
|
|
18125
|
-
/** @deprecated */
|
|
18126
|
-
refreshUserData: WidgetQuizGrouped.refreshUserData,
|
|
18127
18128
|
onRefreshUserData: WidgetQuizGrouped.onRefreshUserData,
|
|
18128
|
-
init: function (element, localData) {
|
|
18129
|
-
WidgetQuizGrouped.initWidget(element, localData, (element, options) => new WidgetQuizGrouped(element, options));
|
|
18130
|
-
},
|
|
18131
|
-
/** @deprecated */
|
|
18132
|
-
initWidget: function (element, localData) {
|
|
18133
|
-
WidgetQuizGrouped.initWidgets((element, options) => new WidgetQuizGrouped(element, options), [element], localData).then(() => {
|
|
18134
|
-
WidgetQuizGrouped.getInstance(element)?.onStart();
|
|
18135
|
-
});
|
|
18129
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
18130
|
+
WidgetQuizGrouped.initWidget(element, localData, (element, options) => new WidgetQuizGrouped(element, options, onWidgetComplete, sdkApi));
|
|
18136
18131
|
},
|
|
18137
18132
|
onStart: function (element) {
|
|
18138
18133
|
WidgetQuizGrouped.getInstance(element)?.onStart();
|
|
@@ -18161,7 +18156,7 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
18161
18156
|
return true;
|
|
18162
18157
|
},
|
|
18163
18158
|
};
|
|
18164
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
18159
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
18165
18160
|
}
|
|
18166
18161
|
|
|
18167
18162
|
// Polyfill Number.isNaN(value)
|
|
@@ -18331,9 +18326,10 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18331
18326
|
* @throws Error
|
|
18332
18327
|
* @param element
|
|
18333
18328
|
* @param options
|
|
18329
|
+
* @param onWidgetComplete
|
|
18334
18330
|
*/
|
|
18335
|
-
constructor(element, options) {
|
|
18336
|
-
super(element, options);
|
|
18331
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
18332
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
18337
18333
|
this.hasSubmitButton = Boolean(this.element.querySelector(".submit-button-view"));
|
|
18338
18334
|
this.topScale = this.element.querySelector(".top-scale-bar-view-group");
|
|
18339
18335
|
this.snapPosition = false;
|
|
@@ -18402,7 +18398,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18402
18398
|
this.displayAverageAnswer();
|
|
18403
18399
|
this.startReadyPromise.then(() => {
|
|
18404
18400
|
if (this.disableTimer) {
|
|
18405
|
-
this.
|
|
18401
|
+
this.onWidgetComplete();
|
|
18406
18402
|
}
|
|
18407
18403
|
});
|
|
18408
18404
|
}
|
|
@@ -18478,7 +18474,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18478
18474
|
}
|
|
18479
18475
|
});
|
|
18480
18476
|
// if (this.disableTimer) {
|
|
18481
|
-
this.
|
|
18477
|
+
this.onWidgetComplete();
|
|
18482
18478
|
// }
|
|
18483
18479
|
this.setLocalData(this.localData, true);
|
|
18484
18480
|
this._statEventInputSave(this.localData["_rs_g_" + this.elementId + "_v"]);
|
|
@@ -18775,17 +18771,9 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18775
18771
|
}
|
|
18776
18772
|
static api = {
|
|
18777
18773
|
widgetClassName: WidgetRangeSlider.widgetClassName,
|
|
18778
|
-
/** @deprecated */
|
|
18779
|
-
refreshUserData: WidgetRangeSlider.refreshUserData,
|
|
18780
18774
|
onRefreshUserData: WidgetRangeSlider.onRefreshUserData,
|
|
18781
|
-
init: function (element, localData) {
|
|
18782
|
-
WidgetRangeSlider.initWidget(element, localData, (element, options) => new WidgetRangeSlider(element, options));
|
|
18783
|
-
},
|
|
18784
|
-
/** @deprecated */
|
|
18785
|
-
initWidget: function (element, localData) {
|
|
18786
|
-
WidgetRangeSlider.initWidgets((element, options) => new WidgetRangeSlider(element, options), [element], localData).then(() => {
|
|
18787
|
-
WidgetRangeSlider.getInstance(element)?.onStart();
|
|
18788
|
-
});
|
|
18775
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
18776
|
+
WidgetRangeSlider.initWidget(element, localData, (element, options) => new WidgetRangeSlider(element, options, onWidgetComplete, sdkApi));
|
|
18789
18777
|
},
|
|
18790
18778
|
onStart: function (element) {
|
|
18791
18779
|
WidgetRangeSlider.getInstance(element)?.onStart();
|
|
@@ -18814,7 +18802,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18814
18802
|
return false;
|
|
18815
18803
|
},
|
|
18816
18804
|
};
|
|
18817
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
18805
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
18818
18806
|
}
|
|
18819
18807
|
|
|
18820
18808
|
class WidgetRate extends WidgetBase {
|
|
@@ -18837,8 +18825,8 @@ class WidgetRate extends WidgetBase {
|
|
|
18837
18825
|
selectedStar;
|
|
18838
18826
|
answerSelectDuration;
|
|
18839
18827
|
elementRect;
|
|
18840
|
-
constructor(element, options) {
|
|
18841
|
-
super(element, options);
|
|
18828
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
18829
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
18842
18830
|
this.label = this.element.querySelector(".label-view .label");
|
|
18843
18831
|
this.stars = slice.call(this.element.querySelectorAll(".input-view"));
|
|
18844
18832
|
this.submitToStores = Boolean(getValueOrDefault(getTagDataAsNumber(this.element, "submitToStores"), 0));
|
|
@@ -18913,7 +18901,7 @@ class WidgetRate extends WidgetBase {
|
|
|
18913
18901
|
this.element.classList.add("done");
|
|
18914
18902
|
this.startReadyPromise.then(() => {
|
|
18915
18903
|
if (this.disableTimer && runTimer) {
|
|
18916
|
-
this.
|
|
18904
|
+
this.onWidgetComplete();
|
|
18917
18905
|
}
|
|
18918
18906
|
});
|
|
18919
18907
|
}
|
|
@@ -19040,18 +19028,9 @@ class WidgetRate extends WidgetBase {
|
|
|
19040
19028
|
}
|
|
19041
19029
|
static api = {
|
|
19042
19030
|
widgetClassName: WidgetRate.widgetClassName,
|
|
19043
|
-
/** @deprecated */
|
|
19044
|
-
refreshUserData: WidgetRate.refreshUserData,
|
|
19045
19031
|
onRefreshUserData: WidgetRate.onRefreshUserData,
|
|
19046
|
-
init: function (element, localData) {
|
|
19047
|
-
WidgetRate.initWidget(element, localData, (element, options) => new WidgetRate(element, options));
|
|
19048
|
-
},
|
|
19049
|
-
/** @deprecated */
|
|
19050
|
-
initWidget: function (nodeList, localData) {
|
|
19051
|
-
const elements = slice.call(nodeList);
|
|
19052
|
-
WidgetRate.initWidgets((element, options) => new WidgetRate(element, options), elements, localData).then(() => {
|
|
19053
|
-
elements.forEach(element => WidgetRate.getInstance(element)?.onStart());
|
|
19054
|
-
});
|
|
19032
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
19033
|
+
WidgetRate.initWidget(element, localData, (element, options) => new WidgetRate(element, options, onWidgetComplete, sdkApi));
|
|
19055
19034
|
},
|
|
19056
19035
|
onStart: function (element) {
|
|
19057
19036
|
WidgetRate.getInstance(element)?.onStart();
|
|
@@ -19080,7 +19059,7 @@ class WidgetRate extends WidgetBase {
|
|
|
19080
19059
|
WidgetRate.getInstanceById(id)?.setUserText(text);
|
|
19081
19060
|
},
|
|
19082
19061
|
};
|
|
19083
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19062
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
19084
19063
|
}
|
|
19085
19064
|
|
|
19086
19065
|
class WidgetShare extends WidgetBase {
|
|
@@ -19097,8 +19076,8 @@ class WidgetShare extends WidgetBase {
|
|
|
19097
19076
|
shareTarget;
|
|
19098
19077
|
withLayer;
|
|
19099
19078
|
btnDisabled;
|
|
19100
|
-
constructor(element, options) {
|
|
19101
|
-
super(element, options);
|
|
19079
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
19080
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
19102
19081
|
this.shareType = getTagData(this.element, "shareType");
|
|
19103
19082
|
this.shareTarget = getTagData(this.element, "shareTarget");
|
|
19104
19083
|
this.layers = this.options.layers;
|
|
@@ -19120,7 +19099,7 @@ class WidgetShare extends WidgetBase {
|
|
|
19120
19099
|
}
|
|
19121
19100
|
this.startReadyPromise.then(() => {
|
|
19122
19101
|
if (this.isDone() && this.disableTimer) {
|
|
19123
|
-
this.
|
|
19102
|
+
this.onWidgetComplete();
|
|
19124
19103
|
}
|
|
19125
19104
|
});
|
|
19126
19105
|
this.btnDisabled = false;
|
|
@@ -19180,7 +19159,7 @@ class WidgetShare extends WidgetBase {
|
|
|
19180
19159
|
this._showLayer(this.layers, 1, true);
|
|
19181
19160
|
}
|
|
19182
19161
|
if (this.disableTimer) {
|
|
19183
|
-
this.
|
|
19162
|
+
this.onWidgetComplete();
|
|
19184
19163
|
}
|
|
19185
19164
|
this.btnDisabled = false;
|
|
19186
19165
|
}
|
|
@@ -19189,31 +19168,12 @@ class WidgetShare extends WidgetBase {
|
|
|
19189
19168
|
}
|
|
19190
19169
|
static api = {
|
|
19191
19170
|
widgetClassName: WidgetShare.widgetClassName,
|
|
19192
|
-
/** @deprecated */
|
|
19193
|
-
refreshUserData: WidgetShare.refreshUserData,
|
|
19194
19171
|
onRefreshUserData: WidgetShare.onRefreshUserData,
|
|
19195
|
-
init: function (element, layers, localData) {
|
|
19172
|
+
init: function (element, layers, localData, onWidgetComplete, sdkApi) {
|
|
19196
19173
|
WidgetShare.initWidget(element, localData, (element, options) => new WidgetShare(element, {
|
|
19197
19174
|
...options,
|
|
19198
19175
|
layers,
|
|
19199
|
-
}));
|
|
19200
|
-
},
|
|
19201
|
-
/** @deprecated
|
|
19202
|
-
* signature variants
|
|
19203
|
-
* (widget, layers, undefined) - modern web sdk
|
|
19204
|
-
* (widget, undefined, layers) - old web sdk and rn
|
|
19205
|
-
* (widget, layers, localData) - native sdk
|
|
19206
|
-
*/
|
|
19207
|
-
initWidget: function (nodeList, layers, localData) {
|
|
19208
|
-
if (layers === undefined && localData !== undefined) {
|
|
19209
|
-
// @ts-ignore
|
|
19210
|
-
layers = localData;
|
|
19211
|
-
localData = undefined;
|
|
19212
|
-
}
|
|
19213
|
-
const elements = slice.call(nodeList);
|
|
19214
|
-
WidgetShare.initWidgets((element, options) => new WidgetShare(element, { ...options, layers }), elements, localData).then(() => {
|
|
19215
|
-
elements.forEach(element => WidgetShare.getInstance(element)?.onStart());
|
|
19216
|
-
});
|
|
19176
|
+
}, onWidgetComplete, sdkApi));
|
|
19217
19177
|
},
|
|
19218
19178
|
onStart: function (element) {
|
|
19219
19179
|
WidgetShare.getInstance(element)?.onStart();
|
|
@@ -19234,7 +19194,7 @@ class WidgetShare extends WidgetBase {
|
|
|
19234
19194
|
WidgetShare.getInstanceById(id)?._complete(isSuccess);
|
|
19235
19195
|
},
|
|
19236
19196
|
};
|
|
19237
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19197
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
19238
19198
|
}
|
|
19239
19199
|
|
|
19240
19200
|
class WidgetTest extends WidgetBase {
|
|
@@ -19259,8 +19219,8 @@ class WidgetTest extends WidgetBase {
|
|
|
19259
19219
|
timeLeftDefault;
|
|
19260
19220
|
timeline;
|
|
19261
19221
|
isWidgetTimerInit = false;
|
|
19262
|
-
constructor(element, options) {
|
|
19263
|
-
super(element, options);
|
|
19222
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
19223
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
19264
19224
|
this.label = this.element.querySelector(".label-view .label");
|
|
19265
19225
|
this.variants = slice.call(this.element.querySelectorAll(".variants-box .variant-view"));
|
|
19266
19226
|
this.testCount = getValueOrException(getTagDataAsNumber(this.slide, "testCount"), "Empty testCount");
|
|
@@ -19415,7 +19375,7 @@ class WidgetTest extends WidgetBase {
|
|
|
19415
19375
|
});
|
|
19416
19376
|
this.startReadyPromise.then(() => {
|
|
19417
19377
|
if (this.disableTimer) {
|
|
19418
|
-
this.
|
|
19378
|
+
this.onWidgetComplete();
|
|
19419
19379
|
}
|
|
19420
19380
|
});
|
|
19421
19381
|
}
|
|
@@ -19487,17 +19447,9 @@ class WidgetTest extends WidgetBase {
|
|
|
19487
19447
|
}
|
|
19488
19448
|
static api = {
|
|
19489
19449
|
widgetClassName: WidgetTest.widgetClassName,
|
|
19490
|
-
/** @deprecated */
|
|
19491
|
-
refreshUserData: WidgetTest.refreshUserData,
|
|
19492
19450
|
onRefreshUserData: WidgetTest.onRefreshUserData,
|
|
19493
|
-
init: function (element, localData) {
|
|
19494
|
-
WidgetTest.initWidget(element, localData, (element, options) => new WidgetTest(element, options));
|
|
19495
|
-
},
|
|
19496
|
-
/** @deprecated */
|
|
19497
|
-
initWidget: function (element, localData) {
|
|
19498
|
-
WidgetTest.initWidgets((element, options) => new WidgetTest(element, options), [element], localData).then(() => {
|
|
19499
|
-
WidgetTest.getInstance(element)?.onStart();
|
|
19500
|
-
});
|
|
19451
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
19452
|
+
WidgetTest.initWidget(element, localData, (element, options) => new WidgetTest(element, options, onWidgetComplete, sdkApi));
|
|
19501
19453
|
},
|
|
19502
19454
|
onStart: function (element) {
|
|
19503
19455
|
WidgetTest.getInstance(element)?.onStart();
|
|
@@ -19533,7 +19485,7 @@ class WidgetTest extends WidgetBase {
|
|
|
19533
19485
|
return true;
|
|
19534
19486
|
},
|
|
19535
19487
|
};
|
|
19536
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19488
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
19537
19489
|
}
|
|
19538
19490
|
|
|
19539
19491
|
class WidgetVote extends WidgetBase {
|
|
@@ -19559,9 +19511,11 @@ class WidgetVote extends WidgetBase {
|
|
|
19559
19511
|
* @throws Error
|
|
19560
19512
|
* @param element
|
|
19561
19513
|
* @param options
|
|
19514
|
+
* @param onWidgetComplete
|
|
19515
|
+
* @param sdkApi
|
|
19562
19516
|
*/
|
|
19563
|
-
constructor(element, options) {
|
|
19564
|
-
super(element, options);
|
|
19517
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
19518
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
19565
19519
|
this.voteAllocation = getTagData(this.slide, "voteAllocation");
|
|
19566
19520
|
this.label = this.element.querySelector(".label-view .label");
|
|
19567
19521
|
this.variants = slice.call(this.element.querySelectorAll(".variants-box .variant-view-group"));
|
|
@@ -19745,7 +19699,7 @@ class WidgetVote extends WidgetBase {
|
|
|
19745
19699
|
}
|
|
19746
19700
|
this.startReadyPromise.then(() => {
|
|
19747
19701
|
if (this.disableTimer) {
|
|
19748
|
-
this.
|
|
19702
|
+
this.onWidgetComplete();
|
|
19749
19703
|
}
|
|
19750
19704
|
});
|
|
19751
19705
|
}
|
|
@@ -19943,45 +19897,9 @@ class WidgetVote extends WidgetBase {
|
|
|
19943
19897
|
}
|
|
19944
19898
|
static api = {
|
|
19945
19899
|
widgetClassName: WidgetVote.widgetClassName,
|
|
19946
|
-
/** @deprecated */
|
|
19947
|
-
refreshUserData: WidgetVote.refreshUserData,
|
|
19948
19900
|
onRefreshUserData: WidgetVote.onRefreshUserData,
|
|
19949
|
-
init: function (element, localData) {
|
|
19950
|
-
WidgetVote.initWidget(element, localData, (element, options) => new WidgetVote(element, options));
|
|
19951
|
-
},
|
|
19952
|
-
/** @deprecated
|
|
19953
|
-
*
|
|
19954
|
-
* fix for WidgetVote on every layer of multilayers story
|
|
19955
|
-
*/
|
|
19956
|
-
fallbackInitOnMultiSlide: function (element, localData) {
|
|
19957
|
-
if (element.dataset.fallbackInitOnMultiSlide) {
|
|
19958
|
-
return;
|
|
19959
|
-
}
|
|
19960
|
-
const multiSlide = element.closest(".narrative-multi-slide");
|
|
19961
|
-
if (multiSlide != null) {
|
|
19962
|
-
const container = multiSlide.parentElement;
|
|
19963
|
-
const widgetElements = container?.querySelectorAll(`.${WidgetVote.widgetClassName}`);
|
|
19964
|
-
if (widgetElements != null) {
|
|
19965
|
-
for (let i = 0; i < widgetElements.length; ++i) {
|
|
19966
|
-
const widgetElement = widgetElements[i];
|
|
19967
|
-
const widget = WidgetVote.getInstance(widgetElement);
|
|
19968
|
-
if (!widget) {
|
|
19969
|
-
WidgetVote.initWidgets((element, options) => new WidgetVote(element, options), [widgetElement], localData);
|
|
19970
|
-
}
|
|
19971
|
-
}
|
|
19972
|
-
}
|
|
19973
|
-
}
|
|
19974
|
-
element.dataset.fallbackInitOnMultiSlide = "1";
|
|
19975
|
-
},
|
|
19976
|
-
/** @deprecated */
|
|
19977
|
-
initWidget: function (element, localData) {
|
|
19978
|
-
WidgetVote.initWidgets((element, options) => new WidgetVote(element, options), [element], localData)
|
|
19979
|
-
.then(localData => {
|
|
19980
|
-
WidgetVote.api.fallbackInitOnMultiSlide(element, localData);
|
|
19981
|
-
})
|
|
19982
|
-
.then(() => {
|
|
19983
|
-
WidgetVote.getInstance(element)?.onStart();
|
|
19984
|
-
});
|
|
19901
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
19902
|
+
WidgetVote.initWidget(element, localData, (element, options) => new WidgetVote(element, options, onWidgetComplete, sdkApi));
|
|
19985
19903
|
},
|
|
19986
19904
|
onStart: function (element) {
|
|
19987
19905
|
WidgetVote.getInstance(element)?.onStart();
|
|
@@ -20017,7 +19935,7 @@ class WidgetVote extends WidgetBase {
|
|
|
20017
19935
|
return true;
|
|
20018
19936
|
},
|
|
20019
19937
|
};
|
|
20020
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19938
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
20021
19939
|
}
|
|
20022
19940
|
|
|
20023
19941
|
class EsModuleLayoutApi {
|