@inappstory/react-sdk 1.7.7 → 1.7.8

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.
@@ -3180,6 +3180,39 @@ class API {
3180
3180
  set baseURL(value) {
3181
3181
  this._baseURL = value;
3182
3182
  }
3183
+ buildQuery(obj, prefix) {
3184
+ const pairs = [];
3185
+ for (const [key, value] of Object.entries(obj)) {
3186
+ if (value == null || value === "")
3187
+ continue;
3188
+ const fullKey = prefix ? `${prefix}[${key}]` : key;
3189
+ if (typeof value === "object" && !Array.isArray(value)) {
3190
+ pairs.push(...this.buildQuery(value, fullKey));
3191
+ }
3192
+ else {
3193
+ pairs.push([fullKey, value]);
3194
+ }
3195
+ }
3196
+ return pairs;
3197
+ }
3198
+ buildBody(obj) {
3199
+ const result = {};
3200
+ for (const [key, value] of Object.entries(obj)) {
3201
+ if (value == null || value === "") {
3202
+ continue;
3203
+ }
3204
+ if (typeof value === "object" && !Array.isArray(value)) {
3205
+ const filteredNested = this.buildBody(value);
3206
+ if (Object.keys(filteredNested).length) {
3207
+ result[key] = filteredNested;
3208
+ }
3209
+ }
3210
+ else {
3211
+ result[key] = value;
3212
+ }
3213
+ }
3214
+ return result;
3215
+ }
3183
3216
  async request(config) {
3184
3217
  return new Promise((resolve, reject) => {
3185
3218
  const cb = async () => {
@@ -3195,7 +3228,7 @@ class API {
3195
3228
  }
3196
3229
  let search = "";
3197
3230
  if (!(0,isNil_js_namespaceObject["default"])(config.params) && (0,isObject_js_namespaceObject["default"])(config.params)) {
3198
- search = new URLSearchParams(Object.entries(config.params).filter(([key, value]) => value != null && value !== "")).toString();
3231
+ search = new URLSearchParams(this.buildQuery(config.params)).toString();
3199
3232
  }
3200
3233
  let url = new URL(`${trimStartSlash(config.url)}${search ? "?" + search : ""}`, this._baseURL);
3201
3234
  let method = "GET";
@@ -3208,7 +3241,7 @@ class API {
3208
3241
  }
3209
3242
  let body = null;
3210
3243
  if (!(0,isNil_js_namespaceObject["default"])(config.data) && (0,isObject_js_namespaceObject["default"])(config.data)) {
3211
- body = JSON.stringify(config.data);
3244
+ body = JSON.stringify(this.buildBody(config.data));
3212
3245
  headers["Content-Type"] = "application/json";
3213
3246
  }
3214
3247
  const response = await fetch(url.toString(), {
@@ -3470,10 +3503,12 @@ let IamApi = (() => {
3470
3503
  value: (__runInitializers(this, _instanceExtraInitializers), storyManager)
3471
3504
  });
3472
3505
  }
3473
- async fetchAll({ tags }) {
3474
- const response = await api.get("inappmessaging", {
3475
- fields: messageFieldsWithPrefix,
3476
- tag: tags.join(",")
3506
+ async fetchAll({ tags, options }) {
3507
+ const response = await api.post("inappmessaging", {
3508
+ tags: tags.join(","),
3509
+ options
3510
+ }, {
3511
+ fields: messageFieldsWithPrefix
3477
3512
  });
3478
3513
  return response.data.messages;
3479
3514
  }
@@ -4574,43 +4609,44 @@ class StoryFeedsApi {
4574
4609
  value: storyManager
4575
4610
  });
4576
4611
  }
4577
- async fetchUgcFeed({ filter, tags, testKey }) {
4612
+ async fetchUgcFeed({ filter, tags, testKey, options }) {
4578
4613
  const url = "ugc/feed";
4579
4614
  const params = {
4580
4615
  tags: tags.join(","),
4581
4616
  test: testKey,
4582
- f: filter && JSON.stringify(filter)
4617
+ f: filter && JSON.stringify(filter),
4618
+ options
4583
4619
  };
4584
4620
  const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4585
4621
  return response.data;
4586
4622
  }
4587
- async fetchDefaultFeed({ feedSlug, tags, testKey }) {
4623
+ async fetchDefaultFeed({ feedSlug, tags, testKey, options }) {
4588
4624
  const url = `feed/${feedSlug}`;
4589
- const params = {
4625
+ const response = await api.post(url, {
4590
4626
  tags: tags.join(","),
4627
+ options
4628
+ }, {
4591
4629
  test: testKey
4592
- };
4593
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4630
+ });
4594
4631
  response.data.feedSlug = feedSlug;
4595
4632
  return response.data;
4596
4633
  }
4597
4634
  async fetchFavoriteFeed({ tags }) {
4598
4635
  const url = "story";
4599
- const params = {
4636
+ const response = await api.get(url, {
4600
4637
  tags: tags.join(","),
4601
4638
  favorite: 1
4602
- };
4603
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4639
+ });
4604
4640
  return response.data;
4605
4641
  }
4606
4642
  async fetchOnboardingFeed(payload) {
4607
4643
  const url = `feed/${payload.feedSlug}/onboarding`;
4608
- const tags = payload.tags.join(",");
4609
- const params = {
4610
- tags: tags,
4644
+ const response = await api.post(url, {
4645
+ tags: payload.tags.join(","),
4646
+ options: payload.options
4647
+ }, {
4611
4648
  limit: payload.limit
4612
- };
4613
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4649
+ });
4614
4650
  response.data.feedSlug = payload.feedSlug;
4615
4651
  return response.data;
4616
4652
  }
@@ -7838,6 +7874,18 @@ let StorySlideViewModel = (() => {
7838
7874
  writable: true,
7839
7875
  value: (storySlideViewModel_runInitializers(this, __disabledNextClick_extraInitializers), new external_async_mutex_namespaceObject.Mutex())
7840
7876
  });
7877
+ Object.defineProperty(this, "isInited", {
7878
+ enumerable: true,
7879
+ configurable: true,
7880
+ writable: true,
7881
+ value: false
7882
+ });
7883
+ Object.defineProperty(this, "isStarted", {
7884
+ enumerable: true,
7885
+ configurable: true,
7886
+ writable: true,
7887
+ value: false
7888
+ });
7841
7889
  Object.defineProperty(this, "handleTouchEnd", {
7842
7890
  enumerable: true,
7843
7891
  configurable: true,
@@ -7900,6 +7948,8 @@ let StorySlideViewModel = (() => {
7900
7948
  }
7901
7949
  async init() {
7902
7950
  const release = await this.mutex.acquire();
7951
+ if (this.isInited)
7952
+ return;
7903
7953
  let loaderShown = this.story.needShowLoaderScreen;
7904
7954
  let startTime = Date.now();
7905
7955
  const loaderTimeout = setTimeout(() => {
@@ -7912,6 +7962,7 @@ let StorySlideViewModel = (() => {
7912
7962
  const { result, reason } = await this.slideApi.showSlide(this.html);
7913
7963
  if (!result)
7914
7964
  throw new Error(reason);
7965
+ this.isInited = true;
7915
7966
  }
7916
7967
  catch (error) {
7917
7968
  this.handleSlideError(error);
@@ -7925,9 +7976,12 @@ let StorySlideViewModel = (() => {
7925
7976
  async start() {
7926
7977
  const release = await this.mutex.acquire();
7927
7978
  try {
7979
+ if (!this.isInited || this.isStarted)
7980
+ return;
7928
7981
  debug(`[SLIDE][START]:${this.story.id}:${this.slide.index}`);
7929
7982
  await this.slideApi.slideStart({ muted: this._story.muted });
7930
7983
  this.story.touchController.on(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
7984
+ this.isStarted = true;
7931
7985
  }
7932
7986
  catch (error) {
7933
7987
  this.handleSlideError(error);
@@ -7942,6 +7996,8 @@ let StorySlideViewModel = (() => {
7942
7996
  this.story.hideErrorScreen();
7943
7997
  this.story.showLoaderScreen();
7944
7998
  await this.slideApi.slideRestart({ muted: this._story.muted });
7999
+ this.isInited = true;
8000
+ this.isStarted = true;
7945
8001
  }
7946
8002
  catch (error) {
7947
8003
  this.handleSlideError(error);
@@ -7954,6 +8010,8 @@ let StorySlideViewModel = (() => {
7954
8010
  async resumeByApp() {
7955
8011
  const release = await this.mutex.acquire();
7956
8012
  try {
8013
+ if (!this.isStarted)
8014
+ return;
7957
8015
  debug(`[SLIDE][RESUME-BY-APP]:${this.story.id}:${this.slide.index}`);
7958
8016
  await this.slideApi.slideAppResume();
7959
8017
  }
@@ -7967,6 +8025,8 @@ let StorySlideViewModel = (() => {
7967
8025
  async pauseByApp() {
7968
8026
  const release = await this.mutex.acquire();
7969
8027
  try {
8028
+ if (!this.isStarted)
8029
+ return;
7970
8030
  debug(`[SLIDE][PAUSE-BY-APP]:${this.story.id}:${this.slide.index}`);
7971
8031
  await this.slideApi.slideAppPause();
7972
8032
  }
@@ -7980,6 +8040,8 @@ let StorySlideViewModel = (() => {
7980
8040
  async resumeByUser() {
7981
8041
  const release = await this.mutex.acquire();
7982
8042
  try {
8043
+ if (!this.isStarted)
8044
+ return;
7983
8045
  debug(`[SLIDE][RESUME-BY-USER]:${this.story.id}:${this.slide.index}`);
7984
8046
  await this.slideApi.slideUserResume();
7985
8047
  }
@@ -7993,6 +8055,8 @@ let StorySlideViewModel = (() => {
7993
8055
  async pauseByUser() {
7994
8056
  const release = await this.mutex.acquire();
7995
8057
  try {
8058
+ if (!this.isStarted)
8059
+ return;
7996
8060
  debug(`[SLIDE][PAUSE-BY-USER]:${this.story.id}:${this.slide.index}`);
7997
8061
  await this.slideApi.slideUserPause();
7998
8062
  }
@@ -8006,6 +8070,8 @@ let StorySlideViewModel = (() => {
8006
8070
  async stop(params) {
8007
8071
  const release = await this.mutex.acquire();
8008
8072
  try {
8073
+ if (!this.isInited || !this.isStarted)
8074
+ return;
8009
8075
  debug(`[SLIDE][STOP]:${this.story.id}:${this.slide.index}`);
8010
8076
  await this.slideApi.slideStop(params);
8011
8077
  }
@@ -8013,6 +8079,9 @@ let StorySlideViewModel = (() => {
8013
8079
  this.handleSlideError(error);
8014
8080
  }
8015
8081
  finally {
8082
+ this.isStarted = false;
8083
+ if (params.prepareForRestart === 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */)
8084
+ this.isInited = false;
8016
8085
  this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8017
8086
  release();
8018
8087
  }
@@ -8045,6 +8114,8 @@ let StorySlideViewModel = (() => {
8045
8114
  }
8046
8115
  async destroy() {
8047
8116
  try {
8117
+ this.isStarted = false;
8118
+ this.isInited = false;
8048
8119
  this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8049
8120
  await this.slideApi.destroy();
8050
8121
  }
@@ -9399,6 +9470,7 @@ var storyViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivate
9399
9470
 
9400
9471
 
9401
9472
 
9473
+
9402
9474
  var StoryEvent;
9403
9475
  (function (StoryEvent) {
9404
9476
  StoryEvent["ShowToast"] = "showToast";
@@ -9499,7 +9571,7 @@ let StoryViewModel = (() => {
9499
9571
  writable: true,
9500
9572
  value: (storyViewModel_runInitializers(this, __$root_extraInitializers), false)
9501
9573
  });
9502
- Object.defineProperty(this, "isActive", {
9574
+ Object.defineProperty(this, "isStarted", {
9503
9575
  enumerable: true,
9504
9576
  configurable: true,
9505
9577
  writable: true,
@@ -9511,6 +9583,12 @@ let StoryViewModel = (() => {
9511
9583
  writable: true,
9512
9584
  value: 0
9513
9585
  });
9586
+ Object.defineProperty(this, "mutex", {
9587
+ enumerable: true,
9588
+ configurable: true,
9589
+ writable: true,
9590
+ value: new external_async_mutex_namespaceObject.Mutex()
9591
+ });
9514
9592
  // internal services
9515
9593
  Object.defineProperty(this, "slideApi", {
9516
9594
  enumerable: true,
@@ -9591,6 +9669,10 @@ let StoryViewModel = (() => {
9591
9669
  writable: true,
9592
9670
  value: async (el) => {
9593
9671
  this._$root = el;
9672
+ // Reaction to `layout` (modern or classic) change
9673
+ // TODO: add test with example
9674
+ await this.reinit();
9675
+ await this.restart();
9594
9676
  }
9595
9677
  });
9596
9678
  Object.defineProperty(this, "handleKeydown", {
@@ -9779,7 +9861,7 @@ let StoryViewModel = (() => {
9779
9861
  }
9780
9862
  async prevSlideOrStory() {
9781
9863
  if (this.reachStart && this.storyReader.reachStart) {
9782
- if (!this.isActive)
9864
+ if (!this.isStarted)
9783
9865
  return;
9784
9866
  await this.activeSlide.restart();
9785
9867
  return;
@@ -9828,41 +9910,54 @@ let StoryViewModel = (() => {
9828
9910
  await this.storyManager.rootStore.storyStore.updateNarrativeData(this.id, data);
9829
9911
  }
9830
9912
  detachRoot() {
9913
+ var _b;
9831
9914
  this._$root = null;
9915
+ const isInited = this.isInited;
9916
+ const isStarted = this.isStarted;
9917
+ this.stop();
9918
+ (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
9919
+ for (const slide of this._slides)
9920
+ slide.destroy();
9921
+ this.isInited = isInited;
9922
+ this.isStarted = isStarted;
9832
9923
  }
9833
9924
  async init() {
9834
- if (this.isInited)
9835
- return;
9836
- if (!this.initOnce && !this.story.canBeShown) {
9837
- this.showLoaderScreen();
9838
- this.initOnce = true;
9839
- }
9840
- await (0,external_mobx_namespaceObject.when)(() => this.canBeShown && Boolean(this._$root));
9841
- await this.activeSlide.init();
9842
- this.isInited = true;
9925
+ await this.mutex.runExclusive(async () => {
9926
+ if (this.isInited)
9927
+ return;
9928
+ if (!this.initOnce && !this.story.canBeShown) {
9929
+ this.showLoaderScreen();
9930
+ this.initOnce = true;
9931
+ }
9932
+ await (0,external_mobx_namespaceObject.when)(() => this.canBeShown && Boolean(this._$root));
9933
+ await this.activeSlide.init();
9934
+ this.isInited = true;
9935
+ });
9843
9936
  }
9844
9937
  async start() {
9845
- if (!this.isInited)
9846
- throw new Error("[IAS]: story was not initialized error. Please contact IAS support.");
9847
- if (this.isActive)
9848
- return;
9849
- await this.activeSlide.start();
9850
- document.addEventListener("visibilitychange", this.handleVisibilityChange);
9851
- document.addEventListener("keydown", this.handleKeydown);
9852
- this.isActive = true;
9853
- this._activeSlideStartTime = Date.now();
9938
+ await this.mutex.runExclusive(async () => {
9939
+ if (this.isStarted || !this.isInited)
9940
+ return;
9941
+ await this.activeSlide.start();
9942
+ document.addEventListener("visibilitychange", this.handleVisibilityChange);
9943
+ document.addEventListener("keydown", this.handleKeydown);
9944
+ this.isStarted = true;
9945
+ this._activeSlideStartTime = Date.now();
9946
+ });
9854
9947
  }
9855
9948
  async stop() {
9856
- var _b;
9857
- if (!this.isActive || !this.isInited)
9858
- return;
9859
- (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
9860
- this.isActive = false;
9861
- this.slideApiHandlers.clearNarrativeSessionDataCache();
9862
- this.resumeAll();
9863
- await this.activeSlide.stop({ prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */ });
9864
- document.removeEventListener("visibilitychange", this.handleVisibilityChange);
9865
- document.removeEventListener("keydown", this.handleKeydown);
9949
+ await this.mutex.runExclusive(async () => {
9950
+ var _b;
9951
+ if (!this.isStarted || !this.isInited)
9952
+ return;
9953
+ (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
9954
+ this.isStarted = false;
9955
+ this.slideApiHandlers.clearNarrativeSessionDataCache();
9956
+ this.resumeAll();
9957
+ await this.activeSlide.stop({ prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */ });
9958
+ document.removeEventListener("visibilitychange", this.handleVisibilityChange);
9959
+ document.removeEventListener("keydown", this.handleKeydown);
9960
+ });
9866
9961
  }
9867
9962
  canGoNext() {
9868
9963
  return this.activeSlide.canGoNext();
@@ -9888,13 +9983,13 @@ let StoryViewModel = (() => {
9888
9983
  this.goodsWidget.close();
9889
9984
  const activeSlide = this.getSlideByIndex(this._activeSlideIndex);
9890
9985
  this.slideApiHandlers.clearNarrativeSessionDataCache();
9891
- if (this.isActive)
9986
+ if (this.isStarted)
9892
9987
  await activeSlide.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ });
9893
9988
  await activeSlide.destroy();
9894
9989
  (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
9895
9990
  (_c = this.toast) === null || _c === void 0 ? void 0 : _c.destroy();
9896
9991
  this.isInited = false;
9897
- this.isActive = false;
9992
+ this.isStarted = false;
9898
9993
  }
9899
9994
  notifyPauseStateChange() {
9900
9995
  if (this.pauseManager.isUserPaused)
@@ -9949,8 +10044,6 @@ let StoryViewModel = (() => {
9949
10044
  }
9950
10045
  async createSlidesViewModels(slides, slideApi) {
9951
10046
  this._slides = slides.map((slide, index) => new StorySlideViewModel(this, index, slideApi, slide));
9952
- // Reaction to `layout` (modern or classsic) change
9953
- await this.onSlideChange(this.activeSlideIndex);
9954
10047
  }
9955
10048
  handleSpaceKeydown(e) {
9956
10049
  if (e.code !== "Space")
@@ -9969,17 +10062,34 @@ let StoryViewModel = (() => {
9969
10062
  this.mute();
9970
10063
  }
9971
10064
  async onSlideChange(index) {
9972
- const lastSlide = this.getSlideByIndex(this._activeSlideIndex);
9973
- const activeSlide = this.getSlideByIndex(index);
9974
- this._activeSlideIndex = index;
9975
- if (this.isInited)
9976
- await activeSlide.init();
9977
- if (this.isActive) {
10065
+ try {
10066
+ if (!this.isInited || !this.isStarted)
10067
+ return;
10068
+ const lastSlide = this.getSlideByIndex(this._activeSlideIndex);
10069
+ const activeSlide = this.getSlideByIndex(index);
10070
+ this._activeSlideIndex = index;
10071
+ this.hideErrorScreen();
9978
10072
  this.resumeAll();
10073
+ await activeSlide.init();
9979
10074
  await (lastSlide === null || lastSlide === void 0 ? void 0 : lastSlide.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ }));
9980
10075
  await activeSlide.start();
9981
10076
  this._activeSlideStartTime = Date.now();
9982
10077
  }
10078
+ catch (error) {
10079
+ console.error(error);
10080
+ }
10081
+ }
10082
+ async reinit() {
10083
+ if (this.isInited) {
10084
+ this.isInited = false;
10085
+ await this.init();
10086
+ }
10087
+ }
10088
+ async restart() {
10089
+ if (this.isStarted) {
10090
+ this.isStarted = false;
10091
+ await this.start();
10092
+ }
9983
10093
  }
9984
10094
  },
9985
10095
  _StoryViewModel__activeSlideIndex_accessor_storage = new WeakMap(),
@@ -10479,7 +10589,7 @@ class GameClientConfig {
10479
10589
  value: void 0
10480
10590
  });
10481
10591
  const storyManagerConfig = this.storyManager.config;
10482
- const sdkVersion = "1.7.7";
10592
+ const sdkVersion = "1.7.8";
10483
10593
  const placeholders = this.storyManager.rootStore.placeholderStore.placeholders;
10484
10594
  const session = this.storyManager.rootStore.sessionStore.session;
10485
10595
  this.sessionId = session.id;
@@ -12874,16 +12984,21 @@ let StoryReaderNavigationController = (() => {
12874
12984
  return activeStory;
12875
12985
  }
12876
12986
  async runNextStory(prevStory, story) {
12877
- await (prevStory === null || prevStory === void 0 ? void 0 : prevStory.stop());
12878
- await story.init();
12879
- await story.start();
12987
+ try {
12988
+ await (prevStory === null || prevStory === void 0 ? void 0 : prevStory.stop());
12989
+ await story.init();
12990
+ await story.start();
12991
+ }
12992
+ catch (error) {
12993
+ console.error(error);
12994
+ }
12880
12995
  }
12881
12996
  async initStoriesWithinRange(currentIndex) {
12882
12997
  let stories = this.storyReader.stories;
12883
12998
  const start = Math.max(currentIndex - STORY_INIT_RANGE, 0);
12884
12999
  const end = Math.min(currentIndex + STORY_INIT_RANGE, stories.length - 1);
12885
13000
  stories = stories.slice(start, end + 1);
12886
- return Promise.all(stories.map(story => story.init()));
13001
+ return Promise.allSettled(stories.map(story => story.init()));
12887
13002
  }
12888
13003
  handleActiveStoryError(story) {
12889
13004
  if (!(story === null || story === void 0 ? void 0 : story.error))
@@ -13564,13 +13679,6 @@ var storyReaderViewModel_classPrivateFieldSet = (undefined && undefined.__classP
13564
13679
 
13565
13680
 
13566
13681
 
13567
- var StoryReaderCommand;
13568
- (function (StoryReaderCommand) {
13569
- StoryReaderCommand["RedirectToStory"] = "redirectToStory";
13570
- StoryReaderCommand["CloseStory"] = "closeStory";
13571
- StoryReaderCommand["ShowMultipleStories"] = "showMultipleStories";
13572
- StoryReaderCommand["ReloadStory"] = "reloadStory";
13573
- })(StoryReaderCommand || (StoryReaderCommand = {}));
13574
13682
  var StoryReaderEvent;
13575
13683
  (function (StoryReaderEvent) {
13576
13684
  StoryReaderEvent["Close"] = "closeStoryReader";
@@ -19517,8 +19625,9 @@ let IamStore = (() => {
19517
19625
  async fetchAll(params) {
19518
19626
  await this.rootStore.sessionStore.open();
19519
19627
  await this.fetchMessageContext();
19520
- const tags = params.tags ? params.tags : this.rootStore.storyManagerConfigStore.config.tags;
19521
- const messageDtos = await this.iamApi.fetchAll({ tags: filterTags(tags) });
19628
+ const config = this.rootStore.storyManagerConfigStore.config;
19629
+ const tags = params.tags ? params.tags : config.tags;
19630
+ const messageDtos = await this.iamApi.fetchAll({ tags: filterTags(tags), options: config.options });
19522
19631
  return this.createMessagesByDtos(messageDtos);
19523
19632
  }
19524
19633
  async fetchMessageContext() {
@@ -20053,8 +20162,15 @@ let StoryFeedStore = (() => {
20053
20162
  }
20054
20163
  async fetchDefaultFeed({ feedSlug, testKey }) {
20055
20164
  const session = await this.rootStore.sessionStore.open();
20056
- const tags = this.rootStore.storyManagerConfigStore.config.tags;
20057
- const storyFeedDto = await this.storyFeedsApi.fetchDefaultFeed({ feedSlug, tags, testKey });
20165
+ const config = this.rootStore.storyManagerConfigStore.config;
20166
+ const storyFeedDto = await this.storyFeedsApi.fetchDefaultFeed({
20167
+ feedSlug,
20168
+ tags: config.tags,
20169
+ testKey,
20170
+ options: {
20171
+ pos: config.options.pos
20172
+ }
20173
+ });
20058
20174
  const stories = this.rootStore.storyStore.addStoriesByDtos(storyFeedDto.stories);
20059
20175
  const storyFeed = new StoryFeed(storyFeedDto, stories, { testKey });
20060
20176
  this.addStoryFeed(session.userKey, storyFeed);
@@ -20071,10 +20187,19 @@ let StoryFeedStore = (() => {
20071
20187
  }
20072
20188
  async fetchUgcFeed({ filter, testKey }) {
20073
20189
  const session = await this.rootStore.sessionStore.open();
20074
- const tags = this.rootStore.storyManagerConfigStore.config.tags;
20075
- const storyDtos = await this.storyFeedsApi.fetchUgcFeed({ filter, tags, testKey });
20190
+ const config = this.rootStore.storyManagerConfigStore.config;
20191
+ const storyDtos = await this.storyFeedsApi.fetchUgcFeed({
20192
+ filter,
20193
+ tags: config.tags,
20194
+ testKey,
20195
+ options: {
20196
+ pos: config.options.pos
20197
+ }
20198
+ });
20076
20199
  const stories = this.rootStore.storyStore.addStoriesByDtos(storyDtos);
20077
- const ugcFeed = UgcStoryFeed.createByStories(stories, { filter });
20200
+ const ugcFeed = UgcStoryFeed.createByStories(stories, {
20201
+ filter
20202
+ });
20078
20203
  this.addStoryFeed(session.userKey, ugcFeed);
20079
20204
  return ugcFeed;
20080
20205
  }
@@ -20184,7 +20309,7 @@ let OnboardingFeedStore = (() => {
20184
20309
  const config = this.rootStore.storyManagerConfigStore.config;
20185
20310
  if (!config)
20186
20311
  return null;
20187
- return [config.lang, config.apiKey];
20312
+ return [config.lang, config.apiKey, config.options];
20188
20313
  }, () => {
20189
20314
  this.invalidateCacheData();
20190
20315
  });
@@ -20211,7 +20336,10 @@ let OnboardingFeedStore = (() => {
20211
20336
  if (onboardingStoryFeed && !this.cacheDataInvalidated && onboardingStoryFeed.isEqualParams(onboardingParams))
20212
20337
  return onboardingStoryFeed;
20213
20338
  const session = await this.rootStore.sessionStore.open();
20214
- const onboardingFeedDto = await this.storyFeedsApi.fetchOnboardingFeed(Object.assign(Object.assign({}, onboardingParams), { feedSlug }));
20339
+ const config = this.rootStore.storyManagerConfigStore.config;
20340
+ const onboardingFeedDto = await this.storyFeedsApi.fetchOnboardingFeed(Object.assign(Object.assign({}, onboardingParams), { feedSlug, options: {
20341
+ pos: config.options.pos
20342
+ } }));
20215
20343
  const stories = this.rootStore.storyStore.addStoriesByDtos(onboardingFeedDto.stories);
20216
20344
  onboardingStoryFeed = new OnboardingStoryFeed(onboardingFeedDto, stories, onboardingParams);
20217
20345
  this.addOnboardingFeed(session.userKey, onboardingStoryFeed);
@@ -20284,7 +20412,7 @@ class UgcEditorStore {
20284
20412
  const session = await this.storyManager.rootStore.sessionStore.open();
20285
20413
  const ugcEditorConfigDto = await this.ugcEditorApi.fetchUgcEditorConfig();
20286
20414
  const storyManagerConfig = this.storyManager.config;
20287
- const sdkVersion = "1.7.7";
20415
+ const sdkVersion = "1.7.8";
20288
20416
  this._config = {
20289
20417
  sessionId: session.id,
20290
20418
  apiKey: storyManagerConfig.apiKey,
@@ -20716,11 +20844,11 @@ class StoryManager extends TypedEventEmitter {
20716
20844
  return this._userAgent;
20717
20845
  }
20718
20846
  get sdkVersionName() {
20719
- const sdkVersionName = "1.7.7";
20847
+ const sdkVersionName = "1.7.8";
20720
20848
  return sdkVersionName || "0.0.0";
20721
20849
  }
20722
20850
  get sdkVersionCode() {
20723
- const sdkVersionCode = 10707;
20851
+ const sdkVersionCode = 10708;
20724
20852
  return sdkVersionCode ? parseInt(sdkVersionCode) : 0;
20725
20853
  }
20726
20854
  get lang() {
@@ -20777,7 +20905,7 @@ class StoryManager extends TypedEventEmitter {
20777
20905
  this.rootStore.storyManagerConfigStore.setConfig(configDto);
20778
20906
  }
20779
20907
  setUserAgent(userAgent) {
20780
- const sdkVersionCode = 10707;
20908
+ const sdkVersionCode = 10708;
20781
20909
  const buildVersion = sdkVersionCode ? parseInt(sdkVersionCode) : 0;
20782
20910
  // According to RFC5987, HTTP header values can legitimately be supplied using the ISO-8859-1 encoding.
20783
20911
  this._userAgent = `${userAgent} ${convertStrToLatin1(navigator.userAgent)}`;
@@ -22717,7 +22845,8 @@ const StoryReaderRoot = (0,external_mobx_react_lite_namespaceObject.observer)((p
22717
22845
  filter: ((_c = options.slideBackdrop) === null || _c === void 0 ? void 0 : _c.blur) ? `blur(${options.slideBackdrop.blur}px)` : "none"
22718
22846
  };
22719
22847
  };
22720
- return ((0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, { children: [(0,jsx_runtime_namespaceObject.jsxs)("div", { ref: storiesViewerRef, className: (0,external_classnames_namespaceObject["default"])("stories-viewer", Root_storyReaderRoot_module["stories-viewer"]), style: Object.assign(Object.assign({}, getRootVars()), getWrapperBackdropStyle()), children: [isDesktopMode_isDesktopMode && ((0,jsx_runtime_namespaceObject.jsx)("div", { className: Root_storyReaderRoot_module["stories-viewer-background"], style: getSlideBackdropStyle() })), props.children, props.isDesktopGeometry && props.storyReader.activeStory && ((0,jsx_runtime_namespaceObject.jsx)(CloseButton_CloseButton, { dir: props.storyReader.dir, className: Root_storyReaderRoot_module["stories-viewer__close-btn"], hidden: Boolean(props.storyReader.activeStory.pauseState.isUIPaused), onClose: () => {
22848
+ const activeStory = props.storyReader.activeStory;
22849
+ return ((0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, { children: [(0,jsx_runtime_namespaceObject.jsxs)("div", { ref: storiesViewerRef, className: (0,external_classnames_namespaceObject["default"])("stories-viewer", Root_storyReaderRoot_module["stories-viewer"]), style: Object.assign(Object.assign({}, getRootVars()), getWrapperBackdropStyle()), children: [isDesktopMode_isDesktopMode && ((0,jsx_runtime_namespaceObject.jsx)("div", { className: Root_storyReaderRoot_module["stories-viewer-background"], style: getSlideBackdropStyle() })), props.children, props.isDesktopGeometry && activeStory && !activeStory.disableClose && ((0,jsx_runtime_namespaceObject.jsx)(CloseButton_CloseButton, { dir: props.storyReader.dir, className: Root_storyReaderRoot_module["stories-viewer__close-btn"], hidden: Boolean(activeStory.pauseState.isUIPaused), onClose: () => {
22721
22850
  props.storyReader.close();
22722
22851
  } }))] }), (0,jsx_runtime_namespaceObject.jsx)("div", { ref: backdropRef, className: (0,external_classnames_namespaceObject["default"])(Root_storyReaderRoot_module["stories-viewer-backdrop"], {
22723
22852
  [Root_storyReaderRoot_module["_desktopMode"]]: isDesktopMode_isDesktopMode