@inappstory/slide-api 0.0.21 → 0.0.22
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 +322 -139
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -9
- package/dist/index.d.ts +56 -9
- package/dist/index.js +322 -139
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1202,6 +1202,8 @@ class WidgetBase {
|
|
|
1202
1202
|
localData = null;
|
|
1203
1203
|
firstOpenTime = 0;
|
|
1204
1204
|
id;
|
|
1205
|
+
startReadyPromise = null;
|
|
1206
|
+
startReadyResolve = null;
|
|
1205
1207
|
constructor(element, options, elementIdGetter, slideGetter) {
|
|
1206
1208
|
this.options = extend({}, this.constructor.DEFAULTS, options);
|
|
1207
1209
|
this.element = element;
|
|
@@ -1253,12 +1255,32 @@ class WidgetBase {
|
|
|
1253
1255
|
this.localData = extend({}, this.savedData ?? {}, this.options.localData ?? {});
|
|
1254
1256
|
this.id = `w_${this.elementId}_${WidgetBase.widgetIndex}`;
|
|
1255
1257
|
++WidgetBase.widgetIndex;
|
|
1258
|
+
this.resetStartReadyPromise();
|
|
1259
|
+
}
|
|
1260
|
+
resetStartReadyPromise() {
|
|
1261
|
+
this.startReadyPromise = new Promise(resolve => {
|
|
1262
|
+
this.startReadyResolve = resolve;
|
|
1263
|
+
});
|
|
1256
1264
|
}
|
|
1257
1265
|
/**
|
|
1258
1266
|
* Start or restart widget
|
|
1259
1267
|
* @param localData
|
|
1260
1268
|
*/
|
|
1261
|
-
onRefreshUserData(localData) {
|
|
1269
|
+
onRefreshUserData(localData) {
|
|
1270
|
+
this.savedData = this.sdkApi.getCardServerData(this.cardId);
|
|
1271
|
+
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
1272
|
+
}
|
|
1273
|
+
onStart() {
|
|
1274
|
+
// add active class for enable animation
|
|
1275
|
+
this.element.classList.add("active");
|
|
1276
|
+
this.startReadyResolve();
|
|
1277
|
+
}
|
|
1278
|
+
onStop() {
|
|
1279
|
+
this.element.classList.remove("active");
|
|
1280
|
+
this.resetStartReadyPromise();
|
|
1281
|
+
}
|
|
1282
|
+
onPause() { }
|
|
1283
|
+
onResume() { }
|
|
1262
1284
|
static widgetCacheKey = "ias.story-element";
|
|
1263
1285
|
static widgetClassName = "";
|
|
1264
1286
|
static getInstance(element) {
|
|
@@ -1412,7 +1434,7 @@ class WidgetBase {
|
|
|
1412
1434
|
startDisabledTimeline() {
|
|
1413
1435
|
this.sdkApi.startDisabledTimeline(this.cardId, this.slideIndex);
|
|
1414
1436
|
}
|
|
1415
|
-
|
|
1437
|
+
_showLayer(layers, selectIndex, withStatEvent = false) {
|
|
1416
1438
|
if (this.sdkApi.isExistsShowLayer()) {
|
|
1417
1439
|
this.sdkApi.showLayer(selectIndex);
|
|
1418
1440
|
}
|
|
@@ -1555,9 +1577,21 @@ class WidgetCopy extends WidgetBase {
|
|
|
1555
1577
|
* @param localData
|
|
1556
1578
|
*/
|
|
1557
1579
|
onRefreshUserData(localData) {
|
|
1558
|
-
|
|
1559
|
-
|
|
1580
|
+
super.onRefreshUserData(localData);
|
|
1581
|
+
// return DOM to init state (ready to copy)
|
|
1582
|
+
this.element.classList.remove("done");
|
|
1583
|
+
if (this.resultLayer) {
|
|
1584
|
+
this.resultLayer.classList.remove("done");
|
|
1585
|
+
}
|
|
1560
1586
|
this.state = null;
|
|
1587
|
+
if (this.isPromotionalCode) {
|
|
1588
|
+
this.initPromotionalCodeFromLocalData();
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
onStart() {
|
|
1592
|
+
super.onStart();
|
|
1593
|
+
// add active class for enable animation
|
|
1594
|
+
this.resultLayer?.classList.add("active");
|
|
1561
1595
|
if (this.isPromotionalCode) {
|
|
1562
1596
|
this.fetchPromoCode();
|
|
1563
1597
|
}
|
|
@@ -1581,16 +1615,22 @@ class WidgetCopy extends WidgetBase {
|
|
|
1581
1615
|
this.button.textContent = newText;
|
|
1582
1616
|
}
|
|
1583
1617
|
}
|
|
1584
|
-
|
|
1585
|
-
this.
|
|
1586
|
-
|
|
1618
|
+
getPromotionalCodeFromLocalData() {
|
|
1619
|
+
return this.localData["_cp_g_" + this.elementId + "_pc"];
|
|
1620
|
+
}
|
|
1621
|
+
initPromotionalCodeFromLocalData() {
|
|
1622
|
+
if (this.getPromotionalCodeFromLocalData() !== undefined) {
|
|
1587
1623
|
this.state = 1;
|
|
1588
|
-
this.clipboardTarget = this.
|
|
1624
|
+
this.clipboardTarget = this.getPromotionalCodeFromLocalData();
|
|
1589
1625
|
if (this.clipboardTarget != null) {
|
|
1590
1626
|
this.changeText(this.clipboardTarget);
|
|
1591
1627
|
}
|
|
1592
1628
|
removeClass(this.element, "loader");
|
|
1593
1629
|
}
|
|
1630
|
+
}
|
|
1631
|
+
fetchPromoCode() {
|
|
1632
|
+
this.state = 0;
|
|
1633
|
+
this.initPromotionalCodeFromLocalData();
|
|
1594
1634
|
if (this.state === 0) {
|
|
1595
1635
|
if (!this.isTransparentElement()) {
|
|
1596
1636
|
// for transparent element
|
|
@@ -1678,12 +1718,14 @@ class WidgetCopy extends WidgetBase {
|
|
|
1678
1718
|
if (this.resultLayer) {
|
|
1679
1719
|
this.resultLayer.classList.add("done");
|
|
1680
1720
|
}
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1721
|
+
this.startReadyPromise.then(() => {
|
|
1722
|
+
if (this.disableTimer) {
|
|
1723
|
+
// флаг - что таймер уже стартанул (в layout или добавить объект sharedMemory)
|
|
1724
|
+
// смотрим что прозрачный текст - тогда и лоадер прозрачный
|
|
1725
|
+
// _log("_showNarrativeNextSlide: " + getSlideDuration(this.narrativeId, this.slideIndex), true);
|
|
1726
|
+
this.startDisabledTimeline();
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1687
1729
|
}
|
|
1688
1730
|
copyToClipboard(element) {
|
|
1689
1731
|
this._select();
|
|
@@ -1717,6 +1759,13 @@ class WidgetCopy extends WidgetBase {
|
|
|
1717
1759
|
// prevent initWidget for result layer
|
|
1718
1760
|
const elements = slice.call(nodeList).filter(element => !element.classList.contains("narrative-element-copy-result-variant"));
|
|
1719
1761
|
WidgetCopy.initWidgets((element, options) => new WidgetCopy(element, options), elements, localData);
|
|
1762
|
+
elements.forEach(element => WidgetCopy.getInstance(element)?.onStart());
|
|
1763
|
+
},
|
|
1764
|
+
onStart: function (element) {
|
|
1765
|
+
WidgetCopy.getInstance(element)?.onStart();
|
|
1766
|
+
},
|
|
1767
|
+
onStop: function (element) {
|
|
1768
|
+
WidgetCopy.getInstance(element)?.onStop();
|
|
1720
1769
|
},
|
|
1721
1770
|
click: function (element) {
|
|
1722
1771
|
const widgetElement = element.closest(`.${WidgetCopy.widgetClassName}`);
|
|
@@ -1772,17 +1821,21 @@ class WidgetDataInput extends WidgetBase {
|
|
|
1772
1821
|
* @param localData
|
|
1773
1822
|
*/
|
|
1774
1823
|
onRefreshUserData(localData) {
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
const text = this.localData["_di_g_" + this.elementId + "_t"];
|
|
1824
|
+
super.onRefreshUserData(localData);
|
|
1825
|
+
const text = this.getTextFromLocalData();
|
|
1778
1826
|
this._fillUserText(text);
|
|
1779
|
-
if (text) {
|
|
1827
|
+
if (text != null) {
|
|
1780
1828
|
this.element.classList.add("done");
|
|
1781
|
-
|
|
1782
|
-
this.
|
|
1783
|
-
|
|
1829
|
+
this.startReadyPromise.then(() => {
|
|
1830
|
+
if (this.disableTimer) {
|
|
1831
|
+
this.startDisabledTimeline();
|
|
1832
|
+
}
|
|
1833
|
+
});
|
|
1784
1834
|
}
|
|
1785
1835
|
}
|
|
1836
|
+
getTextFromLocalData() {
|
|
1837
|
+
return this.localData["_di_g_" + this.elementId + "_t"];
|
|
1838
|
+
}
|
|
1786
1839
|
_statEventFocusIn() {
|
|
1787
1840
|
try {
|
|
1788
1841
|
const labelText = this.label ? this.label.textContent ?? "" : "";
|
|
@@ -1860,7 +1913,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
1860
1913
|
}
|
|
1861
1914
|
_fillUserText(text) {
|
|
1862
1915
|
if (this.inputElement && this.textElement) {
|
|
1863
|
-
if (text) {
|
|
1916
|
+
if (text != null) {
|
|
1864
1917
|
this.inputElement.classList.remove("_is-placeholder");
|
|
1865
1918
|
text = text.replace(new RegExp("\r?\n", "g"), "<br />");
|
|
1866
1919
|
this.textElement.innerHTML = text;
|
|
@@ -1910,7 +1963,15 @@ class WidgetDataInput extends WidgetBase {
|
|
|
1910
1963
|
},
|
|
1911
1964
|
/** @deprecated */
|
|
1912
1965
|
initWidget: function (nodeList, localData) {
|
|
1966
|
+
const elements = slice.call(nodeList);
|
|
1913
1967
|
WidgetDataInput.initWidgets((element, options) => new WidgetDataInput(element, options), slice.call(nodeList), localData);
|
|
1968
|
+
elements.forEach(element => WidgetDataInput.getInstance(element)?.onStart());
|
|
1969
|
+
},
|
|
1970
|
+
onStart: function (element) {
|
|
1971
|
+
WidgetDataInput.getInstance(element)?.onStart();
|
|
1972
|
+
},
|
|
1973
|
+
onStop: function (element) {
|
|
1974
|
+
WidgetDataInput.getInstance(element)?.onStop();
|
|
1914
1975
|
},
|
|
1915
1976
|
click: function (element) {
|
|
1916
1977
|
const widgetElement = element.closest(`.${WidgetDataInput.widgetClassName}`);
|
|
@@ -1941,7 +2002,7 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
1941
2002
|
label;
|
|
1942
2003
|
layers;
|
|
1943
2004
|
messages;
|
|
1944
|
-
|
|
2005
|
+
timestampMs;
|
|
1945
2006
|
diff;
|
|
1946
2007
|
timerInit;
|
|
1947
2008
|
pendingUpdate;
|
|
@@ -1963,58 +2024,56 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
1963
2024
|
minutes: getTagData(this.element, "tMinutes") ?? "",
|
|
1964
2025
|
seconds: getTagData(this.element, "tSeconds") ?? "",
|
|
1965
2026
|
};
|
|
1966
|
-
this.
|
|
2027
|
+
this.timestampMs = getValueOrException(getTagDataAsNumber(this.element, "timestampSeconds"), "Empty timestampSeconds") * 1000;
|
|
1967
2028
|
this.diff = 0;
|
|
1968
2029
|
this.timerInit = false;
|
|
1969
2030
|
this.pendingUpdate = true;
|
|
1970
2031
|
this.layers = this.options.layers;
|
|
1971
|
-
// if (false) {
|
|
1972
|
-
// // if (sendApiRequestSupported()) {
|
|
1973
|
-
// // fetch project time
|
|
1974
|
-
// var path = "story/" + this.storyId + "/widget/" + this.elementId + "/timestamp";
|
|
1975
|
-
// var profileKey = "fetch-story-timestamp";
|
|
1976
|
-
// this.sdkApi
|
|
1977
|
-
// .sendApiRequest<{ timestamp: number }>(path, "GET", null, null, null, profileKey)
|
|
1978
|
-
// .then(response => {
|
|
1979
|
-
// var status = response.status;
|
|
1980
|
-
// var timestamp = null;
|
|
1981
|
-
// if (status === 200) {
|
|
1982
|
-
// if (response.data) timestamp = response.data.timestamp;
|
|
1983
|
-
// if (timestamp) {
|
|
1984
|
-
// this.diff = new Date().getTime() - timestamp * 1000;
|
|
1985
|
-
// }
|
|
1986
|
-
// }
|
|
1987
|
-
//
|
|
1988
|
-
// this.initTimer();
|
|
1989
|
-
// })
|
|
1990
|
-
// .catch( (reason)=> {
|
|
1991
|
-
// console.error(reason);
|
|
1992
|
-
// this.initTimer();
|
|
1993
|
-
// });
|
|
1994
|
-
// } else {
|
|
1995
|
-
this.initTimer();
|
|
1996
|
-
// }
|
|
1997
2032
|
}
|
|
1998
2033
|
/**
|
|
1999
2034
|
* Start or restart widget
|
|
2000
2035
|
* @param localData
|
|
2001
2036
|
*/
|
|
2002
2037
|
onRefreshUserData(localData) {
|
|
2003
|
-
|
|
2004
|
-
this.
|
|
2038
|
+
super.onRefreshUserData(localData);
|
|
2039
|
+
const value = this.timestampMs - (new Date().getTime() - this.diff);
|
|
2040
|
+
if (value > 0) {
|
|
2041
|
+
this._showLayer(this.layers, 0);
|
|
2042
|
+
}
|
|
2043
|
+
else {
|
|
2044
|
+
this._showLayer(this.layers, 1);
|
|
2045
|
+
}
|
|
2005
2046
|
}
|
|
2006
|
-
|
|
2047
|
+
onPause() {
|
|
2048
|
+
super.onPause();
|
|
2007
2049
|
if (this.timerInit) {
|
|
2008
2050
|
this.pendingUpdate = false;
|
|
2009
2051
|
}
|
|
2010
2052
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2053
|
+
onResume() {
|
|
2054
|
+
super.onResume();
|
|
2055
|
+
if (this.timerInit && !this.pendingUpdate) {
|
|
2013
2056
|
this.pendingUpdate = true;
|
|
2014
2057
|
this.updateTimer();
|
|
2015
2058
|
}
|
|
2016
2059
|
}
|
|
2060
|
+
onStart() {
|
|
2061
|
+
super.onStart();
|
|
2062
|
+
if (!this.timerInit) {
|
|
2063
|
+
this.initTimer();
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
onStop() {
|
|
2067
|
+
super.onStop();
|
|
2068
|
+
if (this.timerInit) {
|
|
2069
|
+
this.pendingUpdate = false;
|
|
2070
|
+
this.timerInit = false;
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2017
2073
|
initTimer() {
|
|
2074
|
+
if (this.timerInit) {
|
|
2075
|
+
return;
|
|
2076
|
+
}
|
|
2018
2077
|
// find groups
|
|
2019
2078
|
this.firstGroup1 = getValueOrException(this.element.querySelector(".date-item-view-group-1 .date-output-label-1"), "Empty firstGroup1");
|
|
2020
2079
|
this.firstGroup2 = getValueOrException(this.element.querySelector(".date-item-view-group-1 .date-output-label-2"), "Empty firstGroup2");
|
|
@@ -2025,16 +2084,18 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
2025
2084
|
this.thirdGroup1 = getValueOrException(this.element.querySelector(".date-item-view-group-3 .date-output-label-1"), "Empty thirdGroup1");
|
|
2026
2085
|
this.thirdGroup2 = getValueOrException(this.element.querySelector(".date-item-view-group-3 .date-output-label-2"), "Empty thirdGroup2");
|
|
2027
2086
|
this.thirdGroupCaption = getValueOrException(this.element.querySelector(".date-item-view-group-3 .date-item-caption"), "Empty thirdGroupCaption");
|
|
2028
|
-
this.timestampSeconds *= 1000;
|
|
2029
2087
|
this.timerInit = true;
|
|
2030
|
-
const value = this.
|
|
2088
|
+
const value = this.timestampMs - (new Date().getTime() - this.diff);
|
|
2031
2089
|
if (value > 0) {
|
|
2032
|
-
this.
|
|
2090
|
+
this._showLayer(this.layers, 0);
|
|
2033
2091
|
}
|
|
2034
2092
|
this.updateTimer();
|
|
2035
2093
|
}
|
|
2036
2094
|
updateTimer() {
|
|
2037
|
-
|
|
2095
|
+
if (!this.timerInit) {
|
|
2096
|
+
return;
|
|
2097
|
+
}
|
|
2098
|
+
const value = this.timestampMs - (new Date().getTime() - this.diff);
|
|
2038
2099
|
if (value > 0) {
|
|
2039
2100
|
const result = this._asDuration(Math.round(value / 1000));
|
|
2040
2101
|
if (result.days) {
|
|
@@ -2063,7 +2124,7 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
2063
2124
|
}
|
|
2064
2125
|
else {
|
|
2065
2126
|
this.pendingUpdate = false;
|
|
2066
|
-
this.
|
|
2127
|
+
this._showLayer(this.layers, 1);
|
|
2067
2128
|
}
|
|
2068
2129
|
if (this.pendingUpdate) {
|
|
2069
2130
|
this.env.requestAnimationFrame(() => this.updateTimer());
|
|
@@ -2136,24 +2197,32 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
2136
2197
|
},
|
|
2137
2198
|
/** @deprecated */
|
|
2138
2199
|
initWidget: function (nodeList, layers, localData) {
|
|
2139
|
-
|
|
2200
|
+
const elements = slice.call(nodeList);
|
|
2201
|
+
WidgetDateCountdown.initWidgets((element, options) => new WidgetDateCountdown(element, { ...options, layers }), elements, localData);
|
|
2202
|
+
elements.forEach(element => WidgetDateCountdown.getInstance(element)?.onStart());
|
|
2203
|
+
},
|
|
2204
|
+
onStart: function (element) {
|
|
2205
|
+
WidgetDateCountdown.getInstance(element)?.onStart();
|
|
2206
|
+
},
|
|
2207
|
+
onStop: function (element) {
|
|
2208
|
+
WidgetDateCountdown.getInstance(element)?.onStop();
|
|
2140
2209
|
},
|
|
2141
2210
|
onPause: function (element) {
|
|
2142
|
-
WidgetDateCountdown.getInstance(element)?.
|
|
2211
|
+
WidgetDateCountdown.getInstance(element)?.onPause();
|
|
2143
2212
|
},
|
|
2144
2213
|
onResume: function (element) {
|
|
2145
|
-
WidgetDateCountdown.getInstance(element)?.
|
|
2214
|
+
WidgetDateCountdown.getInstance(element)?.onResume();
|
|
2146
2215
|
},
|
|
2147
2216
|
/** @deprecated */
|
|
2148
2217
|
pause: function (nodeList) {
|
|
2149
2218
|
forEach(slice.call(nodeList), function (el, index) {
|
|
2150
|
-
WidgetDateCountdown.getInstance(el)?.
|
|
2219
|
+
WidgetDateCountdown.getInstance(el)?.onPause();
|
|
2151
2220
|
});
|
|
2152
2221
|
},
|
|
2153
2222
|
/** @deprecated */
|
|
2154
2223
|
resume: function (nodeList) {
|
|
2155
2224
|
forEach(slice.call(nodeList), function (el, index) {
|
|
2156
|
-
WidgetDateCountdown.getInstance(el)?.
|
|
2225
|
+
WidgetDateCountdown.getInstance(el)?.onResume();
|
|
2157
2226
|
});
|
|
2158
2227
|
},
|
|
2159
2228
|
};
|
|
@@ -2345,8 +2414,7 @@ class WidgetPoll extends WidgetBase {
|
|
|
2345
2414
|
* @param localData
|
|
2346
2415
|
*/
|
|
2347
2416
|
onRefreshUserData(localData) {
|
|
2348
|
-
|
|
2349
|
-
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
2417
|
+
super.onRefreshUserData(localData);
|
|
2350
2418
|
this.selectedVariant = undefined;
|
|
2351
2419
|
if (this.localData) {
|
|
2352
2420
|
if (this.localData["_p_g_" + this.elementId + "_sa"] !== undefined) {
|
|
@@ -2429,14 +2497,11 @@ class WidgetPoll extends WidgetBase {
|
|
|
2429
2497
|
this.element.classList.add("with-total-result");
|
|
2430
2498
|
this.displayPercents(index, filled);
|
|
2431
2499
|
}
|
|
2432
|
-
|
|
2433
|
-
this.
|
|
2434
|
-
// todo poll - если виджет на первом слайде то при повторном заходе автоматически не стартует таймлайн слайда
|
|
2435
|
-
// только в web sdk такое
|
|
2436
|
-
// если поставить через setTimeout то все ок
|
|
2500
|
+
this.startReadyPromise.then(() => {
|
|
2501
|
+
if (this.disableTimer) {
|
|
2437
2502
|
this.startDisabledTimeline();
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
2503
|
+
}
|
|
2504
|
+
});
|
|
2440
2505
|
}
|
|
2441
2506
|
_clearVariantSelection() {
|
|
2442
2507
|
forEach(this.variants, function (variant) {
|
|
@@ -2783,6 +2848,13 @@ class WidgetPoll extends WidgetBase {
|
|
|
2783
2848
|
/** @deprecated */
|
|
2784
2849
|
initWidget: function (element, localData) {
|
|
2785
2850
|
WidgetPoll.initWidgets((element, options) => new WidgetPoll(element, options), [element], localData);
|
|
2851
|
+
WidgetPoll.getInstance(element)?.onStart();
|
|
2852
|
+
},
|
|
2853
|
+
onStart: function (element) {
|
|
2854
|
+
WidgetPoll.getInstance(element)?.onStart();
|
|
2855
|
+
},
|
|
2856
|
+
onStop: function (element) {
|
|
2857
|
+
WidgetPoll.getInstance(element)?.onStop();
|
|
2786
2858
|
},
|
|
2787
2859
|
/**
|
|
2788
2860
|
* click
|
|
@@ -2857,14 +2929,13 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
2857
2929
|
* @param localData
|
|
2858
2930
|
*/
|
|
2859
2931
|
onRefreshUserData(localData) {
|
|
2860
|
-
|
|
2861
|
-
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
2932
|
+
super.onRefreshUserData(localData);
|
|
2862
2933
|
this.selectedVariant = undefined;
|
|
2863
2934
|
if (this.slidePollIsDone()) {
|
|
2864
2935
|
this._selectVariant(this.localData["_pl_g_" + this.elementId + "_sa"]);
|
|
2865
2936
|
}
|
|
2866
2937
|
else {
|
|
2867
|
-
this.
|
|
2938
|
+
this._showLayer(this.layers, 0);
|
|
2868
2939
|
}
|
|
2869
2940
|
this.firstOpenTime = new Date().getTime();
|
|
2870
2941
|
}
|
|
@@ -2910,10 +2981,12 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
2910
2981
|
else if (index === 1) {
|
|
2911
2982
|
layerIndex = 2;
|
|
2912
2983
|
}
|
|
2913
|
-
this.
|
|
2914
|
-
|
|
2915
|
-
this.
|
|
2916
|
-
|
|
2984
|
+
this._showLayer(this.layers, layerIndex, userAction);
|
|
2985
|
+
this.startReadyPromise.then(() => {
|
|
2986
|
+
if (this.disableTimer) {
|
|
2987
|
+
this.startDisabledTimeline();
|
|
2988
|
+
}
|
|
2989
|
+
});
|
|
2917
2990
|
}
|
|
2918
2991
|
selectVariant(variant) {
|
|
2919
2992
|
if (this.selectedVariant !== undefined) {
|
|
@@ -2970,6 +3043,13 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
2970
3043
|
localData = undefined;
|
|
2971
3044
|
}
|
|
2972
3045
|
WidgetPollLayers.initWidgets((element, options) => new WidgetPollLayers(element, { ...options, layers }), [element], localData);
|
|
3046
|
+
WidgetPollLayers.getInstance(element)?.onStart();
|
|
3047
|
+
},
|
|
3048
|
+
onStart: function (element) {
|
|
3049
|
+
WidgetPollLayers.getInstance(element)?.onStart();
|
|
3050
|
+
},
|
|
3051
|
+
onStop: function (element) {
|
|
3052
|
+
WidgetPollLayers.getInstance(element)?.onStop();
|
|
2973
3053
|
},
|
|
2974
3054
|
/**
|
|
2975
3055
|
* click on poll variant
|
|
@@ -3023,8 +3103,7 @@ class WidgetQuest extends WidgetBase {
|
|
|
3023
3103
|
* @param localData
|
|
3024
3104
|
*/
|
|
3025
3105
|
onRefreshUserData(localData) {
|
|
3026
|
-
|
|
3027
|
-
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
3106
|
+
super.onRefreshUserData(localData);
|
|
3028
3107
|
}
|
|
3029
3108
|
setCardSessionValue(name, value) {
|
|
3030
3109
|
this.sdkApi.setCardSessionValue(this.element, name, value);
|
|
@@ -3277,8 +3356,15 @@ class WidgetQuest extends WidgetBase {
|
|
|
3277
3356
|
resolve(true);
|
|
3278
3357
|
}
|
|
3279
3358
|
});
|
|
3359
|
+
WidgetQuest.getInstance(element)?.onStart();
|
|
3280
3360
|
});
|
|
3281
3361
|
},
|
|
3362
|
+
onStart: function (element) {
|
|
3363
|
+
WidgetQuest.getInstance(element)?.onStart();
|
|
3364
|
+
},
|
|
3365
|
+
onStop: function (element) {
|
|
3366
|
+
WidgetQuest.getInstance(element)?.onStop();
|
|
3367
|
+
},
|
|
3282
3368
|
select: function (element) {
|
|
3283
3369
|
const widgetElement = element.closest(`.${WidgetQuest.widgetClassName}`);
|
|
3284
3370
|
if (widgetElement) {
|
|
@@ -3329,8 +3415,7 @@ class WidgetQuiz extends WidgetBase {
|
|
|
3329
3415
|
* @param localData
|
|
3330
3416
|
*/
|
|
3331
3417
|
onRefreshUserData(localData) {
|
|
3332
|
-
|
|
3333
|
-
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
3418
|
+
super.onRefreshUserData(localData);
|
|
3334
3419
|
this.selectedAnswer = undefined;
|
|
3335
3420
|
if (this.localData) {
|
|
3336
3421
|
if (this.localData["_q_g_" + this.elementId + "_sa"] !== undefined) {
|
|
@@ -3373,9 +3458,11 @@ class WidgetQuiz extends WidgetBase {
|
|
|
3373
3458
|
// })
|
|
3374
3459
|
// })
|
|
3375
3460
|
// }
|
|
3376
|
-
|
|
3377
|
-
this.
|
|
3378
|
-
|
|
3461
|
+
this.startReadyPromise.then(() => {
|
|
3462
|
+
if (this.disableTimer) {
|
|
3463
|
+
this.startDisabledTimeline();
|
|
3464
|
+
}
|
|
3465
|
+
});
|
|
3379
3466
|
}
|
|
3380
3467
|
_clearAnswerSelection() {
|
|
3381
3468
|
forEach(this.answers, function (answer) {
|
|
@@ -3474,6 +3561,13 @@ class WidgetQuiz extends WidgetBase {
|
|
|
3474
3561
|
/** @deprecated */
|
|
3475
3562
|
initWidget: function (element, localData) {
|
|
3476
3563
|
WidgetQuiz.initWidgets((element, options) => new WidgetQuiz(element, options), [element], localData);
|
|
3564
|
+
WidgetQuiz.getInstance(element)?.onStart();
|
|
3565
|
+
},
|
|
3566
|
+
onStart: function (element) {
|
|
3567
|
+
WidgetQuiz.getInstance(element)?.onStart();
|
|
3568
|
+
},
|
|
3569
|
+
onStop: function (element) {
|
|
3570
|
+
WidgetQuiz.getInstance(element)?.onStop();
|
|
3477
3571
|
},
|
|
3478
3572
|
/**
|
|
3479
3573
|
* click on quiz answer
|
|
@@ -3527,8 +3621,7 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
3527
3621
|
* @param localData
|
|
3528
3622
|
*/
|
|
3529
3623
|
onRefreshUserData(localData) {
|
|
3530
|
-
|
|
3531
|
-
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
3624
|
+
super.onRefreshUserData(localData);
|
|
3532
3625
|
this.selectedAnswer = undefined;
|
|
3533
3626
|
if (this.localData) {
|
|
3534
3627
|
if (this.localData["_q_gg_" + this.elementId + "_sa"] !== undefined) {
|
|
@@ -3558,9 +3651,11 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
3558
3651
|
this.submitButtonAnimatedView.style.maxHeight = this.submitButtonViewHeight + "px";
|
|
3559
3652
|
}
|
|
3560
3653
|
});
|
|
3561
|
-
|
|
3562
|
-
this.
|
|
3563
|
-
|
|
3654
|
+
this.startReadyPromise.then(() => {
|
|
3655
|
+
if (this.disableTimer) {
|
|
3656
|
+
this.startDisabledTimeline();
|
|
3657
|
+
}
|
|
3658
|
+
});
|
|
3564
3659
|
}
|
|
3565
3660
|
_clearAnswerSelection() {
|
|
3566
3661
|
forEach(this.answers, function (answer) {
|
|
@@ -3676,6 +3771,13 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
3676
3771
|
/** @deprecated */
|
|
3677
3772
|
initWidget: function (element, localData) {
|
|
3678
3773
|
WidgetQuizGrouped.initWidgets((element, options) => new WidgetQuizGrouped(element, options), [element], localData);
|
|
3774
|
+
WidgetQuizGrouped.getInstance(element)?.onStart();
|
|
3775
|
+
},
|
|
3776
|
+
onStart: function (element) {
|
|
3777
|
+
WidgetQuizGrouped.getInstance(element)?.onStart();
|
|
3778
|
+
},
|
|
3779
|
+
onStop: function (element) {
|
|
3780
|
+
WidgetQuizGrouped.getInstance(element)?.onStop();
|
|
3679
3781
|
},
|
|
3680
3782
|
/**
|
|
3681
3783
|
* click on quiz answer
|
|
@@ -3921,15 +4023,16 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
3921
4023
|
* @param localData
|
|
3922
4024
|
*/
|
|
3923
4025
|
onRefreshUserData(localData) {
|
|
3924
|
-
|
|
3925
|
-
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
4026
|
+
super.onRefreshUserData(localData);
|
|
3926
4027
|
if (this.localData["_rs_g_" + this.elementId + "_v"] !== undefined) {
|
|
3927
4028
|
this.elementSlider.value = String(tryParseFloat(this.localData["_rs_g_" + this.elementId + "_v"], 0));
|
|
3928
4029
|
this.element.classList.add("done");
|
|
3929
4030
|
this.displayAverageAnswer();
|
|
3930
|
-
|
|
3931
|
-
this.
|
|
3932
|
-
|
|
4031
|
+
this.startReadyPromise.then(() => {
|
|
4032
|
+
if (this.disableTimer) {
|
|
4033
|
+
this.startDisabledTimeline();
|
|
4034
|
+
}
|
|
4035
|
+
});
|
|
3933
4036
|
}
|
|
3934
4037
|
else {
|
|
3935
4038
|
this.elementSlider.value = String(this.startValue);
|
|
@@ -3938,6 +4041,10 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
3938
4041
|
}
|
|
3939
4042
|
this.init();
|
|
3940
4043
|
}
|
|
4044
|
+
onStop() {
|
|
4045
|
+
super.onStop();
|
|
4046
|
+
this.destroy();
|
|
4047
|
+
}
|
|
3941
4048
|
_statEventInputSave(val) {
|
|
3942
4049
|
try {
|
|
3943
4050
|
const labelText = this.label?.textContent ?? "";
|
|
@@ -4289,11 +4396,18 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
4289
4396
|
onRefreshUserData: WidgetRangeSlider.onRefreshUserData,
|
|
4290
4397
|
init: function (element, localData) {
|
|
4291
4398
|
WidgetRangeSlider.initWidget(element, localData, (element, options) => new WidgetRangeSlider(element, options));
|
|
4399
|
+
WidgetRangeSlider.getInstance(element)?.onStart();
|
|
4292
4400
|
},
|
|
4293
4401
|
/** @deprecated */
|
|
4294
4402
|
initWidget: function (element, localData) {
|
|
4295
4403
|
WidgetRangeSlider.initWidgets((element, options) => new WidgetRangeSlider(element, options), [element], localData);
|
|
4296
4404
|
},
|
|
4405
|
+
onStart: function (element) {
|
|
4406
|
+
WidgetRangeSlider.getInstance(element)?.onStart();
|
|
4407
|
+
},
|
|
4408
|
+
onStop: function (element) {
|
|
4409
|
+
WidgetRangeSlider.getInstance(element)?.onStop();
|
|
4410
|
+
},
|
|
4297
4411
|
click: function (element) {
|
|
4298
4412
|
const widgetElement = element.closest(`.${WidgetRangeSlider.widgetClassName}`);
|
|
4299
4413
|
if (widgetElement) {
|
|
@@ -4354,8 +4468,7 @@ class WidgetRate extends WidgetBase {
|
|
|
4354
4468
|
* @param localData
|
|
4355
4469
|
*/
|
|
4356
4470
|
onRefreshUserData(localData) {
|
|
4357
|
-
|
|
4358
|
-
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
4471
|
+
super.onRefreshUserData(localData);
|
|
4359
4472
|
this.selectedStar = undefined;
|
|
4360
4473
|
if (this.localData) {
|
|
4361
4474
|
if (this.localData["_r_g_" + this.elementId + "_ss"] !== undefined) {
|
|
@@ -4413,9 +4526,11 @@ class WidgetRate extends WidgetBase {
|
|
|
4413
4526
|
this.selectedStar = value;
|
|
4414
4527
|
this.localData["_r_g_" + this.elementId + "_ss"] = value;
|
|
4415
4528
|
this.element.classList.add("done");
|
|
4416
|
-
|
|
4417
|
-
this.
|
|
4418
|
-
|
|
4529
|
+
this.startReadyPromise.then(() => {
|
|
4530
|
+
if (this.disableTimer && runTimer) {
|
|
4531
|
+
this.startDisabledTimeline();
|
|
4532
|
+
}
|
|
4533
|
+
});
|
|
4419
4534
|
}
|
|
4420
4535
|
_clearSelectedStar() {
|
|
4421
4536
|
forEach(this.stars, function (element) {
|
|
@@ -4548,7 +4663,15 @@ class WidgetRate extends WidgetBase {
|
|
|
4548
4663
|
},
|
|
4549
4664
|
/** @deprecated */
|
|
4550
4665
|
initWidget: function (nodeList, localData) {
|
|
4551
|
-
|
|
4666
|
+
const elements = slice.call(nodeList);
|
|
4667
|
+
WidgetRate.initWidgets((element, options) => new WidgetRate(element, options), elements, localData);
|
|
4668
|
+
elements.forEach(element => WidgetRate.getInstance(element)?.onStart());
|
|
4669
|
+
},
|
|
4670
|
+
onStart: function (element) {
|
|
4671
|
+
WidgetRate.getInstance(element)?.onStart();
|
|
4672
|
+
},
|
|
4673
|
+
onStop: function (element) {
|
|
4674
|
+
WidgetRate.getInstance(element)?.onStop();
|
|
4552
4675
|
},
|
|
4553
4676
|
select: function (element) {
|
|
4554
4677
|
const widgetElement = element.closest(`.${WidgetRate.widgetClassName}`);
|
|
@@ -4600,19 +4723,20 @@ class WidgetShare extends WidgetBase {
|
|
|
4600
4723
|
* @param localData
|
|
4601
4724
|
*/
|
|
4602
4725
|
onRefreshUserData(localData) {
|
|
4603
|
-
|
|
4604
|
-
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
4726
|
+
super.onRefreshUserData(localData);
|
|
4605
4727
|
if (this.withLayer) {
|
|
4606
4728
|
if (this.isDone()) {
|
|
4607
|
-
this.
|
|
4729
|
+
this._showLayer(this.layers, 1);
|
|
4608
4730
|
}
|
|
4609
4731
|
else {
|
|
4610
|
-
this.
|
|
4732
|
+
this._showLayer(this.layers, 0);
|
|
4611
4733
|
}
|
|
4612
4734
|
}
|
|
4613
|
-
|
|
4614
|
-
this.
|
|
4615
|
-
|
|
4735
|
+
this.startReadyPromise.then(() => {
|
|
4736
|
+
if (this.isDone() && this.disableTimer) {
|
|
4737
|
+
this.startDisabledTimeline();
|
|
4738
|
+
}
|
|
4739
|
+
});
|
|
4616
4740
|
this.btnDisabled = false;
|
|
4617
4741
|
}
|
|
4618
4742
|
_statEventShare(result, via) {
|
|
@@ -4667,7 +4791,7 @@ class WidgetShare extends WidgetBase {
|
|
|
4667
4791
|
}
|
|
4668
4792
|
this._statEventShare(isSuccess, null);
|
|
4669
4793
|
if (isSuccess && this.withLayer) {
|
|
4670
|
-
this.
|
|
4794
|
+
this._showLayer(this.layers, 1, true);
|
|
4671
4795
|
}
|
|
4672
4796
|
if (this.disableTimer) {
|
|
4673
4797
|
this.startDisabledTimeline();
|
|
@@ -4683,7 +4807,10 @@ class WidgetShare extends WidgetBase {
|
|
|
4683
4807
|
refreshUserData: WidgetShare.refreshUserData,
|
|
4684
4808
|
onRefreshUserData: WidgetShare.onRefreshUserData,
|
|
4685
4809
|
init: function (element, layers, localData) {
|
|
4686
|
-
WidgetShare.initWidget(element, localData, (element, options) => new WidgetShare(element, {
|
|
4810
|
+
WidgetShare.initWidget(element, localData, (element, options) => new WidgetShare(element, {
|
|
4811
|
+
...options,
|
|
4812
|
+
layers,
|
|
4813
|
+
}));
|
|
4687
4814
|
},
|
|
4688
4815
|
/** @deprecated
|
|
4689
4816
|
* signature variants
|
|
@@ -4697,7 +4824,15 @@ class WidgetShare extends WidgetBase {
|
|
|
4697
4824
|
layers = localData;
|
|
4698
4825
|
localData = undefined;
|
|
4699
4826
|
}
|
|
4700
|
-
|
|
4827
|
+
const elements = slice.call(nodeList);
|
|
4828
|
+
WidgetShare.initWidgets((element, options) => new WidgetShare(element, { ...options, layers }), elements, localData);
|
|
4829
|
+
elements.forEach(element => WidgetShare.getInstance(element)?.onStart());
|
|
4830
|
+
},
|
|
4831
|
+
onStart: function (element) {
|
|
4832
|
+
WidgetShare.getInstance(element)?.onStart();
|
|
4833
|
+
},
|
|
4834
|
+
onStop: function (element) {
|
|
4835
|
+
WidgetShare.getInstance(element)?.onStop();
|
|
4701
4836
|
},
|
|
4702
4837
|
click: function (element) {
|
|
4703
4838
|
const widgetElement = element.closest(`.${WidgetShare.widgetClassName}`);
|
|
@@ -4777,8 +4912,7 @@ class WidgetTest extends WidgetBase {
|
|
|
4777
4912
|
* @param localData
|
|
4778
4913
|
*/
|
|
4779
4914
|
onRefreshUserData(localData) {
|
|
4780
|
-
|
|
4781
|
-
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
4915
|
+
super.onRefreshUserData(localData);
|
|
4782
4916
|
this.selectedAnswer = undefined;
|
|
4783
4917
|
if (this.localData) {
|
|
4784
4918
|
if (this.localData["_t_g_" + this.elementId + "_sa"] !== undefined) {
|
|
@@ -4802,7 +4936,9 @@ class WidgetTest extends WidgetBase {
|
|
|
4802
4936
|
this.timeLeft = this.timeLeftDefault;
|
|
4803
4937
|
this.animationFrameId = null;
|
|
4804
4938
|
this.startTimerAt = new Date().getTime();
|
|
4805
|
-
this.
|
|
4939
|
+
this.startReadyPromise.then(() => {
|
|
4940
|
+
this.tick();
|
|
4941
|
+
});
|
|
4806
4942
|
// set answer - unanswered (for close and run again)
|
|
4807
4943
|
this.localData["_t_g_" + this.elementId + "_sa"] = -1;
|
|
4808
4944
|
this.setLocalData(this.localData, true);
|
|
@@ -4822,6 +4958,15 @@ class WidgetTest extends WidgetBase {
|
|
|
4822
4958
|
}
|
|
4823
4959
|
}
|
|
4824
4960
|
}
|
|
4961
|
+
onStart() {
|
|
4962
|
+
super.onStart();
|
|
4963
|
+
}
|
|
4964
|
+
onStop() {
|
|
4965
|
+
super.onStop();
|
|
4966
|
+
if (this.slideTestWithTimer()) {
|
|
4967
|
+
this.cancelTick();
|
|
4968
|
+
}
|
|
4969
|
+
}
|
|
4825
4970
|
_statEventVoteAnswer(answerScore) {
|
|
4826
4971
|
try {
|
|
4827
4972
|
if (this.selectedAnswer != null) {
|
|
@@ -4869,9 +5014,11 @@ class WidgetTest extends WidgetBase {
|
|
|
4869
5014
|
this.submitButtonAnimatedView.style.maxHeight = this.submitButtonViewHeight + "px";
|
|
4870
5015
|
}
|
|
4871
5016
|
});
|
|
4872
|
-
|
|
4873
|
-
this.
|
|
4874
|
-
|
|
5017
|
+
this.startReadyPromise.then(() => {
|
|
5018
|
+
if (this.disableTimer) {
|
|
5019
|
+
this.startDisabledTimeline();
|
|
5020
|
+
}
|
|
5021
|
+
});
|
|
4875
5022
|
}
|
|
4876
5023
|
selectAnswer(answer) {
|
|
4877
5024
|
if (this.selectedAnswer !== undefined) {
|
|
@@ -4950,6 +5097,13 @@ class WidgetTest extends WidgetBase {
|
|
|
4950
5097
|
/** @deprecated */
|
|
4951
5098
|
initWidget: function (element, localData) {
|
|
4952
5099
|
WidgetTest.initWidgets((element, options) => new WidgetTest(element, options), [element], localData);
|
|
5100
|
+
WidgetTest.getInstance(element)?.onStart();
|
|
5101
|
+
},
|
|
5102
|
+
onStart: function (element) {
|
|
5103
|
+
WidgetTest.getInstance(element)?.onStart();
|
|
5104
|
+
},
|
|
5105
|
+
onStop: function (element) {
|
|
5106
|
+
WidgetTest.getInstance(element)?.onStop();
|
|
4953
5107
|
},
|
|
4954
5108
|
/**
|
|
4955
5109
|
* click on quiz answer
|
|
@@ -5059,8 +5213,7 @@ class WidgetVote extends WidgetBase {
|
|
|
5059
5213
|
* @param localData
|
|
5060
5214
|
*/
|
|
5061
5215
|
onRefreshUserData(localData) {
|
|
5062
|
-
|
|
5063
|
-
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
5216
|
+
super.onRefreshUserData(localData);
|
|
5064
5217
|
this.selectedVariant = undefined;
|
|
5065
5218
|
if (this.localData) {
|
|
5066
5219
|
if (this.localData["_v_g_" + this.elementId + "_sa"] != null) {
|
|
@@ -5190,9 +5343,11 @@ class WidgetVote extends WidgetBase {
|
|
|
5190
5343
|
this._removeInputDone();
|
|
5191
5344
|
this._hideSubmitBtn();
|
|
5192
5345
|
}
|
|
5193
|
-
|
|
5194
|
-
this.
|
|
5195
|
-
|
|
5346
|
+
this.startReadyPromise.then(() => {
|
|
5347
|
+
if (this.disableTimer) {
|
|
5348
|
+
this.startDisabledTimeline();
|
|
5349
|
+
}
|
|
5350
|
+
});
|
|
5196
5351
|
}
|
|
5197
5352
|
_showSubmitBtn() {
|
|
5198
5353
|
this.env.requestAnimationFrame(() => {
|
|
@@ -5423,6 +5578,13 @@ class WidgetVote extends WidgetBase {
|
|
|
5423
5578
|
WidgetVote.initWidgets((element, options) => new WidgetVote(element, options), [element], localData).then(localData => {
|
|
5424
5579
|
WidgetVote.api.fallbackInitOnMultiSlide(element, localData);
|
|
5425
5580
|
});
|
|
5581
|
+
WidgetVote.getInstance(element)?.onStart();
|
|
5582
|
+
},
|
|
5583
|
+
onStart: function (element) {
|
|
5584
|
+
WidgetVote.getInstance(element)?.onStart();
|
|
5585
|
+
},
|
|
5586
|
+
onStop: function (element) {
|
|
5587
|
+
WidgetVote.getInstance(element)?.onStop();
|
|
5426
5588
|
},
|
|
5427
5589
|
select: function (element) {
|
|
5428
5590
|
const widgetElement = element.closest(`.${WidgetVote.widgetClassName}`);
|
|
@@ -14851,17 +15013,22 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14851
15013
|
* @param localData
|
|
14852
15014
|
*/
|
|
14853
15015
|
onRefreshUserData(localData) {
|
|
14854
|
-
|
|
14855
|
-
this.localData = extend({}, this.savedData ?? {}, localData);
|
|
15016
|
+
super.onRefreshUserData(localData);
|
|
14856
15017
|
this.state = null;
|
|
14857
15018
|
if (this.isPromotionalCode) {
|
|
14858
|
-
this.
|
|
15019
|
+
this.initPromotionalCodeFromLocalData();
|
|
14859
15020
|
}
|
|
14860
15021
|
else {
|
|
14861
15022
|
this.renderCodeView();
|
|
14862
15023
|
this.renderCaptionView();
|
|
14863
15024
|
}
|
|
14864
15025
|
}
|
|
15026
|
+
onStart() {
|
|
15027
|
+
super.onStart();
|
|
15028
|
+
if (this.isPromotionalCode) {
|
|
15029
|
+
this.fetchPromoCode();
|
|
15030
|
+
}
|
|
15031
|
+
}
|
|
14865
15032
|
isTransparentElement() {
|
|
14866
15033
|
if (this.element) {
|
|
14867
15034
|
try {
|
|
@@ -14943,17 +15110,23 @@ class WidgetBarcode extends WidgetBase {
|
|
|
14943
15110
|
this.captionView.textContent = text;
|
|
14944
15111
|
}
|
|
14945
15112
|
}
|
|
14946
|
-
|
|
14947
|
-
this.
|
|
14948
|
-
|
|
15113
|
+
getPromotionalCodeFromLocalData() {
|
|
15114
|
+
return this.localData["_bc_g_" + this.elementId + "_pc"];
|
|
15115
|
+
}
|
|
15116
|
+
initPromotionalCodeFromLocalData() {
|
|
15117
|
+
if (this.getPromotionalCodeFromLocalData() !== undefined) {
|
|
14949
15118
|
this.state = 1;
|
|
14950
|
-
this.clipboardTarget = this.
|
|
15119
|
+
this.clipboardTarget = this.getPromotionalCodeFromLocalData();
|
|
14951
15120
|
if (this.clipboardTarget != null) {
|
|
14952
15121
|
this.renderCaptionView();
|
|
14953
15122
|
this.renderCodeView();
|
|
14954
15123
|
}
|
|
14955
15124
|
removeClass(this.element, "loader");
|
|
14956
15125
|
}
|
|
15126
|
+
}
|
|
15127
|
+
fetchPromoCode() {
|
|
15128
|
+
this.state = 0;
|
|
15129
|
+
this.initPromotionalCodeFromLocalData();
|
|
14957
15130
|
if (this.state === 0) {
|
|
14958
15131
|
if (!this.isTransparentElement()) {
|
|
14959
15132
|
// for transparent element
|
|
@@ -15039,12 +15212,14 @@ class WidgetBarcode extends WidgetBase {
|
|
|
15039
15212
|
}
|
|
15040
15213
|
_select() {
|
|
15041
15214
|
this.element.classList.add("done");
|
|
15042
|
-
|
|
15043
|
-
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15215
|
+
this.startReadyPromise.then(() => {
|
|
15216
|
+
if (this.disableTimer) {
|
|
15217
|
+
// флаг - что таймер уже стартанул (в layout или добавить объект sharedMemory)
|
|
15218
|
+
// смотрим что прозрачный текст - тогда и лоадер прозрачный
|
|
15219
|
+
// _log("_showNarrativeNextSlide: " + getSlideDuration(this.narrativeId, this.slideIndex), true);
|
|
15220
|
+
this.startDisabledTimeline();
|
|
15221
|
+
}
|
|
15222
|
+
});
|
|
15048
15223
|
if (this.copiedText) {
|
|
15049
15224
|
this.sdkApi.showToast(this.copiedText);
|
|
15050
15225
|
}
|
|
@@ -15075,7 +15250,15 @@ class WidgetBarcode extends WidgetBase {
|
|
|
15075
15250
|
},
|
|
15076
15251
|
/** @deprecated */
|
|
15077
15252
|
initWidget: function (nodeList, localData) {
|
|
15078
|
-
|
|
15253
|
+
const elements = slice.call(nodeList);
|
|
15254
|
+
WidgetBarcode.initWidgets((element, options) => new WidgetBarcode(element, options), elements, localData);
|
|
15255
|
+
elements.forEach(element => WidgetBarcode.getInstance(element)?.onStart());
|
|
15256
|
+
},
|
|
15257
|
+
onStart: function (element) {
|
|
15258
|
+
WidgetBarcode.getInstance(element)?.onStart();
|
|
15259
|
+
},
|
|
15260
|
+
onStop: function (element) {
|
|
15261
|
+
WidgetBarcode.getInstance(element)?.onStop();
|
|
15079
15262
|
},
|
|
15080
15263
|
click: function (element) {
|
|
15081
15264
|
const widgetElement = element.closest(`.${WidgetBarcode.widgetClassName}`);
|