@inappstory/react-sdk 1.9.4 → 1.9.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.
@@ -9,7 +9,6 @@ import * as __WEBPACK_EXTERNAL_MODULE_deepmerge__ from "deepmerge";
9
9
  import * as __WEBPACK_EXTERNAL_MODULE_lodash_debounce_js_35379ba8__ from "lodash/debounce.js";
10
10
  import * as __WEBPACK_EXTERNAL_MODULE__inappstory_slide_api_2e636188__ from "@inappstory/slide-api";
11
11
  import * as __WEBPACK_EXTERNAL_MODULE_async_mutex_052338b1__ from "async-mutex";
12
- import * as __WEBPACK_EXTERNAL_MODULE_lodash_isEmpty_js_f1e1789b__ from "lodash/isEmpty.js";
13
12
  import * as __WEBPACK_EXTERNAL_MODULE_lodash_isObject_js_84bb7d23__ from "lodash/isObject.js";
14
13
  import * as __WEBPACK_EXTERNAL_MODULE_lodash_isNumber_js_09f2ee09__ from "lodash/isNumber.js";
15
14
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_179142b8__ from "react/jsx-runtime";
@@ -904,7 +903,7 @@ ___CSS_LOADER_EXPORT___.locals = {
904
903
 
905
904
  var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0___default()));
906
905
  // Module
907
- ___CSS_LOADER_EXPORT___.push([module.id, ".loader--O0iuj{position:absolute;z-index:1;top:0;bottom:0;left:0;right:0;display:flex;justify-content:center;align-items:center;background:var(--loader-background, black)}.loader--O0iuj .loader__refresh-btn--RtExV{color:#fff;cursor:pointer;position:absolute;left:50%;top:50%;transform:translate3d(-50%, -50%, 0);pointer-events:auto;padding:20px;width:32px;height:32px;box-sizing:content-box}.loader--O0iuj .loader__spinner--cKqH0{-ms-flex-negative:0;flex-shrink:0;display:inline-block;width:32px;height:32px;border-radius:50%;border:solid 2px var(--loaderBackgroundColor, white);border-color:var(--loaderBackgroundAccentColor, transparent) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white);-webkit-animation:loading-spinner--7I4aU .6s infinite linear;animation:loading-spinner--7I4aU .6s infinite linear}@keyframes loading-spinner--7I4aU{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}", "",{"version":3,"sources":["webpack://./src/UI/Loader/loader.module.scss"],"names":[],"mappings":"AAAA,eACI,iBAAA,CACA,SAAA,CACA,KAAA,CACA,QAAA,CACA,MAAA,CACA,OAAA,CACA,YAAA,CACA,sBAAA,CACA,kBAAA,CACA,0CAAA,CAEA,2CACI,UAAA,CACA,cAAA,CACA,iBAAA,CACA,QAAA,CACA,OAAA,CACA,oCAAA,CACA,mBAAA,CACA,YAAA,CACA,UAAA,CACA,WAAA,CACA,sBAAA,CAGJ,uCACI,mBAAA,CACA,aAAA,CACA,oBAAA,CACA,UAAA,CACA,WAAA,CACA,iBAAA,CACA,oDAAA,CACA,wKAAA,CACA,4DAAA,CACA,oDAAA,CAIR,kCACI,KACI,8BAAA,CACA,sBAAA,CAGJ,GACI,gCAAA,CACA,wBAAA,CAAA","sourcesContent":[".loader {\n position: absolute;\n z-index: 1;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n background: var(--loader-background, black);\n\n .loader__refresh-btn {\n color: white;\n cursor: pointer;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate3d(-50%, -50%, 0);\n pointer-events: auto;\n padding: 20px;\n width: 32px;\n height: 32px;\n box-sizing: content-box;\n }\n\n .loader__spinner {\n -ms-flex-negative: 0;\n flex-shrink: 0;\n display: inline-block;\n width: 32px;\n height: 32px;\n border-radius: 50%;\n border: solid 2px var(--loaderBackgroundColor, white);\n border-color: var(--loaderBackgroundAccentColor, transparent) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white);\n -webkit-animation: loading-spinner .6s infinite linear;\n animation: loading-spinner .6s infinite linear;\n }\n}\n\n@keyframes loading-spinner {\n from {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n\n to {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}"],"sourceRoot":""}]);
906
+ ___CSS_LOADER_EXPORT___.push([module.id, ".loader--O0iuj{position:absolute;z-index:10001;top:0;bottom:0;left:0;right:0;display:flex;justify-content:center;align-items:center;background:var(--loader-background, black)}.loader--O0iuj .loader__refresh-btn--RtExV{color:#fff;cursor:pointer;position:absolute;left:50%;top:50%;transform:translate3d(-50%, -50%, 0);pointer-events:auto;padding:20px;width:32px;height:32px;box-sizing:content-box}.loader--O0iuj .loader__spinner--cKqH0{-ms-flex-negative:0;flex-shrink:0;display:inline-block;width:32px;height:32px;border-radius:50%;border:solid 2px var(--loaderBackgroundColor, white);border-color:var(--loaderBackgroundAccentColor, transparent) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white);-webkit-animation:loading-spinner--7I4aU .6s infinite linear;animation:loading-spinner--7I4aU .6s infinite linear}@keyframes loading-spinner--7I4aU{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}", "",{"version":3,"sources":["webpack://./src/UI/Loader/loader.module.scss"],"names":[],"mappings":"AAAA,eACI,iBAAA,CACA,aAAA,CACA,KAAA,CACA,QAAA,CACA,MAAA,CACA,OAAA,CACA,YAAA,CACA,sBAAA,CACA,kBAAA,CACA,0CAAA,CAEA,2CACI,UAAA,CACA,cAAA,CACA,iBAAA,CACA,QAAA,CACA,OAAA,CACA,oCAAA,CACA,mBAAA,CACA,YAAA,CACA,UAAA,CACA,WAAA,CACA,sBAAA,CAGJ,uCACI,mBAAA,CACA,aAAA,CACA,oBAAA,CACA,UAAA,CACA,WAAA,CACA,iBAAA,CACA,oDAAA,CACA,wKAAA,CACA,4DAAA,CACA,oDAAA,CAIR,kCACI,KACI,8BAAA,CACA,sBAAA,CAGJ,GACI,gCAAA,CACA,wBAAA,CAAA","sourcesContent":[".loader {\n position: absolute;\n z-index: 10001;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n background: var(--loader-background, black);\n\n .loader__refresh-btn {\n color: white;\n cursor: pointer;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate3d(-50%, -50%, 0);\n pointer-events: auto;\n padding: 20px;\n width: 32px;\n height: 32px;\n box-sizing: content-box;\n }\n\n .loader__spinner {\n -ms-flex-negative: 0;\n flex-shrink: 0;\n display: inline-block;\n width: 32px;\n height: 32px;\n border-radius: 50%;\n border: solid 2px var(--loaderBackgroundColor, white);\n border-color: var(--loaderBackgroundAccentColor, transparent) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white);\n -webkit-animation: loading-spinner .6s infinite linear;\n animation: loading-spinner .6s infinite linear;\n }\n}\n\n@keyframes loading-spinner {\n from {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n\n to {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}"],"sourceRoot":""}]);
908
907
  // Exports
