@inappstory/slide-api 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +442 -576
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +361 -348
- package/dist/index.d.ts +361 -348
- package/dist/index.js +442 -576
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.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);
|
|
1195
1167
|
}
|
|
1196
|
-
|
|
1168
|
+
isSdkSupportTimelineOnBeforeStart() {
|
|
1169
|
+
return true;
|
|
1170
|
+
}
|
|
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,19 +2031,34 @@ class Text {
|
|
|
1994
2031
|
const waitForImageHtmlElementLoad = async (nodeRef) => {
|
|
1995
2032
|
return new Promise((resolve, reject) => {
|
|
1996
2033
|
const onLoad = function () {
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
nodeRef.
|
|
2000
|
-
|
|
2034
|
+
nodeRef.decoding = "sync";
|
|
2035
|
+
if (nodeRef.decode != null) {
|
|
2036
|
+
nodeRef.decode().then(() => {
|
|
2037
|
+
// @ts-ignore
|
|
2038
|
+
// _log("img loaded 1", true);
|
|
2039
|
+
resolve(nodeRef);
|
|
2040
|
+
nodeRef.removeEventListener("load", onLoad);
|
|
2041
|
+
}, reason => reject(reason));
|
|
2042
|
+
}
|
|
2043
|
+
else {
|
|
2044
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
2045
|
+
// @ts-ignore
|
|
2046
|
+
// _log("img loaded 1", true);
|
|
2047
|
+
resolve(nodeRef);
|
|
2048
|
+
nodeRef.removeEventListener("load", onLoad);
|
|
2049
|
+
}));
|
|
2050
|
+
}
|
|
2001
2051
|
};
|
|
2002
2052
|
nodeRef.addEventListener("load", onLoad);
|
|
2003
|
-
if (nodeRef.complete && 0 !== nodeRef.naturalHeight) {
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
}
|
|
2053
|
+
// if (nodeRef.complete && 0 !== nodeRef.naturalHeight) {
|
|
2054
|
+
// requestAnimationFrame(() => {
|
|
2055
|
+
// requestAnimationFrame(() => {
|
|
2056
|
+
// // @ts-ignore
|
|
2057
|
+
// _log("img loaded 2", true)
|
|
2058
|
+
// resolve(nodeRef);
|
|
2059
|
+
// });
|
|
2060
|
+
// });
|
|
2061
|
+
// }
|
|
2010
2062
|
nodeRef.addEventListener("error", err => reject(err));
|
|
2011
2063
|
});
|
|
2012
2064
|
};
|
|
@@ -2016,6 +2068,8 @@ const waitForVideoHtmlElementLoad = async (nodeRef) => {
|
|
|
2016
2068
|
const onCanplaythrough = () => {
|
|
2017
2069
|
requestAnimationFrame(() => {
|
|
2018
2070
|
requestAnimationFrame(() => {
|
|
2071
|
+
// @ts-ignore
|
|
2072
|
+
// _log("video loaded 1", true)
|
|
2019
2073
|
resolve(nodeRef);
|
|
2020
2074
|
nodeRef.removeEventListener("canplaythrough", onCanplaythrough);
|
|
2021
2075
|
});
|
|
@@ -2028,6 +2082,8 @@ const waitForVideoHtmlElementLoad = async (nodeRef) => {
|
|
|
2028
2082
|
var onCanPlay = function () {
|
|
2029
2083
|
requestAnimationFrame(() => {
|
|
2030
2084
|
requestAnimationFrame(() => {
|
|
2085
|
+
// @ts-ignore
|
|
2086
|
+
// _log("video loaded 2", true)
|
|
2031
2087
|
resolve(nodeRef);
|
|
2032
2088
|
nodeRef.removeEventListener("canplay", onCanPlay);
|
|
2033
2089
|
});
|
|
@@ -2195,6 +2251,8 @@ class Video {
|
|
|
2195
2251
|
onStop() { }
|
|
2196
2252
|
onBeforeUnmount() {
|
|
2197
2253
|
// clean up memory and cpu processes
|
|
2254
|
+
// @ts-ignore
|
|
2255
|
+
// _log("onBeforeUnmount", true)
|
|
2198
2256
|
this._destroyVODPlayer();
|
|
2199
2257
|
}
|
|
2200
2258
|
_initVOD(vodData) {
|
|
@@ -2269,6 +2327,8 @@ class Video {
|
|
|
2269
2327
|
// console.log("_initVOD 5");
|
|
2270
2328
|
this._vodPlayerInstance = player;
|
|
2271
2329
|
// This runs if the asynchronous load is successful.
|
|
2330
|
+
// @ts-ignore
|
|
2331
|
+
_log("vod loaded 1", true);
|
|
2272
2332
|
resolve(this._video);
|
|
2273
2333
|
})
|
|
2274
2334
|
.catch(reason => {
|
|
@@ -2293,6 +2353,8 @@ class Video {
|
|
|
2293
2353
|
if (vodData && vodData.formats != null && Array.isArray(vodData.formats) && vodData.formats.length > 0) {
|
|
2294
2354
|
src = vodData.formats[0].url;
|
|
2295
2355
|
this._video.src = src;
|
|
2356
|
+
// @ts-ignore
|
|
2357
|
+
// _log("vod loaded 2", true)
|
|
2296
2358
|
resolve(this._video);
|
|
2297
2359
|
}
|
|
2298
2360
|
else {
|
|
@@ -2315,6 +2377,8 @@ class Video {
|
|
|
2315
2377
|
return mpd_;
|
|
2316
2378
|
}
|
|
2317
2379
|
async _destroyVODPlayer() {
|
|
2380
|
+
//@ts-ignore
|
|
2381
|
+
// _log("call _destroyVODPlayer", true)
|
|
2318
2382
|
if (this._vodPlayerInstance != null) {
|
|
2319
2383
|
try {
|
|
2320
2384
|
if (this._videoStateAdapter) {
|
|
@@ -2617,7 +2681,7 @@ class VideoStateAdapter {
|
|
|
2617
2681
|
// _log(`_onPlaying, _timeupdate: ${this._timeupdate}`, true);
|
|
2618
2682
|
this._playingCheckerId = window.setTimeout(() => {
|
|
2619
2683
|
// @ts-ignore
|
|
2620
|
-
_log(`_onPlaying cb, _timeupdate: ${this._timeupdate}, now: ${Date.now()}, diff: ${Date.now() - this._timeupdate}`, true);
|
|
2684
|
+
// _log(`_onPlaying cb, _timeupdate: ${this._timeupdate}, now: ${Date.now()}, diff: ${Date.now() - this._timeupdate}`, true);
|
|
2621
2685
|
if (Date.now() - this._timeupdate <= this._maxDiff / 2) {
|
|
2622
2686
|
// @ts-ignore
|
|
2623
2687
|
// _log(`_onPlaying if`, true);
|
|
@@ -2664,7 +2728,7 @@ class VideoStateAdapter {
|
|
|
2664
2728
|
// const
|
|
2665
2729
|
// }
|
|
2666
2730
|
// args nodeRef, elementClassName
|
|
2667
|
-
const tryCreateFromHtmlElement = (nodeRef, layer) => {
|
|
2731
|
+
const tryCreateFromHtmlElement = (nodeRef, layer, onWidgetComplete, sdkApi) => {
|
|
2668
2732
|
const layoutApi = layer.layoutService.layoutApi;
|
|
2669
2733
|
const layersNodesRefs = layer.slide.layersNodesRefs;
|
|
2670
2734
|
for (let elementClassName of nodeRef.classList.values()) {
|
|
@@ -2682,38 +2746,42 @@ const tryCreateFromHtmlElement = (nodeRef, layer) => {
|
|
|
2682
2746
|
case SwipeUpItems.className():
|
|
2683
2747
|
return new SwipeUpItems(nodeRef, layer);
|
|
2684
2748
|
case Video.className():
|
|
2685
|
-
return new Video(nodeRef, layer, layoutApi.VideoPlayer, layer.
|
|
2749
|
+
return new Video(nodeRef, layer, layoutApi.VideoPlayer, layer.sdkApi);
|
|
2686
2750
|
//////// widgets ///////
|
|
2687
2751
|
case Copy.className():
|
|
2688
|
-
return layoutApi.widgetCopyApi ? new Copy(nodeRef, layer, layoutApi.widgetCopyApi) : null;
|
|
2752
|
+
return layoutApi.widgetCopyApi ? new Copy(nodeRef, layer, layoutApi.widgetCopyApi, onWidgetComplete, sdkApi) : null;
|
|
2689
2753
|
case Barcode.className():
|
|
2690
|
-
return layoutApi.widgetBarcodeApi ? new Barcode(nodeRef, layer, layoutApi.widgetBarcodeApi) : null;
|
|
2754
|
+
return layoutApi.widgetBarcodeApi ? new Barcode(nodeRef, layer, layoutApi.widgetBarcodeApi, onWidgetComplete, sdkApi) : null;
|
|
2691
2755
|
case DataInput.className():
|
|
2692
|
-
return layoutApi.widgetDataInputApi ? new DataInput(nodeRef, layer, layoutApi.widgetDataInputApi) : null;
|
|
2756
|
+
return layoutApi.widgetDataInputApi ? new DataInput(nodeRef, layer, layoutApi.widgetDataInputApi, onWidgetComplete, sdkApi) : null;
|
|
2693
2757
|
case DateCountdown.className():
|
|
2694
|
-
return layoutApi.widgetDateCountdownApi
|
|
2758
|
+
return layoutApi.widgetDateCountdownApi
|
|
2759
|
+
? new DateCountdown(nodeRef, layer, layersNodesRefs, layoutApi.widgetDateCountdownApi, onWidgetComplete, sdkApi)
|
|
2760
|
+
: null;
|
|
2695
2761
|
case Poll.className():
|
|
2696
|
-
return layoutApi.widgetPollApi ? new Poll(nodeRef, layer, layoutApi.widgetPollApi) : null;
|
|
2762
|
+
return layoutApi.widgetPollApi ? new Poll(nodeRef, layer, layoutApi.widgetPollApi, onWidgetComplete, sdkApi) : null;
|
|
2697
2763
|
case PollLayers.className():
|
|
2698
|
-
return layoutApi.widgetPollLayersApi
|
|
2764
|
+
return layoutApi.widgetPollLayersApi
|
|
2765
|
+
? new PollLayers(nodeRef, layer, layersNodesRefs, layoutApi.widgetPollLayersApi, onWidgetComplete, sdkApi)
|
|
2766
|
+
: null;
|
|
2699
2767
|
case Quest.className():
|
|
2700
|
-
return layoutApi.widgetQuestApi ? new Quest(nodeRef, layer, layoutApi.widgetQuestApi) : null;
|
|
2768
|
+
return layoutApi.widgetQuestApi ? new Quest(nodeRef, layer, layoutApi.widgetQuestApi, onWidgetComplete, sdkApi) : null;
|
|
2701
2769
|
case Quiz.className():
|
|
2702
|
-
return layoutApi.widgetQuizApi ? new Quiz(nodeRef, layer, layoutApi.widgetQuizApi) : null;
|
|
2770
|
+
return layoutApi.widgetQuizApi ? new Quiz(nodeRef, layer, layoutApi.widgetQuizApi, onWidgetComplete, sdkApi) : null;
|
|
2703
2771
|
case QuizGrouped.className():
|
|
2704
|
-
return layoutApi.widgetQuizGroupedApi ? new QuizGrouped(nodeRef, layer, layoutApi.widgetQuizGroupedApi) : null;
|
|
2772
|
+
return layoutApi.widgetQuizGroupedApi ? new QuizGrouped(nodeRef, layer, layoutApi.widgetQuizGroupedApi, onWidgetComplete, sdkApi) : null;
|
|
2705
2773
|
case RangeSlider.className():
|
|
2706
|
-
return layoutApi.widgetRangeSliderApi ? new RangeSlider(nodeRef, layer, layoutApi.widgetRangeSliderApi) : null;
|
|
2774
|
+
return layoutApi.widgetRangeSliderApi ? new RangeSlider(nodeRef, layer, layoutApi.widgetRangeSliderApi, onWidgetComplete, sdkApi) : null;
|
|
2707
2775
|
case Rate.className():
|
|
2708
|
-
return layoutApi.widgetRateApi ? new Rate(nodeRef, layer, layoutApi.widgetRateApi) : null;
|
|
2776
|
+
return layoutApi.widgetRateApi ? new Rate(nodeRef, layer, layoutApi.widgetRateApi, onWidgetComplete, sdkApi) : null;
|
|
2709
2777
|
case Share.className():
|
|
2710
|
-
return layoutApi.widgetShareApi ? new Share(nodeRef, layer, layersNodesRefs, layoutApi.widgetShareApi) : null;
|
|
2778
|
+
return layoutApi.widgetShareApi ? new Share(nodeRef, layer, layersNodesRefs, layoutApi.widgetShareApi, onWidgetComplete, sdkApi) : null;
|
|
2711
2779
|
case Test.className():
|
|
2712
|
-
return layoutApi.widgetTestApi ? new Test(nodeRef, layer, layoutApi.widgetTestApi) : null;
|
|
2780
|
+
return layoutApi.widgetTestApi ? new Test(nodeRef, layer, layoutApi.widgetTestApi, onWidgetComplete, sdkApi) : null;
|
|
2713
2781
|
case Vote.className():
|
|
2714
|
-
return layoutApi.widgetVoteApi ? new Vote(nodeRef, layer, layoutApi.widgetVoteApi) : null;
|
|
2782
|
+
return layoutApi.widgetVoteApi ? new Vote(nodeRef, layer, layoutApi.widgetVoteApi, onWidgetComplete, sdkApi) : null;
|
|
2715
2783
|
case Products.className():
|
|
2716
|
-
return layoutApi.widgetProductsApi ? new Products(nodeRef, layer, layoutApi.widgetProductsApi) : null;
|
|
2784
|
+
return layoutApi.widgetProductsApi ? new Products(nodeRef, layer, layoutApi.widgetProductsApi, onWidgetComplete, sdkApi) : null;
|
|
2717
2785
|
}
|
|
2718
2786
|
}
|
|
2719
2787
|
return null;
|
|
@@ -2724,18 +2792,24 @@ var TimelineDisabledState;
|
|
|
2724
2792
|
TimelineDisabledState[TimelineDisabledState["disabled"] = 0] = "disabled";
|
|
2725
2793
|
TimelineDisabledState[TimelineDisabledState["enabled"] = 1] = "enabled";
|
|
2726
2794
|
})(TimelineDisabledState || (TimelineDisabledState = {}));
|
|
2795
|
+
// use Promise
|
|
2796
|
+
// await Promise()
|
|
2797
|
+
// call timeLine api
|
|
2798
|
+
// promise - slideReadyPromise
|
|
2727
2799
|
class SlideTimeline {
|
|
2728
2800
|
slideIndex;
|
|
2729
2801
|
slideDuration;
|
|
2730
2802
|
slideDisabledTimer;
|
|
2731
2803
|
slideReady;
|
|
2732
2804
|
_afterResumeQueuePush;
|
|
2733
|
-
|
|
2805
|
+
sdkApi;
|
|
2806
|
+
constructor(slideIndex, slideDuration, slideDisabledTimer, slideReady, _afterResumeQueuePush, sdkApi) {
|
|
2734
2807
|
this.slideIndex = slideIndex;
|
|
2735
2808
|
this.slideDuration = slideDuration;
|
|
2736
2809
|
this.slideDisabledTimer = slideDisabledTimer;
|
|
2737
2810
|
this.slideReady = slideReady;
|
|
2738
2811
|
this._afterResumeQueuePush = _afterResumeQueuePush;
|
|
2812
|
+
this.sdkApi = sdkApi;
|
|
2739
2813
|
this.timelineDisabledState = this.slideDisabledTimer ? TimelineDisabledState.disabled : TimelineDisabledState.enabled;
|
|
2740
2814
|
}
|
|
2741
2815
|
resumedAt = new Date().getTime();
|
|
@@ -2749,17 +2823,23 @@ class SlideTimeline {
|
|
|
2749
2823
|
return SlideTimeline.layoutService;
|
|
2750
2824
|
}
|
|
2751
2825
|
get isSDKSupportUpdateTimeline() {
|
|
2752
|
-
if (
|
|
2753
|
-
return SlideTimeline.layoutService.env.Android && "updateTimeline" in SlideTimeline.layoutService.env.Android;
|
|
2826
|
+
if (this.sdkApi.isAndroid) {
|
|
2827
|
+
return Boolean(SlideTimeline.layoutService.env.Android && "updateTimeline" in SlideTimeline.layoutService.env.Android);
|
|
2754
2828
|
}
|
|
2755
|
-
else if (
|
|
2829
|
+
else if (this.sdkApi.isIOS) {
|
|
2756
2830
|
const mh = SlideTimeline.layoutService.env?.webkit?.messageHandlers ?? {};
|
|
2757
2831
|
return "updateTimeline" in mh;
|
|
2758
2832
|
}
|
|
2833
|
+
else if (this.sdkApi.isWeb) {
|
|
2834
|
+
return true;
|
|
2835
|
+
}
|
|
2759
2836
|
else {
|
|
2760
2837
|
return false;
|
|
2761
2838
|
}
|
|
2762
2839
|
}
|
|
2840
|
+
get isSdkSupportTimelineOnBeforeStart() {
|
|
2841
|
+
return this.sdkApi.isSdkSupportTimelineOnBeforeStart();
|
|
2842
|
+
}
|
|
2763
2843
|
get index() {
|
|
2764
2844
|
return this.slideIndex;
|
|
2765
2845
|
}
|
|
@@ -2797,7 +2877,24 @@ class SlideTimeline {
|
|
|
2797
2877
|
//@ts-ignore
|
|
2798
2878
|
// window._log(`updateTimeline, a: ${action} ct: ${currentTime} d: ${duration} tds: ${this.timelineDisabledState}`, true);
|
|
2799
2879
|
// console.trace(`updateTimeline ${action} slideIndex: ${this.slideIndex} currentTime:${currentTime} duration:${duration} tds: ${this.timelineDisabledState}`);
|
|
2800
|
-
|
|
2880
|
+
this.sdkApi.updateTimeline(this.slideIndex, action, currentTime, duration, showLoader, showError);
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* trigger timeline update for new slide in sdk, before slide strat event (prevent timeout in timeline while we wait for video start)
|
|
2884
|
+
*/
|
|
2885
|
+
triggerSlideLoadState() {
|
|
2886
|
+
if (this.isSDKSupportUpdateTimeline && this.isSdkSupportTimelineOnBeforeStart) {
|
|
2887
|
+
let duration = this.slideDuration;
|
|
2888
|
+
// tmp
|
|
2889
|
+
// todo брать из модели
|
|
2890
|
+
if (!duration) {
|
|
2891
|
+
duration = DEFAULT_SLIDE_DURATION;
|
|
2892
|
+
}
|
|
2893
|
+
if (this.timelineDisabledState === TimelineDisabledState.disabled) {
|
|
2894
|
+
duration = 0;
|
|
2895
|
+
}
|
|
2896
|
+
this.sdkApi.updateTimeline(this.slideIndex, "before_start" /* TIMELINE_ACTION.BEFORE_START */, 0, duration, false, false);
|
|
2897
|
+
}
|
|
2801
2898
|
}
|
|
2802
2899
|
/**
|
|
2803
2900
|
* Start timeline after slide started
|
|
@@ -2836,7 +2933,7 @@ class SlideTimeline {
|
|
|
2836
2933
|
this.updateTimeline("pause" /* TIMELINE_ACTION.PAUSE */);
|
|
2837
2934
|
}
|
|
2838
2935
|
else {
|
|
2839
|
-
this.
|
|
2936
|
+
this.sdkApi.cardPausedCallback(videoCurrentTime);
|
|
2840
2937
|
}
|
|
2841
2938
|
}
|
|
2842
2939
|
slideResumed(videoCurrentTime) {
|
|
@@ -2851,7 +2948,7 @@ class SlideTimeline {
|
|
|
2851
2948
|
this.updateTimeline("start" /* TIMELINE_ACTION.START */);
|
|
2852
2949
|
}
|
|
2853
2950
|
else {
|
|
2854
|
-
this.
|
|
2951
|
+
this.sdkApi.cardResumedCallback(videoCurrentTime);
|
|
2855
2952
|
}
|
|
2856
2953
|
}
|
|
2857
2954
|
slideStopped() {
|
|
@@ -2908,7 +3005,7 @@ class SlideTimeline {
|
|
|
2908
3005
|
}
|
|
2909
3006
|
this.updateTimeline("stop" /* TIMELINE_ACTION.STOP */, false, true);
|
|
2910
3007
|
}
|
|
2911
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`number`, `number`, `boolean`, `Promise`, `(cb: () => void) => void`]; }
|
|
3008
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`number`, `number`, `boolean`, `Promise`, `(cb: () => void) => void`, `SDKApi`]; }
|
|
2912
3009
|
}
|
|
2913
3010
|
|
|
2914
3011
|
class Layer {
|
|
@@ -2916,6 +3013,9 @@ class Layer {
|
|
|
2916
3013
|
_slide;
|
|
2917
3014
|
_slideReadyPromise;
|
|
2918
3015
|
_afterResumeQueuePush;
|
|
3016
|
+
_afterStartInitQueuePush;
|
|
3017
|
+
_showNextSlide;
|
|
3018
|
+
sdkApi;
|
|
2919
3019
|
_slideIndex;
|
|
2920
3020
|
_cardId;
|
|
2921
3021
|
_cardType;
|
|
@@ -2925,11 +3025,14 @@ class Layer {
|
|
|
2925
3025
|
_disabledNavigation;
|
|
2926
3026
|
_elements = [];
|
|
2927
3027
|
_timeline;
|
|
2928
|
-
constructor(_nodeRef, _slide, _slideReadyPromise, _afterResumeQueuePush) {
|
|
3028
|
+
constructor(_nodeRef, _slide, _slideReadyPromise, _afterResumeQueuePush, _afterStartInitQueuePush, _showNextSlide, sdkApi) {
|
|
2929
3029
|
this._nodeRef = _nodeRef;
|
|
2930
3030
|
this._slide = _slide;
|
|
2931
3031
|
this._slideReadyPromise = _slideReadyPromise;
|
|
2932
3032
|
this._afterResumeQueuePush = _afterResumeQueuePush;
|
|
3033
|
+
this._afterStartInitQueuePush = _afterStartInitQueuePush;
|
|
3034
|
+
this._showNextSlide = _showNextSlide;
|
|
3035
|
+
this.sdkApi = sdkApi;
|
|
2933
3036
|
this._slideIndex = parseInt(this._nodeRef.getAttribute("data-index") ?? "0");
|
|
2934
3037
|
this._cardId = parseInt(this._nodeRef.getAttribute("data-id") ?? "0");
|
|
2935
3038
|
this._cardType = parseInt(this._nodeRef.getAttribute("data-card-type") ?? "1") || 1 /* CARD_TYPE.STORY */;
|
|
@@ -2937,11 +3040,19 @@ class Layer {
|
|
|
2937
3040
|
this._duration = parseInt(this._nodeRef.getAttribute("data-duration") ?? "") || DEFAULT_SLIDE_DURATION;
|
|
2938
3041
|
this._disabledTimer = this._nodeRef.getAttribute("data-disable-timer") === "1";
|
|
2939
3042
|
this._disabledNavigation = this._nodeRef.getAttribute("data-disable-navigation") === "1";
|
|
2940
|
-
this._timeline = new SlideTimeline(this._slideIndex, this._duration, this._disabledTimer, this._slideReadyPromise, this._afterResumeQueuePush);
|
|
3043
|
+
this._timeline = new SlideTimeline(this._slideIndex, this._duration, this._disabledTimer, this._slideReadyPromise, this._afterResumeQueuePush, this.sdkApi);
|
|
3044
|
+
const onWidgetComplete = (cardId, slideIndex) => {
|
|
3045
|
+
// todo if nothing more widgets with disabled timers - we can start layer timeline
|
|
3046
|
+
const fallback = () => this._showNextSlide(DEFAULT_SLIDE_DURATION);
|
|
3047
|
+
// для android sdk важно чтобы этот метод вызывался только после slide_start
|
|
3048
|
+
this._afterStartInitQueuePush(() => {
|
|
3049
|
+
this._timeline.startDisabledTimeline(fallback);
|
|
3050
|
+
});
|
|
3051
|
+
};
|
|
2941
3052
|
const _elementsNodes = this._nodeRef.querySelectorAll(".narrative-slide-elements .narrative-element");
|
|
2942
3053
|
let layerWithWidgetQuest = false;
|
|
2943
3054
|
_elementsNodes.forEach(item => {
|
|
2944
|
-
let element = tryCreateFromHtmlElement(item, this);
|
|
3055
|
+
let element = tryCreateFromHtmlElement(item, this, onWidgetComplete, this.sdkApi);
|
|
2945
3056
|
if (element) {
|
|
2946
3057
|
this._elements.push(element);
|
|
2947
3058
|
if (element instanceof Quest) {
|
|
@@ -2956,7 +3067,7 @@ class Layer {
|
|
|
2956
3067
|
* - then init WidgetQuest with layer instead of WidgetQuest element (required for WidgetQuest slides navigation)
|
|
2957
3068
|
*/
|
|
2958
3069
|
if (this.isQuest && !layerWithWidgetQuest && this.layoutService.layoutApi.widgetQuestApi != null) {
|
|
2959
|
-
this._elements.push(new Quest(this._nodeRef, this, this.layoutService.layoutApi.widgetQuestApi));
|
|
3070
|
+
this._elements.push(new Quest(this._nodeRef, this, this.layoutService.layoutApi.widgetQuestApi, onWidgetComplete, this.sdkApi));
|
|
2960
3071
|
}
|
|
2961
3072
|
}
|
|
2962
3073
|
init(localData) {
|
|
@@ -2985,11 +3096,8 @@ class Layer {
|
|
|
2985
3096
|
get layoutService() {
|
|
2986
3097
|
return container.get({ identifier: "LayoutService" });
|
|
2987
3098
|
}
|
|
2988
|
-
get sdkApi() {
|
|
2989
|
-
return container.get({ identifier: "SDKApi" });
|
|
2990
|
-
}
|
|
2991
3099
|
getLocalData() {
|
|
2992
|
-
return this.
|
|
3100
|
+
return this.sdkApi.getCardLocalData();
|
|
2993
3101
|
}
|
|
2994
3102
|
get isQuest() {
|
|
2995
3103
|
return this._nodeRef.getAttribute("data-quest-count") != null;
|
|
@@ -3253,7 +3361,7 @@ class Layer {
|
|
|
3253
3361
|
get isLayerForcePaused() {
|
|
3254
3362
|
return this.elements.some(element => element.isLayerForcePaused);
|
|
3255
3363
|
}
|
|
3256
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Slide`, `Promise`, `(cb: () => void) => void`]; }
|
|
3364
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Slide`, `Promise`, `(cb: () => void) => void`, `(cb: () => void) => void`, `(duration: number) => void`, `SDKApi`]; }
|
|
3257
3365
|
}
|
|
3258
3366
|
const TextFit = (function () {
|
|
3259
3367
|
const defaultSettings = {
|
|
@@ -3427,17 +3535,23 @@ class Slide {
|
|
|
3427
3535
|
_slidesNodesRefs;
|
|
3428
3536
|
_slideReadyPromise;
|
|
3429
3537
|
_afterResumeQueuePush;
|
|
3538
|
+
_afterStartInitQueuePush;
|
|
3539
|
+
_showNextSlide;
|
|
3540
|
+
sdkApi;
|
|
3430
3541
|
_layers;
|
|
3431
3542
|
_start;
|
|
3432
|
-
constructor(_slidesNodesRefs, _slideReadyPromise, _afterResumeQueuePush) {
|
|
3543
|
+
constructor(_slidesNodesRefs, _slideReadyPromise, _afterResumeQueuePush, _afterStartInitQueuePush, _showNextSlide, sdkApi) {
|
|
3433
3544
|
this._slidesNodesRefs = _slidesNodesRefs;
|
|
3434
3545
|
this._slideReadyPromise = _slideReadyPromise;
|
|
3435
3546
|
this._afterResumeQueuePush = _afterResumeQueuePush;
|
|
3547
|
+
this._afterStartInitQueuePush = _afterStartInitQueuePush;
|
|
3548
|
+
this._showNextSlide = _showNextSlide;
|
|
3549
|
+
this.sdkApi = sdkApi;
|
|
3436
3550
|
this._start = window.performance.now();
|
|
3437
3551
|
if (!this._slidesNodesRefs.length) {
|
|
3438
3552
|
throw new Error("No slides found.");
|
|
3439
3553
|
}
|
|
3440
|
-
this._layers = this._slidesNodesRefs.map(item => new Layer(item, this, this._slideReadyPromise, this._afterResumeQueuePush));
|
|
3554
|
+
this._layers = this._slidesNodesRefs.map(item => new Layer(item, this, this._slideReadyPromise, this._afterResumeQueuePush, this._afterStartInitQueuePush, this._showNextSlide, this.sdkApi));
|
|
3441
3555
|
this._activeLayer = this._layers[0];
|
|
3442
3556
|
}
|
|
3443
3557
|
_activeLayer;
|
|
@@ -3456,7 +3570,7 @@ class Slide {
|
|
|
3456
3570
|
const multiSlideApi = this.layoutService.layoutApi.widgetMultiSlideApi;
|
|
3457
3571
|
if (multiSlideApi != null && this.layers.length > 1) {
|
|
3458
3572
|
try {
|
|
3459
|
-
multiSlideApi.init(this.layersNodesRefs, localData);
|
|
3573
|
+
multiSlideApi.init(this.layersNodesRefs, localData, this.sdkApi);
|
|
3460
3574
|
}
|
|
3461
3575
|
catch (e) {
|
|
3462
3576
|
console.error(e);
|
|
@@ -3528,7 +3642,7 @@ class Slide {
|
|
|
3528
3642
|
get disabledNavigation() {
|
|
3529
3643
|
return this._activeLayer.disabledNavigation;
|
|
3530
3644
|
}
|
|
3531
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Array`, `Promise`, `(cb: () => void) => void`]; }
|
|
3645
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`Array`, `Promise`, `(cb: () => void) => void`, `(cb: () => void) => void`, `(duration: number) => void`, `SDKApi`]; }
|
|
3532
3646
|
}
|
|
3533
3647
|
|
|
3534
3648
|
let SlideApi$1 = class SlideApi {
|
|
@@ -3541,10 +3655,16 @@ let SlideApi$1 = class SlideApi {
|
|
|
3541
3655
|
static prerenderBoxClassName = "narrative-slide-box-prerender";
|
|
3542
3656
|
_slideWrapper;
|
|
3543
3657
|
_viewport;
|
|
3658
|
+
_getViewportWidth;
|
|
3659
|
+
_getViewportHeight;
|
|
3660
|
+
sdkApi;
|
|
3544
3661
|
constructor(config) {
|
|
3545
3662
|
this.config = config;
|
|
3663
|
+
this.sdkApi = config.sdkApi;
|
|
3546
3664
|
this._slideWrapper = config.slideWrapper;
|
|
3547
3665
|
this._viewport = config.viewport;
|
|
3666
|
+
this._getViewportWidth = config.getViewportWidth;
|
|
3667
|
+
this._getViewportHeight = config.getViewportHeight;
|
|
3548
3668
|
this.refreshSizes = proxy(this.refreshSizes, this);
|
|
3549
3669
|
this.initListeners();
|
|
3550
3670
|
this.refreshSizes();
|
|
@@ -3574,10 +3694,8 @@ let SlideApi$1 = class SlideApi {
|
|
|
3574
3694
|
this._viewport.removeEventListener("resize", this.refreshSizes);
|
|
3575
3695
|
}
|
|
3576
3696
|
refreshSizes() {
|
|
3577
|
-
|
|
3578
|
-
const
|
|
3579
|
-
// const viewportHeight = getViewportHeight(this._viewport);
|
|
3580
|
-
const viewportHeight = this._slideWrapper.clientHeight;
|
|
3697
|
+
const viewportWidth = this._getViewportWidth();
|
|
3698
|
+
const viewportHeight = this._getViewportHeight();
|
|
3581
3699
|
const viewportRatio = viewportWidth / viewportHeight;
|
|
3582
3700
|
let slideWidth = 0;
|
|
3583
3701
|
let slideHeight = 0;
|
|
@@ -3641,7 +3759,6 @@ let SlideApi$1 = class SlideApi {
|
|
|
3641
3759
|
if (_isFullscreen) {
|
|
3642
3760
|
slideOffset?.classList.add("narrative-slide-offset-fullscreen");
|
|
3643
3761
|
}
|
|
3644
|
-
console.log({ fontSize, slideWidth });
|
|
3645
3762
|
if (this.config.userResizeHandler != null) {
|
|
3646
3763
|
this.config.userResizeHandler({ viewportWidth, viewportHeight, fontSize });
|
|
3647
3764
|
}
|
|
@@ -3674,10 +3791,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
3674
3791
|
return container.get({ identifier: "LayoutService" });
|
|
3675
3792
|
}
|
|
3676
3793
|
getLocalData() {
|
|
3677
|
-
return this.
|
|
3678
|
-
}
|
|
3679
|
-
get sdkApi() {
|
|
3680
|
-
return container.get({ identifier: "SDKApi" });
|
|
3794
|
+
return this.sdkApi.getCardLocalData();
|
|
3681
3795
|
}
|
|
3682
3796
|
_fontsInit = false;
|
|
3683
3797
|
_initAndLoadFonts(fonts) {
|
|
@@ -3732,6 +3846,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
3732
3846
|
async _onAllMediaLoaded(slide) {
|
|
3733
3847
|
return new Promise((resolve, reject) => {
|
|
3734
3848
|
const promises = slide.layers.flatMap(layer => layer.elements.flatMap(element => element.mediaElementsLoadingPromises));
|
|
3849
|
+
console.log({ promises });
|
|
3735
3850
|
let checkerTimerId = undefined;
|
|
3736
3851
|
let timeOutFired = false;
|
|
3737
3852
|
if (promises.length > 0) {
|
|
@@ -3773,15 +3888,16 @@ let SlideApi$1 = class SlideApi {
|
|
|
3773
3888
|
slideReadyResolve = resolve;
|
|
3774
3889
|
slideReadyReject = reject;
|
|
3775
3890
|
});
|
|
3776
|
-
const slide = new Slide(slidesNodesRefs, slideReadyPromise, this.afterResumeQueuePush.bind(this));
|
|
3891
|
+
const slide = new Slide(slidesNodesRefs, slideReadyPromise, this.afterResumeQueuePush.bind(this), this.afterStartInitQueuePush.bind(this), this.sdkApi.showNextSlide.bind(this), this.sdkApi);
|
|
3777
3892
|
this._slideInInit = slide;
|
|
3893
|
+
slide.activeLayer.timeline.triggerSlideLoadState();
|
|
3778
3894
|
const onAllMediaLoaded = this._onAllMediaLoaded(slide);
|
|
3779
3895
|
if (this.sdkApi.isAndroid) {
|
|
3780
3896
|
this._afterStartInitQueue = [];
|
|
3781
3897
|
}
|
|
3782
3898
|
this._afterResumeQueue = [];
|
|
3783
3899
|
const result = { slide, result: false, reason: "" };
|
|
3784
|
-
await this._initAndLoadFonts(this.
|
|
3900
|
+
await this._initAndLoadFonts(this.sdkApi.getCardFonts());
|
|
3785
3901
|
const localData = await this.getLocalData();
|
|
3786
3902
|
const finishRender = await slide.init(localData);
|
|
3787
3903
|
/**
|
|
@@ -3829,8 +3945,15 @@ let SlideApi$1 = class SlideApi {
|
|
|
3829
3945
|
slideBoxPrerender.classList.remove(SlideApi.prerenderBoxClassName);
|
|
3830
3946
|
slideBox.classList.remove(SlideApi.renderedBoxClassName);
|
|
3831
3947
|
slideBox.classList.add(SlideApi.prerenderBoxClassName);
|
|
3832
|
-
|
|
3833
|
-
|
|
3948
|
+
// 2 RAF - wait for browser render complete (CSS changes, etc.)
|
|
3949
|
+
this.layoutService.env.requestAnimationFrame(() => {
|
|
3950
|
+
this.layoutService.env.requestAnimationFrame(() => {
|
|
3951
|
+
prevSlide?.onBeforeUnmount();
|
|
3952
|
+
// @ts-ignore
|
|
3953
|
+
// _log("clear innerHTML", true);
|
|
3954
|
+
slideBox.innerHTML = "";
|
|
3955
|
+
});
|
|
3956
|
+
});
|
|
3834
3957
|
slideBoxPrerender.classList.add(SlideApi.renderedBoxClassName);
|
|
3835
3958
|
}
|
|
3836
3959
|
this._slideInRender = false;
|
|
@@ -4585,10 +4708,9 @@ let SlideApi$1 = class SlideApi {
|
|
|
4585
4708
|
this.activeLayer.shareElement.complete(id, isSuccess);
|
|
4586
4709
|
}
|
|
4587
4710
|
}
|
|
4588
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`{\n slideWrapper: HTMLElement;\n viewport: Window;\n userResizeHandler?: (data: { viewportWidth: number; viewportHeight: number; fontSize: number }) => void;\n slideRatio: number;\n isFullscreen: boolean;\n slideLoadedCb?: (data: { slide: Slide; result: boolean; reason?: string }) => void;\n }`]; }
|
|
4711
|
+
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 }`]; }
|
|
4589
4712
|
};
|
|
4590
4713
|
|
|
4591
|
-
let sdkInterface;
|
|
4592
4714
|
const slideApiPeerDeps = {};
|
|
4593
4715
|
const createSlideWrapper = ({ slideBoxRatio, nonce }) => {
|
|
4594
4716
|
const slideWrapper = document.createElement("div");
|
|
@@ -4613,7 +4735,6 @@ const createSlideWrapper = ({ slideBoxRatio, nonce }) => {
|
|
|
4613
4735
|
// style.sheet?.insertRule(`.narrative-slide-box {padding: ${paddingTop} 0 0 0;`);
|
|
4614
4736
|
slideBoxRendered.style.padding = `${paddingTop} 0 0 0`;
|
|
4615
4737
|
slideBoxPrerender.style.padding = `${paddingTop} 0 0 0`;
|
|
4616
|
-
console.log({ paddingTop });
|
|
4617
4738
|
slideOffset.appendChild(slideBoxPrerender);
|
|
4618
4739
|
slideOffset.appendChild(slideBoxRendered);
|
|
4619
4740
|
slideWrapper.appendChild(slideOffset);
|
|
@@ -4622,24 +4743,24 @@ const createSlideWrapper = ({ slideBoxRatio, nonce }) => {
|
|
|
4622
4743
|
};
|
|
4623
4744
|
class SlideApi extends SlideApi$1 {
|
|
4624
4745
|
constructor(_sdkInterface, config) {
|
|
4625
|
-
sdkInterface = _sdkInterface;
|
|
4626
4746
|
slideApiPeerDeps.VODPlayer = config.VODPlayer;
|
|
4627
4747
|
const slideWrapper = createSlideWrapper({ slideBoxRatio: config.slideRatio, nonce: config.nonce });
|
|
4628
4748
|
// todo need to clear root node before append slideWrapper?
|
|
4629
4749
|
config.root.appendChild(slideWrapper);
|
|
4630
4750
|
super({
|
|
4751
|
+
sdkApi: new EsModuleSdkApi(_sdkInterface),
|
|
4631
4752
|
slideWrapper,
|
|
4632
4753
|
viewport: config.viewport,
|
|
4633
4754
|
slideRatio: config.slideRatio,
|
|
4634
4755
|
isFullscreen: config.isFullscreen,
|
|
4635
4756
|
userResizeHandler: config.userResizeHandler,
|
|
4757
|
+
getViewportWidth: () => slideWrapper.clientWidth,
|
|
4758
|
+
getViewportHeight: () => slideWrapper.clientHeight,
|
|
4636
4759
|
});
|
|
4637
4760
|
}
|
|
4638
4761
|
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 }`]; }
|
|
4639
4762
|
}
|
|
4640
4763
|
|
|
4641
|
-
container.registerSingleton(() => new EsModuleSdkApi(() => sdkInterface), { identifier: `SDKApi` });
|
|
4642
|
-
|
|
4643
4764
|
// This file is part of the bwip-js project available at:
|
|
4644
4765
|
//
|
|
4645
4766
|
// http://metafloor.github.io/bwip-js
|
|
@@ -13996,6 +14117,8 @@ FontLib.loadFont("OCR-B", 96, 100, "AAEAAAAPAIAAAwBwRkZUTXxHn14AADmUAAAAHEdERUYA
|
|
|
13996
14117
|
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
14118
|
|
|
13998
14119
|
class WidgetBase {
|
|
14120
|
+
_onWidgetComplete;
|
|
14121
|
+
sdkApi;
|
|
13999
14122
|
static DEFAULTS = {
|
|
14000
14123
|
slide: null,
|
|
14001
14124
|
activateAfterCreate: false,
|
|
@@ -14004,7 +14127,6 @@ class WidgetBase {
|
|
|
14004
14127
|
};
|
|
14005
14128
|
static widgetIndex = 0;
|
|
14006
14129
|
env = WidgetBase.widgetsService.env;
|
|
14007
|
-
sdkApi = WidgetBase.widgetsService.sdkApi;
|
|
14008
14130
|
options = null;
|
|
14009
14131
|
element = null;
|
|
14010
14132
|
elementId = null;
|
|
@@ -14024,7 +14146,9 @@ class WidgetBase {
|
|
|
14024
14146
|
id;
|
|
14025
14147
|
startReadyPromise = null;
|
|
14026
14148
|
startReadyResolve = null;
|
|
14027
|
-
constructor(element, options, elementIdGetter, slideGetter) {
|
|
14149
|
+
constructor(element, options, _onWidgetComplete, sdkApi, elementIdGetter, slideGetter) {
|
|
14150
|
+
this._onWidgetComplete = _onWidgetComplete;
|
|
14151
|
+
this.sdkApi = sdkApi;
|
|
14028
14152
|
this.options = extend({}, this.constructor.DEFAULTS, options);
|
|
14029
14153
|
this.element = element;
|
|
14030
14154
|
if (elementIdGetter) {
|
|
@@ -14132,68 +14256,24 @@ class WidgetBase {
|
|
|
14132
14256
|
return instance;
|
|
14133
14257
|
}
|
|
14134
14258
|
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
|
-
}
|
|
14259
|
+
const widget = this.createInstance(instantiate, htmlElement, {
|
|
14260
|
+
slide: null,
|
|
14261
|
+
localData,
|
|
14262
|
+
});
|
|
14263
|
+
// start widget (just created or cached instance)
|
|
14264
|
+
widget.onRefreshUserData(localData);
|
|
14265
|
+
return Promise.resolve(localData);
|
|
14186
14266
|
}
|
|
14187
14267
|
static get widgetsService() {
|
|
14188
14268
|
return container.get({ identifier: "WidgetsService" });
|
|
14189
14269
|
}
|
|
14190
|
-
static getLocalData() {
|
|
14191
|
-
return
|
|
14270
|
+
static getLocalData(sdkApi) {
|
|
14271
|
+
return sdkApi.getCardLocalData();
|
|
14192
14272
|
}
|
|
14193
14273
|
getLocalData() {
|
|
14194
|
-
return this.constructor.getLocalData();
|
|
14274
|
+
return this.constructor.getLocalData(this.sdkApi);
|
|
14195
14275
|
}
|
|
14196
|
-
static setLocalData(keyValue, sendToServer, syncWithRuntimeLocalData) {
|
|
14276
|
+
static setLocalData(sdkApi, keyValue, sendToServer, syncWithRuntimeLocalData) {
|
|
14197
14277
|
// push json object as string
|
|
14198
14278
|
if (sendToServer === undefined) {
|
|
14199
14279
|
sendToServer = true;
|
|
@@ -14208,20 +14288,20 @@ class WidgetBase {
|
|
|
14208
14288
|
syncWithRuntimeLocalData = Boolean(syncWithRuntimeLocalData);
|
|
14209
14289
|
}
|
|
14210
14290
|
if (syncWithRuntimeLocalData) {
|
|
14211
|
-
this.getLocalData().then(localData => {
|
|
14291
|
+
this.getLocalData(sdkApi).then(localData => {
|
|
14212
14292
|
// 1 - old values, 2 - new values
|
|
14213
14293
|
keyValue = extend({}, localData, keyValue);
|
|
14214
14294
|
// todo make async via promise or async
|
|
14215
|
-
|
|
14295
|
+
sdkApi.setCardLocalData(keyValue, sendToServer);
|
|
14216
14296
|
});
|
|
14217
14297
|
}
|
|
14218
14298
|
else {
|
|
14219
14299
|
// todo make async via promise or async
|
|
14220
|
-
|
|
14300
|
+
sdkApi.setCardLocalData(keyValue, sendToServer);
|
|
14221
14301
|
}
|
|
14222
14302
|
}
|
|
14223
14303
|
setLocalData(keyValue, sendToServer, syncWithRuntimeLocalData) {
|
|
14224
|
-
return this.constructor.setLocalData(keyValue, sendToServer, syncWithRuntimeLocalData);
|
|
14304
|
+
return this.constructor.setLocalData(this.sdkApi, keyValue, sendToServer, syncWithRuntimeLocalData);
|
|
14225
14305
|
}
|
|
14226
14306
|
get statisticEventBaseFieldsShortForm() {
|
|
14227
14307
|
return WidgetBase.getStatisticEventBaseFieldsShortForm(this.cardId, this.slideIndex);
|
|
@@ -14248,14 +14328,14 @@ class WidgetBase {
|
|
|
14248
14328
|
}
|
|
14249
14329
|
return data;
|
|
14250
14330
|
}
|
|
14251
|
-
static sendStatisticEventToApp(name, data, devPayload, options) {
|
|
14252
|
-
sendStatisticEventToApp(
|
|
14331
|
+
static sendStatisticEventToApp(sdkApi, name, data, devPayload, options) {
|
|
14332
|
+
sendStatisticEventToApp(sdkApi, name, data, devPayload, options);
|
|
14253
14333
|
}
|
|
14254
14334
|
sendStatisticEventToApp(name, data, devPayload, options) {
|
|
14255
|
-
this.constructor.sendStatisticEventToApp(name, data, devPayload, options);
|
|
14335
|
+
this.constructor.sendStatisticEventToApp(this.sdkApi, name, data, devPayload, options);
|
|
14256
14336
|
}
|
|
14257
|
-
|
|
14258
|
-
this.
|
|
14337
|
+
onWidgetComplete() {
|
|
14338
|
+
this._onWidgetComplete(this.cardId, this.slideIndex);
|
|
14259
14339
|
}
|
|
14260
14340
|
_showLayer(layers, selectIndex, withStatEvent = false) {
|
|
14261
14341
|
if (this.sdkApi.isExistsShowLayer()) {
|
|
@@ -14290,45 +14370,13 @@ class WidgetBase {
|
|
|
14290
14370
|
console.error(error);
|
|
14291
14371
|
}
|
|
14292
14372
|
}
|
|
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
14373
|
static onRefreshUserData(element, localData) {
|
|
14316
|
-
const
|
|
14317
|
-
|
|
14318
|
-
|
|
14319
|
-
|
|
14320
|
-
|
|
14321
|
-
widget.onRefreshUserData(localData);
|
|
14322
|
-
}
|
|
14374
|
+
const widgetElement = element.closest(`.${this.widgetClassName}`);
|
|
14375
|
+
if (widgetElement) {
|
|
14376
|
+
const widget = WidgetBase.getInstance(widgetElement);
|
|
14377
|
+
if (widget) {
|
|
14378
|
+
widget.onRefreshUserData(localData);
|
|
14323
14379
|
}
|
|
14324
|
-
};
|
|
14325
|
-
if (localData != null) {
|
|
14326
|
-
cb(element, localData);
|
|
14327
|
-
}
|
|
14328
|
-
else {
|
|
14329
|
-
WidgetBase.getLocalData().then(localData => {
|
|
14330
|
-
cb(element, localData);
|
|
14331
|
-
});
|
|
14332
14380
|
}
|
|
14333
14381
|
}
|
|
14334
14382
|
getPromotionalCodeFetchPath(promotionalCodeId) {
|
|
@@ -14339,7 +14387,7 @@ class WidgetBase {
|
|
|
14339
14387
|
return `story/${this.cardId}/widget/${this.elementId}/promo-code/${promotionalCodeId}`;
|
|
14340
14388
|
}
|
|
14341
14389
|
}
|
|
14342
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `(element: HTMLElement) => string`, `(element: HTMLElement) => HTMLElement`]; }
|
|
14390
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`, `(element: HTMLElement) => string`, `(element: HTMLElement) => HTMLElement`]; }
|
|
14343
14391
|
}
|
|
14344
14392
|
|
|
14345
14393
|
class WidgetBarcode extends WidgetBase {
|
|
@@ -14363,8 +14411,8 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14363
14411
|
msgNoMoreCodes;
|
|
14364
14412
|
msgTryAgain;
|
|
14365
14413
|
msgBarcodeRenderError;
|
|
14366
|
-
constructor(element, options) {
|
|
14367
|
-
super(element, options);
|
|
14414
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
14415
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
14368
14416
|
this.captionView = this.element.querySelector(".narrative-element-text-lines");
|
|
14369
14417
|
this.clipboardTarget = getTagData(element, "clipboardTarget");
|
|
14370
14418
|
this.isPromotionalCode = getTagData(element, "clipboardType") === "promocode";
|
|
@@ -14587,7 +14635,7 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14587
14635
|
// флаг - что таймер уже стартанул (в layout или добавить объект sharedMemory)
|
|
14588
14636
|
// смотрим что прозрачный текст - тогда и лоадер прозрачный
|
|
14589
14637
|
// _log("_showNarrativeNextSlide: " + getSlideDuration(this.narrativeId, this.slideIndex), true);
|
|
14590
|
-
this.
|
|
14638
|
+
this.onWidgetComplete();
|
|
14591
14639
|
}
|
|
14592
14640
|
});
|
|
14593
14641
|
if (this.copiedText) {
|
|
@@ -14612,18 +14660,9 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14612
14660
|
}
|
|
14613
14661
|
static api = {
|
|
14614
14662
|
widgetClassName: WidgetBarcode.widgetClassName,
|
|
14615
|
-
/** @deprecated */
|
|
14616
|
-
refreshUserData: WidgetBarcode.refreshUserData,
|
|
14617
14663
|
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
|
-
});
|
|
14664
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
14665
|
+
WidgetBarcode.initWidget(element, localData, (element, options) => new WidgetBarcode(element, options, onWidgetComplete, sdkApi));
|
|
14627
14666
|
},
|
|
14628
14667
|
onStart: function (element) {
|
|
14629
14668
|
WidgetBarcode.getInstance(element)?.onStart();
|
|
@@ -14650,7 +14689,7 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14650
14689
|
return false;
|
|
14651
14690
|
},
|
|
14652
14691
|
};
|
|
14653
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
14692
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
14654
14693
|
}
|
|
14655
14694
|
|
|
14656
14695
|
class WidgetCopy extends WidgetBase {
|
|
@@ -14672,8 +14711,8 @@ class WidgetCopy extends WidgetBase {
|
|
|
14672
14711
|
geometry;
|
|
14673
14712
|
resultLayer;
|
|
14674
14713
|
resultLayerGeometry;
|
|
14675
|
-
constructor(element, options) {
|
|
14676
|
-
super(element, options);
|
|
14714
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
14715
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
14677
14716
|
this.button = this.element.querySelector(".narrative-element-text-lines");
|
|
14678
14717
|
this.clipboardTarget = getTagData(element, "clipboardTarget");
|
|
14679
14718
|
this.isPromotionalCode = getTagData(element, "clipboardType") === "promocode";
|
|
@@ -14857,7 +14896,7 @@ class WidgetCopy extends WidgetBase {
|
|
|
14857
14896
|
// флаг - что таймер уже стартанул (в layout или добавить объект sharedMemory)
|
|
14858
14897
|
// смотрим что прозрачный текст - тогда и лоадер прозрачный
|
|
14859
14898
|
// _log("_showNarrativeNextSlide: " + getSlideDuration(this.narrativeId, this.slideIndex), true);
|
|
14860
|
-
this.
|
|
14899
|
+
this.onWidgetComplete();
|
|
14861
14900
|
}
|
|
14862
14901
|
});
|
|
14863
14902
|
}
|
|
@@ -14879,23 +14918,13 @@ class WidgetCopy extends WidgetBase {
|
|
|
14879
14918
|
}
|
|
14880
14919
|
static api = {
|
|
14881
14920
|
widgetClassName: WidgetCopy.widgetClassName,
|
|
14882
|
-
/** @deprecated */
|
|
14883
|
-
refreshUserData: WidgetCopy.refreshUserData,
|
|
14884
14921
|
onRefreshUserData: WidgetCopy.onRefreshUserData,
|
|
14885
|
-
init: function (element, localData) {
|
|
14922
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
14886
14923
|
// prevent initWidget for result layer
|
|
14887
14924
|
if (!element.classList.contains("narrative-element-copy-result-variant")) {
|
|
14888
|
-
WidgetCopy.initWidget(element, localData, (element, options) => new WidgetCopy(element, options));
|
|
14925
|
+
WidgetCopy.initWidget(element, localData, (element, options) => new WidgetCopy(element, options, onWidgetComplete, sdkApi));
|
|
14889
14926
|
}
|
|
14890
14927
|
},
|
|
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
14928
|
onStart: function (element) {
|
|
14900
14929
|
WidgetCopy.getInstance(element)?.onStart();
|
|
14901
14930
|
},
|
|
@@ -14921,10 +14950,9 @@ class WidgetCopy extends WidgetBase {
|
|
|
14921
14950
|
return false;
|
|
14922
14951
|
},
|
|
14923
14952
|
};
|
|
14924
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
14953
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
14925
14954
|
}
|
|
14926
14955
|
|
|
14927
|
-
/** QUIZ */
|
|
14928
14956
|
class WidgetDataInput extends WidgetBase {
|
|
14929
14957
|
static DEFAULTS = {
|
|
14930
14958
|
slide: null,
|
|
@@ -14942,9 +14970,11 @@ class WidgetDataInput extends WidgetBase {
|
|
|
14942
14970
|
* @throws Error
|
|
14943
14971
|
* @param element
|
|
14944
14972
|
* @param options
|
|
14973
|
+
* @param onWidgetComplete
|
|
14974
|
+
* @param sdkApi
|
|
14945
14975
|
*/
|
|
14946
|
-
constructor(element, options) {
|
|
14947
|
-
super(element, options);
|
|
14976
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
14977
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
14948
14978
|
this.label = this.element.querySelector(".label-view .label");
|
|
14949
14979
|
this.elementRect = this.element.getBoundingClientRect();
|
|
14950
14980
|
this.inputElement = getValueOrException(this.element.querySelector(".input-view .input"), "Empty .input-view .input");
|
|
@@ -14963,7 +14993,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
14963
14993
|
this.element.classList.add("done");
|
|
14964
14994
|
this.startReadyPromise.then(() => {
|
|
14965
14995
|
if (this.disableTimer) {
|
|
14966
|
-
this.
|
|
14996
|
+
this.onWidgetComplete();
|
|
14967
14997
|
}
|
|
14968
14998
|
});
|
|
14969
14999
|
}
|
|
@@ -15080,7 +15110,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
15080
15110
|
this.setLocalData(this.localData, true);
|
|
15081
15111
|
this._statEventInputSave(text);
|
|
15082
15112
|
if (this.disableTimer) {
|
|
15083
|
-
this.
|
|
15113
|
+
this.onWidgetComplete();
|
|
15084
15114
|
needResumeUITimer = false;
|
|
15085
15115
|
}
|
|
15086
15116
|
}
|
|
@@ -15090,18 +15120,9 @@ class WidgetDataInput extends WidgetBase {
|
|
|
15090
15120
|
}
|
|
15091
15121
|
static api = {
|
|
15092
15122
|
widgetClassName: WidgetDataInput.widgetClassName,
|
|
15093
|
-
/** @deprecated */
|
|
15094
|
-
refreshUserData: WidgetDataInput.refreshUserData,
|
|
15095
15123
|
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
|
-
});
|
|
15124
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
15125
|
+
WidgetDataInput.initWidget(element, localData, (element, options) => new WidgetDataInput(element, options, onWidgetComplete, sdkApi));
|
|
15105
15126
|
},
|
|
15106
15127
|
onStart: function (element) {
|
|
15107
15128
|
WidgetDataInput.getInstance(element)?.onStart();
|
|
@@ -15123,7 +15144,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
15123
15144
|
WidgetDataInput.getInstanceById(id)?.setUserText(text);
|
|
15124
15145
|
},
|
|
15125
15146
|
};
|
|
15126
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
15147
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
15127
15148
|
}
|
|
15128
15149
|
|
|
15129
15150
|
class WidgetDateCountdown extends WidgetBase {
|
|
@@ -15151,8 +15172,8 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
15151
15172
|
thirdGroup1;
|
|
15152
15173
|
thirdGroup2;
|
|
15153
15174
|
thirdGroupCaption;
|
|
15154
|
-
constructor(element, options) {
|
|
15155
|
-
super(element, options);
|
|
15175
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
15176
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
15156
15177
|
this.label = this.element.querySelector(".label-view .label");
|
|
15157
15178
|
this.messages = {
|
|
15158
15179
|
days: getTagData(this.element, "tDays") ?? "",
|
|
@@ -15329,18 +15350,9 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
15329
15350
|
}
|
|
15330
15351
|
static api = {
|
|
15331
15352
|
widgetClassName: WidgetDateCountdown.widgetClassName,
|
|
15332
|
-
/** @deprecated */
|
|
15333
|
-
refreshUserData: WidgetDateCountdown.refreshUserData,
|
|
15334
15353
|
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
|
-
});
|
|
15354
|
+
init: function (element, layers, localData, onWidgetComplete, sdkApi) {
|
|
15355
|
+
WidgetDateCountdown.initWidget(element, localData, (element, options) => new WidgetDateCountdown(element, { ...options, layers }, onWidgetComplete, sdkApi));
|
|
15344
15356
|
},
|
|
15345
15357
|
onStart: function (element) {
|
|
15346
15358
|
WidgetDateCountdown.getInstance(element)?.onStart();
|
|
@@ -15354,23 +15366,11 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
15354
15366
|
onResume: function (element) {
|
|
15355
15367
|
WidgetDateCountdown.getInstance(element)?.onResume();
|
|
15356
15368
|
},
|
|
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
15369
|
};
|
|
15370
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
15370
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
15371
15371
|
}
|
|
15372
15372
|
|
|
15373
|
-
const displaySlide = function (slides, localData) {
|
|
15373
|
+
const displaySlide = function (slides, localData, sdkApi) {
|
|
15374
15374
|
const multiSlideItem = slides[0];
|
|
15375
15375
|
let cardId = undefined;
|
|
15376
15376
|
let cardType = 1 /* CARD_TYPE.STORY */;
|
|
@@ -15435,7 +15435,7 @@ const displaySlide = function (slides, localData) {
|
|
|
15435
15435
|
if (slides.length > 0) {
|
|
15436
15436
|
var slide = slides[0];
|
|
15437
15437
|
slide.classList.remove("hidden");
|
|
15438
|
-
|
|
15438
|
+
sdkApi.cardAnimation?.start(slide);
|
|
15439
15439
|
return;
|
|
15440
15440
|
}
|
|
15441
15441
|
score = 0;
|
|
@@ -15464,19 +15464,19 @@ const displaySlide = function (slides, localData) {
|
|
|
15464
15464
|
if (index === selectedIndex) {
|
|
15465
15465
|
slide.classList.remove("hidden");
|
|
15466
15466
|
undefinedResult = false;
|
|
15467
|
-
|
|
15468
|
-
_sendStatEvent(cardId, cardType, slideIndex, selectedIndex);
|
|
15467
|
+
sdkApi.cardAnimation?.start(slide);
|
|
15468
|
+
_sendStatEvent(sdkApi, cardId, cardType, slideIndex, selectedIndex);
|
|
15469
15469
|
}
|
|
15470
15470
|
});
|
|
15471
15471
|
}
|
|
15472
15472
|
if (undefinedResult) {
|
|
15473
15473
|
console.warn("undefinedResult layer index");
|
|
15474
|
-
|
|
15474
|
+
sdkApi.showLayer(0);
|
|
15475
15475
|
}
|
|
15476
15476
|
};
|
|
15477
|
-
const _sendStatEvent = function (cardId, cardType, slideIndex, layerIndex) {
|
|
15477
|
+
const _sendStatEvent = function (sdkApi, cardId, cardType, slideIndex, layerIndex) {
|
|
15478
15478
|
try {
|
|
15479
|
-
WidgetBase.sendStatisticEventToApp("layout-show", {
|
|
15479
|
+
WidgetBase.sendStatisticEventToApp(sdkApi, "layout-show", {
|
|
15480
15480
|
...WidgetBase.getStatisticEventBaseFieldsShortForm(cardId, slideIndex),
|
|
15481
15481
|
li: layerIndex,
|
|
15482
15482
|
}, {
|
|
@@ -15490,15 +15490,8 @@ const _sendStatEvent = function (cardId, cardType, slideIndex, layerIndex) {
|
|
|
15490
15490
|
};
|
|
15491
15491
|
class WidgetMultiSlide {
|
|
15492
15492
|
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
|
-
}
|
|
15493
|
+
init: function (slides, localData, sdkApi) {
|
|
15494
|
+
displaySlide(slides, localData, sdkApi);
|
|
15502
15495
|
},
|
|
15503
15496
|
};
|
|
15504
15497
|
}
|
|
@@ -15529,9 +15522,10 @@ class WidgetPoll extends WidgetBase {
|
|
|
15529
15522
|
* @throws Error
|
|
15530
15523
|
* @param element
|
|
15531
15524
|
* @param options
|
|
15525
|
+
* @param onWidgetComplete
|
|
15532
15526
|
*/
|
|
15533
|
-
constructor(element, options) {
|
|
15534
|
-
super(element, options);
|
|
15527
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
15528
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
15535
15529
|
this.label = this.element.querySelector(".label-view .label");
|
|
15536
15530
|
this.percentFillMask = this.element.querySelector(".percent-filled-variants-view-group-mask");
|
|
15537
15531
|
this.maskedVariants = slice.call(this.element.querySelectorAll(".variants-box .variants-view-group.percent-filled-variants-view-group .variant-view"));
|
|
@@ -15640,7 +15634,7 @@ class WidgetPoll extends WidgetBase {
|
|
|
15640
15634
|
}
|
|
15641
15635
|
this.startReadyPromise.then(() => {
|
|
15642
15636
|
if (this.disableTimer) {
|
|
15643
|
-
this.
|
|
15637
|
+
this.onWidgetComplete();
|
|
15644
15638
|
}
|
|
15645
15639
|
});
|
|
15646
15640
|
}
|
|
@@ -15980,17 +15974,9 @@ class WidgetPoll extends WidgetBase {
|
|
|
15980
15974
|
}
|
|
15981
15975
|
static api = {
|
|
15982
15976
|
widgetClassName: WidgetPoll.widgetClassName,
|
|
15983
|
-
/** @deprecated */
|
|
15984
|
-
refreshUserData: WidgetPoll.refreshUserData,
|
|
15985
15977
|
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
|
-
});
|
|
15978
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
15979
|
+
WidgetPoll.initWidget(element, localData, (element, options) => new WidgetPoll(element, options, onWidgetComplete, sdkApi));
|
|
15994
15980
|
},
|
|
15995
15981
|
onStart: function (element) {
|
|
15996
15982
|
WidgetPoll.getInstance(element)?.onStart();
|
|
@@ -16036,7 +16022,7 @@ class WidgetPoll extends WidgetBase {
|
|
|
16036
16022
|
}
|
|
16037
16023
|
},
|
|
16038
16024
|
};
|
|
16039
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
16025
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
16040
16026
|
}
|
|
16041
16027
|
|
|
16042
16028
|
class WidgetPollLayers extends WidgetBase {
|
|
@@ -16053,8 +16039,8 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16053
16039
|
variantsTexts;
|
|
16054
16040
|
selectedVariant;
|
|
16055
16041
|
layers;
|
|
16056
|
-
constructor(element, options) {
|
|
16057
|
-
super(element, options);
|
|
16042
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
16043
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
16058
16044
|
this.layers = this.options.layers;
|
|
16059
16045
|
this.label = this.element.querySelector(".label-view .label");
|
|
16060
16046
|
this.variants = slice.call(this.element.querySelectorAll(".variants-box .variant-view"));
|
|
@@ -16126,7 +16112,7 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16126
16112
|
this._showLayer(this.layers, layerIndex, userAction);
|
|
16127
16113
|
this.startReadyPromise.then(() => {
|
|
16128
16114
|
if (this.disableTimer) {
|
|
16129
|
-
this.
|
|
16115
|
+
this.onWidgetComplete();
|
|
16130
16116
|
}
|
|
16131
16117
|
});
|
|
16132
16118
|
}
|
|
@@ -16165,28 +16151,9 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16165
16151
|
}
|
|
16166
16152
|
static api = {
|
|
16167
16153
|
widgetClassName: WidgetPollLayers.widgetClassName,
|
|
16168
|
-
/** @deprecated */
|
|
16169
|
-
refreshUserData: WidgetPollLayers.refreshUserData,
|
|
16170
16154
|
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
|
-
});
|
|
16155
|
+
init: function (element, layers, localData, onWidgetComplete, sdkApi) {
|
|
16156
|
+
WidgetPollLayers.initWidget(element, localData, (element, options) => new WidgetPollLayers(element, { ...options, layers }, onWidgetComplete, sdkApi));
|
|
16190
16157
|
},
|
|
16191
16158
|
onStart: function (element) {
|
|
16192
16159
|
WidgetPollLayers.getInstance(element)?.onStart();
|
|
@@ -16210,7 +16177,7 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
16210
16177
|
return false;
|
|
16211
16178
|
},
|
|
16212
16179
|
};
|
|
16213
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
16180
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
16214
16181
|
}
|
|
16215
16182
|
|
|
16216
16183
|
class Formatter {
|
|
@@ -16837,8 +16804,8 @@ class WidgetProducts extends WidgetBase {
|
|
|
16837
16804
|
swipeGestureDetector = null;
|
|
16838
16805
|
isClickCapturedByWidget = false;
|
|
16839
16806
|
isScreenSupportsTouch = false;
|
|
16840
|
-
constructor(element, options) {
|
|
16841
|
-
super(element, options);
|
|
16807
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
16808
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
16842
16809
|
this.captionView = this.element.querySelector(".narrative-element-text-lines");
|
|
16843
16810
|
const linkTarget = decodeURIComponent(getTagData(element, "linkTarget") ?? "[]");
|
|
16844
16811
|
try {
|
|
@@ -17313,8 +17280,8 @@ class WidgetProducts extends WidgetBase {
|
|
|
17313
17280
|
static api = {
|
|
17314
17281
|
widgetClassName: WidgetProducts.widgetClassName,
|
|
17315
17282
|
onRefreshUserData: WidgetProducts.onRefreshUserData,
|
|
17316
|
-
init: function (element, localData) {
|
|
17317
|
-
WidgetProducts.initWidget(element, localData, (element, options) => new WidgetProducts(element, options));
|
|
17283
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
17284
|
+
WidgetProducts.initWidget(element, localData, (element, options) => new WidgetProducts(element, options, onWidgetComplete, sdkApi));
|
|
17318
17285
|
},
|
|
17319
17286
|
onStart: function (element) {
|
|
17320
17287
|
WidgetProducts.getInstance(element)?.onStart();
|
|
@@ -17363,7 +17330,7 @@ class WidgetProducts extends WidgetBase {
|
|
|
17363
17330
|
return false;
|
|
17364
17331
|
},
|
|
17365
17332
|
};
|
|
17366
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
17333
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
17367
17334
|
}
|
|
17368
17335
|
|
|
17369
17336
|
class WidgetQuest extends WidgetBase {
|
|
@@ -17383,11 +17350,11 @@ class WidgetQuest extends WidgetBase {
|
|
|
17383
17350
|
navigationNextSlide;
|
|
17384
17351
|
slideDisabledNavigation;
|
|
17385
17352
|
finalSlide;
|
|
17386
|
-
constructor(element, options) {
|
|
17353
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
17387
17354
|
const isWidget = !hasClass(element, "narrative-slide");
|
|
17388
17355
|
const elementIdGetter = (element) => getValueOrDefault(getTagData(element, "elementId"), "");
|
|
17389
17356
|
const slideGetter = (element) => isWidget ? getValueOrException(element.closest(".narrative-slide"), "Empty slide") : element;
|
|
17390
|
-
super(element, options, elementIdGetter, slideGetter);
|
|
17357
|
+
super(element, options, onWidgetComplete, sdkApi, elementIdGetter, slideGetter);
|
|
17391
17358
|
this.isWidget = isWidget;
|
|
17392
17359
|
this.slideCount = getTagDataAsNumber(this.slide, "slideCount") ?? 0;
|
|
17393
17360
|
const nonFinalSlide = getTagDataAsNumber(this.slide, "nonFinalSlide");
|
|
@@ -17584,6 +17551,14 @@ class WidgetQuest extends WidgetBase {
|
|
|
17584
17551
|
if (this.nonFinalSlide == null) {
|
|
17585
17552
|
// widget v2 (with navigationNextSlide)
|
|
17586
17553
|
if (directionForward) {
|
|
17554
|
+
if (this.navigationNextSlide === -1) {
|
|
17555
|
+
// this is the final slide - exit from this quest
|
|
17556
|
+
if (this.sdkApi.isExistsShowNextCard) {
|
|
17557
|
+
this.sdkApi.cardShowNext();
|
|
17558
|
+
}
|
|
17559
|
+
result.continueDefaultNavigation = false;
|
|
17560
|
+
return result;
|
|
17561
|
+
}
|
|
17587
17562
|
const nextSlideIndex = this.navigationNextSlide ?? event.slideIndex + 1;
|
|
17588
17563
|
if (nextSlideIndex < this.slideCount) {
|
|
17589
17564
|
this._addNewRouteHistory(nextSlideIndex);
|
|
@@ -17685,12 +17660,10 @@ class WidgetQuest extends WidgetBase {
|
|
|
17685
17660
|
}
|
|
17686
17661
|
static api = {
|
|
17687
17662
|
widgetClassName: WidgetQuest.widgetClassName,
|
|
17688
|
-
/** @deprecated */
|
|
17689
|
-
refreshUserData: WidgetQuest.refreshUserData,
|
|
17690
17663
|
onRefreshUserData: WidgetQuest.onRefreshUserData,
|
|
17691
|
-
init: function (element, localData) {
|
|
17664
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
17692
17665
|
return new Promise(function (resolve, reject) {
|
|
17693
|
-
WidgetQuest.initWidget(element, localData, (element, options) => new WidgetQuest(element, options)).then(localData => {
|
|
17666
|
+
WidgetQuest.initWidget(element, localData, (element, options) => new WidgetQuest(element, options, onWidgetComplete, sdkApi)).then(localData => {
|
|
17694
17667
|
const widget = WidgetQuest.getInstance(element);
|
|
17695
17668
|
if (widget) {
|
|
17696
17669
|
resolve(widget.init());
|
|
@@ -17701,22 +17674,6 @@ class WidgetQuest extends WidgetBase {
|
|
|
17701
17674
|
});
|
|
17702
17675
|
});
|
|
17703
17676
|
},
|
|
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
17677
|
onStart: function (element) {
|
|
17721
17678
|
WidgetQuest.getInstance(element)?.onStart();
|
|
17722
17679
|
},
|
|
@@ -17748,7 +17705,7 @@ class WidgetQuest extends WidgetBase {
|
|
|
17748
17705
|
return { continueDefaultNavigation: true };
|
|
17749
17706
|
},
|
|
17750
17707
|
};
|
|
17751
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
17708
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
17752
17709
|
}
|
|
17753
17710
|
|
|
17754
17711
|
class WidgetQuiz extends WidgetBase {
|
|
@@ -17763,8 +17720,8 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17763
17720
|
answers;
|
|
17764
17721
|
questionCount;
|
|
17765
17722
|
selectedAnswer;
|
|
17766
|
-
constructor(element, options) {
|
|
17767
|
-
super(element, options);
|
|
17723
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
17724
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
17768
17725
|
this.question = this.element.querySelector(".label-view .label");
|
|
17769
17726
|
this.answers = slice.call(this.element.querySelectorAll(".variants-box .variant-view-group"));
|
|
17770
17727
|
this.questionCount = getValueOrException(getTagDataAsNumber(this.slide, "quizCount"), "Empty quizCount");
|
|
@@ -17819,7 +17776,7 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17819
17776
|
// }
|
|
17820
17777
|
this.startReadyPromise.then(() => {
|
|
17821
17778
|
if (this.disableTimer) {
|
|
17822
|
-
this.
|
|
17779
|
+
this.onWidgetComplete();
|
|
17823
17780
|
}
|
|
17824
17781
|
});
|
|
17825
17782
|
}
|
|
@@ -17911,17 +17868,9 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17911
17868
|
}
|
|
17912
17869
|
static api = {
|
|
17913
17870
|
widgetClassName: WidgetQuiz.widgetClassName,
|
|
17914
|
-
/** @deprecated */
|
|
17915
|
-
refreshUserData: WidgetQuiz.refreshUserData,
|
|
17916
17871
|
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
|
-
});
|
|
17872
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
17873
|
+
WidgetQuiz.initWidget(element, localData, (element, options) => new WidgetQuiz(element, options, onWidgetComplete, sdkApi));
|
|
17925
17874
|
},
|
|
17926
17875
|
onStart: function (element) {
|
|
17927
17876
|
WidgetQuiz.getInstance(element)?.onStart();
|
|
@@ -17950,7 +17899,7 @@ class WidgetQuiz extends WidgetBase {
|
|
|
17950
17899
|
return true;
|
|
17951
17900
|
},
|
|
17952
17901
|
};
|
|
17953
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
17902
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
17954
17903
|
}
|
|
17955
17904
|
|
|
17956
17905
|
class WidgetQuizGrouped extends WidgetBase {
|
|
@@ -17969,9 +17918,11 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
17969
17918
|
* @throws Error
|
|
17970
17919
|
* @param element
|
|
17971
17920
|
* @param options
|
|
17921
|
+
* @param onWidgetComplete
|
|
17922
|
+
* @param sdkApi
|
|
17972
17923
|
*/
|
|
17973
|
-
constructor(element, options) {
|
|
17974
|
-
super(element, options);
|
|
17924
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
17925
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
17975
17926
|
this.question = this.element.querySelector(".label-view .label");
|
|
17976
17927
|
this.answers = slice.call(this.element.querySelectorAll(".variants-box .variant-view-group"));
|
|
17977
17928
|
this.questionCount = getValueOrException(getTagDataAsNumber(this.slide, "quizCount"), "Empty quizCount");
|
|
@@ -18013,7 +17964,7 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
18013
17964
|
});
|
|
18014
17965
|
this.startReadyPromise.then(() => {
|
|
18015
17966
|
if (this.disableTimer) {
|
|
18016
|
-
this.
|
|
17967
|
+
this.onWidgetComplete();
|
|
18017
17968
|
}
|
|
18018
17969
|
});
|
|
18019
17970
|
}
|
|
@@ -18122,17 +18073,9 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
18122
18073
|
}
|
|
18123
18074
|
static api = {
|
|
18124
18075
|
widgetClassName: WidgetQuizGrouped.widgetClassName,
|
|
18125
|
-
/** @deprecated */
|
|
18126
|
-
refreshUserData: WidgetQuizGrouped.refreshUserData,
|
|
18127
18076
|
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
|
-
});
|
|
18077
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
18078
|
+
WidgetQuizGrouped.initWidget(element, localData, (element, options) => new WidgetQuizGrouped(element, options, onWidgetComplete, sdkApi));
|
|
18136
18079
|
},
|
|
18137
18080
|
onStart: function (element) {
|
|
18138
18081
|
WidgetQuizGrouped.getInstance(element)?.onStart();
|
|
@@ -18161,7 +18104,7 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
18161
18104
|
return true;
|
|
18162
18105
|
},
|
|
18163
18106
|
};
|
|
18164
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
18107
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
18165
18108
|
}
|
|
18166
18109
|
|
|
18167
18110
|
// Polyfill Number.isNaN(value)
|
|
@@ -18331,9 +18274,10 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18331
18274
|
* @throws Error
|
|
18332
18275
|
* @param element
|
|
18333
18276
|
* @param options
|
|
18277
|
+
* @param onWidgetComplete
|
|
18334
18278
|
*/
|
|
18335
|
-
constructor(element, options) {
|
|
18336
|
-
super(element, options);
|
|
18279
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
18280
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
18337
18281
|
this.hasSubmitButton = Boolean(this.element.querySelector(".submit-button-view"));
|
|
18338
18282
|
this.topScale = this.element.querySelector(".top-scale-bar-view-group");
|
|
18339
18283
|
this.snapPosition = false;
|
|
@@ -18402,7 +18346,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18402
18346
|
this.displayAverageAnswer();
|
|
18403
18347
|
this.startReadyPromise.then(() => {
|
|
18404
18348
|
if (this.disableTimer) {
|
|
18405
|
-
this.
|
|
18349
|
+
this.onWidgetComplete();
|
|
18406
18350
|
}
|
|
18407
18351
|
});
|
|
18408
18352
|
}
|
|
@@ -18478,7 +18422,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18478
18422
|
}
|
|
18479
18423
|
});
|
|
18480
18424
|
// if (this.disableTimer) {
|
|
18481
|
-
this.
|
|
18425
|
+
this.onWidgetComplete();
|
|
18482
18426
|
// }
|
|
18483
18427
|
this.setLocalData(this.localData, true);
|
|
18484
18428
|
this._statEventInputSave(this.localData["_rs_g_" + this.elementId + "_v"]);
|
|
@@ -18775,17 +18719,9 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18775
18719
|
}
|
|
18776
18720
|
static api = {
|
|
18777
18721
|
widgetClassName: WidgetRangeSlider.widgetClassName,
|
|
18778
|
-
/** @deprecated */
|
|
18779
|
-
refreshUserData: WidgetRangeSlider.refreshUserData,
|
|
18780
18722
|
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
|
-
});
|
|
18723
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
18724
|
+
WidgetRangeSlider.initWidget(element, localData, (element, options) => new WidgetRangeSlider(element, options, onWidgetComplete, sdkApi));
|
|
18789
18725
|
},
|
|
18790
18726
|
onStart: function (element) {
|
|
18791
18727
|
WidgetRangeSlider.getInstance(element)?.onStart();
|
|
@@ -18814,7 +18750,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
18814
18750
|
return false;
|
|
18815
18751
|
},
|
|
18816
18752
|
};
|
|
18817
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
18753
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
18818
18754
|
}
|
|
18819
18755
|
|
|
18820
18756
|
class WidgetRate extends WidgetBase {
|
|
@@ -18837,8 +18773,8 @@ class WidgetRate extends WidgetBase {
|
|
|
18837
18773
|
selectedStar;
|
|
18838
18774
|
answerSelectDuration;
|
|
18839
18775
|
elementRect;
|
|
18840
|
-
constructor(element, options) {
|
|
18841
|
-
super(element, options);
|
|
18776
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
18777
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
18842
18778
|
this.label = this.element.querySelector(".label-view .label");
|
|
18843
18779
|
this.stars = slice.call(this.element.querySelectorAll(".input-view"));
|
|
18844
18780
|
this.submitToStores = Boolean(getValueOrDefault(getTagDataAsNumber(this.element, "submitToStores"), 0));
|
|
@@ -18913,7 +18849,7 @@ class WidgetRate extends WidgetBase {
|
|
|
18913
18849
|
this.element.classList.add("done");
|
|
18914
18850
|
this.startReadyPromise.then(() => {
|
|
18915
18851
|
if (this.disableTimer && runTimer) {
|
|
18916
|
-
this.
|
|
18852
|
+
this.onWidgetComplete();
|
|
18917
18853
|
}
|
|
18918
18854
|
});
|
|
18919
18855
|
}
|
|
@@ -19040,18 +18976,9 @@ class WidgetRate extends WidgetBase {
|
|
|
19040
18976
|
}
|
|
19041
18977
|
static api = {
|
|
19042
18978
|
widgetClassName: WidgetRate.widgetClassName,
|
|
19043
|
-
/** @deprecated */
|
|
19044
|
-
refreshUserData: WidgetRate.refreshUserData,
|
|
19045
18979
|
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
|
-
});
|
|
18980
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
18981
|
+
WidgetRate.initWidget(element, localData, (element, options) => new WidgetRate(element, options, onWidgetComplete, sdkApi));
|
|
19055
18982
|
},
|
|
19056
18983
|
onStart: function (element) {
|
|
19057
18984
|
WidgetRate.getInstance(element)?.onStart();
|
|
@@ -19080,7 +19007,7 @@ class WidgetRate extends WidgetBase {
|
|
|
19080
19007
|
WidgetRate.getInstanceById(id)?.setUserText(text);
|
|
19081
19008
|
},
|
|
19082
19009
|
};
|
|
19083
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19010
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
19084
19011
|
}
|
|
19085
19012
|
|
|
19086
19013
|
class WidgetShare extends WidgetBase {
|
|
@@ -19097,8 +19024,8 @@ class WidgetShare extends WidgetBase {
|
|
|
19097
19024
|
shareTarget;
|
|
19098
19025
|
withLayer;
|
|
19099
19026
|
btnDisabled;
|
|
19100
|
-
constructor(element, options) {
|
|
19101
|
-
super(element, options);
|
|
19027
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
19028
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
19102
19029
|
this.shareType = getTagData(this.element, "shareType");
|
|
19103
19030
|
this.shareTarget = getTagData(this.element, "shareTarget");
|
|
19104
19031
|
this.layers = this.options.layers;
|
|
@@ -19120,7 +19047,7 @@ class WidgetShare extends WidgetBase {
|
|
|
19120
19047
|
}
|
|
19121
19048
|
this.startReadyPromise.then(() => {
|
|
19122
19049
|
if (this.isDone() && this.disableTimer) {
|
|
19123
|
-
this.
|
|
19050
|
+
this.onWidgetComplete();
|
|
19124
19051
|
}
|
|
19125
19052
|
});
|
|
19126
19053
|
this.btnDisabled = false;
|
|
@@ -19180,7 +19107,7 @@ class WidgetShare extends WidgetBase {
|
|
|
19180
19107
|
this._showLayer(this.layers, 1, true);
|
|
19181
19108
|
}
|
|
19182
19109
|
if (this.disableTimer) {
|
|
19183
|
-
this.
|
|
19110
|
+
this.onWidgetComplete();
|
|
19184
19111
|
}
|
|
19185
19112
|
this.btnDisabled = false;
|
|
19186
19113
|
}
|
|
@@ -19189,31 +19116,12 @@ class WidgetShare extends WidgetBase {
|
|
|
19189
19116
|
}
|
|
19190
19117
|
static api = {
|
|
19191
19118
|
widgetClassName: WidgetShare.widgetClassName,
|
|
19192
|
-
/** @deprecated */
|
|
19193
|
-
refreshUserData: WidgetShare.refreshUserData,
|
|
19194
19119
|
onRefreshUserData: WidgetShare.onRefreshUserData,
|
|
19195
|
-
init: function (element, layers, localData) {
|
|
19120
|
+
init: function (element, layers, localData, onWidgetComplete, sdkApi) {
|
|
19196
19121
|
WidgetShare.initWidget(element, localData, (element, options) => new WidgetShare(element, {
|
|
19197
19122
|
...options,
|
|
19198
19123
|
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
|
-
});
|
|
19124
|
+
}, onWidgetComplete, sdkApi));
|
|
19217
19125
|
},
|
|
19218
19126
|
onStart: function (element) {
|
|
19219
19127
|
WidgetShare.getInstance(element)?.onStart();
|
|
@@ -19234,7 +19142,7 @@ class WidgetShare extends WidgetBase {
|
|
|
19234
19142
|
WidgetShare.getInstanceById(id)?._complete(isSuccess);
|
|
19235
19143
|
},
|
|
19236
19144
|
};
|
|
19237
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19145
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
19238
19146
|
}
|
|
19239
19147
|
|
|
19240
19148
|
class WidgetTest extends WidgetBase {
|
|
@@ -19259,8 +19167,8 @@ class WidgetTest extends WidgetBase {
|
|
|
19259
19167
|
timeLeftDefault;
|
|
19260
19168
|
timeline;
|
|
19261
19169
|
isWidgetTimerInit = false;
|
|
19262
|
-
constructor(element, options) {
|
|
19263
|
-
super(element, options);
|
|
19170
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
19171
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
19264
19172
|
this.label = this.element.querySelector(".label-view .label");
|
|
19265
19173
|
this.variants = slice.call(this.element.querySelectorAll(".variants-box .variant-view"));
|
|
19266
19174
|
this.testCount = getValueOrException(getTagDataAsNumber(this.slide, "testCount"), "Empty testCount");
|
|
@@ -19415,7 +19323,7 @@ class WidgetTest extends WidgetBase {
|
|
|
19415
19323
|
});
|
|
19416
19324
|
this.startReadyPromise.then(() => {
|
|
19417
19325
|
if (this.disableTimer) {
|
|
19418
|
-
this.
|
|
19326
|
+
this.onWidgetComplete();
|
|
19419
19327
|
}
|
|
19420
19328
|
});
|
|
19421
19329
|
}
|
|
@@ -19487,17 +19395,9 @@ class WidgetTest extends WidgetBase {
|
|
|
19487
19395
|
}
|
|
19488
19396
|
static api = {
|
|
19489
19397
|
widgetClassName: WidgetTest.widgetClassName,
|
|
19490
|
-
/** @deprecated */
|
|
19491
|
-
refreshUserData: WidgetTest.refreshUserData,
|
|
19492
19398
|
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
|
-
});
|
|
19399
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
19400
|
+
WidgetTest.initWidget(element, localData, (element, options) => new WidgetTest(element, options, onWidgetComplete, sdkApi));
|
|
19501
19401
|
},
|
|
19502
19402
|
onStart: function (element) {
|
|
19503
19403
|
WidgetTest.getInstance(element)?.onStart();
|
|
@@ -19533,7 +19433,7 @@ class WidgetTest extends WidgetBase {
|
|
|
19533
19433
|
return true;
|
|
19534
19434
|
},
|
|
19535
19435
|
};
|
|
19536
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19436
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
19537
19437
|
}
|
|
19538
19438
|
|
|
19539
19439
|
class WidgetVote extends WidgetBase {
|
|
@@ -19559,9 +19459,11 @@ class WidgetVote extends WidgetBase {
|
|
|
19559
19459
|
* @throws Error
|
|
19560
19460
|
* @param element
|
|
19561
19461
|
* @param options
|
|
19462
|
+
* @param onWidgetComplete
|
|
19463
|
+
* @param sdkApi
|
|
19562
19464
|
*/
|
|
19563
|
-
constructor(element, options) {
|
|
19564
|
-
super(element, options);
|
|
19465
|
+
constructor(element, options, onWidgetComplete, sdkApi) {
|
|
19466
|
+
super(element, options, onWidgetComplete, sdkApi);
|
|
19565
19467
|
this.voteAllocation = getTagData(this.slide, "voteAllocation");
|
|
19566
19468
|
this.label = this.element.querySelector(".label-view .label");
|
|
19567
19469
|
this.variants = slice.call(this.element.querySelectorAll(".variants-box .variant-view-group"));
|
|
@@ -19745,7 +19647,7 @@ class WidgetVote extends WidgetBase {
|
|
|
19745
19647
|
}
|
|
19746
19648
|
this.startReadyPromise.then(() => {
|
|
19747
19649
|
if (this.disableTimer) {
|
|
19748
|
-
this.
|
|
19650
|
+
this.onWidgetComplete();
|
|
19749
19651
|
}
|
|
19750
19652
|
});
|
|
19751
19653
|
}
|
|
@@ -19943,45 +19845,9 @@ class WidgetVote extends WidgetBase {
|
|
|
19943
19845
|
}
|
|
19944
19846
|
static api = {
|
|
19945
19847
|
widgetClassName: WidgetVote.widgetClassName,
|
|
19946
|
-
/** @deprecated */
|
|
19947
|
-
refreshUserData: WidgetVote.refreshUserData,
|
|
19948
19848
|
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
|
-
});
|
|
19849
|
+
init: function (element, localData, onWidgetComplete, sdkApi) {
|
|
19850
|
+
WidgetVote.initWidget(element, localData, (element, options) => new WidgetVote(element, options, onWidgetComplete, sdkApi));
|
|
19985
19851
|
},
|
|
19986
19852
|
onStart: function (element) {
|
|
19987
19853
|
WidgetVote.getInstance(element)?.onStart();
|
|
@@ -20017,7 +19883,7 @@ class WidgetVote extends WidgetBase {
|
|
|
20017
19883
|
return true;
|
|
20018
19884
|
},
|
|
20019
19885
|
};
|
|
20020
|
-
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`]; }
|
|
19886
|
+
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `OnWidgetComplete`, `SDKApi`]; }
|
|
20021
19887
|
}
|
|
20022
19888
|
|
|
20023
19889
|
class EsModuleLayoutApi {
|