@inappstory/slide-api 0.0.3 → 0.0.4
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 +32 -33
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +27 -29
- package/dist/index.d.ts +27 -29
- package/dist/index.js +32 -33
- package/dist/index.js.map +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1342,29 +1342,27 @@ class WidgetBase {
|
|
|
1342
1342
|
console.error(error);
|
|
1343
1343
|
}
|
|
1344
1344
|
}
|
|
1345
|
-
static
|
|
1346
|
-
|
|
1347
|
-
const
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
widget.refreshUserData(localData);
|
|
1353
|
-
}
|
|
1345
|
+
static refreshUserData(nodes, localData) {
|
|
1346
|
+
const cb = (el, localData) => {
|
|
1347
|
+
const widgetElement = el.closest(`.${this.widgetClassName}`);
|
|
1348
|
+
if (widgetElement) {
|
|
1349
|
+
const widget = WidgetBase.getInstance(widgetElement);
|
|
1350
|
+
if (widget) {
|
|
1351
|
+
widget.refreshUserData(localData);
|
|
1354
1352
|
}
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1353
|
+
}
|
|
1354
|
+
};
|
|
1355
|
+
if (localData != null) {
|
|
1356
|
+
const elements = slice.call(nodes);
|
|
1357
|
+
forEach(elements, el => cb(el, localData));
|
|
1358
|
+
}
|
|
1359
|
+
else {
|
|
1360
|
+
WidgetBase.getLocalData().then(localData => {
|
|
1357
1361
|
const elements = slice.call(nodes);
|
|
1358
1362
|
forEach(elements, el => cb(el, localData));
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
const elements = slice.call(nodes);
|
|
1363
|
-
forEach(elements, el => cb(el, localData));
|
|
1364
|
-
});
|
|
1365
|
-
}
|
|
1366
|
-
},
|
|
1367
|
-
};
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1368
1366
|
static get [Symbol.for("___CTOR_ARGS___")]() { return [`HTMLElement`, `Partial`, `(element: HTMLElement) => string`, `(element: HTMLElement) => HTMLElement`]; }
|
|
1369
1367
|
}
|
|
1370
1368
|
|
|
@@ -1564,7 +1562,7 @@ class WidgetCopy extends WidgetBase {
|
|
|
1564
1562
|
return this.localData["_cp_g_" + this.elementId + "_done_at"] !== undefined;
|
|
1565
1563
|
}
|
|
1566
1564
|
static api = {
|
|
1567
|
-
|
|
1565
|
+
refreshUserData: WidgetCopy.refreshUserData,
|
|
1568
1566
|
initWidget: function (nodeList, localData) {
|
|
1569
1567
|
// prevent initWidget for result layer
|
|
1570
1568
|
const elements = slice.call(nodeList).filter(element => !element.classList.contains("narrative-element-copy-result-variant"));
|
|
@@ -1756,7 +1754,7 @@ class WidgetDataInput extends WidgetBase {
|
|
|
1756
1754
|
}
|
|
1757
1755
|
}
|
|
1758
1756
|
static api = {
|
|
1759
|
-
|
|
1757
|
+
refreshUserData: WidgetDataInput.refreshUserData,
|
|
1760
1758
|
initWidget: function (nodeList, localData) {
|
|
1761
1759
|
WidgetDataInput.initWidgets((element, options) => new WidgetDataInput(element, options), slice.call(nodeList), localData);
|
|
1762
1760
|
},
|
|
@@ -1969,7 +1967,7 @@ class WidgetDateCountdown extends WidgetBase {
|
|
|
1969
1967
|
return result;
|
|
1970
1968
|
}
|
|
1971
1969
|
static api = {
|
|
1972
|
-
|
|
1970
|
+
refreshUserData: WidgetDateCountdown.refreshUserData,
|
|
1973
1971
|
initWidget: function (nodeList, layers, localData) {
|
|
1974
1972
|
WidgetDateCountdown.initWidgets((element, options) => new WidgetDateCountdown(element, { ...options, layers }), slice.call(nodeList), localData);
|
|
1975
1973
|
},
|
|
@@ -2597,7 +2595,7 @@ class WidgetPoll extends WidgetBase {
|
|
|
2597
2595
|
return this.localData["_p_g_" + this.elementId + "_sa"] !== undefined;
|
|
2598
2596
|
}
|
|
2599
2597
|
static api = {
|
|
2600
|
-
|
|
2598
|
+
refreshUserData: WidgetPoll.refreshUserData,
|
|
2601
2599
|
initWidget: function (element, localData) {
|
|
2602
2600
|
WidgetPoll.initWidgets((element, options) => new WidgetPoll(element, options), [element], localData);
|
|
2603
2601
|
},
|
|
@@ -2762,7 +2760,7 @@ class WidgetPollLayers extends WidgetBase {
|
|
|
2762
2760
|
return this.localData != null && this.localData["_pl_g_" + this.elementId + "_sa"] !== undefined;
|
|
2763
2761
|
}
|
|
2764
2762
|
static api = {
|
|
2765
|
-
|
|
2763
|
+
refreshUserData: WidgetPollLayers.refreshUserData,
|
|
2766
2764
|
// signature variants
|
|
2767
2765
|
// (widget, layers, undefined) - modern web sdk
|
|
2768
2766
|
// (widget, undefined, layers) - old web sdk and rn
|
|
@@ -3069,7 +3067,7 @@ class WidgetQuest extends WidgetBase {
|
|
|
3069
3067
|
}
|
|
3070
3068
|
}
|
|
3071
3069
|
static api = {
|
|
3072
|
-
|
|
3070
|
+
refreshUserData: WidgetQuest.refreshUserData,
|
|
3073
3071
|
initWidget: function (element, localData) {
|
|
3074
3072
|
return new Promise(function (resolve, reject) {
|
|
3075
3073
|
WidgetQuest.initWidgets((element, options) => new WidgetQuest(element, options), [element], localData).then(localData => {
|
|
@@ -3267,7 +3265,7 @@ class WidgetQuiz extends WidgetBase {
|
|
|
3267
3265
|
return this.localData["_q_g_" + this.elementId + "_sa"] !== undefined;
|
|
3268
3266
|
}
|
|
3269
3267
|
static api = {
|
|
3270
|
-
|
|
3268
|
+
refreshUserData: WidgetQuiz.refreshUserData,
|
|
3271
3269
|
initWidget: function (element, localData) {
|
|
3272
3270
|
WidgetQuiz.initWidgets((element, options) => new WidgetQuiz(element, options), [element], localData);
|
|
3273
3271
|
},
|
|
@@ -3461,7 +3459,7 @@ class WidgetQuizGrouped extends WidgetBase {
|
|
|
3461
3459
|
return this.localData["_q_gg_" + this.elementId + "_sa"] !== undefined;
|
|
3462
3460
|
}
|
|
3463
3461
|
static api = {
|
|
3464
|
-
|
|
3462
|
+
refreshUserData: WidgetQuizGrouped.refreshUserData,
|
|
3465
3463
|
initWidget: function (element, localData) {
|
|
3466
3464
|
WidgetQuizGrouped.initWidgets((element, options) => new WidgetQuizGrouped(element, options), [element], localData);
|
|
3467
3465
|
},
|
|
@@ -4070,7 +4068,7 @@ class WidgetRangeSlider extends WidgetBase {
|
|
|
4070
4068
|
// .removeData('plugin_' + pluginName);
|
|
4071
4069
|
}
|
|
4072
4070
|
static api = {
|
|
4073
|
-
|
|
4071
|
+
refreshUserData: WidgetRangeSlider.refreshUserData,
|
|
4074
4072
|
initWidget: function (element, localData) {
|
|
4075
4073
|
WidgetRangeSlider.initWidgets((element, options) => new WidgetRangeSlider(element, options), [element], localData);
|
|
4076
4074
|
},
|
|
@@ -4317,7 +4315,7 @@ class WidgetRate extends WidgetBase {
|
|
|
4317
4315
|
return this.localData["_r_g_" + this.elementId + "_sa"] !== undefined;
|
|
4318
4316
|
}
|
|
4319
4317
|
static api = {
|
|
4320
|
-
|
|
4318
|
+
refreshUserData: WidgetRate.refreshUserData,
|
|
4321
4319
|
initWidget: function (nodeList, localData) {
|
|
4322
4320
|
WidgetRate.initWidgets((element, options) => new WidgetRate(element, options), slice.call(nodeList), localData);
|
|
4323
4321
|
},
|
|
@@ -4439,7 +4437,7 @@ class WidgetShare extends WidgetBase {
|
|
|
4439
4437
|
return Boolean(this.localData["_s_" + this.elementId + "_ts"]);
|
|
4440
4438
|
}
|
|
4441
4439
|
static api = {
|
|
4442
|
-
|
|
4440
|
+
refreshUserData: WidgetShare.refreshUserData,
|
|
4443
4441
|
// signature variants
|
|
4444
4442
|
// (widget, layers, undefined) - modern web sdk
|
|
4445
4443
|
// (widget, undefined, layers) - old web sdk and rn
|
|
@@ -4679,7 +4677,7 @@ class WidgetTest extends WidgetBase {
|
|
|
4679
4677
|
return Boolean(this.withTimeToAnswer && this.answerTimeout);
|
|
4680
4678
|
}
|
|
4681
4679
|
static api = {
|
|
4682
|
-
|
|
4680
|
+
refreshUserData: WidgetTest.refreshUserData,
|
|
4683
4681
|
initWidget: function (element, localData) {
|
|
4684
4682
|
WidgetTest.initWidgets((element, options) => new WidgetTest(element, options), [element], localData);
|
|
4685
4683
|
},
|
|
@@ -4932,7 +4930,7 @@ class WidgetVote extends WidgetBase {
|
|
|
4932
4930
|
return this.localData["_v_g_" + this.elementId + "_sa"] !== undefined;
|
|
4933
4931
|
}
|
|
4934
4932
|
static api = {
|
|
4935
|
-
|
|
4933
|
+
refreshUserData: WidgetVote.refreshUserData,
|
|
4936
4934
|
// fix for WidgetVote on every layer of multilayers story
|
|
4937
4935
|
fallbackInitOnMultiSlide: function (element, localData) {
|
|
4938
4936
|
if (element.dataset.fallbackInitOnMultiSlide) {
|
|
@@ -5005,3 +5003,4 @@ const getSlideApi = (_sdkInterface) => {
|
|
|
5005
5003
|
container.registerSingleton(() => new EsModuleSdkApi(() => sdkInterface), { identifier: `SDKApi` });
|
|
5006
5004
|
|
|
5007
5005
|
exports.getSlideApi = getSlideApi;
|
|
5006
|
+
//# sourceMappingURL=index.cjs.map
|