909
908
  ___CSS_LOADER_EXPORT___.locals = {
910
909
  "loader": "loader--O0iuj",
@@ -5706,26 +5705,6 @@ let Story = (() => {
5706
5705
  get wasShown() {
5707
5706
  return this._wasShown;
5708
5707
  }
5709
- getImagesPerSlide(index) {
5710
- var _b, _c;
5711
- this.parseHtmlSlidesForMainImage();
5712
- return (_c = (_b = this._parsedSlideImage) === null || _b === void 0 ? void 0 : _b[index]) !== null && _c !== void 0 ? _c : null;
5713
- }
5714
- parseHtmlSlidesForMainImage() {
5715
- if (this._parsedSlideImage || !this.slidesLoaded)
5716
- return;
5717
- this._parsedSlideImage = this._slides.map((slide) => this.parseSlideNarrativeImageSrc(slide.html) ||
5718
- this.parseSlideNarrativeVideoPosterSrc(slide.html) ||
5719
- null);
5720
- }
5721
- parseSlideNarrativeImageSrc(slideHtml) {
5722
- const results = slideHtml.match(/<[^<]*narrative-element-image.*<img[^<]*src="([^"]*)"[^<]*>/i);
5723
- return results === null || results === void 0 ? void 0 : results[1];
5724
- }
5725
- parseSlideNarrativeVideoPosterSrc(slideHtml) {
5726
- const results = slideHtml.match(/<[^<]*narrative-element-video.*<video[^<]*poster\-remote\-src="([^"]*)"[^<]*>/i);
5727
- return results === null || results === void 0 ? void 0 : results[1];
5728
- }
5729
5708
  get videoCover() {
5730
5709
  return this._videoCover;
5731
5710
  }
@@ -7962,12 +7941,6 @@ let SharePanelViewModel = (() => {
7962
7941
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/sharePanelViewModel/index.ts
7963
7942
 
7964
7943
 
7965
- ;// CONCATENATED MODULE: external "async-mutex"
7966
- var external_async_mutex_x = (y) => {
7967
- var x = {}; __webpack_require__.d(x, y); return x
7968
- }
7969
- var external_async_mutex_y = (x) => (() => (x))
7970
- const external_async_mutex_namespaceObject = external_async_mutex_x({ ["Mutex"]: () => (__WEBPACK_EXTERNAL_MODULE_async_mutex_052338b1__.Mutex), ["Semaphore"]: () => (__WEBPACK_EXTERNAL_MODULE_async_mutex_052338b1__.Semaphore) });
7971
7944
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storySlideViewModel/storySlideViewModel.ts
7972
7945
  var storySlideViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
7973
7946
  var useValue = arguments.length > 2;
@@ -8017,21 +7990,35 @@ var storySlideViewModel_classPrivateFieldSet = (undefined && undefined.__classPr
8017
7990
 
8018
7991
 
8019
7992
 
8020
-
8021
7993
  const SWIPE_UP_THRESHOLD = 10;
8022
7994
  const SLIDE_CLICK_THRESHOLD = 0.3;
8023
7995
  const SHOW_SLIDE_TIMEOUT = 500;
8024
7996
  const STORY_LOADER_TIMEOUT = 500;
7997
+ var StorySlideEmodji;
7998
+ (function (StorySlideEmodji) {
7999
+ StorySlideEmodji["Init"] = "\uD83D\uDD27";
8000
+ StorySlideEmodji["Start"] = "\uD83D\uDE80";
8001
+ StorySlideEmodji["Pause"] = "\u23F8\uFE0F";
8002
+ StorySlideEmodji["Resume"] = "\u21A9\uFE0F";
8003
+ StorySlideEmodji["Stop"] = "\uD83D\uDED1";
8004
+ StorySlideEmodji["Destroy"] = "\uD83D\uDDD1\uFE0F";
8005
+ StorySlideEmodji["Restart"] = "\uD83D\uDD04";
8006
+ })(StorySlideEmodji || (StorySlideEmodji = {}));
8025
8007
  let StorySlideViewModel = (() => {
8026
- var _a, _StorySlideViewModel__disabledNextClick_accessor_storage;
8008
+ var _a, _StorySlideViewModel__disabledNextClick_accessor_storage, _StorySlideViewModel__cover_accessor_storage;
8027
8009
  let _instanceExtraInitializers = [];
8028
8010
  let __disabledNextClick_decorators;
8029
8011
  let __disabledNextClick_initializers = [];
8030
8012
  let __disabledNextClick_extraInitializers = [];
8031
- let _start_decorators;
8013
+ let __cover_decorators;
8014
+ let __cover_initializers = [];
8015
+ let __cover_extraInitializers = [];
8016
+ let _commit_decorators;
8032
8017
  return _a = class StorySlideViewModel {
8033
8018
  get _disabledNextClick() { return storySlideViewModel_classPrivateFieldGet(this, _StorySlideViewModel__disabledNextClick_accessor_storage, "f"); }
8034
8019
  set _disabledNextClick(value) { storySlideViewModel_classPrivateFieldSet(this, _StorySlideViewModel__disabledNextClick_accessor_storage, value, "f"); }
8020
+ get _cover() { return storySlideViewModel_classPrivateFieldGet(this, _StorySlideViewModel__cover_accessor_storage, "f"); }
8021
+ set _cover(value) { storySlideViewModel_classPrivateFieldSet(this, _StorySlideViewModel__cover_accessor_storage, value, "f"); }
8035
8022
  constructor(_story, _index, slideApi, slide, cacheManager) {
8036
8023
  Object.defineProperty(this, "_story", {
8037
8024
  enumerable: true,
@@ -8064,35 +8051,28 @@ let StorySlideViewModel = (() => {
8064
8051
  value: cacheManager
8065
8052
  });
8066
8053
  _StorySlideViewModel__disabledNextClick_accessor_storage.set(this, storySlideViewModel_runInitializers(this, __disabledNextClick_initializers, false));
8067
- Object.defineProperty(this, "mutex", {
8068
- enumerable: true,
8069
- configurable: true,
8070
- writable: true,
8071
- value: (storySlideViewModel_runInitializers(this, __disabledNextClick_extraInitializers), new external_async_mutex_namespaceObject.Mutex())
8072
- });
8073
- Object.defineProperty(this, "isInited", {
8074
- enumerable: true,
8075
- configurable: true,
8076
- writable: true,
8077
- value: false
8078
- });
8079
- Object.defineProperty(this, "isStarted", {
8054
+ _StorySlideViewModel__cover_accessor_storage.set(this, (storySlideViewModel_runInitializers(this, __disabledNextClick_extraInitializers), storySlideViewModel_runInitializers(this, __cover_initializers, null)));
8055
+ Object.defineProperty(this, "preloaded", {
8080
8056
  enumerable: true,
8081
8057
  configurable: true,
8082
8058
  writable: true,
8083
- value: false
8059
+ value: (storySlideViewModel_runInitializers(this, __cover_extraInitializers), false)
8084
8060
  });
8085
- Object.defineProperty(this, "preloaded", {
8061
+ Object.defineProperty(this, "isPreloading", {
8086
8062
  enumerable: true,
8087
8063
  configurable: true,
8088
8064
  writable: true,
8089
8065
  value: false
8090
8066
  });
8091
- Object.defineProperty(this, "isPreloading", {
8067
+ Object.defineProperty(this, "state", {
8092
8068
  enumerable: true,
8093
8069
  configurable: true,
8094
8070
  writable: true,
8095
- value: false
8071
+ value: external_mobx_namespaceObject.observable.object({
8072
+ inited: false,
8073
+ started: false,
8074
+ paused: false
8075
+ })
8096
8076
  });
8097
8077
  Object.defineProperty(this, "handleTouchEnd", {
8098
8078
  enumerable: true,
@@ -8133,6 +8113,9 @@ let StorySlideViewModel = (() => {
8133
8113
  get disabledNextClick() {
8134
8114
  return this._disabledNextClick;
8135
8115
  }
8116
+ get cover() {
8117
+ return this._cover;
8118
+ }
8136
8119
  mute() {
8137
8120
  this.slideApi.disableAudio();
8138
8121
  }
@@ -8152,8 +8135,7 @@ let StorySlideViewModel = (() => {
8152
8135
  this.slideApi.setWidgetGoodsComplete(elementId);
8153
8136
  }
8154
8137
  async init() {
8155
- const release = await this.mutex.acquire();
8156
- if (this.isInited)
8138
+ if (this.state.inited)
8157
8139
  return;
8158
8140
  let loaderShown = this.story.needShowLoaderScreen;
8159
8141
  let startTime = Date.now();
@@ -8162,12 +8144,12 @@ let StorySlideViewModel = (() => {
8162
8144
  loaderShown = true;
8163
8145
  startTime = Date.now();
8164
8146
  }, SHOW_SLIDE_TIMEOUT);
8147
+ let result = false;
8165
8148
  try {
8166
- debug(`[SLIDE][INIT]:${this.story.id}:${this.slide.index}`);
8167
- const { result, reason } = await this.slideApi.showSlide(this.html);
8168
- if (!result)
8169
- throw new Error(reason);
8170
- this.isInited = true;
8149
+ const data = await this.slideApi.showSlide(this.html);
8150
+ result = data.result;
8151
+ if (!data.result)
8152
+ throw new Error(data.reason);
8171
8153
  }
8172
8154
  catch (error) {
8173
8155
  this.handleSlideError(error);
@@ -8175,124 +8157,112 @@ let StorySlideViewModel = (() => {
8175
8157
  finally {
8176
8158
  clearTimeout(loaderTimeout);
8177
8159
  await this.cleanupLoaderIfNeeded(Date.now() - startTime, loaderShown);
8178
- release();
8160
+ if (result)
8161
+ this._cover = this.getCoverByLayer();
8179
8162
  }
8163
+ this.commit({ inited: true });
8164
+ this.debug(`${StorySlideEmodji.Init} [Slide Lifecycle] inited: `);
8180
8165
  }
8181
8166
  async start() {
8182
- const release = await this.mutex.acquire();
8167
+ if (!this.state.inited || this.state.started)
8168
+ return;
8183
8169
  try {
8184
- if (!this.isInited || this.isStarted)
8185
- return;
8186
- debug(`[SLIDE][START]:${this.story.id}:${this.slide.index}`);
8187
8170
  await this.slideApi.slideStart({ muted: this._story.muted });
8188
8171
  this.story.touchController.on(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8189
- this.isStarted = true;
8190
8172
  }
8191
8173
  catch (error) {
8192
8174
  this.handleSlideError(error);
8193
8175
  }
8194
- finally {
8195
- release();
8196
- }
8176
+ this.commit({ started: true });
8177
+ this.debug(`${StorySlideEmodji.Start} [Slide Lifecycle] started: `);
8197
8178
  }
8198
8179
  async restart() {
8199
- const release = await this.mutex.acquire();
8200
8180
  try {
8201
8181
  this.story.hideErrorScreen();
8202
8182
  this.story.showLoaderScreen();
8203
8183
  await this.slideApi.slideRestart({ muted: this._story.muted });
8204
- this.isInited = true;
8205
- this.isStarted = true;
8184
+ this.commit({ inited: true, started: true, paused: false });
8206
8185
  }
8207
8186
  catch (error) {
8208
8187
  this.handleSlideError(error);
8209
8188
  }
8210
8189
  finally {
8211
8190
  this.story.hideLoaderScreen();
8212
- release();
8213
8191
  }
8192
+ this.debug(`${StorySlideEmodji.Restart} [Slide Lifecycle] restarted: `);
8214
8193
  }
8215
8194
  async resumeByApp() {
8216
- const release = await this.mutex.acquire();
8195
+ if (!this.state.paused)
8196
+ return;
8217
8197
  try {
8218
- if (!this.isStarted)
8219
- return;
8220
- debug(`[SLIDE][RESUME-BY-APP]:${this.story.id}:${this.slide.index}`);
8221
8198
  await this.slideApi.slideAppResume();
8222
8199
  }
8223
8200
  catch (error) {
8224
8201
  this.handleSlideError(error);
8225
8202
  }
8226
- finally {
8227
- release();
8228
- }
8203
+ this.commit({ paused: false });
8204
+ this.debug(`${StorySlideEmodji.Resume} [Slide Lifecycle] resume by app: `);
8229
8205
  }
8230
8206
  async pauseByApp() {
8231
- const release = await this.mutex.acquire();
8207
+ if (this.state.paused)
8208
+ return;
8232
8209
  try {
8233
- if (!this.isStarted)
8234
- return;
8235
- debug(`[SLIDE][PAUSE-BY-APP]:${this.story.id}:${this.slide.index}`);
8236
8210
  await this.slideApi.slideAppPause();
8237
8211
  }
8238
8212
  catch (error) {
8239
8213
  this.handleSlideError(error);
8240
8214
  }
8241
- finally {
8242
- release();
8243
- }
8215
+ this.debug(`${StorySlideEmodji.Pause} [Slide Lifecycle] pause by app: `);
8216
+ this.commit({ paused: true });
8244
8217
  }
8245
8218
  async resumeByUser() {
8246
- const release = await this.mutex.acquire();
8219
+ if (!this.state.paused)
8220
+ return;
8247
8221
  try {
8248
- if (!this.isStarted)
8249
- return;
8250
- debug(`[SLIDE][RESUME-BY-USER]:${this.story.id}:${this.slide.index}`);
8251
8222
  await this.slideApi.slideUserResume();
8252
8223
  }
8253
8224
  catch (error) {
8254
8225
  this.handleSlideError(error);
8255
8226
  }
8256
- finally {
8257
- release();
8258
- }
8227
+ this.commit({ paused: false });
8228
+ this.debug(`${StorySlideEmodji.Resume} [Slide Lifecycle] resume by user: `);
8259
8229
  }
8260
8230
  async pauseByUser() {
8261
- const release = await this.mutex.acquire();
8231
+ if (this.state.paused)
8232
+ return;
8262
8233
  try {
8263
- if (!this.isStarted)
8264
- return;
8265
- debug(`[SLIDE][PAUSE-BY-USER]:${this.story.id}:${this.slide.index}`);
8266
8234
  await this.slideApi.slideUserPause();
8267
8235
  }
8268
8236
  catch (error) {
8269
8237
  this.handleSlideError(error);
8270
8238
  }
8271
- finally {
8272
- release();
8273
- }
8239
+ this.commit({ paused: true });
8240
+ this.debug(`${StorySlideEmodji.Pause} [Slide Lifecycle] pause by user: `);
8274
8241
  }
8275
8242
  async stop(params) {
8276
- const release = await this.mutex.acquire();
8243
+ if (!this.state.started)
8244
+ return;
8245
+ await this.stopAndCleanup(params);
8246
+ if (params.prepareForRestart === 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */) {
8247
+ this.commit({ started: false, paused: false });
8248
+ }
8249
+ else {
8250
+ this.commit({ started: false, inited: false, paused: false });
8251
+ }
8252
+ this.debug(`${StorySlideEmodji.Stop} [Slide Lifecycle] stopped: `);
8253
+ }
8254
+ async stopAndCleanup(params) {
8277
8255
  try {
8278
- if (!this.isInited || !this.isStarted)
8279
- return;
8280
- debug(`[SLIDE][STOP]:${this.story.id}:${this.slide.index}`);
8256
+ this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8281
8257
  await this.slideApi.slideStop(params);
8282
8258
  }
8283
8259
  catch (error) {
8284
8260
  this.handleSlideError(error);
8285
8261
  }
8286
- finally {
8287
- this.isStarted = false;
8288
- if (params.prepareForRestart === 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */)
8289
- this.isInited = false;
8290
- this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8291
- release();
8292
- }
8293
8262
  }
8294
8263
  showLayerByIndex(index) {
8295
8264
  this.slideApi.showLayer(index);
8265
+ this._cover = this.getCoverByLayer();
8296
8266
  }
8297
8267
  canGoNext() {
8298
8268
  const { canClickNext } = this.slideApi.slideClickHandler(null, "forward");
@@ -8335,20 +8305,17 @@ let StorySlideViewModel = (() => {
8335
8305
  }
8336
8306
  }
8337
8307
  async destroy() {
8338
- const release = await this.mutex.acquire();
8339
8308
  try {
8340
- this.isStarted = false;
8341
- this.isInited = false;
8342
- this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8343
8309
  if (this.cacheManager)
8344
8310
  this.slide.restoreOriginalResourceUrls();
8311
+ this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8312
+ this.commit({ inited: false, started: false, paused: false });
8313
+ this.debug(`${StorySlideEmodji.Destroy} [Slide Lifecycle] destroyed: `);
8314
+ await this.slideApi.slideStop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ });
8345
8315
  }
8346
8316
  catch (error) {
8347
8317
  console.error(error);
8348
8318
  }
8349
- finally {
8350
- release();
8351
- }
8352
8319
  }
8353
8320
  getNavigationDirection(event, currentTarget) {
8354
8321
  const xPercent = this.getClickPosition(event, currentTarget);
@@ -8392,14 +8359,37 @@ let StorySlideViewModel = (() => {
8392
8359
  this.story.hideLoaderScreen();
8393
8360
  }
8394
8361
  }
8362
+ getCoverByLayer() {
8363
+ var _b, _c;
8364
+ const activeLayer = this.slideApi.activeLayer.nodeRef;
8365
+ const imageSrc = (_b = activeLayer.querySelector(".narrative-element-image img")) === null || _b === void 0 ? void 0 : _b.src;
8366
+ const videoPosterSrc = (_c = activeLayer.querySelector(".narrative-element-video video")) === null || _c === void 0 ? void 0 : _c.getAttribute("poster-remote-src");
8367
+ return imageSrc || videoPosterSrc || null;
8368
+ }
8369
+ commit(partial) {
8370
+ Object.assign(this.state, partial);
8371
+ if (!this.state.inited) {
8372
+ this.state.started = false;
8373
+ this.state.paused = false;
8374
+ }
8375
+ if (!this.state.started) {
8376
+ this.state.paused = false;
8377
+ }
8378
+ }
8379
+ debug(message) {
8380
+ debug(message, { cardId: this.story.id, slideIndex: this.index });
8381
+ }
8395
8382
  },
8396
8383
  _StorySlideViewModel__disabledNextClick_accessor_storage = new WeakMap(),
8384
+ _StorySlideViewModel__cover_accessor_storage = new WeakMap(),
8397
8385
  (() => {
8398
8386
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
8399
8387
  __disabledNextClick_decorators = [external_mobx_namespaceObject.observable];
8400
- _start_decorators = [noConcurrent];
8388
+ __cover_decorators = [external_mobx_namespaceObject.observable];
8389
+ _commit_decorators = [external_mobx_namespaceObject.action];
8401
8390
  storySlideViewModel_esDecorate(_a, null, __disabledNextClick_decorators, { kind: "accessor", name: "_disabledNextClick", static: false, private: false, access: { has: obj => "_disabledNextClick" in obj, get: obj => obj._disabledNextClick, set: (obj, value) => { obj._disabledNextClick = value; } }, metadata: _metadata }, __disabledNextClick_initializers, __disabledNextClick_extraInitializers);
8402
- storySlideViewModel_esDecorate(_a, null, _start_decorators, { kind: "method", name: "start", static: false, private: false, access: { has: obj => "start" in obj, get: obj => obj.start }, metadata: _metadata }, null, _instanceExtraInitializers);
8391
+ storySlideViewModel_esDecorate(_a, null, __cover_decorators, { kind: "accessor", name: "_cover", static: false, private: false, access: { has: obj => "_cover" in obj, get: obj => obj._cover, set: (obj, value) => { obj._cover = value; } }, metadata: _metadata }, __cover_initializers, __cover_extraInitializers);
8392
+ storySlideViewModel_esDecorate(_a, null, _commit_decorators, { kind: "method", name: "commit", static: false, private: false, access: { has: obj => "commit" in obj, get: obj => obj.commit }, metadata: _metadata }, null, _instanceExtraInitializers);
8403
8393
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
8404
8394
  })(),
8405
8395
  _a;
@@ -9637,6 +9627,12 @@ let TextInputViewModel = (() => {
9637
9627
  const SLIDE_RATIO = 310 / 480;
9638
9628
  const MOBILE_ASPECT_RATIO = 428 / 805;
9639
9629
 
9630
+ ;// CONCATENATED MODULE: external "async-mutex"
9631
+ var external_async_mutex_x = (y) => {
9632
+ var x = {}; __webpack_require__.d(x, y); return x
9633
+ }
9634
+ var external_async_mutex_y = (x) => (() => (x))
9635
+ const external_async_mutex_namespaceObject = external_async_mutex_x({ ["Mutex"]: () => (__WEBPACK_EXTERNAL_MODULE_async_mutex_052338b1__.Mutex), ["Semaphore"]: () => (__WEBPACK_EXTERNAL_MODULE_async_mutex_052338b1__.Semaphore) });
9640
9636
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyViewModel/storyViewModel.ts
9641
9637
  var storyViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
9642
9638
  var useValue = arguments.length > 2;
@@ -9700,11 +9696,22 @@ var storyViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivate
9700
9696
 
9701
9697
  var StoryEvent;
9702
9698
  (function (StoryEvent) {
9703
- StoryEvent["ShowToast"] = "showToast";
9699
+ StoryEvent["Started"] = "started";
9704
9700
  })(StoryEvent || (StoryEvent = {}));
9701
+ var StoryEmodji;
9702
+ (function (StoryEmodji) {
9703
+ StoryEmodji["Prefetch"] = "\uD83D\uDD04";
9704
+ StoryEmodji["Init"] = "\uD83D\uDD27";
9705
+ StoryEmodji["Start"] = "\uD83D\uDFE2";
9706
+ StoryEmodji["Stop"] = "\uD83D\uDED1";
9707
+ StoryEmodji["Attach"] = "\uD83D\uDD17";
9708
+ StoryEmodji["Detach"] = "\uD83D\uDDD1\uFE0F";
9709
+ })(StoryEmodji || (StoryEmodji = {}));
9705
9710
  const ACTIVE_SLIDE_PRELOAD_PRIORITY = 1000;
9711
+ const ACTIVE_STORY_PRELOAD_PRIORITY = 1000;
9712
+ const NON_ACTIVE_STORY_PRELOAD_PRIORITY = 0;
9706
9713
  let StoryViewModel = (() => {
9707
- var _a, _StoryViewModel__activeSlideIndex_accessor_storage, _StoryViewModel__slides_accessor_storage, _StoryViewModel__needShowErrorScreen_accessor_storage, _StoryViewModel__needShowLoaderScreen_accessor_storage, _StoryViewModel__$root_accessor_storage, _StoryViewModel_isInited_accessor_storage;
9714
+ var _a, _StoryViewModel__activeSlideIndex_accessor_storage, _StoryViewModel__slides_accessor_storage, _StoryViewModel__needShowErrorScreen_accessor_storage, _StoryViewModel__needShowLoaderScreen_accessor_storage, _StoryViewModel__$root_accessor_storage;
9708
9715
  var _b;
9709
9716
  let _classSuper = ViewModel;
9710
9717
  let _instanceExtraInitializers = [];
@@ -9723,13 +9730,9 @@ let StoryViewModel = (() => {
9723
9730
  let __$root_decorators;
9724
9731
  let __$root_initializers = [];
9725
9732
  let __$root_extraInitializers = [];
9726
- let _isInited_decorators;
9727
- let _isInited_initializers = [];
9728
- let _isInited_extraInitializers = [];
9729
9733
  let _get_needShowErrorScreen_decorators;
9730
9734
  let _get_needShowLoaderScreen_decorators;
9731
9735
  let _get_activeSlide_decorators;
9732
- let _get_displayedSlideImage_decorators;
9733
9736
  let _get_reachEnd_decorators;
9734
9737
  let _get_reachStart_decorators;
9735
9738
  let _get_pauseState_decorators;
@@ -9742,6 +9745,7 @@ let StoryViewModel = (() => {
9742
9745
  let _showSlide_decorators;
9743
9746
  let _markAsOpened_decorators;
9744
9747
  let _markWasShown_decorators;
9748
+ let _commit_decorators;
9745
9749
  return _a = class StoryViewModel extends _classSuper {
9746
9750
  get _activeSlideIndex() { return storyViewModel_classPrivateFieldGet(this, _StoryViewModel__activeSlideIndex_accessor_storage, "f"); }
9747
9751
  set _activeSlideIndex(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__activeSlideIndex_accessor_storage, value, "f"); }
@@ -9753,9 +9757,7 @@ let StoryViewModel = (() => {
9753
9757
  set _needShowLoaderScreen(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__needShowLoaderScreen_accessor_storage, value, "f"); }
9754
9758
  get _$root() { return storyViewModel_classPrivateFieldGet(this, _StoryViewModel__$root_accessor_storage, "f"); }
9755
9759
  set _$root(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__$root_accessor_storage, value, "f"); }
9756
- get isInited() { return storyViewModel_classPrivateFieldGet(this, _StoryViewModel_isInited_accessor_storage, "f"); }
9757
- set isInited(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel_isInited_accessor_storage, value, "f"); }
9758
- constructor(storyManager, storyReader, story, storySlideApiHandlersFactory, storyReaderStatisticV1Service, storyReaderStatisticV2Service, cacheManager) {
9760
+ constructor(storyManager, storyReader, story, storySlideApiHandlersFactory, statisticV1Service, statisticV2Service, cacheManager) {
9759
9761
  super();
9760
9762
  Object.defineProperty(this, "storyManager", {
9761
9763
  enumerable: true,
@@ -9781,17 +9783,17 @@ let StoryViewModel = (() => {
9781
9783
  writable: true,
9782
9784
  value: storySlideApiHandlersFactory
9783
9785
  });
9784
- Object.defineProperty(this, "storyReaderStatisticV1Service", {
9786
+ Object.defineProperty(this, "statisticV1Service", {
9785
9787
  enumerable: true,
9786
9788
  configurable: true,
9787
9789
  writable: true,
9788
- value: storyReaderStatisticV1Service
9790
+ value: statisticV1Service
9789
9791
  });
9790
- Object.defineProperty(this, "storyReaderStatisticV2Service", {
9792
+ Object.defineProperty(this, "statisticV2Service", {
9791
9793
  enumerable: true,
9792
9794
  configurable: true,
9793
9795
  writable: true,
9794
- value: storyReaderStatisticV2Service
9796
+ value: statisticV2Service
9795
9797
  });
9796
9798
  Object.defineProperty(this, "cacheManager", {
9797
9799
  enumerable: true,
@@ -9804,24 +9806,11 @@ let StoryViewModel = (() => {
9804
9806
  _StoryViewModel__needShowErrorScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __slides_extraInitializers), storyViewModel_runInitializers(this, __needShowErrorScreen_initializers, false)));
9805
9807
  _StoryViewModel__needShowLoaderScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowErrorScreen_extraInitializers), storyViewModel_runInitializers(this, __needShowLoaderScreen_initializers, false)));
9806
9808
  _StoryViewModel__$root_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowLoaderScreen_extraInitializers), storyViewModel_runInitializers(this, __$root_initializers, null)));
9807
- _StoryViewModel_isInited_accessor_storage.set(this, (storyViewModel_runInitializers(this, __$root_extraInitializers), storyViewModel_runInitializers(this, _isInited_initializers, false)));
9808
- Object.defineProperty(this, "isStarted", {
9809
- enumerable: true,
9810
- configurable: true,
9811
- writable: true,
9812
- value: (storyViewModel_runInitializers(this, _isInited_extraInitializers), false)
9813
- });
9814
9809
  Object.defineProperty(this, "_activeSlideStartTime", {
9815
9810
  enumerable: true,
9816
9811
  configurable: true,
9817
9812
  writable: true,
9818
- value: 0
9819
- });
9820
- Object.defineProperty(this, "mutex", {
9821
- enumerable: true,
9822
- configurable: true,
9823
- writable: true,
9824
- value: new external_async_mutex_namespaceObject.Mutex()
9813
+ value: (storyViewModel_runInitializers(this, __$root_extraInitializers), 0)
9825
9814
  });
9826
9815
  // internal services
9827
9816
  Object.defineProperty(this, "slideApi", {
@@ -9836,12 +9825,6 @@ let StoryViewModel = (() => {
9836
9825
  writable: true,
9837
9826
  value: void 0
9838
9827
  });
9839
- Object.defineProperty(this, "storySlidesReactionDisposer", {
9840
- enumerable: true,
9841
- configurable: true,
9842
- writable: true,
9843
- value: void 0
9844
- });
9845
9828
  // UI
9846
9829
  Object.defineProperty(this, "timeline", {
9847
9830
  enumerable: true,
@@ -9885,23 +9868,37 @@ let StoryViewModel = (() => {
9885
9868
  writable: true,
9886
9869
  value: void 0
9887
9870
  });
9871
+ Object.defineProperty(this, "mutex", {
9872
+ enumerable: true,
9873
+ configurable: true,
9874
+ writable: true,
9875
+ value: new external_async_mutex_namespaceObject.Mutex()
9876
+ });
9888
9877
  Object.defineProperty(this, "toast", {
9889
9878
  enumerable: true,
9890
9879
  configurable: true,
9891
9880
  writable: true,
9892
9881
  value: null
9893
9882
  });
9894
- Object.defineProperty(this, "attachRoot", {
9883
+ Object.defineProperty(this, "state", {
9895
9884
  enumerable: true,
9896
9885
  configurable: true,
9897
9886
  writable: true,
9898
- value: async (el) => {
9899
- this._$root = el;
9900
- // Reaction to `layout` (modern or classic) change
9901
- // TODO: add test with example
9902
- await this.reinit();
9903
- await this.restart();
9904
- }
9887
+ value: external_mobx_namespaceObject.observable.object({
9888
+ attached: false,
9889
+ inited: false,
9890
+ started: false,
9891
+ prefetched: false
9892
+ })
9893
+ });
9894
+ /**
9895
+ * The story content are loaded at the time the instance is created (e.g. when the story reader is reopened)
9896
+ */
9897
+ Object.defineProperty(this, "isLoaded", {
9898
+ enumerable: true,
9899
+ configurable: true,
9900
+ writable: true,
9901
+ value: false
9905
9902
  });
9906
9903
  Object.defineProperty(this, "handleKeydown", {
9907
9904
  enumerable: true,
@@ -9926,18 +9923,20 @@ let StoryViewModel = (() => {
9926
9923
  this.pauseManager = new StoryPauseManager(this);
9927
9924
  this.touchController = this.storyReader.touchController;
9928
9925
  this.slideApiHandlers = this.storySlideApiHandlersFactory.create(this);
9929
- this.goodsWidget = new StoryGoodsWidgetViewModel(this.storyManager, this, this.storyReaderStatisticV2Service);
9930
- this.textInput = new TextInputViewModel(this, this.storyReaderStatisticV2Service);
9926
+ this.goodsWidget = new StoryGoodsWidgetViewModel(this.storyManager, this, this.statisticV2Service);
9927
+ this.textInput = new TextInputViewModel(this, this.statisticV2Service);
9931
9928
  this.timeline = new StoryTimelineViewModel(this);
9932
9929
  this.sharePanel = new SharePanelViewModel(this.storyManager, this, this.storyReader.touchController);
9933
- this.actionPanel = new StoryActionPanelViewModel(this.storyManager, this, this.sharePanel, this.storyReaderStatisticV2Service);
9934
- this.storySlidesReactionDisposer = this.observeStorySlides();
9930
+ this.actionPanel = new StoryActionPanelViewModel(this.storyManager, this, this.sharePanel, this.statisticV2Service);
9931
+ this.isLoaded = this.story.canBeShown && Boolean(this.story.slides.length > 0);
9935
9932
  }
9936
9933
  get needShowErrorScreen() {
9937
9934
  return this._needShowErrorScreen || Boolean(this.error);
9938
9935
  }
9939
9936
  get needShowLoaderScreen() {
9940
- return !this.story.canBeShown || this._needShowLoaderScreen;
9937
+ if (this.isLoaded)
9938
+ return !this.slides.length || this._needShowLoaderScreen;
9939
+ return !this.slides.length || !this.state.inited || this._needShowLoaderScreen;
9941
9940
  }
9942
9941
  get id() {
9943
9942
  return this.story.id;
@@ -9960,9 +9959,6 @@ let StoryViewModel = (() => {
9960
9959
  get displayStrategy() {
9961
9960
  return this.storyReader.displayStrategy;
9962
9961
  }
9963
- get canBeShown() {
9964
- return this.story.canBeShown && this.slides.length > 0 && Boolean(this._$root);
9965
- }
9966
9962
  get context() {
9967
9963
  return this.story.context;
9968
9964
  }
@@ -9987,9 +9983,6 @@ let StoryViewModel = (() => {
9987
9983
  get slidesCount() {
9988
9984
  return this.story.slidesCount;
9989
9985
  }
9990
- get displayedSlideImage() {
9991
- return this.story.getImagesPerSlide(this.activeSlideIndex);
9992
- }
9993
9986
  get reachEnd() {
9994
9987
  return this.slides.length === 0 || this.activeSlideIndex === this.slides.length - 1;
9995
9988
  }
@@ -10019,7 +10012,10 @@ let StoryViewModel = (() => {
10019
10012
  return this.storyReader.dir;
10020
10013
  }
10021
10014
  get isSlideRendered() {
10022
- return this.isInited;
10015
+ return this.state.inited;
10016
+ }
10017
+ get cover() {
10018
+ return this.activeSlide.cover;
10023
10019
  }
10024
10020
  get isNextDisabled() {
10025
10021
  return ((this.storyReader.reachEnd && this.reachEnd) ||
@@ -10076,6 +10072,8 @@ let StoryViewModel = (() => {
10076
10072
  }
10077
10073
  setError(error) {
10078
10074
  this.story.setError(error);
10075
+ if (error)
10076
+ this.handleStoryError(error);
10079
10077
  }
10080
10078
  async reset() {
10081
10079
  this.textInput.close();
@@ -10092,7 +10090,7 @@ let StoryViewModel = (() => {
10092
10090
  }
10093
10091
  async prevSlideOrStory() {
10094
10092
  if (this.reachStart && this.storyReader.reachStart) {
10095
- if (!this.isStarted)
10093
+ if (!this.state.started)
10096
10094
  return;
10097
10095
  await this.activeSlide.restart();
10098
10096
  return;
@@ -10110,6 +10108,17 @@ let StoryViewModel = (() => {
10110
10108
  this.storyReader.unmute();
10111
10109
  this.activeSlide.unmute();
10112
10110
  }
10111
+ showLayer(index) {
10112
+ var _b;
10113
+ this.statisticV2Service.sendSlideLayout({
10114
+ layoutIndex: index,
10115
+ storyId: this.id,
10116
+ activeSlideIndex: this.activeSlideIndex,
10117
+ feedSlug: (_b = this.feed) === null || _b === void 0 ? void 0 : _b.slug
10118
+ });
10119
+ this.resumeUser();
10120
+ this.activeSlide.showLayerByIndex(index);
10121
+ }
10113
10122
  pauseUser() {
10114
10123
  if (this.timeline.paused)
10115
10124
  return;
@@ -10140,22 +10149,56 @@ let StoryViewModel = (() => {
10140
10149
  async updateNarrativeData(data) {
10141
10150
  await this.storyManager.rootStore.storyStore.updateNarrativeData(this.id, data);
10142
10151
  }
10143
- detachRoot() {
10144
- var _b;
10152
+ async detach(ui) {
10153
+ var _b, _c;
10154
+ if (ui.container || !this.state.attached)
10155
+ return;
10145
10156
  this._$root = null;
10146
- const isInited = this.isInited;
10147
- const isStarted = this.isStarted;
10148
- this.stop();
10149
- (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
10157
+ (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
10158
+ this.slideApiHandlers.clearNarrativeSessionDataCache();
10159
+ this.resumeAll();
10160
+ document.removeEventListener("visibilitychange", this.handleVisibilityChange);
10161
+ document.removeEventListener("keydown", this.handleKeydown);
10162
+ (_c = this.slideApi) === null || _c === void 0 ? void 0 : _c.destroy();
10150
10163
  for (const slide of this._slides)
10151
- slide.destroy();
10152
- this.isInited = isInited;
10153
- this.isStarted = isStarted;
10164
+ await slide.destroy();
10165
+ this.debug(`${StoryEmodji.Detach} [Story Lifecycle] detached: `);
10166
+ this.commit({ attached: false, inited: false, started: false });
10167
+ }
10168
+ async attach(ui) {
10169
+ if (!ui.container || this.state.attached)
10170
+ return;
10171
+ this._$root = ui.container;
10172
+ await (0,external_mobx_namespaceObject.when)(() => this.story.canBeShown && Boolean(this.story.slides.length));
10173
+ this.slideApi = this.createSlideApi(ui.container);
10174
+ this.createSlidesViewModels(this.story.slides, this.slideApi);
10175
+ this.debug(`${StoryEmodji.Attach} [Story Lifecycle] attached: `);
10176
+ this.commit({ attached: true });
10177
+ }
10178
+ async prefetch(ui) {
10179
+ if (!ui.canBeInited || this.state.prefetched)
10180
+ return;
10181
+ if (this === ui.activeStory) {
10182
+ await this.preload(ACTIVE_STORY_PRELOAD_PRIORITY);
10183
+ }
10184
+ else {
10185
+ await this.preload(NON_ACTIVE_STORY_PRELOAD_PRIORITY, 2);
10186
+ }
10187
+ this.debug(`${StoryEmodji.Prefetch} [Story Lifecycle] prefetched: `);
10188
+ this.commit({ prefetched: true });
10189
+ }
10190
+ async preload(priority = 1000, count = this.slidesCount) {
10191
+ const cacheConfig = this.storyManager.config.cache;
10192
+ if (!cacheConfig)
10193
+ return;
10194
+ if (cacheConfig.prefetch) {
10195
+ await this.preloadSlides(0, count, priority);
10196
+ }
10197
+ else {
10198
+ await this.preloadActiveSlide(priority);
10199
+ }
10154
10200
  }
10155
10201
  async preloadSlides(start, end, priority) {
10156
- if (!this.story.canBeShown)
10157
- this.showLoaderScreen();
10158
- await (0,external_mobx_namespaceObject.when)(() => this.story.canBeShown);
10159
10202
  end = end !== null && end !== void 0 ? end : this._slides.length;
10160
10203
  priority = priority !== null && priority !== void 0 ? priority : 0;
10161
10204
  await Promise.all(this._slides.slice(start, end).map((slide, index) => slide.preload(end - index + priority)));
@@ -10163,41 +10206,36 @@ let StoryViewModel = (() => {
10163
10206
  async preloadActiveSlide(priority) {
10164
10207
  this.preloadSlides(this._activeSlideIndex, this._activeSlideIndex + 1, priority);
10165
10208
  }
10166
- async init() {
10167
- await this.mutex.runExclusive(async () => {
10168
- if (this.isInited)
10169
- return;
10170
- if (!this.story.canBeShown)
10171
- this.showLoaderScreen();
10172
- await (0,external_mobx_namespaceObject.when)(() => this.canBeShown);
10173
- await this.activeSlide.init();
10174
- this.isInited = true;
10175
- });
10209
+ async init(ui) {
10210
+ if (!ui.canBeInited || !this.state.attached || this.state.inited)
10211
+ return;
10212
+ await this.activeSlide.init();
10213
+ this.debug(`${StoryEmodji.Init} [Story Lifecycle] inited: `);
10214
+ this.commit({ inited: true });
10176
10215
  }
10177
- async start() {
10178
- await this.mutex.runExclusive(async () => {
10179
- if (this.isStarted || !this.isInited)
10180
- return;
10181
- await this.activeSlide.start();
10182
- document.addEventListener("visibilitychange", this.handleVisibilityChange);
10183
- document.addEventListener("keydown", this.handleKeydown);
10184
- this.isStarted = true;
10185
- this._activeSlideStartTime = Date.now();
10186
- });
10216
+ async start(ui) {
10217
+ if (!ui.canBeStarted || !this.state.inited || this.state.started)
10218
+ return;
10219
+ this.emit(StoryEvent.Started);
10220
+ await this.activeSlide.start();
10221
+ document.addEventListener("visibilitychange", this.handleVisibilityChange);
10222
+ document.addEventListener("keydown", this.handleKeydown);
10223
+ this._activeSlideStartTime = Date.now();
10224
+ this.debug(`${StoryEmodji.Start} [Story Lifecycle] started: `);
10225
+ this.commit({ started: true });
10187
10226
  }
10188
- async stop() {
10189
- await this.mutex.runExclusive(async () => {
10190
- var _b;
10191
- if (!this.isStarted || !this.isInited)
10192
- return;
10193
- (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
10194
- this.isStarted = false;
10195
- this.slideApiHandlers.clearNarrativeSessionDataCache();
10196
- this.resumeAll();
10197
- document.removeEventListener("visibilitychange", this.handleVisibilityChange);
10198
- document.removeEventListener("keydown", this.handleKeydown);
10199
- await this.activeSlide.stop({ prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */ });
10200
- });
10227
+ async stop(ui) {
10228
+ var _b;
10229
+ if (ui.canBeStarted || !this.state.started)
10230
+ return;
10231
+ (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
10232
+ this.slideApiHandlers.clearNarrativeSessionDataCache();
10233
+ this.resumeAll();
10234
+ document.removeEventListener("visibilitychange", this.handleVisibilityChange);
10235
+ document.removeEventListener("keydown", this.handleKeydown);
10236
+ await this.activeSlide.stop({ prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */ });
10237
+ this.debug(`${StoryEmodji.Stop} [Story Lifecycle] stopped: `);
10238
+ this.commit({ started: false });
10201
10239
  }
10202
10240
  canGoNext() {
10203
10241
  return this.activeSlide.canGoNext();
@@ -10213,23 +10251,15 @@ let StoryViewModel = (() => {
10213
10251
  }
10214
10252
  async destroy() {
10215
10253
  var _b, _c;
10216
- this._$root = null;
10217
10254
  document.removeEventListener("visibilitychange", this.handleVisibilityChange);
10218
10255
  document.removeEventListener("keydown", this.handleKeydown);
10219
- this.storySlidesReactionDisposer();
10220
10256
  this.sharePanel.close();
10221
10257
  this.textInput.close();
10222
10258
  this.timeline.destroy();
10223
10259
  this.goodsWidget.close();
10224
- const activeSlide = this.getSlideByIndex(this._activeSlideIndex);
10225
10260
  this.slideApiHandlers.clearNarrativeSessionDataCache();
10226
- if (this.isStarted)
10227
- await activeSlide.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ });
10228
- await activeSlide.destroy();
10229
10261
  (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
10230
10262
  (_c = this.toast) === null || _c === void 0 ? void 0 : _c.destroy();
10231
- this.isInited = false;
10232
- this.isStarted = false;
10233
10263
  }
10234
10264
  notifyPauseStateChange() {
10235
10265
  if (this.pauseManager.isUserPaused)
@@ -10243,7 +10273,7 @@ let StoryViewModel = (() => {
10243
10273
  }
10244
10274
  emitSlideV2Stat(index, durationMs) {
10245
10275
  var _b;
10246
- this.storyReaderStatisticV2Service.sendSlideEvent({
10276
+ this.statisticV2Service.sendSlideEvent({
10247
10277
  durationMs,
10248
10278
  storyId: this.id,
10249
10279
  activeSlideIndex: index,
@@ -10253,21 +10283,11 @@ let StoryViewModel = (() => {
10253
10283
  emitSlideV1Stat(index) {
10254
10284
  const event = new ShowSlideEvent(this);
10255
10285
  this.storyManager.emit(event.name, event.toJSON());
10256
- this.storyReaderStatisticV1Service.sendOpenStoryEvent({
10286
+ this.statisticV1Service.sendOpenStoryEvent({
10257
10287
  storyId: this.id,
10258
10288
  slideIndex: index
10259
10289
  });
10260
10290
  }
10261
- observeStorySlides() {
10262
- return (0,external_mobx_namespaceObject.reaction)(() => ({ storySlides: this.story.slides, canBeShown: this.story.canBeShown && Boolean(this._$root) }), ({ storySlides, canBeShown }) => {
10263
- if (!this._$root || !canBeShown || !storySlides.length)
10264
- return [];
10265
- this.slideApi = this.createSlideApi(this._$root);
10266
- return this.createSlidesViewModels(storySlides, this.slideApi);
10267
- }, {
10268
- fireImmediately: true
10269
- });
10270
- }
10271
10291
  createSlideApi(root) {
10272
10292
  const slideApi = new slide_api_namespaceObject.SlideApi(this.slideApiHandlers, {
10273
10293
  root,
@@ -10321,25 +10341,46 @@ let StoryViewModel = (() => {
10321
10341
  console.error(error);
10322
10342
  }
10323
10343
  }
10324
- async reinit() {
10325
- if (this.isInited) {
10326
- this.isInited = false;
10327
- await this.init();
10328
- }
10344
+ handleStoryError(error) {
10345
+ const event = new ShowStoryFailed({
10346
+ id: this.id,
10347
+ title: this.title,
10348
+ name: error.name,
10349
+ message: error.message
10350
+ });
10351
+ this.storyManager.emit(event.name, event.toJSON());
10329
10352
  }
10330
- async restart() {
10331
- if (this.isStarted) {
10332
- this.isStarted = false;
10333
- await this.start();
10353
+ async update(uiState) {
10354
+ await this.mutex.runExclusive(async () => {
10355
+ await this.detach(uiState);
10356
+ await this.attach(uiState);
10357
+ await this.prefetch(uiState);
10358
+ await this.init(uiState);
10359
+ await this.stop(uiState);
10360
+ await this.start(uiState);
10361
+ });
10362
+ }
10363
+ commit(partial) {
10364
+ Object.assign(this.state, partial);
10365
+ if (!this.state.attached) {
10366
+ this.state.inited = false;
10367
+ this.state.started = false;
10368
+ this.state.prefetched = false;
10369
+ }
10370
+ if (!this.state.inited) {
10371
+ this.state.started = false;
10372
+ this.state.prefetched = false;
10334
10373
  }
10335
10374
  }
10375
+ debug(message) {
10376
+ //debug(message, { storyId: this.id });
10377
+ }
10336
10378
  },
10337
10379
  _StoryViewModel__activeSlideIndex_accessor_storage = new WeakMap(),
10338
10380
  _StoryViewModel__slides_accessor_storage = new WeakMap(),
10339
10381
  _StoryViewModel__needShowErrorScreen_accessor_storage = new WeakMap(),
10340
10382
  _StoryViewModel__needShowLoaderScreen_accessor_storage = new WeakMap(),
10341
10383
  _StoryViewModel__$root_accessor_storage = new WeakMap(),
10342
- _StoryViewModel_isInited_accessor_storage = new WeakMap(),
10343
10384
  (() => {
10344
10385
  var _b;
10345
10386
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
@@ -10348,11 +10389,9 @@ let StoryViewModel = (() => {
10348
10389
  __needShowErrorScreen_decorators = [external_mobx_namespaceObject.observable];
10349
10390
  __needShowLoaderScreen_decorators = [external_mobx_namespaceObject.observable];
10350
10391
  __$root_decorators = [external_mobx_namespaceObject.observable];
10351
- _isInited_decorators = [external_mobx_namespaceObject.observable];
10352
10392
  _get_needShowErrorScreen_decorators = [external_mobx_namespaceObject.computed];
10353
10393
  _get_needShowLoaderScreen_decorators = [external_mobx_namespaceObject.computed];
10354
10394
  _get_activeSlide_decorators = [external_mobx_namespaceObject.computed];
10355
- _get_displayedSlideImage_decorators = [external_mobx_namespaceObject.computed];
10356
10395
  _get_reachEnd_decorators = [external_mobx_namespaceObject.computed];
10357
10396
  _get_reachStart_decorators = [external_mobx_namespaceObject.computed];
10358
10397
  _get_pauseState_decorators = [(_b = external_mobx_namespaceObject.computed).struct.bind(_b)];
@@ -10365,16 +10404,15 @@ let StoryViewModel = (() => {
10365
10404
  _showSlide_decorators = [external_mobx_namespaceObject.action];
10366
10405
  _markAsOpened_decorators = [external_mobx_namespaceObject.action];
10367
10406
  _markWasShown_decorators = [external_mobx_namespaceObject.action];
10407
+ _commit_decorators = [external_mobx_namespaceObject.action];
10368
10408
  storyViewModel_esDecorate(_a, null, __activeSlideIndex_decorators, { kind: "accessor", name: "_activeSlideIndex", static: false, private: false, access: { has: obj => "_activeSlideIndex" in obj, get: obj => obj._activeSlideIndex, set: (obj, value) => { obj._activeSlideIndex = value; } }, metadata: _metadata }, __activeSlideIndex_initializers, __activeSlideIndex_extraInitializers);
10369
10409
  storyViewModel_esDecorate(_a, null, __slides_decorators, { kind: "accessor", name: "_slides", static: false, private: false, access: { has: obj => "_slides" in obj, get: obj => obj._slides, set: (obj, value) => { obj._slides = value; } }, metadata: _metadata }, __slides_initializers, __slides_extraInitializers);
10370
10410
  storyViewModel_esDecorate(_a, null, __needShowErrorScreen_decorators, { kind: "accessor", name: "_needShowErrorScreen", static: false, private: false, access: { has: obj => "_needShowErrorScreen" in obj, get: obj => obj._needShowErrorScreen, set: (obj, value) => { obj._needShowErrorScreen = value; } }, metadata: _metadata }, __needShowErrorScreen_initializers, __needShowErrorScreen_extraInitializers);
10371
10411
  storyViewModel_esDecorate(_a, null, __needShowLoaderScreen_decorators, { kind: "accessor", name: "_needShowLoaderScreen", static: false, private: false, access: { has: obj => "_needShowLoaderScreen" in obj, get: obj => obj._needShowLoaderScreen, set: (obj, value) => { obj._needShowLoaderScreen = value; } }, metadata: _metadata }, __needShowLoaderScreen_initializers, __needShowLoaderScreen_extraInitializers);
10372
10412
  storyViewModel_esDecorate(_a, null, __$root_decorators, { kind: "accessor", name: "_$root", static: false, private: false, access: { has: obj => "_$root" in obj, get: obj => obj._$root, set: (obj, value) => { obj._$root = value; } }, metadata: _metadata }, __$root_initializers, __$root_extraInitializers);
10373
- storyViewModel_esDecorate(_a, null, _isInited_decorators, { kind: "accessor", name: "isInited", static: false, private: false, access: { has: obj => "isInited" in obj, get: obj => obj.isInited, set: (obj, value) => { obj.isInited = value; } }, metadata: _metadata }, _isInited_initializers, _isInited_extraInitializers);
10374
10413
  storyViewModel_esDecorate(_a, null, _get_needShowErrorScreen_decorators, { kind: "getter", name: "needShowErrorScreen", static: false, private: false, access: { has: obj => "needShowErrorScreen" in obj, get: obj => obj.needShowErrorScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
10375
10414
  storyViewModel_esDecorate(_a, null, _get_needShowLoaderScreen_decorators, { kind: "getter", name: "needShowLoaderScreen", static: false, private: false, access: { has: obj => "needShowLoaderScreen" in obj, get: obj => obj.needShowLoaderScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
10376
10415
  storyViewModel_esDecorate(_a, null, _get_activeSlide_decorators, { kind: "getter", name: "activeSlide", static: false, private: false, access: { has: obj => "activeSlide" in obj, get: obj => obj.activeSlide }, metadata: _metadata }, null, _instanceExtraInitializers);
10377
- storyViewModel_esDecorate(_a, null, _get_displayedSlideImage_decorators, { kind: "getter", name: "displayedSlideImage", static: false, private: false, access: { has: obj => "displayedSlideImage" in obj, get: obj => obj.displayedSlideImage }, metadata: _metadata }, null, _instanceExtraInitializers);
10378
10416
  storyViewModel_esDecorate(_a, null, _get_reachEnd_decorators, { kind: "getter", name: "reachEnd", static: false, private: false, access: { has: obj => "reachEnd" in obj, get: obj => obj.reachEnd }, metadata: _metadata }, null, _instanceExtraInitializers);
10379
10417
  storyViewModel_esDecorate(_a, null, _get_reachStart_decorators, { kind: "getter", name: "reachStart", static: false, private: false, access: { has: obj => "reachStart" in obj, get: obj => obj.reachStart }, metadata: _metadata }, null, _instanceExtraInitializers);
10380
10418
  storyViewModel_esDecorate(_a, null, _get_pauseState_decorators, { kind: "getter", name: "pauseState", static: false, private: false, access: { has: obj => "pauseState" in obj, get: obj => obj.pauseState }, metadata: _metadata }, null, _instanceExtraInitializers);
@@ -10387,18 +10425,13 @@ let StoryViewModel = (() => {
10387
10425
  storyViewModel_esDecorate(_a, null, _showSlide_decorators, { kind: "method", name: "showSlide", static: false, private: false, access: { has: obj => "showSlide" in obj, get: obj => obj.showSlide }, metadata: _metadata }, null, _instanceExtraInitializers);
10388
10426
  storyViewModel_esDecorate(_a, null, _markAsOpened_decorators, { kind: "method", name: "markAsOpened", static: false, private: false, access: { has: obj => "markAsOpened" in obj, get: obj => obj.markAsOpened }, metadata: _metadata }, null, _instanceExtraInitializers);
10389
10427
  storyViewModel_esDecorate(_a, null, _markWasShown_decorators, { kind: "method", name: "markWasShown", static: false, private: false, access: { has: obj => "markWasShown" in obj, get: obj => obj.markWasShown }, metadata: _metadata }, null, _instanceExtraInitializers);
10428
+ storyViewModel_esDecorate(_a, null, _commit_decorators, { kind: "method", name: "commit", static: false, private: false, access: { has: obj => "commit" in obj, get: obj => obj.commit }, metadata: _metadata }, null, _instanceExtraInitializers);
10390
10429
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
10391
10430
  })(),
10392
10431
  _a;
10393
10432
  })();
10394
10433
 
10395
10434
 
10396
- ;// CONCATENATED MODULE: external "lodash/isEmpty.js"
10397
- var isEmpty_js_x = (y) => {
10398
- var x = {}; __webpack_require__.d(x, y); return x
10399
- }
10400
- var isEmpty_js_y = (x) => (() => (x))
10401
- const isEmpty_js_namespaceObject = isEmpty_js_x({ ["default"]: () => (__WEBPACK_EXTERNAL_MODULE_lodash_isEmpty_js_f1e1789b__["default"]) });
10402
10435
  ;// CONCATENATED MODULE: external "lodash/isObject.js"
10403
10436
  var isObject_js_x = (y) => {
10404
10437
  var x = {}; __webpack_require__.d(x, y); return x
@@ -10510,7 +10543,7 @@ class GameClientConfig {
10510
10543
  value: void 0
10511
10544
  });
10512
10545
  const storyManagerConfig = this.storyManager.config;
10513
- const sdkVersion = "1.9.4";
10546
+ const sdkVersion = "1.9.5";
10514
10547
  const placeholders = this.storyManager.rootStore.placeholderStore.placeholders;
10515
10548
  const session = this.storyManager.rootStore.sessionStore.session;
10516
10549
  this.sessionId = session.id;
@@ -10967,8 +11000,10 @@ class GameSession extends events.EventEmitter {
10967
11000
  if (event.origin !== this.origin)
10968
11001
  return;
10969
11002
  try {
10970
- if (!Array.isArray(event.data))
10971
- throw new Error(`[IAS]: Invalid MessageEvent data format ${event.data}`);
11003
+ if (!Array.isArray(event.data)) {
11004
+ console.warn(`[IAS]: Invalid game MessageEvent data format ${event.data}`);
11005
+ return;
11006
+ }
10972
11007
  const [gameEvent, ...restData] = event.data;
10973
11008
  this.emit(gameEvent, ...restData);
10974
11009
  }
@@ -11471,7 +11506,6 @@ var gameReaderViewModel_classPrivateFieldSet = (undefined && undefined.__classPr
11471
11506
 
11472
11507
 
11473
11508
 
11474
-
11475
11509
  var GameReaderEvent;
11476
11510
  (function (GameReaderEvent) {
11477
11511
  GameReaderEvent["Close"] = "close";
@@ -11730,7 +11764,7 @@ let GameReaderViewModel = (() => {
11730
11764
  if (this._isGameInited)
11731
11765
  (_b = this.gameSession) === null || _b === void 0 ? void 0 : _b.closeGameReader();
11732
11766
  else
11733
- this.finishGame({ result: {} });
11767
+ this.finishGame();
11734
11768
  return true;
11735
11769
  }
11736
11770
  async reloadGame() {
@@ -11753,7 +11787,7 @@ let GameReaderViewModel = (() => {
11753
11787
  }
11754
11788
  subscribeToGameSession(session) {
11755
11789
  session.on("gameComplete" /* GameSessionEvent.GameComplete */, (result, arg1, arg2, openStory, gameInstance) => {
11756
- this.finishGame({ result, openStory, gameInstance });
11790
+ this.finishGame({ openStory, gameInstance });
11757
11791
  });
11758
11792
  session.on("reloadGameReader" /* GameSessionEvent.ReloadGameReader */, () => {
11759
11793
  this.restartGame();
@@ -11807,17 +11841,14 @@ let GameReaderViewModel = (() => {
11807
11841
  this.resetFlags();
11808
11842
  this.resetGameData();
11809
11843
  }
11810
- finishGame({ result, openStory, gameInstance }) {
11811
- var _b;
11812
- const gameId = (_b = this.game) === null || _b === void 0 ? void 0 : _b.id;
11844
+ finishGame(params = {}) {
11813
11845
  this.resetScrollbar();
11814
11846
  this.closeSession();
11815
11847
  this.resetFlags();
11816
11848
  this.resetGameData();
11817
11849
  this.resetCounters();
11818
- if (gameId)
11819
- this.emitGameCompletion(gameId, result);
11820
- this.navigateAfterGame({ gameInstance, openStory });
11850
+ this.storyManager.emit("closeGame");
11851
+ this.navigateAfterGame(params);
11821
11852
  }
11822
11853
  resetScrollbar() {
11823
11854
  this.scrollbarHelper.disable();
@@ -11839,11 +11870,6 @@ let GameReaderViewModel = (() => {
11839
11870
  resetCounters() {
11840
11871
  this.retryAttempts = 0;
11841
11872
  }
11842
- emitGameCompletion(gameId, result) {
11843
- const event = (0,isEmpty_js_namespaceObject["default"])(result) ? "closeGame" : "finishGame";
11844
- const payload = (0,isEmpty_js_namespaceObject["default"])(result) ? { id: gameId } : { id: gameId, result };
11845
- this.storyManager.emit(event, payload);
11846
- }
11847
11873
  navigateAfterGame(params) {
11848
11874
  var _b, _c;
11849
11875
  if ((_b = params.gameInstance) === null || _b === void 0 ? void 0 : _b.id) {
@@ -12530,15 +12556,7 @@ class StorySlideApiHandlers {
12530
12556
  });
12531
12557
  }
12532
12558
  showLayer(index) {
12533
- var _a;
12534
- this.statisticV2Service.sendSlideLayout({
12535
- layoutIndex: index,
12536
- storyId: this.story.id,
12537
- activeSlideIndex: this.story.activeSlideIndex,
12538
- feedSlug: (_a = this.storyReader.feed) === null || _a === void 0 ? void 0 : _a.slug
12539
- });
12540
- this.story.resumeUser();
12541
- this.story.activeSlide.showLayerByIndex(index);
12559
+ this.story.showLayer(index);
12542
12560
  }
12543
12561
  showCardSlide(slideIndex) {
12544
12562
  this.story.showSlide(slideIndex);
@@ -12889,603 +12907,51 @@ class SafeAreaFrameCalculator {
12889
12907
 
12890
12908
 
12891
12909
 
12892
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/baseStoryReaderEvent.ts
12893
-
12910
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showOnboardingStoriesStrategy.ts
12894
12911
 
12895
- class BaseStoryReaderEvent {
12896
- constructor(story, payload = {}) {
12897
- var _a, _b, _c, _d;
12898
- Object.defineProperty(this, "story", {
12912
+ class ShowOnboardingStoriesStrategy {
12913
+ constructor(showMultipleStoriesStrategy, storyManager) {
12914
+ Object.defineProperty(this, "showMultipleStoriesStrategy", {
12899
12915
  enumerable: true,
12900
12916
  configurable: true,
12901
12917
  writable: true,
12902
- value: story
12918
+ value: showMultipleStoriesStrategy
12903
12919
  });
12904
- Object.defineProperty(this, "payload", {
12920
+ Object.defineProperty(this, "storyManager", {
12905
12921
  enumerable: true,
12906
12922
  configurable: true,
12907
12923
  writable: true,
12908
- value: payload
12924
+ value: storyManager
12909
12925
  });
12910
- Object.defineProperty(this, "title", {
12926
+ Object.defineProperty(this, "_feed", {
12911
12927
  enumerable: true,
12912
12928
  configurable: true,
12913
12929
  writable: true,
12914
12930
  value: null
12915
12931
  });
12916
- Object.defineProperty(this, "tags", {
12917
- enumerable: true,
12918
- configurable: true,
12919
- writable: true,
12920
- value: []
12932
+ }
12933
+ get feed() {
12934
+ return this._feed;
12935
+ }
12936
+ async show(payload) {
12937
+ var _a, _b;
12938
+ const storyFeedStore = this.storyManager.rootStore.onboardingFeedStore;
12939
+ this.throwIfAborted(payload.signal);
12940
+ const onboardingFeed = await storyFeedStore.fetchOnboardingFeed({
12941
+ feedSlug: payload.feedSlug,
12942
+ tags: (_a = payload.customTags) !== null && _a !== void 0 ? _a : [],
12943
+ limit: (_b = payload.limit) !== null && _b !== void 0 ? _b : undefined
12921
12944
  });
12922
- Object.defineProperty(this, "slidesCount", {
12923
- enumerable: true,
12924
- configurable: true,
12925
- writable: true,
12926
- value: null
12927
- });
12928
- Object.defineProperty(this, "feedSlug", {
12929
- enumerable: true,
12930
- configurable: true,
12931
- writable: true,
12932
- value: null
12933
- });
12934
- Object.defineProperty(this, "filter", {
12935
- enumerable: true,
12936
- configurable: true,
12937
- writable: true,
12938
- value: null
12939
- });
12940
- Object.defineProperty(this, "actionSource", {
12941
- enumerable: true,
12942
- configurable: true,
12943
- writable: true,
12944
- value: StoryActionSource.list
12945
- });
12946
- Object.defineProperty(this, "ugcPayload", {
12947
- enumerable: true,
12948
- configurable: true,
12949
- writable: true,
12950
- value: null
12951
- });
12952
- Object.defineProperty(this, "slideEventPayload", {
12953
- enumerable: true,
12954
- configurable: true,
12955
- writable: true,
12956
- value: null
12957
- });
12958
- const feed = (_a = this.story.displayStrategy) === null || _a === void 0 ? void 0 : _a.feed;
12959
- const feedType = feed === null || feed === void 0 ? void 0 : feed.type;
12960
- const feedSlug = (_b = feed === null || feed === void 0 ? void 0 : feed.slug) !== null && _b !== void 0 ? _b : null;
12961
- const filter = feed instanceof UgcStoryFeed ? feed.filter : null;
12962
- this.title = this.story.statTitle;
12963
- this.slidesCount = this.story.slidesCount;
12964
- this.ugcPayload = feedType === StoryFeedType.UGC ? this.story.ugcPayload : null;
12965
- this.feedSlug = feedType === StoryFeedType.DEFAULT ? feedSlug : null;
12966
- this.filter = filter;
12967
- this.actionSource = feedType != null ? this.getStorySourceByFeedType(feedType) : StoryActionSource.direct;
12968
- this.slideEventPayload = (_d = (_c = story.activeSlide.eventPayload) === null || _c === void 0 ? void 0 : _c.payload) !== null && _d !== void 0 ? _d : null;
12969
- }
12970
- toJSON() {
12971
- return Object.assign({ id: this.story.id, index: this.story.activeSlideIndex, title: this.title, tags: this.tags, slidesCount: this.slidesCount, feed: this.feedSlug, filter: this.filter, source: this.actionSource, ugcPayload: this.ugcPayload, payload: this.slideEventPayload }, this.payload);
12972
- }
12973
- getStorySourceByFeedType(feedType) {
12974
- switch (feedType) {
12975
- case StoryFeedType.DEFAULT:
12976
- return StoryActionSource.list;
12977
- case StoryFeedType.UGC:
12978
- return StoryActionSource.list;
12979
- case StoryFeedType.FAVORITE:
12980
- return StoryActionSource.favorite;
12981
- case StoryFeedType.ONBOARDING:
12982
- return StoryActionSource.onboarding;
12983
- default:
12984
- return StoryActionSource.list;
12985
- }
12986
- }
12987
- }
12988
-
12989
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/closeStoryEvent.ts
12990
-
12991
- class CloseStoryEvent extends BaseStoryReaderEvent {
12992
- get name() {
12993
- return "closeStory";
12994
- }
12995
- toJSON() {
12996
- return Object.assign(Object.assign({}, super.toJSON()), { action: this.payload.action });
12997
- }
12998
- }
12999
-
13000
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/closeStoryReaderEvent.ts
13001
-
13002
- class CloseStoryReaderEvent extends BaseStoryReaderEvent {
13003
- get name() {
13004
- return "closeStoryReader";
13005
- }
13006
- toJSON() {
13007
- return Object.assign(Object.assign({}, super.toJSON()), { action: this.payload.action });
13008
- }
13009
- }
13010
-
13011
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/dislikeStoryEvent.ts
13012
-
13013
- class DislikeStoryEvent extends BaseStoryReaderEvent {
13014
- get name() {
13015
- return "dislikeStory";
13016
- }
13017
- toJSON() {
13018
- return Object.assign(Object.assign({}, super.toJSON()), { value: this.payload.value });
13019
- }
13020
- }
13021
-
13022
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/favoriteStoryEvent.ts
13023
-
13024
- class FavoriteStoryEvent extends BaseStoryReaderEvent {
13025
- get name() {
13026
- return "favoriteStory";
13027
- }
13028
- toJSON() {
13029
- return Object.assign(Object.assign({}, super.toJSON()), { value: this.payload.value });
13030
- }
13031
- }
13032
-
13033
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/likeStoryEvent.ts
13034
-
13035
- class LikeStoryEvent extends BaseStoryReaderEvent {
13036
- get name() {
13037
- return "likeStory";
13038
- }
13039
- toJSON() {
13040
- return Object.assign(Object.assign({}, super.toJSON()), { value: this.payload.value });
13041
- }
13042
- }
13043
-
13044
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/shareStoryEvent.ts
13045
-
13046
- class ShareStoryEvent extends BaseStoryReaderEvent {
13047
- get name() {
13048
- return "shareStory";
13049
- }
13050
- }
13051
-
13052
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/shareStoryWithPathEvent.ts
13053
-
13054
- class ShareStoryWithPathEvent extends BaseStoryReaderEvent {
13055
- get name() {
13056
- return "shareStoryWithPath";
13057
- }
13058
- toJSON() {
13059
- return Object.assign(Object.assign({}, super.toJSON()), { value: this.payload.url });
13060
- }
13061
- }
13062
-
13063
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/showSlideEvent.ts
13064
-
13065
- class ShowSlideEvent extends BaseStoryReaderEvent {
13066
- get name() {
13067
- return "showSlide";
13068
- }
13069
- }
13070
-
13071
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/showStoryEvent.ts
13072
-
13073
- class ShowStoryEvent extends BaseStoryReaderEvent {
13074
- get name() {
13075
- return "showStory";
13076
- }
13077
- toJSON() {
13078
- const data = super.toJSON();
13079
- data.payload = null;
13080
- return data;
13081
- }
13082
- }
13083
-
13084
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/showStoryFailed.ts
13085
- class ShowStoryFailed {
13086
- constructor(payload) {
13087
- Object.defineProperty(this, "payload", {
13088
- enumerable: true,
13089
- configurable: true,
13090
- writable: true,
13091
- value: payload
13092
- });
13093
- }
13094
- get name() {
13095
- return "showStoryFailed";
13096
- }
13097
- toJSON() {
13098
- return {
13099
- id: this.payload.id,
13100
- title: this.payload.title,
13101
- name: this.payload.name,
13102
- message: this.payload.message
13103
- };
13104
- }
13105
- }
13106
-
13107
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/index.ts
13108
-
13109
-
13110
-
13111
-
13112
-
13113
-
13114
-
13115
-
13116
-
13117
-
13118
-
13119
-
13120
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyReaderNavigationController.ts
13121
- var storyReaderNavigationController_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
13122
- var useValue = arguments.length > 2;
13123
- for (var i = 0; i < initializers.length; i++) {
13124
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
13125
- }
13126
- return useValue ? value : void 0;
13127
- };
13128
- var storyReaderNavigationController_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
13129
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
13130
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
13131
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13132
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13133
- var _, done = false;
13134
- for (var i = decorators.length - 1; i >= 0; i--) {
13135
- var context = {};
13136
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
13137
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
13138
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13139
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13140
- if (kind === "accessor") {
13141
- if (result === void 0) continue;
13142
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
13143
- if (_ = accept(result.get)) descriptor.get = _;
13144
- if (_ = accept(result.set)) descriptor.set = _;
13145
- if (_ = accept(result.init)) initializers.unshift(_);
13146
- }
13147
- else if (_ = accept(result)) {
13148
- if (kind === "field") initializers.unshift(_);
13149
- else descriptor[key] = _;
13150
- }
13151
- }
13152
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
13153
- done = true;
13154
- };
13155
- var storyReaderNavigationController_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13156
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13157
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
13158
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13159
- };
13160
- var storyReaderNavigationController_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13161
- if (kind === "m") throw new TypeError("Private method is not writable");
13162
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
13163
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
13164
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
13165
- };
13166
-
13167
-
13168
-
13169
- const STORY_INIT_RANGE = 1;
13170
- const ACTIVE_STORY_PRELOAD_PRIORITY = 1000;
13171
- const NON_ACTIVE_STORY_PRELOAD_PRIORITY = 0;
13172
- let StoryReaderNavigationController = (() => {
13173
- var _a, _StoryReaderNavigationController__activeStory_accessor_storage, _StoryReaderNavigationController__currentIndex_accessor_storage, _StoryReaderNavigationController__targetTransitionIndex_accessor_storage;
13174
- let _instanceExtraInitializers = [];
13175
- let __activeStory_decorators;
13176
- let __activeStory_initializers = [];
13177
- let __activeStory_extraInitializers = [];
13178
- let __currentIndex_decorators;
13179
- let __currentIndex_initializers = [];
13180
- let __currentIndex_extraInitializers = [];
13181
- let __targetTransitionIndex_decorators;
13182
- let __targetTransitionIndex_initializers = [];
13183
- let __targetTransitionIndex_extraInitializers = [];
13184
- let _get_reachStart_decorators;
13185
- let _get_reachEnd_decorators;
13186
- let _get_targetTransitionStory_decorators;
13187
- let _nextStory_decorators;
13188
- let _prevStory_decorators;
13189
- let _nextStoryWithAnimation_decorators;
13190
- let _prevStoryWithAnimation_decorators;
13191
- let _navigateStoryWithAnimation_decorators;
13192
- let _handleTransitionEnd_decorators;
13193
- return _a = class StoryReaderNavigationController {
13194
- get _activeStory() { return storyReaderNavigationController_classPrivateFieldGet(this, _StoryReaderNavigationController__activeStory_accessor_storage, "f"); }
13195
- set _activeStory(value) { storyReaderNavigationController_classPrivateFieldSet(this, _StoryReaderNavigationController__activeStory_accessor_storage, value, "f"); }
13196
- get _currentIndex() { return storyReaderNavigationController_classPrivateFieldGet(this, _StoryReaderNavigationController__currentIndex_accessor_storage, "f"); }
13197
- set _currentIndex(value) { storyReaderNavigationController_classPrivateFieldSet(this, _StoryReaderNavigationController__currentIndex_accessor_storage, value, "f"); }
13198
- get _targetTransitionIndex() { return storyReaderNavigationController_classPrivateFieldGet(this, _StoryReaderNavigationController__targetTransitionIndex_accessor_storage, "f"); }
13199
- set _targetTransitionIndex(value) { storyReaderNavigationController_classPrivateFieldSet(this, _StoryReaderNavigationController__targetTransitionIndex_accessor_storage, value, "f"); }
13200
- constructor(storyManager, storyReader, statistics) {
13201
- Object.defineProperty(this, "storyManager", {
13202
- enumerable: true,
13203
- configurable: true,
13204
- writable: true,
13205
- value: (storyReaderNavigationController_runInitializers(this, _instanceExtraInitializers), storyManager)
13206
- });
13207
- Object.defineProperty(this, "storyReader", {
13208
- enumerable: true,
13209
- configurable: true,
13210
- writable: true,
13211
- value: storyReader
13212
- });
13213
- Object.defineProperty(this, "statistics", {
13214
- enumerable: true,
13215
- configurable: true,
13216
- writable: true,
13217
- value: statistics
13218
- });
13219
- _StoryReaderNavigationController__activeStory_accessor_storage.set(this, storyReaderNavigationController_runInitializers(this, __activeStory_initializers, null));
13220
- _StoryReaderNavigationController__currentIndex_accessor_storage.set(this, (storyReaderNavigationController_runInitializers(this, __activeStory_extraInitializers), storyReaderNavigationController_runInitializers(this, __currentIndex_initializers, 0)));
13221
- _StoryReaderNavigationController__targetTransitionIndex_accessor_storage.set(this, (storyReaderNavigationController_runInitializers(this, __currentIndex_extraInitializers), storyReaderNavigationController_runInitializers(this, __targetTransitionIndex_initializers, -1)));
13222
- Object.defineProperty(this, "animatedNavigationController", {
13223
- enumerable: true,
13224
- configurable: true,
13225
- writable: true,
13226
- value: (storyReaderNavigationController_runInitializers(this, __targetTransitionIndex_extraInitializers), null)
13227
- });
13228
- Object.defineProperty(this, "currentStoryDisplayStrategy", {
13229
- enumerable: true,
13230
- configurable: true,
13231
- writable: true,
13232
- value: null
13233
- });
13234
- Object.defineProperty(this, "_activeStoryStartTime", {
13235
- enumerable: true,
13236
- configurable: true,
13237
- writable: true,
13238
- value: 0
13239
- });
13240
- }
13241
- get reachStart() {
13242
- return this._currentIndex === 0;
13243
- }
13244
- get reachEnd() {
13245
- return this._currentIndex === this.storyReader.stories.length - 1;
13246
- }
13247
- get targetTransitionStory() {
13248
- return this.storyReader.stories[this._targetTransitionIndex];
13249
- }
13250
- get targetTransitionIndex() {
13251
- return this._targetTransitionIndex;
13252
- }
13253
- get activeStory() {
13254
- return this._activeStory;
13255
- }
13256
- get currentIndex() {
13257
- return this._currentIndex;
13258
- }
13259
- get activeStoryDuration() {
13260
- return Date.now() - this._activeStoryStartTime;
13261
- }
13262
- setAnimatedNavigationController(animatedNavigationController) {
13263
- this.animatedNavigationController = animatedNavigationController;
13264
- }
13265
- setCurrentStoryDisplayStrategy(currentStoryDisplayStrategy) {
13266
- this.currentStoryDisplayStrategy = currentStoryDisplayStrategy;
13267
- }
13268
- nextStory() {
13269
- if (this.reachEnd)
13270
- return;
13271
- this.setActiveStoryByIndex(this._currentIndex + 1);
13272
- }
13273
- prevStory() {
13274
- if (this.reachStart)
13275
- return;
13276
- this.setActiveStoryByIndex(this._currentIndex - 1);
13277
- }
13278
- nextStoryWithAnimation(action) {
13279
- if (this.storyReader.reachEnd)
13280
- this.handleStoryReaderReachEnd(action);
13281
- else
13282
- this.navigateStoryWithAnimation(this._currentIndex + 1, action);
13283
- }
13284
- prevStoryWithAnimation(action) {
13285
- if (!this.reachStart)
13286
- this.navigateStoryWithAnimation(this.currentIndex - 1, action);
13287
- }
13288
- destroy() {
13289
- this._activeStory = null;
13290
- }
13291
- setActiveStoryById(storyId) {
13292
- const stories = this.storyReader.stories;
13293
- const index = stories.findIndex(story => story.id === storyId);
13294
- if (index === -1)
13295
- throw new Error(`[IAS]: No story found with ID ${storyId}`);
13296
- this.initStoriesWithinRange(index);
13297
- return this.setActiveStoryByIndex(index);
13298
- }
13299
- async navigateStoryWithAnimation(index, action = "lastSlideClick") {
13300
- if (!this.animatedNavigationController ||
13301
- this.animatedNavigationController.animating ||
13302
- this._targetTransitionIndex !== -1)
13303
- return;
13304
- index = this.limitIndex(index);
13305
- this._targetTransitionIndex = index;
13306
- this.currentStoryDisplayStrategy.handleNextStoryByIndex(index);
13307
- this.initStoriesWithinRange(index);
13308
- await this.animatedNavigationController.transitionByIndex(index, this.currentIndex);
13309
- await this.handleTransitionEnd(index, action);
13310
- }
13311
- handleStoryReaderReachEnd(action) {
13312
- var _b;
13313
- if (action !== CloseStoryReaderAction.CloseByTimer) {
13314
- this.storyReader.close(CloseStoryReaderAction.CloseByLastSlideClick);
13315
- }
13316
- else if ((_b = this.animatedNavigationController) === null || _b === void 0 ? void 0 : _b.options.closeOnLastSlideByTimer) {
13317
- this.storyReader.close(CloseStoryReaderAction.CloseByTimer);
13318
- }
13319
- }
13320
- async handleTransitionEnd(index, navigationAction) {
13321
- if (this.activeStory) {
13322
- const event = new CloseStoryEvent(this.activeStory, {
13323
- action: navigationAction
13324
- });
13325
- this.storyManager.emit(event.name, event.toJSON());
13326
- }
13327
- await this.setActiveStoryByIndex(index);
13328
- this._targetTransitionIndex = -1;
13329
- }
13330
- async setActiveStoryByIndex(index) {
13331
- const prevIndex = this._currentIndex;
13332
- const prevStory = this._activeStory;
13333
- const newActiveStory = this.storyReader.stories[index];
13334
- if (!newActiveStory)
13335
- return;
13336
- await this.updateActiveStory(index, prevStory, newActiveStory);
13337
- this.statistics.emitTransitionEvents(prevIndex, index, prevStory, newActiveStory, this.activeStoryDuration);
13338
- this.handleActiveStoryError(this._activeStory);
13339
- newActiveStory.markAsOpened();
13340
- return newActiveStory;
13341
- }
13342
- async updateActiveStory(index, prevStory, activeStory) {
13343
- this._currentIndex = index;
13344
- this.runNextStory(prevStory, activeStory);
13345
- this._activeStoryStartTime = Date.now();
13346
- this._activeStory = activeStory;
13347
- return activeStory;
13348
- }
13349
- async runNextStory(prevStory, story) {
13350
- try {
13351
- await (prevStory === null || prevStory === void 0 ? void 0 : prevStory.stop());
13352
- await this.preloadActiveStory(story);
13353
- await story.init();
13354
- await story.start();
13355
- }
13356
- catch (error) {
13357
- console.error(error);
13358
- }
13359
- }
13360
- async initStoriesWithinRange(currentIndex) {
13361
- const stories = this.storyReader.stories;
13362
- const start = Math.max(currentIndex - STORY_INIT_RANGE, 0);
13363
- const end = Math.min(currentIndex + STORY_INIT_RANGE, stories.length - 1);
13364
- const storiesToInit = [];
13365
- for (let i = start; i <= end; i++) {
13366
- if (i !== currentIndex)
13367
- storiesToInit.push(stories[i]);
13368
- }
13369
- await this.preloadSiblingStories(storiesToInit);
13370
- return Promise.allSettled(storiesToInit.map(story => story.init()));
13371
- }
13372
- handleActiveStoryError(story) {
13373
- if (!(story === null || story === void 0 ? void 0 : story.error))
13374
- return;
13375
- const event = new ShowStoryFailed({
13376
- id: story.id,
13377
- title: story.title,
13378
- name: story.error.name,
13379
- message: story.error.message
13380
- });
13381
- this.storyManager.emit(event.name, event.toJSON());
13382
- }
13383
- limitIndex(index) {
13384
- return Math.max(0, Math.min(this.storyReader.stories.length - 1, index));
13385
- }
13386
- async preloadActiveStory(story) {
13387
- const cacheConfig = this.storyManager.config.cache;
13388
- if (!cacheConfig)
13389
- return;
13390
- if (cacheConfig.prefetch) {
13391
- await story.preloadSlides(0, story.slidesCount, ACTIVE_STORY_PRELOAD_PRIORITY);
13392
- }
13393
- else {
13394
- await story.preloadActiveSlide(ACTIVE_STORY_PRELOAD_PRIORITY);
13395
- }
13396
- }
13397
- async preloadSiblingStories(stories) {
13398
- const cacheConfig = this.storyManager.config.cache;
13399
- if (!cacheConfig)
13400
- return;
13401
- if (cacheConfig.prefetch) {
13402
- await Promise.all(stories.map(story => story.preloadSlides(0, 2, NON_ACTIVE_STORY_PRELOAD_PRIORITY)));
13403
- }
13404
- else {
13405
- await Promise.all(stories.map(story => story.preloadActiveSlide(NON_ACTIVE_STORY_PRELOAD_PRIORITY)));
13406
- }
13407
- }
13408
- },
13409
- _StoryReaderNavigationController__activeStory_accessor_storage = new WeakMap(),
13410
- _StoryReaderNavigationController__currentIndex_accessor_storage = new WeakMap(),
13411
- _StoryReaderNavigationController__targetTransitionIndex_accessor_storage = new WeakMap(),
13412
- (() => {
13413
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
13414
- __activeStory_decorators = [external_mobx_namespaceObject.observable];
13415
- __currentIndex_decorators = [external_mobx_namespaceObject.observable];
13416
- __targetTransitionIndex_decorators = [external_mobx_namespaceObject.observable];
13417
- _get_reachStart_decorators = [external_mobx_namespaceObject.computed];
13418
- _get_reachEnd_decorators = [external_mobx_namespaceObject.computed];
13419
- _get_targetTransitionStory_decorators = [external_mobx_namespaceObject.computed];
13420
- _nextStory_decorators = [external_mobx_namespaceObject.action];
13421
- _prevStory_decorators = [external_mobx_namespaceObject.action];
13422
- _nextStoryWithAnimation_decorators = [external_mobx_namespaceObject.action];
13423
- _prevStoryWithAnimation_decorators = [external_mobx_namespaceObject.action];
13424
- _navigateStoryWithAnimation_decorators = [external_mobx_namespaceObject.action];
13425
- _handleTransitionEnd_decorators = [external_mobx_namespaceObject.action];
13426
- storyReaderNavigationController_esDecorate(_a, null, __activeStory_decorators, { kind: "accessor", name: "_activeStory", static: false, private: false, access: { has: obj => "_activeStory" in obj, get: obj => obj._activeStory, set: (obj, value) => { obj._activeStory = value; } }, metadata: _metadata }, __activeStory_initializers, __activeStory_extraInitializers);
13427
- storyReaderNavigationController_esDecorate(_a, null, __currentIndex_decorators, { kind: "accessor", name: "_currentIndex", static: false, private: false, access: { has: obj => "_currentIndex" in obj, get: obj => obj._currentIndex, set: (obj, value) => { obj._currentIndex = value; } }, metadata: _metadata }, __currentIndex_initializers, __currentIndex_extraInitializers);
13428
- storyReaderNavigationController_esDecorate(_a, null, __targetTransitionIndex_decorators, { kind: "accessor", name: "_targetTransitionIndex", static: false, private: false, access: { has: obj => "_targetTransitionIndex" in obj, get: obj => obj._targetTransitionIndex, set: (obj, value) => { obj._targetTransitionIndex = value; } }, metadata: _metadata }, __targetTransitionIndex_initializers, __targetTransitionIndex_extraInitializers);
13429
- storyReaderNavigationController_esDecorate(_a, null, _get_reachStart_decorators, { kind: "getter", name: "reachStart", static: false, private: false, access: { has: obj => "reachStart" in obj, get: obj => obj.reachStart }, metadata: _metadata }, null, _instanceExtraInitializers);
13430
- storyReaderNavigationController_esDecorate(_a, null, _get_reachEnd_decorators, { kind: "getter", name: "reachEnd", static: false, private: false, access: { has: obj => "reachEnd" in obj, get: obj => obj.reachEnd }, metadata: _metadata }, null, _instanceExtraInitializers);
13431
- storyReaderNavigationController_esDecorate(_a, null, _get_targetTransitionStory_decorators, { kind: "getter", name: "targetTransitionStory", static: false, private: false, access: { has: obj => "targetTransitionStory" in obj, get: obj => obj.targetTransitionStory }, metadata: _metadata }, null, _instanceExtraInitializers);
13432
- storyReaderNavigationController_esDecorate(_a, null, _nextStory_decorators, { kind: "method", name: "nextStory", static: false, private: false, access: { has: obj => "nextStory" in obj, get: obj => obj.nextStory }, metadata: _metadata }, null, _instanceExtraInitializers);
13433
- storyReaderNavigationController_esDecorate(_a, null, _prevStory_decorators, { kind: "method", name: "prevStory", static: false, private: false, access: { has: obj => "prevStory" in obj, get: obj => obj.prevStory }, metadata: _metadata }, null, _instanceExtraInitializers);
13434
- storyReaderNavigationController_esDecorate(_a, null, _nextStoryWithAnimation_decorators, { kind: "method", name: "nextStoryWithAnimation", static: false, private: false, access: { has: obj => "nextStoryWithAnimation" in obj, get: obj => obj.nextStoryWithAnimation }, metadata: _metadata }, null, _instanceExtraInitializers);
13435
- storyReaderNavigationController_esDecorate(_a, null, _prevStoryWithAnimation_decorators, { kind: "method", name: "prevStoryWithAnimation", static: false, private: false, access: { has: obj => "prevStoryWithAnimation" in obj, get: obj => obj.prevStoryWithAnimation }, metadata: _metadata }, null, _instanceExtraInitializers);
13436
- storyReaderNavigationController_esDecorate(_a, null, _navigateStoryWithAnimation_decorators, { kind: "method", name: "navigateStoryWithAnimation", static: false, private: false, access: { has: obj => "navigateStoryWithAnimation" in obj, get: obj => obj.navigateStoryWithAnimation }, metadata: _metadata }, null, _instanceExtraInitializers);
13437
- storyReaderNavigationController_esDecorate(_a, null, _handleTransitionEnd_decorators, { kind: "method", name: "handleTransitionEnd", static: false, private: false, access: { has: obj => "handleTransitionEnd" in obj, get: obj => obj.handleTransitionEnd }, metadata: _metadata }, null, _instanceExtraInitializers);
13438
- if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
13439
- })(),
13440
- _a;
13441
- })();
13442
-
13443
-
13444
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showOnboardingStoriesStrategy.ts
13445
-
13446
- class ShowOnboardingStoriesStrategy {
13447
- constructor(showMultipleStoriesStrategy, storyManager) {
13448
- Object.defineProperty(this, "showMultipleStoriesStrategy", {
13449
- enumerable: true,
13450
- configurable: true,
13451
- writable: true,
13452
- value: showMultipleStoriesStrategy
13453
- });
13454
- Object.defineProperty(this, "storyManager", {
13455
- enumerable: true,
13456
- configurable: true,
13457
- writable: true,
13458
- value: storyManager
13459
- });
13460
- Object.defineProperty(this, "_feed", {
13461
- enumerable: true,
13462
- configurable: true,
13463
- writable: true,
13464
- value: null
13465
- });
13466
- }
13467
- get feed() {
13468
- return this._feed;
13469
- }
13470
- async show(payload) {
13471
- var _a, _b;
13472
- const storyFeedStore = this.storyManager.rootStore.onboardingFeedStore;
13473
- this.throwIfAborted(payload.signal);
13474
- const onboardingFeed = await storyFeedStore.fetchOnboardingFeed({
13475
- feedSlug: payload.feedSlug,
13476
- tags: (_a = payload.customTags) !== null && _a !== void 0 ? _a : [],
13477
- limit: (_b = payload.limit) !== null && _b !== void 0 ? _b : undefined
13478
- });
13479
- this.throwIfAborted(payload.signal);
13480
- this._feed = onboardingFeed;
13481
- const feedLoadEvent = this.getFeedLoadEvent(onboardingFeed.slug, onboardingFeed.stories);
13482
- this.emitFeedLoad(feedLoadEvent);
13483
- if (!onboardingFeed.stories.length)
13484
- return feedLoadEvent;
13485
- await this.showMultipleStoriesStrategy.show({
13486
- windowReferer: STORY_READER_WINDOW_REFERER.default,
13487
- storyFeed: onboardingFeed,
13488
- storyId: onboardingFeed.stories[0].id
12945
+ this.throwIfAborted(payload.signal);
12946
+ this._feed = onboardingFeed;
12947
+ const feedLoadEvent = this.getFeedLoadEvent(onboardingFeed.slug, onboardingFeed.stories);
12948
+ this.emitFeedLoad(feedLoadEvent);
12949
+ if (!onboardingFeed.stories.length)
12950
+ return feedLoadEvent;
12951
+ await this.showMultipleStoriesStrategy.show({
12952
+ windowReferer: STORY_READER_WINDOW_REFERER.default,
12953
+ storyFeed: onboardingFeed,
12954
+ storyId: onboardingFeed.stories[0].id
13489
12955
  });
13490
12956
  return feedLoadEvent;
13491
12957
  }
@@ -13739,41 +13205,269 @@ class ShowStoryStrategy {
13739
13205
  }
13740
13206
  }
13741
13207
 
13742
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/storyDisplayStrategyFactory.ts
13208
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/storyDisplayStrategyFactory.ts
13209
+
13210
+ class StoryDisplayStrategyFactory {
13211
+ constructor(storyManager, storyReaderViewModel) {
13212
+ Object.defineProperty(this, "storyManager", {
13213
+ enumerable: true,
13214
+ configurable: true,
13215
+ writable: true,
13216
+ value: storyManager
13217
+ });
13218
+ Object.defineProperty(this, "storyReaderViewModel", {
13219
+ enumerable: true,
13220
+ configurable: true,
13221
+ writable: true,
13222
+ value: storyReaderViewModel
13223
+ });
13224
+ }
13225
+ createShowStory() {
13226
+ return new ShowStoryStrategy(this.storyManager, this.storyReaderViewModel);
13227
+ }
13228
+ createShowStoryOnce() {
13229
+ return new ShowStoryOnceStrategy(this.storyManager, this.storyReaderViewModel);
13230
+ }
13231
+ createShowStoryFromSharePage() {
13232
+ return new ShowStoryFromSharePageStrategy(new ShowStoryStrategy(this.storyManager, this.storyReaderViewModel));
13233
+ }
13234
+ createShowOnboardingStories() {
13235
+ return new ShowOnboardingStoriesStrategy(new ShowMultipleStoriesStrategy(this.storyManager, this.storyReaderViewModel), this.storyManager);
13236
+ }
13237
+ createShowMultipleStories() {
13238
+ return new ShowMultipleStoriesStrategy(this.storyManager, this.storyReaderViewModel);
13239
+ }
13240
+ }
13241
+
13242
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/index.ts
13243
+
13244
+
13245
+
13246
+
13247
+
13248
+
13249
+
13250
+
13251
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/baseStoryReaderEvent.ts
13252
+
13253
+
13254
+ class BaseStoryReaderEvent {
13255
+ constructor(story, payload = {}) {
13256
+ var _a, _b, _c, _d;
13257
+ Object.defineProperty(this, "story", {
13258
+ enumerable: true,
13259
+ configurable: true,
13260
+ writable: true,
13261
+ value: story
13262
+ });
13263
+ Object.defineProperty(this, "payload", {
13264
+ enumerable: true,
13265
+ configurable: true,
13266
+ writable: true,
13267
+ value: payload
13268
+ });
13269
+ Object.defineProperty(this, "title", {
13270
+ enumerable: true,
13271
+ configurable: true,
13272
+ writable: true,
13273
+ value: null
13274
+ });
13275
+ Object.defineProperty(this, "tags", {
13276
+ enumerable: true,
13277
+ configurable: true,
13278
+ writable: true,
13279
+ value: []
13280
+ });
13281
+ Object.defineProperty(this, "slidesCount", {
13282
+ enumerable: true,
13283
+ configurable: true,
13284
+ writable: true,
13285
+ value: null
13286
+ });
13287
+ Object.defineProperty(this, "feedSlug", {
13288
+ enumerable: true,
13289
+ configurable: true,
13290
+ writable: true,
13291
+ value: null
13292
+ });
13293
+ Object.defineProperty(this, "filter", {
13294
+ enumerable: true,
13295
+ configurable: true,
13296
+ writable: true,
13297
+ value: null
13298
+ });
13299
+ Object.defineProperty(this, "actionSource", {
13300
+ enumerable: true,
13301
+ configurable: true,
13302
+ writable: true,
13303
+ value: StoryActionSource.list
13304
+ });
13305
+ Object.defineProperty(this, "ugcPayload", {
13306
+ enumerable: true,
13307
+ configurable: true,
13308
+ writable: true,
13309
+ value: null
13310
+ });
13311
+ Object.defineProperty(this, "slideEventPayload", {
13312
+ enumerable: true,
13313
+ configurable: true,
13314
+ writable: true,
13315
+ value: null
13316
+ });
13317
+ const feed = (_a = this.story.displayStrategy) === null || _a === void 0 ? void 0 : _a.feed;
13318
+ const feedType = feed === null || feed === void 0 ? void 0 : feed.type;
13319
+ const feedSlug = (_b = feed === null || feed === void 0 ? void 0 : feed.slug) !== null && _b !== void 0 ? _b : null;
13320
+ const filter = feed instanceof UgcStoryFeed ? feed.filter : null;
13321
+ this.title = this.story.statTitle;
13322
+ this.slidesCount = this.story.slidesCount;
13323
+ this.ugcPayload = feedType === StoryFeedType.UGC ? this.story.ugcPayload : null;
13324
+ this.feedSlug = feedType === StoryFeedType.DEFAULT ? feedSlug : null;
13325
+ this.filter = filter;
13326
+ this.actionSource = feedType != null ? this.getStorySourceByFeedType(feedType) : StoryActionSource.direct;
13327
+ this.slideEventPayload = (_d = (_c = story.activeSlide.eventPayload) === null || _c === void 0 ? void 0 : _c.payload) !== null && _d !== void 0 ? _d : null;
13328
+ }
13329
+ toJSON() {
13330
+ return Object.assign({ id: this.story.id, index: this.story.activeSlideIndex, title: this.title, tags: this.tags, slidesCount: this.slidesCount, feed: this.feedSlug, filter: this.filter, source: this.actionSource, ugcPayload: this.ugcPayload, payload: this.slideEventPayload }, this.payload);
13331
+ }
13332
+ getStorySourceByFeedType(feedType) {
13333
+ switch (feedType) {
13334
+ case StoryFeedType.DEFAULT:
13335
+ return StoryActionSource.list;
13336
+ case StoryFeedType.UGC:
13337
+ return StoryActionSource.list;
13338
+ case StoryFeedType.FAVORITE:
13339
+ return StoryActionSource.favorite;
13340
+ case StoryFeedType.ONBOARDING:
13341
+ return StoryActionSource.onboarding;
13342
+ default:
13343
+ return StoryActionSource.list;
13344
+ }
13345
+ }
13346
+ }
13347
+
13348
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/closeStoryEvent.ts
13349
+
13350
+ class CloseStoryEvent extends BaseStoryReaderEvent {
13351
+ get name() {
13352
+ return "closeStory";
13353
+ }
13354
+ toJSON() {
13355
+ return Object.assign(Object.assign({}, super.toJSON()), { action: this.payload.action });
13356
+ }
13357
+ }
13358
+
13359
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/closeStoryReaderEvent.ts
13360
+
13361
+ class CloseStoryReaderEvent extends BaseStoryReaderEvent {
13362
+ get name() {
13363
+ return "closeStoryReader";
13364
+ }
13365
+ toJSON() {
13366
+ return Object.assign(Object.assign({}, super.toJSON()), { action: this.payload.action });
13367
+ }
13368
+ }
13369
+
13370
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/dislikeStoryEvent.ts
13371
+
13372
+ class DislikeStoryEvent extends BaseStoryReaderEvent {
13373
+ get name() {
13374
+ return "dislikeStory";
13375
+ }
13376
+ toJSON() {
13377
+ return Object.assign(Object.assign({}, super.toJSON()), { value: this.payload.value });
13378
+ }
13379
+ }
13380
+
13381
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/favoriteStoryEvent.ts
13382
+
13383
+ class FavoriteStoryEvent extends BaseStoryReaderEvent {
13384
+ get name() {
13385
+ return "favoriteStory";
13386
+ }
13387
+ toJSON() {
13388
+ return Object.assign(Object.assign({}, super.toJSON()), { value: this.payload.value });
13389
+ }
13390
+ }
13391
+
13392
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/likeStoryEvent.ts
13393
+
13394
+ class LikeStoryEvent extends BaseStoryReaderEvent {
13395
+ get name() {
13396
+ return "likeStory";
13397
+ }
13398
+ toJSON() {
13399
+ return Object.assign(Object.assign({}, super.toJSON()), { value: this.payload.value });
13400
+ }
13401
+ }
13402
+
13403
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/shareStoryEvent.ts
13404
+
13405
+ class ShareStoryEvent extends BaseStoryReaderEvent {
13406
+ get name() {
13407
+ return "shareStory";
13408
+ }
13409
+ }
13410
+
13411
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/shareStoryWithPathEvent.ts
13412
+
13413
+ class ShareStoryWithPathEvent extends BaseStoryReaderEvent {
13414
+ get name() {
13415
+ return "shareStoryWithPath";
13416
+ }
13417
+ toJSON() {
13418
+ return Object.assign(Object.assign({}, super.toJSON()), { value: this.payload.url });
13419
+ }
13420
+ }
13421
+
13422
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/showSlideEvent.ts
13423
+
13424
+ class ShowSlideEvent extends BaseStoryReaderEvent {
13425
+ get name() {
13426
+ return "showSlide";
13427
+ }
13428
+ }
13429
+
13430
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/showStoryEvent.ts
13743
13431
 
13744
- class StoryDisplayStrategyFactory {
13745
- constructor(storyManager, storyReaderViewModel) {
13746
- Object.defineProperty(this, "storyManager", {
13747
- enumerable: true,
13748
- configurable: true,
13749
- writable: true,
13750
- value: storyManager
13751
- });
13752
- Object.defineProperty(this, "storyReaderViewModel", {
13432
+ class ShowStoryEvent extends BaseStoryReaderEvent {
13433
+ get name() {
13434
+ return "showStory";
13435
+ }
13436
+ toJSON() {
13437
+ const data = super.toJSON();
13438
+ data.payload = null;
13439
+ return data;
13440
+ }
13441
+ }
13442
+
13443
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/showStoryFailed.ts
13444
+ class ShowStoryFailed {
13445
+ constructor(payload) {
13446
+ Object.defineProperty(this, "payload", {
13753
13447
  enumerable: true,
13754
13448
  configurable: true,
13755
13449
  writable: true,
13756
- value: storyReaderViewModel
13450
+ value: payload
13757
13451
  });
13758
13452
  }
13759
- createShowStory() {
13760
- return new ShowStoryStrategy(this.storyManager, this.storyReaderViewModel);
13761
- }
13762
- createShowStoryOnce() {
13763
- return new ShowStoryOnceStrategy(this.storyManager, this.storyReaderViewModel);
13764
- }
13765
- createShowStoryFromSharePage() {
13766
- return new ShowStoryFromSharePageStrategy(new ShowStoryStrategy(this.storyManager, this.storyReaderViewModel));
13767
- }
13768
- createShowOnboardingStories() {
13769
- return new ShowOnboardingStoriesStrategy(new ShowMultipleStoriesStrategy(this.storyManager, this.storyReaderViewModel), this.storyManager);
13453
+ get name() {
13454
+ return "showStoryFailed";
13770
13455
  }
13771
- createShowMultipleStories() {
13772
- return new ShowMultipleStoriesStrategy(this.storyManager, this.storyReaderViewModel);
13456
+ toJSON() {
13457
+ return {
13458
+ id: this.payload.id,
13459
+ title: this.payload.title,
13460
+ name: this.payload.name,
13461
+ message: this.payload.message
13462
+ };
13773
13463
  }
13774
13464
  }
13775
13465
 
13776
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/index.ts
13466
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/index.ts
13467
+
13468
+
13469
+
13470
+
13777
13471
 
13778
13472
 
13779
13473
 
@@ -14452,7 +14146,6 @@ var storyReaderViewModel_classPrivateFieldSet = (undefined && undefined.__classP
14452
14146
 
14453
14147
 
14454
14148
 
14455
-
14456
14149
  var StoryReaderEvent;
14457
14150
  (function (StoryReaderEvent) {
14458
14151
  StoryReaderEvent["Close"] = "closeStoryReader";
@@ -14468,7 +14161,7 @@ var CloseStoryReaderAction;
14468
14161
  CloseStoryReaderAction["AppClose"] = "app-close";
14469
14162
  })(CloseStoryReaderAction || (CloseStoryReaderAction = {}));
14470
14163
  let StoryReaderViewModel = (() => {
14471
- var _a, _StoryReaderViewModel__muted_accessor_storage, _StoryReaderViewModel__closeGestureInAction_accessor_storage, _StoryReaderViewModel__stories_accessor_storage;
14164
+ var _a, _StoryReaderViewModel__muted_accessor_storage, _StoryReaderViewModel__closeGestureInAction_accessor_storage, _StoryReaderViewModel__stories_accessor_storage, _StoryReaderViewModel__activeStory_accessor_storage, _StoryReaderViewModel__activeStoryIndex_accessor_storage, _StoryReaderViewModel__targetTransitionIndex_accessor_storage;
14472
14165
  let _classSuper = ViewModel;
14473
14166
  let _instanceExtraInitializers = [];
14474
14167
  let __muted_decorators;
@@ -14480,6 +14173,16 @@ let StoryReaderViewModel = (() => {
14480
14173
  let __stories_decorators;
14481
14174
  let __stories_initializers = [];
14482
14175
  let __stories_extraInitializers = [];
14176
+ let __activeStory_decorators;
14177
+ let __activeStory_initializers = [];
14178
+ let __activeStory_extraInitializers = [];
14179
+ let __activeStoryIndex_decorators;
14180
+ let __activeStoryIndex_initializers = [];
14181
+ let __activeStoryIndex_extraInitializers = [];
14182
+ let __targetTransitionIndex_decorators;
14183
+ let __targetTransitionIndex_initializers = [];
14184
+ let __targetTransitionIndex_extraInitializers = [];
14185
+ let _get_targetTransitionStory_decorators;
14483
14186
  let _get_isOpened_decorators;
14484
14187
  let _get_reachStart_decorators;
14485
14188
  let _get_reachEnd_decorators;
@@ -14501,6 +14204,8 @@ let StoryReaderViewModel = (() => {
14501
14204
  let _unmute_decorators;
14502
14205
  let _enableCloseGesture_decorators;
14503
14206
  let _disableCloseGesture_decorators;
14207
+ let _navigateStoryWithAnimation_decorators;
14208
+ let _handleTransitionEnd_decorators;
14504
14209
  return _a = class StoryReaderViewModel extends _classSuper {
14505
14210
  get _muted() { return storyReaderViewModel_classPrivateFieldGet(this, _StoryReaderViewModel__muted_accessor_storage, "f"); }
14506
14211
  set _muted(value) { storyReaderViewModel_classPrivateFieldSet(this, _StoryReaderViewModel__muted_accessor_storage, value, "f"); }
@@ -14508,6 +14213,12 @@ let StoryReaderViewModel = (() => {
14508
14213
  set _closeGestureInAction(value) { storyReaderViewModel_classPrivateFieldSet(this, _StoryReaderViewModel__closeGestureInAction_accessor_storage, value, "f"); }
14509
14214
  get _stories() { return storyReaderViewModel_classPrivateFieldGet(this, _StoryReaderViewModel__stories_accessor_storage, "f"); }
14510
14215
  set _stories(value) { storyReaderViewModel_classPrivateFieldSet(this, _StoryReaderViewModel__stories_accessor_storage, value, "f"); }
14216
+ get _activeStory() { return storyReaderViewModel_classPrivateFieldGet(this, _StoryReaderViewModel__activeStory_accessor_storage, "f"); }
14217
+ set _activeStory(value) { storyReaderViewModel_classPrivateFieldSet(this, _StoryReaderViewModel__activeStory_accessor_storage, value, "f"); }
14218
+ get _activeStoryIndex() { return storyReaderViewModel_classPrivateFieldGet(this, _StoryReaderViewModel__activeStoryIndex_accessor_storage, "f"); }
14219
+ set _activeStoryIndex(value) { storyReaderViewModel_classPrivateFieldSet(this, _StoryReaderViewModel__activeStoryIndex_accessor_storage, value, "f"); }
14220
+ get _targetTransitionIndex() { return storyReaderViewModel_classPrivateFieldGet(this, _StoryReaderViewModel__targetTransitionIndex_accessor_storage, "f"); }
14221
+ set _targetTransitionIndex(value) { storyReaderViewModel_classPrivateFieldSet(this, _StoryReaderViewModel__targetTransitionIndex_accessor_storage, value, "f"); }
14511
14222
  constructor(storyManager, storyReaderStatisticV1Service, storyReaderStatisticV2Service, storyFeedStatisticV1Service) {
14512
14223
  super();
14513
14224
  Object.defineProperty(this, "storyManager", {
@@ -14567,11 +14278,20 @@ let StoryReaderViewModel = (() => {
14567
14278
  writable: true,
14568
14279
  value: new TouchController({ touchStartTimeout: 200 })
14569
14280
  });
14570
- Object.defineProperty(this, "navigationController", {
14281
+ _StoryReaderViewModel__activeStory_accessor_storage.set(this, storyReaderViewModel_runInitializers(this, __activeStory_initializers, null));
14282
+ _StoryReaderViewModel__activeStoryIndex_accessor_storage.set(this, (storyReaderViewModel_runInitializers(this, __activeStory_extraInitializers), storyReaderViewModel_runInitializers(this, __activeStoryIndex_initializers, 0)));
14283
+ _StoryReaderViewModel__targetTransitionIndex_accessor_storage.set(this, (storyReaderViewModel_runInitializers(this, __activeStoryIndex_extraInitializers), storyReaderViewModel_runInitializers(this, __targetTransitionIndex_initializers, -1)));
14284
+ Object.defineProperty(this, "animatedNavigationController", {
14571
14285
  enumerable: true,
14572
14286
  configurable: true,
14573
14287
  writable: true,
14574
- value: void 0
14288
+ value: (storyReaderViewModel_runInitializers(this, __targetTransitionIndex_extraInitializers), null)
14289
+ });
14290
+ Object.defineProperty(this, "_activeStoryStartTime", {
14291
+ enumerable: true,
14292
+ configurable: true,
14293
+ writable: true,
14294
+ value: 0
14575
14295
  });
14576
14296
  Object.defineProperty(this, "useModernLayout", {
14577
14297
  enumerable: true,
@@ -14585,17 +14305,23 @@ let StoryReaderViewModel = (() => {
14585
14305
  writable: true,
14586
14306
  value: null
14587
14307
  });
14308
+ Object.defineProperty(this, "statisticsController", {
14309
+ enumerable: true,
14310
+ configurable: true,
14311
+ writable: true,
14312
+ value: void 0
14313
+ });
14588
14314
  this.handleWindowUnload = this.handleWindowUnload.bind(this);
14589
14315
  this.handleKeydown = this.handleKeydown.bind(this);
14590
14316
  window.addEventListener("beforeunload", this.handleWindowUnload);
14591
14317
  this.storyDisplayStrategyFactory = new StoryDisplayStrategyFactory(storyManager, this);
14592
- this.navigationController = new StoryReaderNavigationController(this.storyManager, this, new StoryReaderStatisticsController(this, this.storyManager, this.storyReaderStatisticV1Service, this.storyFeedStatisticV1Service, this.storyReaderStatisticV2Service));
14593
- }
14594
- get targetTransitionIndex() {
14595
- return this.navigationController.targetTransitionIndex;
14318
+ this.statisticsController = new StoryReaderStatisticsController(this, this.storyManager, this.storyReaderStatisticV1Service, this.storyFeedStatisticV1Service, this.storyReaderStatisticV2Service);
14596
14319
  }
14597
14320
  get targetTransitionStory() {
14598
- return this.navigationController.targetTransitionStory;
14321
+ return this.stories[this._targetTransitionIndex];
14322
+ }
14323
+ get targetTransitionIndex() {
14324
+ return this._targetTransitionIndex;
14599
14325
  }
14600
14326
  get touchController() {
14601
14327
  return this._touchController;
@@ -14617,22 +14343,26 @@ let StoryReaderViewModel = (() => {
14617
14343
  return this._stories;
14618
14344
  }
14619
14345
  get activeStory() {
14620
- return this.navigationController.activeStory;
14346
+ return this._activeStory;
14347
+ }
14348
+ get activeStoryDuration() {
14349
+ return Date.now() - this._activeStoryStartTime;
14621
14350
  }
14622
14351
  get dir() {
14623
14352
  return this.storyManager.config.dir;
14624
14353
  }
14625
14354
  get isOpened() {
14626
- return Boolean(this.navigationController.activeStory);
14355
+ return Boolean(this.activeStory);
14627
14356
  }
14628
14357
  get activeStoryIndex() {
14629
- return this.navigationController.currentIndex;
14358
+ return this._activeStoryIndex;
14630
14359
  }
14631
14360
  get reachStart() {
14632
- return this.navigationController.reachStart || this._stories[0] === this.targetTransitionStory;
14361
+ return this._activeStoryIndex === 0 || this._stories[0] === this.targetTransitionStory;
14633
14362
  }
14634
14363
  get reachEnd() {
14635
- return (this.navigationController.reachEnd || this._stories[this._stories.length - 1] === this.targetTransitionStory);
14364
+ return (this._activeStoryIndex === this.stories.length - 1 ||
14365
+ this._stories[this._stories.length - 1] === this.targetTransitionStory);
14636
14366
  }
14637
14367
  open(payload) {
14638
14368
  var _b, _c;
@@ -14642,8 +14372,7 @@ let StoryReaderViewModel = (() => {
14642
14372
  this.cacheManager = new CacheManager(this.storyManager.config.cache);
14643
14373
  this.windowReferer = payload.windowReferer;
14644
14374
  this.setStories(payload.stories);
14645
- const activeStory = this.navigationController.setActiveStoryById(payload.id);
14646
- this.navigationController.setCurrentStoryDisplayStrategy(this._currentStoryDisplayStrategy);
14375
+ this.setActiveStoryById(payload.id);
14647
14376
  this.storyReaderStatisticV1Service.init({ feedSlug: (_c = (_b = this._currentStoryDisplayStrategy) === null || _b === void 0 ? void 0 : _b.feed) === null || _c === void 0 ? void 0 : _c.slug });
14648
14377
  this._touchController.init(document.body);
14649
14378
  this.setScrollBar(payload.windowReferer);
@@ -14670,7 +14399,7 @@ let StoryReaderViewModel = (() => {
14670
14399
  this.storyReaderStatisticV2Service.sendCloseReaderEvent({
14671
14400
  action,
14672
14401
  totalSlides: activeStory.slidesCount,
14673
- durationMs: this.navigationController.activeStoryDuration,
14402
+ durationMs: this.activeStoryDuration,
14674
14403
  storyId: activeStory.id,
14675
14404
  activeSlideIndex: activeStory.activeSlideIndex,
14676
14405
  feedSlug: (_b = this.feed) === null || _b === void 0 ? void 0 : _b.slug
@@ -14691,7 +14420,7 @@ let StoryReaderViewModel = (() => {
14691
14420
  this.clearStoryViewModels();
14692
14421
  this._touchController.destroy();
14693
14422
  document.removeEventListener("keydown", this.handleKeydown);
14694
- this.navigationController.destroy();
14423
+ this._activeStory = null;
14695
14424
  (_b = this.cacheManager) === null || _b === void 0 ? void 0 : _b.destroy();
14696
14425
  }
14697
14426
  canBeClosed() {
@@ -14739,24 +14468,32 @@ let StoryReaderViewModel = (() => {
14739
14468
  });
14740
14469
  }
14741
14470
  nextStory() {
14742
- return this.navigationController.nextStory();
14471
+ if (this.reachEnd)
14472
+ return;
14473
+ this.setActiveStoryByIndex(this._activeStoryIndex + 1);
14743
14474
  }
14744
14475
  prevStory() {
14745
- return this.navigationController.prevStory();
14476
+ if (this.reachStart)
14477
+ return;
14478
+ this.setActiveStoryByIndex(this._activeStoryIndex - 1);
14746
14479
  }
14747
14480
  nextStoryWithAnimation(action) {
14748
- return this.navigationController.nextStoryWithAnimation(action);
14481
+ if (this.reachEnd)
14482
+ this.handleStoryReaderReachEnd(action);
14483
+ else
14484
+ this.navigateStoryWithAnimation(this._activeStoryIndex + 1, action);
14749
14485
  }
14750
14486
  prevStoryWithAnimation(action) {
14751
- return this.navigationController.prevStoryWithAnimation(action);
14487
+ if (!this.reachStart)
14488
+ this.navigateStoryWithAnimation(this._activeStoryIndex - 1, action);
14752
14489
  }
14753
14490
  toStoryWithAnimationByIndex(index) {
14754
14491
  if (this.activeStoryIndex === index)
14755
14492
  return;
14756
- return this.navigationController.navigateStoryWithAnimation(index, "");
14493
+ return this.navigateStoryWithAnimation(index, "");
14757
14494
  }
14758
14495
  navigateStoryWithAnimationByIndex(index, action) {
14759
- this.navigationController.navigateStoryWithAnimation(index, action);
14496
+ this.navigateStoryWithAnimation(index, action);
14760
14497
  }
14761
14498
  destroy() {
14762
14499
  var _b;
@@ -14773,7 +14510,7 @@ let StoryReaderViewModel = (() => {
14773
14510
  (_b = this.activeStory) === null || _b === void 0 ? void 0 : _b.goodsWidget.close();
14774
14511
  }
14775
14512
  setAnimatedNavigationController(animatedNavigationController) {
14776
- this.navigationController.setAnimatedNavigationController(animatedNavigationController);
14513
+ this.animatedNavigationController = animatedNavigationController;
14777
14514
  }
14778
14515
  mute() {
14779
14516
  this._muted = true;
@@ -14877,16 +14614,82 @@ let StoryReaderViewModel = (() => {
14877
14614
  });
14878
14615
  this.storyReaderStatisticV1Service.sendData();
14879
14616
  }
14617
+ setActiveStoryById(storyId) {
14618
+ const stories = this.stories;
14619
+ const index = stories.findIndex(story => story.id === storyId);
14620
+ if (index === -1)
14621
+ throw new Error(`[IAS]: No story found with ID ${storyId}`);
14622
+ return this.setActiveStoryByIndex(index);
14623
+ }
14624
+ setActiveStoryByIndex(index) {
14625
+ const prevIndex = this._activeStoryIndex;
14626
+ const prevStory = this._activeStory;
14627
+ const newActiveStory = this.stories[index];
14628
+ if (!newActiveStory)
14629
+ return;
14630
+ this.updateActiveStory(index, prevStory, newActiveStory);
14631
+ newActiveStory.once(StoryEvent.Started, () => {
14632
+ this.statisticsController.emitTransitionEvents(prevIndex, index, prevStory, newActiveStory, this.activeStoryDuration);
14633
+ this._activeStoryStartTime = Date.now();
14634
+ });
14635
+ newActiveStory.markAsOpened();
14636
+ return newActiveStory;
14637
+ }
14638
+ updateActiveStory(index, prevStory, activeStory) {
14639
+ this._activeStoryIndex = index;
14640
+ this._activeStory = activeStory;
14641
+ return activeStory;
14642
+ }
14643
+ handleStoryReaderReachEnd(action) {
14644
+ var _b;
14645
+ if (action !== CloseStoryReaderAction.CloseByTimer) {
14646
+ this.close(CloseStoryReaderAction.CloseByLastSlideClick);
14647
+ }
14648
+ else if ((_b = this.animatedNavigationController) === null || _b === void 0 ? void 0 : _b.options.closeOnLastSlideByTimer) {
14649
+ this.close(CloseStoryReaderAction.CloseByTimer);
14650
+ }
14651
+ }
14652
+ async navigateStoryWithAnimation(index, action = "lastSlideClick") {
14653
+ if (!this.animatedNavigationController ||
14654
+ this.animatedNavigationController.animating ||
14655
+ this._targetTransitionIndex !== -1)
14656
+ return;
14657
+ index = this.limitIndex(index);
14658
+ this._targetTransitionIndex = index;
14659
+ this._currentStoryDisplayStrategy.handleNextStoryByIndex(index);
14660
+ await this.animatedNavigationController.transitionByIndex(index, this._activeStoryIndex);
14661
+ await this.handleTransitionEnd(index, action);
14662
+ }
14663
+ limitIndex(index) {
14664
+ return Math.max(0, Math.min(this.stories.length - 1, index));
14665
+ }
14666
+ async handleTransitionEnd(index, navigationAction) {
14667
+ if (this.activeStory) {
14668
+ const event = new CloseStoryEvent(this.activeStory, {
14669
+ action: navigationAction
14670
+ });
14671
+ this.storyManager.emit(event.name, event.toJSON());
14672
+ }
14673
+ await this.setActiveStoryByIndex(index);
14674
+ this._targetTransitionIndex = -1;
14675
+ }
14880
14676
  },
14881
14677
  _StoryReaderViewModel__muted_accessor_storage = new WeakMap(),
14882
14678
  _StoryReaderViewModel__closeGestureInAction_accessor_storage = new WeakMap(),
14883
14679
  _StoryReaderViewModel__stories_accessor_storage = new WeakMap(),
14680
+ _StoryReaderViewModel__activeStory_accessor_storage = new WeakMap(),
14681
+ _StoryReaderViewModel__activeStoryIndex_accessor_storage = new WeakMap(),
14682
+ _StoryReaderViewModel__targetTransitionIndex_accessor_storage = new WeakMap(),
14884
14683
  (() => {
14885
14684
  var _b;
14886
14685
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
14887
14686
  __muted_decorators = [external_mobx_namespaceObject.observable];
14888
14687
  __closeGestureInAction_decorators = [external_mobx_namespaceObject.observable];
14889
14688
  __stories_decorators = [external_mobx_namespaceObject.observable];
14689
+ __activeStory_decorators = [external_mobx_namespaceObject.observable];
14690
+ __activeStoryIndex_decorators = [external_mobx_namespaceObject.observable];
14691
+ __targetTransitionIndex_decorators = [external_mobx_namespaceObject.observable];
14692
+ _get_targetTransitionStory_decorators = [external_mobx_namespaceObject.computed];
14890
14693
  _get_isOpened_decorators = [external_mobx_namespaceObject.computed];
14891
14694
  _get_reachStart_decorators = [external_mobx_namespaceObject.computed];
14892
14695
  _get_reachEnd_decorators = [external_mobx_namespaceObject.computed];
@@ -14908,9 +14711,15 @@ let StoryReaderViewModel = (() => {
14908
14711
  _unmute_decorators = [external_mobx_namespaceObject.action];
14909
14712
  _enableCloseGesture_decorators = [external_mobx_namespaceObject.action];
14910
14713
  _disableCloseGesture_decorators = [external_mobx_namespaceObject.action];
14714
+ _navigateStoryWithAnimation_decorators = [external_mobx_namespaceObject.action];
14715
+ _handleTransitionEnd_decorators = [external_mobx_namespaceObject.action];
14911
14716
  storyReaderViewModel_esDecorate(_a, null, __muted_decorators, { kind: "accessor", name: "_muted", static: false, private: false, access: { has: obj => "_muted" in obj, get: obj => obj._muted, set: (obj, value) => { obj._muted = value; } }, metadata: _metadata }, __muted_initializers, __muted_extraInitializers);
14912
14717
  storyReaderViewModel_esDecorate(_a, null, __closeGestureInAction_decorators, { kind: "accessor", name: "_closeGestureInAction", static: false, private: false, access: { has: obj => "_closeGestureInAction" in obj, get: obj => obj._closeGestureInAction, set: (obj, value) => { obj._closeGestureInAction = value; } }, metadata: _metadata }, __closeGestureInAction_initializers, __closeGestureInAction_extraInitializers);
14913
14718
  storyReaderViewModel_esDecorate(_a, null, __stories_decorators, { kind: "accessor", name: "_stories", static: false, private: false, access: { has: obj => "_stories" in obj, get: obj => obj._stories, set: (obj, value) => { obj._stories = value; } }, metadata: _metadata }, __stories_initializers, __stories_extraInitializers);
14719
+ storyReaderViewModel_esDecorate(_a, null, __activeStory_decorators, { kind: "accessor", name: "_activeStory", static: false, private: false, access: { has: obj => "_activeStory" in obj, get: obj => obj._activeStory, set: (obj, value) => { obj._activeStory = value; } }, metadata: _metadata }, __activeStory_initializers, __activeStory_extraInitializers);
14720
+ storyReaderViewModel_esDecorate(_a, null, __activeStoryIndex_decorators, { kind: "accessor", name: "_activeStoryIndex", static: false, private: false, access: { has: obj => "_activeStoryIndex" in obj, get: obj => obj._activeStoryIndex, set: (obj, value) => { obj._activeStoryIndex = value; } }, metadata: _metadata }, __activeStoryIndex_initializers, __activeStoryIndex_extraInitializers);
14721
+ storyReaderViewModel_esDecorate(_a, null, __targetTransitionIndex_decorators, { kind: "accessor", name: "_targetTransitionIndex", static: false, private: false, access: { has: obj => "_targetTransitionIndex" in obj, get: obj => obj._targetTransitionIndex, set: (obj, value) => { obj._targetTransitionIndex = value; } }, metadata: _metadata }, __targetTransitionIndex_initializers, __targetTransitionIndex_extraInitializers);
14722
+ storyReaderViewModel_esDecorate(_a, null, _get_targetTransitionStory_decorators, { kind: "getter", name: "targetTransitionStory", static: false, private: false, access: { has: obj => "targetTransitionStory" in obj, get: obj => obj.targetTransitionStory }, metadata: _metadata }, null, _instanceExtraInitializers);
14914
14723
  storyReaderViewModel_esDecorate(_a, null, _get_isOpened_decorators, { kind: "getter", name: "isOpened", static: false, private: false, access: { has: obj => "isOpened" in obj, get: obj => obj.isOpened }, metadata: _metadata }, null, _instanceExtraInitializers);
14915
14724
  storyReaderViewModel_esDecorate(_a, null, _get_reachStart_decorators, { kind: "getter", name: "reachStart", static: false, private: false, access: { has: obj => "reachStart" in obj, get: obj => obj.reachStart }, metadata: _metadata }, null, _instanceExtraInitializers);
14916
14725
  storyReaderViewModel_esDecorate(_a, null, _get_reachEnd_decorators, { kind: "getter", name: "reachEnd", static: false, private: false, access: { has: obj => "reachEnd" in obj, get: obj => obj.reachEnd }, metadata: _metadata }, null, _instanceExtraInitializers);
@@ -14932,14 +14741,10 @@ let StoryReaderViewModel = (() => {
14932
14741
  storyReaderViewModel_esDecorate(_a, null, _unmute_decorators, { kind: "method", name: "unmute", static: false, private: false, access: { has: obj => "unmute" in obj, get: obj => obj.unmute }, metadata: _metadata }, null, _instanceExtraInitializers);
14933
14742
  storyReaderViewModel_esDecorate(_a, null, _enableCloseGesture_decorators, { kind: "method", name: "enableCloseGesture", static: false, private: false, access: { has: obj => "enableCloseGesture" in obj, get: obj => obj.enableCloseGesture }, metadata: _metadata }, null, _instanceExtraInitializers);
14934
14743
  storyReaderViewModel_esDecorate(_a, null, _disableCloseGesture_decorators, { kind: "method", name: "disableCloseGesture", static: false, private: false, access: { has: obj => "disableCloseGesture" in obj, get: obj => obj.disableCloseGesture }, metadata: _metadata }, null, _instanceExtraInitializers);
14744
+ storyReaderViewModel_esDecorate(_a, null, _navigateStoryWithAnimation_decorators, { kind: "method", name: "navigateStoryWithAnimation", static: false, private: false, access: { has: obj => "navigateStoryWithAnimation" in obj, get: obj => obj.navigateStoryWithAnimation }, metadata: _metadata }, null, _instanceExtraInitializers);
14745
+ storyReaderViewModel_esDecorate(_a, null, _handleTransitionEnd_decorators, { kind: "method", name: "handleTransitionEnd", static: false, private: false, access: { has: obj => "handleTransitionEnd" in obj, get: obj => obj.handleTransitionEnd }, metadata: _metadata }, null, _instanceExtraInitializers);
14935
14746
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
14936
14747
  })(),
14937
- Object.defineProperty(_a, "id", {
14938
- enumerable: true,
14939
- configurable: true,
14940
- writable: true,
14941
- value: "StoryReaderViewModel"
14942
- }),
14943
14748
  _a;
14944
14749
  })();
14945
14750
 
@@ -14971,7 +14776,6 @@ class StoryReaderViewModelFactory {
14971
14776
 
14972
14777
 
14973
14778
 
14974
-
14975
14779
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/index.ts
14976
14780
 
14977
14781
 
@@ -21091,7 +20895,7 @@ class UgcEditorStore {
21091
20895
  const session = await this.storyManager.rootStore.sessionStore.open();
21092
20896
  const ugcEditorConfigDto = await this.ugcEditorApi.fetchUgcEditorConfig();
21093
20897
  const storyManagerConfig = this.storyManager.config;
21094
- const sdkVersion = "1.9.4";
20898
+ const sdkVersion = "1.9.5";
21095
20899
  this._config = {
21096
20900
  sessionId: session.id,
21097
20901
  apiKey: storyManagerConfig.apiKey,
@@ -21562,11 +21366,11 @@ class StoryManager extends TypedEventEmitter {
21562
21366
  return deviceDescriptor.deviceId;
21563
21367
  }
21564
21368
  get sdkVersionName() {
21565
- const sdkVersionName = "1.9.4";
21369
+ const sdkVersionName = "1.9.5";
21566
21370
  return sdkVersionName || "0.0.0";
21567
21371
  }
21568
21372
  get sdkVersionCode() {
21569
- const sdkVersionCode = 10904;
21373
+ const sdkVersionCode = 10905;
21570
21374
  return sdkVersionCode ? parseInt(sdkVersionCode) : 0;
21571
21375
  }
21572
21376
  get lang() {
@@ -21630,7 +21434,7 @@ class StoryManager extends TypedEventEmitter {
21630
21434
  this.rootStore.storyManagerConfigStore.setConfig(configDto);
21631
21435
  }
21632
21436
  setUserAgent(userAgent) {
21633
- const sdkVersionCode = 10904;
21437
+ const sdkVersionCode = 10905;
21634
21438
  const buildVersion = sdkVersionCode ? parseInt(sdkVersionCode) : 0;
21635
21439
  // According to RFC5987, HTTP header values can legitimately be supplied using the ISO-8859-1 encoding.
21636
21440
  this._userAgent = `${userAgent} ${convertStrToLatin1(navigator.userAgent)}`;
@@ -23657,11 +23461,11 @@ const StoryReaderRoot = (0,external_mobx_react_lite_namespaceObject.observer)((p
23657
23461
  const getSlideBackdropStyle = () => {
23658
23462
  var _a, _b, _c;
23659
23463
  const imageOptions = [];
23660
- const displayedSlideImage = (_a = props.storyReader.activeStory) === null || _a === void 0 ? void 0 : _a.displayedSlideImage;
23464
+ const cover = (_a = props.storyReader.activeStory) === null || _a === void 0 ? void 0 : _a.cover;
23661
23465
  if (options.slideBackdrop != null && Array.isArray(options.slideBackdrop.linearGradientOverlay))
23662
23466
  imageOptions.push(`linear-gradient(${options.slideBackdrop.linearGradientOverlay.join(", ")})`);
23663
- if (displayedSlideImage != null)
23664
- imageOptions.push(`url(${displayedSlideImage})`);
23467
+ if (cover != null)
23468
+ imageOptions.push(`url(${cover})`);
23665
23469
  return {
23666
23470
  backgroundImage: imageOptions.join(", "),
23667
23471
  opacity: ((_b = options.slideBackdrop) === null || _b === void 0 ? void 0 : _b.opacity) || 0,
@@ -25696,13 +25500,7 @@ class StorySlidesContainer extends HTMLElement {
25696
25500
  writable: true,
25697
25501
  value: null
25698
25502
  });
25699
- Object.defineProperty(this, "story", {
25700
- enumerable: true,
25701
- configurable: true,
25702
- writable: true,
25703
- value: null
25704
- });
25705
- Object.defineProperty(this, "mountPoint", {
25503
+ Object.defineProperty(this, "_mountPoint", {
25706
25504
  enumerable: true,
25707
25505
  configurable: true,
25708
25506
  writable: true,
@@ -25719,22 +25517,22 @@ class StorySlidesContainer extends HTMLElement {
25719
25517
  configurable: true,
25720
25518
  writable: true,
25721
25519
  value: (event) => {
25722
- var _a;
25723
25520
  if (!this.shadowRoot)
25724
25521
  return;
25725
- const isActiveStory = this.getAttribute("is-active-story") === "true";
25726
- if (!isActiveStory)
25727
- return;
25728
- (_a = this.story) === null || _a === void 0 ? void 0 : _a.activeSlide.onClick({
25729
- event,
25730
- currentTarget: this.mountPoint,
25731
- preventNavigation: this.getAttribute("prevent-navigation") === "true"
25732
- });
25522
+ this.dispatchEvent(new CustomEvent("click", {
25523
+ detail: {
25524
+ event,
25525
+ currentTarget: this._mountPoint
25526
+ }
25527
+ }));
25733
25528
  }
25734
25529
  });
25735
25530
  }
25531
+ getMountPoint() {
25532
+ return this._mountPoint;
25533
+ }
25736
25534
  setStyle(cssString) {
25737
- if (!this.mountPoint)
25535
+ if (!this._mountPoint)
25738
25536
  return;
25739
25537
  if (this.styleElement && this.styleElement.parentNode)
25740
25538
  this.styleElement.parentNode.removeChild(this.styleElement);
@@ -25742,30 +25540,20 @@ class StorySlidesContainer extends HTMLElement {
25742
25540
  style.textContent = cssString;
25743
25541
  style.setAttribute("nonce", getNonce());
25744
25542
  this.styleElement = style;
25745
- this.mountPoint.prepend(style);
25746
- }
25747
- attach(story) {
25748
- /** React uses its own virtual DOM and can reuse or move nodes without actually removing them from the DOM. So connectedCallback and disconnectedCallback are not always called.React uses its own virtual DOM and can reuse or move nodes without actually removing them from the DOM. So connectedCallback and disconnectedCallback are not always called. */
25749
- if (!this.mountPoint)
25750
- throw new Error("[IAS]: Mount point was undefined");
25751
- this.story = story;
25752
- this.story.attachRoot(this.mountPoint);
25753
- this.mountPoint.addEventListener("click", this.handleClick);
25754
- }
25755
- detach() {
25756
- var _a, _b;
25757
- /** React uses its own virtual DOM and can reuse or move nodes without actually removing them from the DOM. So connectedCallback and disconnectedCallback are not always called. */
25758
- (_a = this.story) === null || _a === void 0 ? void 0 : _a.detachRoot();
25759
- (_b = this.mountPoint) === null || _b === void 0 ? void 0 : _b.removeEventListener("click", this.handleClick);
25543
+ this._mountPoint.prepend(style);
25760
25544
  }
25761
25545
  connectedCallback() {
25762
25546
  const shadowRoot = this.attachShadow({ mode: "open" });
25763
- this.mountPoint = document.createElement("div");
25764
- this.mountPoint.style.height = "100%";
25765
- this.mountPoint.style.width = "100%";
25766
- shadowRoot.appendChild(this.mountPoint);
25547
+ this._mountPoint = document.createElement("div");
25548
+ this._mountPoint.style.height = "100%";
25549
+ this._mountPoint.style.width = "100%";
25550
+ this._mountPoint.addEventListener("click", this.handleClick);
25551
+ shadowRoot.appendChild(this._mountPoint);
25552
+ }
25553
+ disconnectedCallback() {
25554
+ var _a;
25555
+ (_a = this._mountPoint) === null || _a === void 0 ? void 0 : _a.removeEventListener("click", this.handleClick);
25767
25556
  }
25768
- disconnectedCallback() { }
25769
25557
  }
25770
25558
  customElements.get("story-slides-container") || customElements.define("story-slides-container", StorySlidesContainer);
25771
25559
 
@@ -25786,7 +25574,7 @@ var StorySlidesRenderer_rest = (undefined && undefined.__rest) || function (s, e
25786
25574
 
25787
25575
 
25788
25576
  const StorySlidesRenderer = (0,external_mobx_react_lite_namespaceObject.observer)((0,external_react_namespaceObject.forwardRef)((_a, ref) => {
25789
- var { className, story, preventNavigation, isActiveStory } = _a, props = StorySlidesRenderer_rest(_a, ["className", "story", "preventNavigation", "isActiveStory"]);
25577
+ var { className, story } = _a, props = StorySlidesRenderer_rest(_a, ["className", "story"]);
25790
25578
  const storySlidesRef = (0,external_react_namespaceObject.useRef)(null);
25791
25579
  (0,external_react_namespaceObject.useImperativeHandle)(ref, () => {
25792
25580
  return {
@@ -25794,23 +25582,85 @@ const StorySlidesRenderer = (0,external_mobx_react_lite_namespaceObject.observer
25794
25582
  var _a;
25795
25583
  (_a = storySlidesRef.current) === null || _a === void 0 ? void 0 : _a.setStyle(style);
25796
25584
  },
25797
- attach: (story) => {
25798
- var _a;
25799
- (_a = storySlidesRef.current) === null || _a === void 0 ? void 0 : _a.attach(story);
25800
- },
25801
- detach: () => {
25802
- var _a;
25803
- (_a = storySlidesRef.current) === null || _a === void 0 ? void 0 : _a.detach();
25585
+ getMountPoint: () => {
25586
+ var _a, _b;
25587
+ return (_b = (_a = storySlidesRef.current) === null || _a === void 0 ? void 0 : _a.getMountPoint()) !== null && _b !== void 0 ? _b : null;
25804
25588
  }
25805
25589
  };
25806
25590
  }, [ref, storySlidesRef]);
25591
+ (0,external_react_namespaceObject.useEffect)(() => {
25592
+ if (!storySlidesRef.current)
25593
+ return;
25594
+ const storySlides = storySlidesRef.current;
25595
+ const handleClickEvent = (event) => {
25596
+ props.onClick(event.detail);
25597
+ };
25598
+ storySlides.addEventListener("click", handleClickEvent);
25599
+ return () => {
25600
+ storySlides.removeEventListener("click", handleClickEvent);
25601
+ };
25602
+ }, [props.onClick]);
25807
25603
  const bottomOffset = !props.isDesktopGeometry ? `${story.actionPanel.height}px` : "0px";
25808
25604
  // Bug with attributes in React 19. Explicit cast to string required
25809
25605
  return ((0,jsx_runtime_namespaceObject.jsx)("story-slides-container", { ref: storySlidesRef, style: {
25810
25606
  bottom: bottomOffset
25811
- }, class: className, dir: story.dir, "prevent-navigation": preventNavigation.toString(), "is-active-story": isActiveStory.toString() }));
25607
+ }, class: className, dir: story.dir }));
25812
25608
  }));
25813
25609
 
25610
+ ;// CONCATENATED MODULE: ./src/StoryReader/Story/hooks/useStoryLifecycle.ts
25611
+
25612
+ const useStoryLifecycle = (args) => {
25613
+ (0,external_react_namespaceObject.useEffect)(() => {
25614
+ if (!args.slideRef.current)
25615
+ return;
25616
+ args.story.update({
25617
+ container: args.slideRef.current.getMountPoint(),
25618
+ canBeInited: args.canBeInited,
25619
+ canBeStarted: args.canBeStarted,
25620
+ activeStory: args.activeStory
25621
+ });
25622
+ }, [args.canBeInited, args.canBeStarted, args.slideRef, args.story]);
25623
+ (0,external_react_namespaceObject.useEffect)(() => {
25624
+ return () => {
25625
+ args.story.update({
25626
+ container: null,
25627
+ canBeInited: false,
25628
+ canBeStarted: false,
25629
+ activeStory: null
25630
+ });
25631
+ };
25632
+ }, []);
25633
+ };
25634
+
25635
+ ;// CONCATENATED MODULE: ./src/StoryReader/Story/hooks/useStoryActionPanel.ts
25636
+
25637
+
25638
+
25639
+ const useStoryActionPanel = ({ geometry, story }) => {
25640
+ const { storyReaderOptions, commonOptions } = useIASContainer();
25641
+ const isDesktopGeometry = geometry instanceof DesktopStoryGeometry;
25642
+ (0,external_react_namespaceObject.useLayoutEffect)(() => {
25643
+ const bottomOffset = parseFloat(String(storyReaderOptions.actionPanelBottomOffset));
25644
+ story.actionPanel.setOptions(commonOptions);
25645
+ story.actionPanel.setActionPanelHeight(bottomOffset);
25646
+ }, [story, commonOptions, storyReaderOptions.actionPanelBottomOffset, isDesktopGeometry]);
25647
+ };
25648
+
25649
+ ;// CONCATENATED MODULE: ./src/StoryReader/Story/hooks/useStorySlideStyle.ts
25650
+
25651
+ const useStorySlideStyle = ({ story, slideRef }) => {
25652
+ (0,external_react_namespaceObject.useLayoutEffect)(() => {
25653
+ if (!slideRef.current)
25654
+ return;
25655
+ slideRef.current.setStyle(story.context.style);
25656
+ }, [story.context.style, slideRef]);
25657
+ };
25658
+
25659
+ ;// CONCATENATED MODULE: ./src/StoryReader/Story/hooks/index.ts
25660
+
25661
+
25662
+
25663
+
25814
25664
  ;// CONCATENATED MODULE: ./src/StoryReader/Story/Story.tsx
25815
25665
  var Story_rest = (undefined && undefined.__rest) || function (s, e) {
25816
25666
  var t = {};
@@ -25837,37 +25687,21 @@ var Story_rest = (undefined && undefined.__rest) || function (s, e) {
25837
25687
 
25838
25688
 
25839
25689
 
25690
+
25840
25691
  const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) => {
25841
25692
  var { story, geometry, className } = _a, props = Story_rest(_a, ["story", "geometry", "className"]);
25842
- const { storyReaderOptions, commonOptions, goodsWidgetOptions } = useIASContainer();
25843
25693
  const storyRef = (0,external_react_namespaceObject.useRef)(null);
25844
25694
  const slideRef = (0,external_react_namespaceObject.useRef)(null);
25845
- const isActiveStory = story === props.activeStory;
25846
- const isDesktopGeometry = geometry instanceof DesktopStoryGeometry;
25847
- const useModernLayout = storyReaderOptions.layout === StoryReaderLayout.Modern;
25848
- const shouldHideHeader = isDesktopGeometry && useModernLayout
25849
- ? !isActiveStory || story.pauseState.isUIPaused
25850
- : story.pauseState.isUIPaused;
25851
- const shouldHideActionPanel = isDesktopGeometry && ((useModernLayout && !isActiveStory) || story.textInput.isOpened);
25852
- (0,external_react_namespaceObject.useLayoutEffect)(() => {
25853
- const bottomOffset = parseFloat(String(storyReaderOptions.actionPanelBottomOffset));
25854
- story.actionPanel.setOptions(commonOptions);
25855
- story.actionPanel.setActionPanelHeight(bottomOffset);
25856
- }, [story, commonOptions, storyReaderOptions.actionPanelBottomOffset, isDesktopGeometry]);
25857
- (0,external_react_namespaceObject.useLayoutEffect)(() => {
25858
- if (!slideRef.current)
25859
- return;
25860
- slideRef.current.setStyle(story.context.style);
25861
- }, [story.context.style]);
25862
- (0,external_react_namespaceObject.useLayoutEffect)(() => {
25863
- if (!slideRef.current)
25864
- return;
25865
- const storySlides = slideRef.current;
25866
- storySlides.attach(story);
25867
- return () => {
25868
- storySlides.detach();
25869
- };
25870
- }, [story]);
25695
+ const { storyReaderOptions, commonOptions, goodsWidgetOptions } = useIASContainer();
25696
+ useStoryActionPanel({ geometry, story });
25697
+ useStorySlideStyle({ story, slideRef });
25698
+ useStoryLifecycle({
25699
+ story,
25700
+ canBeInited: props.canBeInited,
25701
+ canBeStarted: props.canBeStarted,
25702
+ activeStory: props.activeStory,
25703
+ slideRef
25704
+ });
25871
25705
  const handleReloadStory = async () => {
25872
25706
  const storyError = Boolean(story.error);
25873
25707
  try {
@@ -25880,13 +25714,28 @@ const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) =
25880
25714
  console.error(error);
25881
25715
  }
25882
25716
  };
25717
+ const isDesktopGeometry = geometry instanceof DesktopStoryGeometry;
25718
+ const isActiveStory = story === props.activeStory;
25719
+ const useModernLayout = storyReaderOptions.layout === StoryReaderLayout.Modern;
25720
+ const shouldHideHeader = isDesktopGeometry && useModernLayout
25721
+ ? !isActiveStory || story.pauseState.isUIPaused
25722
+ : story.pauseState.isUIPaused;
25723
+ const shouldHideActionPanel = isDesktopGeometry && ((useModernLayout && !isActiveStory) || story.textInput.isOpened);
25883
25724
  return ((0,jsx_runtime_namespaceObject.jsxs)("div", { ref: storyRef, className: (0,external_classnames_namespaceObject["default"])(Story_story_module["story"], className, {
25884
25725
  [Story_story_module["story_mobile"]]: !isDesktopGeometry
25885
25726
  }), onMouseDown: () => {
25886
25727
  story.sharePanel.completeNativeSharing({ result: false });
25887
25728
  }, onTouchStart: () => {
25888
25729
  story.sharePanel.completeNativeSharing({ result: false });
25889
- }, "data-testid": "story", children: [isDesktopGeometry && useModernLayout && story.isSlideRendered && (0,jsx_runtime_namespaceObject.jsx)(StoryBackdrop, { hidden: isActiveStory }), story.canBeShown && story.isSlideRendered && ((0,jsx_runtime_namespaceObject.jsx)(StoryHeader, { hidden: shouldHideHeader, story: story, onClose: props.onClose, isDesktopGeometry: isDesktopGeometry })), (0,jsx_runtime_namespaceObject.jsx)(StorySlidesRenderer, { className: Story_story_module["story-slides"], story: story, ref: slideRef, preventNavigation: useModernLayout && isDesktopGeometry, isActiveStory: isActiveStory, isDesktopGeometry: isDesktopGeometry }), story.actionPanel.needShown && story.isSlideRendered && ((0,jsx_runtime_namespaceObject.jsx)(StoryActionPanel, { dir: story.dir, isDesktopGeometry: isDesktopGeometry, hidden: shouldHideActionPanel, actionPanel: story.actionPanel, commonOptions: commonOptions, storyReaderOptions: storyReaderOptions })), props.activeStory === story && ((0,jsx_runtime_namespaceObject.jsx)(GoodsWidgetViewer, { story: story, goodsWidgetOptions: goodsWidgetOptions })), props.activeStory === story && ((0,jsx_runtime_namespaceObject.jsx)(TextInputModal, { story: story, storyRef: storyRef, storyGeometry: geometry })), story.sharePanel.isOpened && ((0,jsx_runtime_namespaceObject.jsx)(SharePanel, { dir: story.dir, className: Story_story_module["share-panel-wrapper"], shareText: story.sharePanel.params.text, shareType: story.sharePanel.params.type, shareLink: story.sharePanel.params.link, onShareCompelete: (result) => story.sharePanel.handleShareComplete(story.sharePanel.params.id, result), sharePanelOptions: storyReaderOptions.sharePanel })), (0,jsx_runtime_namespaceObject.jsx)(Loader, { needShowErrorScreen: story.needShowErrorScreen, needShowLoaderScreen: story.needShowLoaderScreen, onReload: handleReloadStory })] }));
25730
+ }, "data-testid": "story", children: [isDesktopGeometry && useModernLayout && story.isSlideRendered && (0,jsx_runtime_namespaceObject.jsx)(StoryBackdrop, { hidden: isActiveStory }), story.isSlideRendered && ((0,jsx_runtime_namespaceObject.jsx)(StoryHeader, { hidden: shouldHideHeader, story: story, onClose: props.onClose, isDesktopGeometry: isDesktopGeometry })), (0,jsx_runtime_namespaceObject.jsx)(StorySlidesRenderer, { className: Story_story_module["story-slides"], story: story, ref: slideRef, isDesktopGeometry: isDesktopGeometry, onClick: ({ event, currentTarget }) => {
25731
+ if (!isActiveStory)
25732
+ return;
25733
+ story.activeSlide.onClick({
25734
+ event: event,
25735
+ currentTarget,
25736
+ preventNavigation: useModernLayout && isDesktopGeometry
25737
+ });
25738
+ } }), story.actionPanel.needShown && story.isSlideRendered && ((0,jsx_runtime_namespaceObject.jsx)(StoryActionPanel, { dir: story.dir, isDesktopGeometry: isDesktopGeometry, hidden: shouldHideActionPanel, actionPanel: story.actionPanel, commonOptions: commonOptions, storyReaderOptions: storyReaderOptions })), props.activeStory === story && ((0,jsx_runtime_namespaceObject.jsx)(GoodsWidgetViewer, { story: story, goodsWidgetOptions: goodsWidgetOptions })), props.activeStory === story && ((0,jsx_runtime_namespaceObject.jsx)(TextInputModal, { story: story, storyRef: storyRef, storyGeometry: geometry })), story.sharePanel.isOpened && ((0,jsx_runtime_namespaceObject.jsx)(SharePanel, { dir: story.dir, className: Story_story_module["share-panel-wrapper"], shareText: story.sharePanel.params.text, shareType: story.sharePanel.params.type, shareLink: story.sharePanel.params.link, onShareCompelete: (result) => story.sharePanel.handleShareComplete(story.sharePanel.params.id, result), sharePanelOptions: storyReaderOptions.sharePanel })), (0,jsx_runtime_namespaceObject.jsx)(Loader, { needShowErrorScreen: story.needShowErrorScreen, needShowLoaderScreen: story.needShowLoaderScreen, onReload: handleReloadStory })] }));
25890
25739
  });
25891
25740
 
25892
25741
  ;// CONCATENATED MODULE: ./src/StoryReader/Story/index.ts
@@ -26218,6 +26067,15 @@ const ModernStoryList = (0,external_mobx_react_lite_namespaceObject.observer)((p
26218
26067
  const borderRadius = parseFloat(String(storyReaderOptions.borderRadius));
26219
26068
  const maxWidth = parseFloat(props.storyGeometry.getWidth()) * STORIES_PER_VIEWPORT;
26220
26069
  const uiDisabled = activeStory.pauseState.isUIPaused || slider.animating;
26070
+ const canBeInited = (index, range = 2) => {
26071
+ const activeIndex = props.storyReader.targetTransitionIndex === -1 ? props.storyReader.activeStoryIndex : props.storyReader.targetTransitionIndex;
26072
+ const start = Math.max(activeIndex - range, 0);
26073
+ const end = Math.min(activeIndex + range, props.storyReader.stories.length - 1);
26074
+ return index >= start && index <= end;
26075
+ };
26076
+ const canBeStarted = (index) => {
26077
+ return props.storyReader.activeStoryIndex === index;
26078
+ };
26221
26079
  return ((0,jsx_runtime_namespaceObject.jsx)("div", { className: (0,external_classnames_namespaceObject["default"])(ModernStoryList_modernStoryList_module["stories-list-container"]), style: {
26222
26080
  "--slide-border-radius": `${borderRadius}px`,
26223
26081
  maxWidth
@@ -26233,7 +26091,8 @@ const ModernStoryList = (0,external_mobx_react_lite_namespaceObject.observer)((p
26233
26091
  if (uiDisabled)
26234
26092
  return;
26235
26093
  props.storyReader.toStoryWithAnimationByIndex(index);
26236
- }, children: [(0,jsx_runtime_namespaceObject.jsx)(Story_Story, { index: index, story: story, slideClickDisabled: uiDisabled, activeStory: activeStory, geometry: props.storyGeometry, onClose: props.onCloseStory }), (props.storyReader.stories.length > 1 || story.slidesCount > 1) && activeStory.isSlideRendered && ((0,jsx_runtime_namespaceObject.jsx)(ModernStoryListControls, { dir: props.storyReader.dir, display: isActiveStory && activeStory.canBeShown, disabled: uiDisabled, isNextDisabled: isNextDisabled, isPrevDisabled: isPrevDisabled, navigationOptions: storyReaderOptions.navigation, onNext: () => {
26094
+ }, children: [(0,jsx_runtime_namespaceObject.jsx)(Story_Story, { index: index, story: story, slideClickDisabled: uiDisabled, activeStory: activeStory, geometry: props.storyGeometry, onClose: props.onCloseStory, canBeInited: canBeInited(index), canBeStarted: canBeStarted(index) }), (props.storyReader.stories.length > 1 || story.slidesCount > 1) &&
26095
+ activeStory.isSlideRendered && ((0,jsx_runtime_namespaceObject.jsx)(ModernStoryListControls, { dir: props.storyReader.dir, display: isActiveStory && activeStory.isSlideRendered, disabled: uiDisabled, isNextDisabled: isNextDisabled, isPrevDisabled: isPrevDisabled, navigationOptions: storyReaderOptions.navigation, onNext: () => {
26237
26096
  props.storyReader.goNext();
26238
26097
  }, onPrev: () => {
26239
26098
  props.storyReader.goPrev();
@@ -27058,13 +26917,22 @@ const MobileStoryList = (0,external_mobx_react_lite_namespaceObject.observer)((p
27058
26917
  : 0;
27059
26918
  const uiPaused = activeStory.pauseState.isUIPaused || slider.api.animating;
27060
26919
  const useModernLayout = storyReaderOptions.layout === StoryReaderLayout.Modern;
26920
+ const canBeInited = (index, range = 2) => {
26921
+ const activeIndex = props.storyReader.targetTransitionIndex === -1 ? props.storyReader.activeStoryIndex : props.storyReader.targetTransitionIndex;
26922
+ const start = Math.max(activeIndex - range, 0);
26923
+ const end = Math.min(activeIndex + range, props.storyReader.stories.length - 1);
26924
+ return index >= start && index <= end;
26925
+ };
26926
+ const canBeStarted = (index) => {
26927
+ return props.storyReader.activeStoryIndex === index;
26928
+ };
27061
26929
  return ((0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, { children: [(0,jsx_runtime_namespaceObject.jsx)("div", { className: (0,external_classnames_namespaceObject["default"])(StoryReader_MobileStoryList_storyList_module["stories-list-container"], {
27062
26930
  [StoryReader_MobileStoryList_storyList_module["stories-list-container_swipe-up"]]: props.storyReader.closeGestureInAction,
27063
26931
  [StoryReader_MobileStoryList_storyList_module["stories-list-container_desktop"]]: props.isDesktopGeometry
27064
26932
  }), style: Object.assign({ WebkitPerspective: `${slider.perspective}px`, perspective: `${slider.perspective}px`, width: props.storyGeometry.getWidth(), backgroundColor: !props.isDesktopGeometry &&
27065
26933
  props.safeAreaFrameCalculator.shouldBeShownSafeAreaInsets &&
27066
26934
  "#000", "--slide-border-radius": `${borderRadius}px` }, props.correctionPaddingStyle), children: (0,jsx_runtime_namespaceObject.jsx)("div", { className: StoryReader_MobileStoryList_storyList_module["stories-list"], style: { transform: `translateZ(-${slider.depth}px)` }, children: (0,jsx_runtime_namespaceObject.jsxs)("div", { className: (0,external_classnames_namespaceObject["default"])(StoryReader_MobileStoryList_storyList_module["stories-list__effect-viewer"]), ref: slider.ref, children: [(0,jsx_runtime_namespaceObject.jsx)("div", { className: (0,external_classnames_namespaceObject["default"])(StoryReader_MobileStoryList_storyList_module["stories-list__item"]), children: (0,jsx_runtime_namespaceObject.jsx)(StoryBlank, {}) }), stories.map((story, index) => {
27067
- return ((0,jsx_runtime_namespaceObject.jsx)("div", { className: (0,external_classnames_namespaceObject["default"])(StoryReader_MobileStoryList_storyList_module["stories-list__item"]), children: (0,jsx_runtime_namespaceObject.jsx)(Story_Story, { slideClickDisabled: uiPaused, index: index, story: story, activeStory: activeStory, geometry: props.storyGeometry, onClose: props.onCloseStory }) }, story.id));
26935
+ return ((0,jsx_runtime_namespaceObject.jsx)("div", { className: (0,external_classnames_namespaceObject["default"])(StoryReader_MobileStoryList_storyList_module["stories-list__item"]), children: (0,jsx_runtime_namespaceObject.jsx)(Story_Story, { slideClickDisabled: uiPaused, index: index, story: story, activeStory: activeStory, geometry: props.storyGeometry, onClose: props.onCloseStory, canBeInited: canBeInited(index), canBeStarted: canBeStarted(index) }) }, story.id));
27068
26936
  }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: (0,external_classnames_namespaceObject["default"])(StoryReader_MobileStoryList_storyList_module["stories-list__item"]), children: (0,jsx_runtime_namespaceObject.jsx)(StoryBlank, {}) })] }) }) }), !useModernLayout && ((0,jsx_runtime_namespaceObject.jsx)(MobileStoryListControls, { dir: props.storyReader.dir, disabledByUI: activeStory.pauseState.isUIPaused, disabled: uiPaused, reachEnd: props.storyReader.reachEnd, reachStart: props.storyReader.reachStart, navigationOptions: storyReaderOptions.navigation, width: props.storyGeometry.calculateWidth(), onNext: () => props.storyReader.goNext(), onPrev: () => props.storyReader.goPrev() }))] }));
27069
26937
  });
27070
26938
 
@@ -28980,7 +28848,7 @@ const useStoryManagerConfig = (config) => {
28980
28848
  ;// CONCATENATED MODULE: ./src/IASContainer/hooks/useStoryManagerEvents.ts
28981
28849
 
28982
28850
 
28983
- const useStoryManagerEvents = ({ onClickOnStory, onClickOnButton, onShowStory, onCloseStory, onShowSlide, onLikeStory, onDislikeStory, onFavoriteStory, onShareStory, onShareStoryWithPath, onFeedImpression, onVisibleAreaUpdated, onWidgetEvent, onStartGame, onCloseGame, onFinishGame, onEventGame, onCloseStoryReader, onProductCartUpdated, onProductCartClicked }) => {
28851
+ const useStoryManagerEvents = ({ onClickOnStory, onClickOnButton, onShowStory, onCloseStory, onShowSlide, onLikeStory, onDislikeStory, onFavoriteStory, onShareStory, onShareStoryWithPath, onFeedImpression, onVisibleAreaUpdated, onWidgetEvent, onStartGame, onCloseGame, onEventGame, onCloseStoryReader, onProductCartUpdated, onProductCartClicked }) => {
28984
28852
  (0,external_react_namespaceObject.useEffect)(() => {
28985
28853
  const handlers = [
28986
28854
  { event: "clickOnStory", handler: onClickOnStory },
@@ -28997,7 +28865,6 @@ const useStoryManagerEvents = ({ onClickOnStory, onClickOnButton, onShowStory, o
28997
28865
  { event: "widgetEvent", handler: onWidgetEvent },
28998
28866
  { event: "startGame", handler: onStartGame },
28999
28867
  { event: "closeGame", handler: onCloseGame },
29000
- { event: "finishGame", handler: onFinishGame },
29001
28868
  { event: "eventGame", handler: onEventGame },
29002
28869
  { event: "clickOnButton", handler: onClickOnButton },
29003
28870
  { event: "closeStoryReader", handler: onCloseStoryReader },
@@ -29022,7 +28889,6 @@ const useStoryManagerEvents = ({ onClickOnStory, onClickOnButton, onShowStory, o
29022
28889
  onShowSlide,
29023
28890
  onStartGame,
29024
28891
  onCloseGame,
29025
- onFinishGame,
29026
28892
  onEventGame,
29027
28893
  onLikeStory,
29028
28894
  onDislikeStory,