@inappstory/slide-api 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1126,6 +1126,12 @@ class EsModuleSdkApi {
1126
1126
  storyShowNext() {
1127
1127
  this.sdkBinding().storyShowNext();
1128
1128
  }
1129
+ setStorySessionValue(element, key, value) {
1130
+ this.sdkBinding().setStorySessionValue(key, value);
1131
+ }
1132
+ getStorySessionValue(element, key) {
1133
+ return this.sdkBinding().getStorySessionValue(key);
1134
+ }
1129
1135
  static get [Symbol.for("___CTOR_ARGS___")]() { return [`() => SDKInterface`]; }
1130
1136
  }
1131
1137
 
@@ -2823,35 +2829,10 @@ class WidgetQuest extends WidgetBase {
2823
2829
  }
2824
2830
  refreshUserData(localData) { }
2825
2831
  setStorySessionValue(name, value) {
2826
- try {
2827
- var parent = this.element.closest(".stories-item");
2828
- if (parent) {
2829
- parent.dataset[name] = value;
2830
- }
2831
- else {
2832
- //@ts-ignore
2833
- this.env[name] = value;
2834
- }
2835
- }
2836
- catch (e) {
2837
- console.error(e);
2838
- }
2832
+ this.sdkApi.setStorySessionValue(this.element, name, value);
2839
2833
  }
2840
2834
  getStorySessionValue(name) {
2841
- try {
2842
- var parent = this.element.closest(".stories-item");
2843
- if (parent) {
2844
- return parent.dataset[name];
2845
- }
2846
- else {
2847
- // @ts-ignore
2848
- return this.env[name];
2849
- }
2850
- }
2851
- catch (e) {
2852
- console.error(e);
2853
- return undefined;
2854
- }
2835
+ return this.sdkApi.getStorySessionValue(this.element, name);
2855
2836
  }
2856
2837
  init() {
2857
2838
  if (this.localData) {
@@ -2868,6 +2849,7 @@ class WidgetQuest extends WidgetBase {
2868
2849
  lastSlideIdx !== this.slideIndex /*&& this.slideIndex === this.firstSlideWithQuestIndex()*/) {
2869
2850
  if (this.getStorySessionValue("__storyQuestSlideChanged") === undefined) {
2870
2851
  // global flag - был сделан переход на нужный слайд, больше не нужно повторять за эту сессию
2852
+ // perform showStorySlide with lastSlideIdx only on story open first time (not on second slide, etc)
2871
2853
  this.setStorySessionValue("__storyQuestSlideChanged", "1");
2872
2854
  if (this.sdkApi.isExistsShowStorySlide) {
2873
2855
  this.sdkApi.showStorySlide(lastSlideIdx);