@inappstory/react-sdk 1.9.3 → 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";
@@ -94,7 +93,7 @@ ___CSS_LOADER_EXPORT___.locals = {
94
93
 
95
94
  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()));
96
95
  // Module
97
- ___CSS_LOADER_EXPORT___.push([module.id, "@keyframes spin--Vkzob{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.splash-container--o7jGP{position:absolute;left:0;top:0;width:100%;height:100%;opacity:0;z-index:-1}.splash-container--o7jGP .splash-container__image--oC55V{position:absolute;inset:0px;z-index:0}.splash-container--o7jGP .splash-container__image--oC55V img{width:100%;height:100%;object-fit:cover}.splash-container--o7jGP .splash-container__lottie--krFru{position:absolute;inset:0px;z-index:1}.splash-container--o7jGP .splash-container__lottie--krFru canvas{width:100%;height:100%}.splash-container--o7jGP.splash-container--isLoading--O-XQM:after{display:inline-block;position:absolute;top:calc(50% - 1rem);left:calc(50% - 1rem);content:\"\";width:2rem;height:2rem;border:solid 2px var(--GRLoaderBackgroundColor, white);border-color:var(--GRLoaderBackgroundAccentColor, transparent) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white);border-radius:50%;animation:spin--Vkzob .6s infinite linear;z-index:10}.splash-container--o7jGP.splash-container--fadeIn--7OcPY{opacity:1;transition:opacity ease-in .2s}.splash-container--o7jGP.splash-container--fadeOut--MC7Yo{opacity:0;transition:opacity ease-out .3s}", "",{"version":3,"sources":["webpack://./src/GameReader/GameSplashScreen/gameSplashScreen.module.scss"],"names":[],"mappings":"AAAA,uBACI,KACI,8BAAA,CACA,sBAAA,CAGJ,GACI,gCAAA,CACA,wBAAA,CAAA,CAIR,yBACI,iBAAA,CACA,MAAA,CACA,KAAA,CACA,UAAA,CACA,WAAA,CACA,SAAA,CACA,UAAA,CAEA,yDACI,iBAAA,CACA,SAAA,CACA,SAAA,CAEA,6DACI,UAAA,CACA,WAAA,CACA,gBAAA,CAIR,0DACI,iBAAA,CACA,SAAA,CACA,SAAA,CAEA,iEACI,UAAA,CACA,WAAA,CAIR,kEACI,oBAAA,CACA,iBAAA,CACA,oBAAA,CACA,qBAAA,CACA,UAAA,CACA,UAAA,CACA,WAAA,CACA,sDAAA,CACA,gLAAA,CACA,iBAAA,CACA,yCAAA,CACA,UAAA,CAGJ,yDACI,SAAA,CACA,8BAAA,CAGJ,0DACI,SAAA,CACA,+BAAA","sourcesContent":["@keyframes spin {\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}\n\n.splash-container {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n z-index: -1;\n\n .splash-container__image {\n position: absolute;\n inset: 0px;\n z-index: 0;\n\n img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n }\n\n .splash-container__lottie {\n position: absolute;\n inset: 0px;\n z-index: 1;\n\n canvas {\n width: 100%;\n height: 100%;\n }\n }\n\n &.splash-container--isLoading:after {\n display: inline-block;\n position: absolute;\n top: calc(50% - 2rem / 2);\n left: calc(50% - 2rem / 2);\n content: '';\n width: 2rem;\n height: 2rem;\n border: solid 2px var(--GRLoaderBackgroundColor, white);\n border-color: var(--GRLoaderBackgroundAccentColor, transparent) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white);\n border-radius: 50%;\n animation: spin .6s infinite linear;\n z-index: 10;\n }\n\n &.splash-container--fadeIn {\n opacity: 1;\n transition: opacity ease-in 0.2s;\n }\n\n &.splash-container--fadeOut {\n opacity: 0;\n transition: opacity ease-out 0.3s;\n }\n}"],"sourceRoot":""}]);
96
+ ___CSS_LOADER_EXPORT___.push([module.id, "@keyframes spin--Vkzob{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.splash-container--o7jGP{position:absolute;left:0;top:0;width:100%;height:100%;opacity:0;z-index:-1}.splash-container--o7jGP .splash-container__image--oC55V{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.splash-container--o7jGP .splash-container__image--oC55V img{width:100%;height:100%;object-fit:cover}.splash-container--o7jGP .splash-container__lottie--krFru{position:absolute;left:0;right:0;top:0;bottom:0;z-index:1}.splash-container--o7jGP .splash-container__lottie--krFru canvas{width:100%;height:100%}.splash-container--o7jGP.splash-container--isLoading--O-XQM:after{display:inline-block;position:absolute;top:calc(50% - 1rem);left:calc(50% - 1rem);content:\"\";width:2rem;height:2rem;border:solid 2px var(--GRLoaderBackgroundColor, white);border-color:var(--GRLoaderBackgroundAccentColor, transparent) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white);border-radius:50%;animation:spin--Vkzob .6s infinite linear;z-index:10}.splash-container--o7jGP.splash-container--fadeIn--7OcPY{opacity:1;transition:opacity ease-in .2s}.splash-container--o7jGP.splash-container--fadeOut--MC7Yo{opacity:0;transition:opacity ease-out .3s}", "",{"version":3,"sources":["webpack://./src/GameReader/GameSplashScreen/gameSplashScreen.module.scss"],"names":[],"mappings":"AAAA,uBACI,KACI,8BAAA,CACA,sBAAA,CAGJ,GACI,gCAAA,CACA,wBAAA,CAAA,CA8BR,yBACI,iBAAA,CACA,MAAA,CACA,KAAA,CACA,UAAA,CACA,WAAA,CACA,SAAA,CACA,UAAA,CAEA,yDACI,iBAAA,CACA,MAAA,CACA,OAAA,CACA,KAAA,CACA,QAAA,CACA,SAAA,CAEA,6DACI,UAAA,CACA,WAAA,CACA,gBAAA,CAIR,0DACI,iBAAA,CACA,MAAA,CACA,OAAA,CACA,KAAA,CACA,QAAA,CACA,SAAA,CAEA,iEACI,UAAA,CACA,WAAA,CAIR,kEACI,oBAAA,CACA,iBAAA,CACA,oBAAA,CACA,qBAAA,CACA,UAAA,CACA,UAAA,CACA,WAAA,CACA,sDAAA,CACA,gLAAA,CACA,iBAAA,CACA,yCAAA,CACA,UAAA,CAGJ,yDACI,SAAA,CACA,8BAAA,CAGJ,0DACI,SAAA,CACA,+BAAA","sourcesContent":["@keyframes spin {\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}\n\n/* .splash-container.splash-container--widescreen {\n .splash-container__image {\n display: flex;\n justify-content: center;\n align-items: center;\n\n img {\n object-fit: fill;\n width: auto;\n height: 100%;\n max-width: inherit;\n }\n\n \n }\n\n .splash-container__lottie {\n top: 50%;\n left: 50%;\n transform: translate3d(-50%, -50%, 0);\n width: 28vmin;\n max-width: 360px;\n min-width: 160px;\n }\n} */\n\n.splash-container {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n z-index: -1;\n\n .splash-container__image {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 0;\n\n img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n }\n\n .splash-container__lottie {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 1;\n\n canvas {\n width: 100%;\n height: 100%;\n }\n }\n\n &.splash-container--isLoading:after {\n display: inline-block;\n position: absolute;\n top: calc(50% - 2rem / 2);\n left: calc(50% - 2rem / 2);\n content: '';\n width: 2rem;\n height: 2rem;\n border: solid 2px var(--GRLoaderBackgroundColor, white);\n border-color: var(--GRLoaderBackgroundAccentColor, transparent) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white) var(--GRLoaderBackgroundColor, white);\n border-radius: 50%;\n animation: spin .6s infinite linear;\n z-index: 10;\n }\n\n &.splash-container--fadeIn {\n opacity: 1;\n transition: opacity ease-in 0.2s;\n }\n\n &.splash-container--fadeOut {\n opacity: 0;\n transition: opacity ease-out 0.3s;\n }\n}"],"sourceRoot":""}]);
98
97
  // Exports
99
98
  ___CSS_LOADER_EXPORT___.locals = {
100
99
  "splash-container": "splash-container--o7jGP",
@@ -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",
@@ -976,6 +975,31 @@ ___CSS_LOADER_EXPORT___.locals = {
976
975
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
977
976
 
978
977
 
978
+ /***/ }),
979
+
980
+ /***/ 827:
981
+ /***/ ((module, __webpack_exports__, __webpack_require__) => {
982
+
983
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
984
+ /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
985
+ /* harmony export */ });
986
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(372);
987
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_cssWithMappingToString_js__WEBPACK_IMPORTED_MODULE_0__);
988
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(935);
989
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
990
+ // Imports
991
+
992
+
993
+ 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()));
994
+ // Module
995
+ ___CSS_LOADER_EXPORT___.push([module.id, ".ias-copy-button--q2E8X{color:#fff}.ias-copy-button--q2E8X:hover{color:#fff}", "",{"version":3,"sources":["webpack://./src/UI/SharePanel/ShareCopyButton/shareCopyButton.module.scss"],"names":[],"mappings":"AAAA,wBACI,UAAA,CAGJ,8BACI,UAAA","sourcesContent":[".ias-copy-button {\n color: white;\n}\n\n.ias-copy-button:hover {\n color: white;\n}"],"sourceRoot":""}]);
996
+ // Exports
997
+ ___CSS_LOADER_EXPORT___.locals = {
998
+ "ias-copy-button": "ias-copy-button--q2E8X"
999
+ };
1000
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
1001
+
1002
+
979
1003
  /***/ }),
980
1004
 
981
1005
  /***/ 749:
@@ -5681,26 +5705,6 @@ let Story = (() => {
5681
5705
  get wasShown() {
5682
5706
  return this._wasShown;
5683
5707
  }
5684
- getImagesPerSlide(index) {
5685
- var _b, _c;
5686
- this.parseHtmlSlidesForMainImage();
5687
- return (_c = (_b = this._parsedSlideImage) === null || _b === void 0 ? void 0 : _b[index]) !== null && _c !== void 0 ? _c : null;
5688
- }
5689
- parseHtmlSlidesForMainImage() {
5690
- if (this._parsedSlideImage || !this.slidesLoaded)
5691
- return;
5692
- this._parsedSlideImage = this._slides.map((slide) => this.parseSlideNarrativeImageSrc(slide.html) ||
5693
- this.parseSlideNarrativeVideoPosterSrc(slide.html) ||
5694
- null);
5695
- }
5696
- parseSlideNarrativeImageSrc(slideHtml) {
5697
- const results = slideHtml.match(/<[^<]*narrative-element-image.*<img[^<]*src="([^"]*)"[^<]*>/i);
5698
- return results === null || results === void 0 ? void 0 : results[1];
5699
- }
5700
- parseSlideNarrativeVideoPosterSrc(slideHtml) {
5701
- const results = slideHtml.match(/<[^<]*narrative-element-video.*<video[^<]*poster\-remote\-src="([^"]*)"[^<]*>/i);
5702
- return results === null || results === void 0 ? void 0 : results[1];
5703
- }
5704
5708
  get videoCover() {
5705
5709
  return this._videoCover;
5706
5710
  }
@@ -5912,78 +5916,13 @@ const AppearanceCommonOptionsDefault = {
5912
5916
  };
5913
5917
 
5914
5918
 
5915
- ;// CONCATENATED MODULE: ../core/src/types/gameReader.ts
5916
-
5917
- const GameReaderOptionsDefault = {
5918
- borderRadius: 5,
5919
- loader: {
5920
- default: {
5921
- color: "white",
5922
- accentColor: "transparent"
5923
- },
5924
- custom: null
5925
- },
5926
- backdropColor: "#1a1a1a",
5927
- backdrop: {
5928
- opacity: 1,
5929
- background: "#1a1a1a"
5930
- },
5931
- game: {
5932
- backdropColor: "rgb(51, 51, 51)"
5933
- },
5934
- forceDesktopMode: AppearanceCommonOptionsDefault.forceDesktopMode,
5935
- forceCheckOrientation: true
5936
- };
5937
-
5938
-
5939
- ;// CONCATENATED MODULE: ../core/src/types/goodsWidget.ts
5940
- var GoodsWidgetRenderingType;
5941
- (function (GoodsWidgetRenderingType) {
5942
- GoodsWidgetRenderingType["DEFAULT"] = "default";
5943
- GoodsWidgetRenderingType["CUSTOM_CARD"] = "customCard";
5944
- })(GoodsWidgetRenderingType || (GoodsWidgetRenderingType = {}));
5945
- const GoodsWidgetOptionsDefault = {
5946
- goodsWidgetRenderingType: GoodsWidgetRenderingType.DEFAULT,
5947
- goodsList: {
5948
- renderingType: GoodsWidgetRenderingType.DEFAULT,
5949
- closeBackgroundColor: "#000000",
5950
- substrateHeight: 200,
5951
- substrateColor: "#FFFFFF",
5952
- dimColor: "rgba(0, 0, 0, 0.5)"
5953
- },
5954
- goodsCard: {
5955
- mainTextColor: "#000000",
5956
- oldPriceTextColor: "#CCCCCC",
5957
- imageBackgroundColor: "transparent",
5958
- imageCornerRadius: 8
5959
- },
5960
- openGoodsWidgetHandler: goods => Promise.resolve(goods),
5961
- loader: {
5962
- default: {
5963
- color: "gray",
5964
- accentColor: "transparent"
5965
- }
5966
- }
5967
- };
5968
-
5969
-
5970
- ;// CONCATENATED MODULE: ../core/src/types/storyManager.ts
5971
- var StoryManagerEvent;
5972
- (function (StoryManagerEvent) {
5973
- StoryManagerEvent["WidgetEvent"] = "widgetEvent";
5974
- StoryManagerEvent["ClickOnButton"] = "clickOnButton";
5975
- })(StoryManagerEvent || (StoryManagerEvent = {}));
5976
- var CTASource;
5977
- (function (CTASource) {
5978
- CTASource["STORY_LIST"] = "storyList";
5979
- CTASource["STORY_READER"] = "storyReader";
5980
- CTASource["GAME_READER"] = "gameReader";
5981
- CTASource["STACK_STORY_LIST"] = "stackStoryList";
5982
- CTASource["IAM_READER"] = "iamReader";
5983
- CTASource["BANNERS"] = "banners";
5984
- })(CTASource || (CTASource = {}));
5985
-
5986
5919
  ;// CONCATENATED MODULE: ../core/src/types/sharePanel.ts
5920
+ var ShareType;
5921
+ (function (ShareType) {
5922
+ ShareType["Text"] = "text";
5923
+ ShareType["Link"] = "link";
5924
+ ShareType["Image"] = "image";
5925
+ })(ShareType || (ShareType = {}));
5987
5926
  const twitter = {
5988
5927
  label: "X",
5989
5928
  icon: {
@@ -6077,6 +6016,14 @@ const SharePanelDefault = {
6077
6016
  },
6078
6017
  copyButton: {
6079
6018
  label: "Copy link",
6019
+ getLabel: ({ url, text, type }) => {
6020
+ var _a;
6021
+ if (type === ShareType.Link)
6022
+ return (_a = SharePanelDefault.copyButton.label) !== null && _a !== void 0 ? _a : "Copy link";
6023
+ if (type === ShareType.Text)
6024
+ return "Copy text";
6025
+ return "";
6026
+ },
6080
6027
  svgSrc: {
6081
6028
  baseState: `<svg width="30px" height="30px" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 20"><path d="M6.6 0a2 2 0 0 0-2 2v12c0 1.2.9 2 2 2h9a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2h-9Zm0 2h9v12h-9V2Z" fill="currentColor"/><path d="M2.6 20a2 2 0 0 1-2-2V5h2v13h10v2h-10Z" fill="currentColor"/></svg>`,
6082
6029
  doneState: `<svg width="30px" height="30px" fill="none" viewBox="0 0 386 264" xmlns="http://www.w3.org/2000/svg">
@@ -6094,7 +6041,7 @@ const SharePanelDefault = {
6094
6041
  background: "white",
6095
6042
  display: true
6096
6043
  },
6097
- getValue: ({ url }) => url
6044
+ getValue: ({ url, text }) => url || text || ""
6098
6045
  },
6099
6046
  background: "#202125",
6100
6047
  borderRadius: 20,
@@ -6107,6 +6054,79 @@ const SharePanelDefault = {
6107
6054
  }
6108
6055
  };
6109
6056
 
6057
+ ;// CONCATENATED MODULE: ../core/src/types/gameReader.ts
6058
+
6059
+
6060
+ const GameReaderOptionsDefault = {
6061
+ borderRadius: 5,
6062
+ loader: {
6063
+ default: {
6064
+ color: "white",
6065
+ accentColor: "transparent"
6066
+ },
6067
+ custom: null
6068
+ },
6069
+ backdropColor: "#1a1a1a",
6070
+ backdrop: {
6071
+ opacity: 1,
6072
+ background: "#1a1a1a"
6073
+ },
6074
+ game: {
6075
+ backdropColor: "rgb(51, 51, 51)"
6076
+ },
6077
+ forceDesktopMode: AppearanceCommonOptionsDefault.forceDesktopMode,
6078
+ forceCheckOrientation: true,
6079
+ sharePanel: SharePanelDefault,
6080
+ };
6081
+
6082
+
6083
+ ;// CONCATENATED MODULE: ../core/src/types/goodsWidget.ts
6084
+ var GoodsWidgetRenderingType;
6085
+ (function (GoodsWidgetRenderingType) {
6086
+ GoodsWidgetRenderingType["DEFAULT"] = "default";
6087
+ GoodsWidgetRenderingType["CUSTOM_CARD"] = "customCard";
6088
+ })(GoodsWidgetRenderingType || (GoodsWidgetRenderingType = {}));
6089
+ const GoodsWidgetOptionsDefault = {
6090
+ goodsWidgetRenderingType: GoodsWidgetRenderingType.DEFAULT,
6091
+ goodsList: {
6092
+ renderingType: GoodsWidgetRenderingType.DEFAULT,
6093
+ closeBackgroundColor: "#000000",
6094
+ substrateHeight: 200,
6095
+ substrateColor: "#FFFFFF",
6096
+ dimColor: "rgba(0, 0, 0, 0.5)"
6097
+ },
6098
+ goodsCard: {
6099
+ mainTextColor: "#000000",
6100
+ oldPriceTextColor: "#CCCCCC",
6101
+ imageBackgroundColor: "transparent",
6102
+ imageCornerRadius: 8
6103
+ },
6104
+ openGoodsWidgetHandler: goods => Promise.resolve(goods),
6105
+ loader: {
6106
+ default: {
6107
+ color: "gray",
6108
+ accentColor: "transparent"
6109
+ }
6110
+ }
6111
+ };
6112
+
6113
+
6114
+ ;// CONCATENATED MODULE: ../core/src/types/storyManager.ts
6115
+ var StoryManagerEvent;
6116
+ (function (StoryManagerEvent) {
6117
+ StoryManagerEvent["WidgetEvent"] = "widgetEvent";
6118
+ StoryManagerEvent["ClickOnButton"] = "clickOnButton";
6119
+ })(StoryManagerEvent || (StoryManagerEvent = {}));
6120
+ var CTASource;
6121
+ (function (CTASource) {
6122
+ CTASource["STORY_LIST"] = "storyList";
6123
+ CTASource["STORY_READER"] = "storyReader";
6124
+ CTASource["GAME_READER"] = "gameReader";
6125
+ CTASource["STACK_STORY_LIST"] = "stackStoryList";
6126
+ CTASource["IAM_READER"] = "iamReader";
6127
+ CTASource["BANNERS"] = "banners";
6128
+ })(CTASource || (CTASource = {}));
6129
+
6110
6130
  ;// CONCATENATED MODULE: ../core/src/types/storyReader.ts
6111
6131
 
6112
6132
  var StoryReaderSwipeStyle;
@@ -7649,11 +7669,6 @@ function processSlideElement(env, preview, styles, hideElementsSelector) {
7649
7669
  * iOS in VK mini apps - does not complete share promise (on bottom sheet swipe down)
7650
7670
  * so we check and call `completeNativeSharing()` after any user gesture
7651
7671
  */
7652
- var ShareType;
7653
- (function (ShareType) {
7654
- ShareType["Social"] = "social";
7655
- ShareType["SlideScreenshot"] = "slide-screenshot";
7656
- })(ShareType || (ShareType = {}));
7657
7672
  class SharingService {
7658
7673
  async getScreenShot({ hideElementsSelector, slideContent }) {
7659
7674
  const file = await processSlideElement(ENV.IOS, slideContent, extractStyles(function () {
@@ -7721,6 +7736,7 @@ var sharePanelViewModel_classPrivateFieldSet = (undefined && undefined.__classPr
7721
7736
 
7722
7737
 
7723
7738
 
7739
+
7724
7740
  let SharePanelViewModel = (() => {
7725
7741
  var _a, _SharePanelViewModel__isOpened_accessor_storage, _SharePanelViewModel__params_accessor_storage;
7726
7742
  let _instanceExtraInitializers = [];
@@ -7779,7 +7795,7 @@ let SharePanelViewModel = (() => {
7779
7795
  _SharePanelViewModel__isOpened_accessor_storage.set(this, sharePanelViewModel_runInitializers(this, __isOpened_initializers, false));
7780
7796
  _SharePanelViewModel__params_accessor_storage.set(this, (sharePanelViewModel_runInitializers(this, __isOpened_extraInitializers), sharePanelViewModel_runInitializers(this, __params_initializers, {
7781
7797
  id: "",
7782
- type: ShareType.Social,
7798
+ type: ShareType.Link,
7783
7799
  link: ""
7784
7800
  })));
7785
7801
  Object.defineProperty(this, "currentStorySlide", {
@@ -7812,7 +7828,7 @@ let SharePanelViewModel = (() => {
7812
7828
  this._isOpened = false;
7813
7829
  this._params = {
7814
7830
  id: "",
7815
- type: ShareType.Social,
7831
+ type: ShareType.Image,
7816
7832
  link: ""
7817
7833
  };
7818
7834
  this.touchController.enable();
@@ -7835,7 +7851,7 @@ let SharePanelViewModel = (() => {
7835
7851
  url = screenShot.url;
7836
7852
  const shareConfig = { files: [screenShot.file], text: shareText };
7837
7853
  if (isDesktopMode_isDesktopMode) {
7838
- this.open({ type: ShareType.SlideScreenshot, id: shareId, link: url, text: shareText });
7854
+ this.open({ type: ShareType.Image, id: shareId, link: url, text: shareText });
7839
7855
  return;
7840
7856
  }
7841
7857
  await this.startNativeSharing(shareId, shareConfig);
@@ -7843,7 +7859,7 @@ let SharePanelViewModel = (() => {
7843
7859
  catch (error) {
7844
7860
  console.error(error);
7845
7861
  if (url)
7846
- this.open({ type: ShareType.SlideScreenshot, id: shareId, link: url, text: shareText });
7862
+ this.open({ type: ShareType.Image, id: shareId, link: url, text: shareText });
7847
7863
  }
7848
7864
  }
7849
7865
  async shareText({ shareId, config: configDto, storySlide }) {
@@ -7853,7 +7869,7 @@ let SharePanelViewModel = (() => {
7853
7869
  shareId = "story-share";
7854
7870
  const config = this.sharingService.getFilteredConfigDto(configDto);
7855
7871
  const sharePath = (config.url = (_b = config.url) !== null && _b !== void 0 ? _b : config.text);
7856
- const desktopOpenSharePanelParams = { type: ShareType.Social, id: shareId, link: sharePath };
7872
+ const desktopOpenSharePanelParams = { type: ShareType.Link, id: shareId, link: sharePath };
7857
7873
  try {
7858
7874
  if (isDesktopMode_isDesktopMode) {
7859
7875
  this.open(desktopOpenSharePanelParams);
@@ -7925,12 +7941,6 @@ let SharePanelViewModel = (() => {
7925
7941
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/sharePanelViewModel/index.ts
7926
7942
 
7927
7943
 
7928
- ;// CONCATENATED MODULE: external "async-mutex"
7929
- var external_async_mutex_x = (y) => {
7930
- var x = {}; __webpack_require__.d(x, y); return x
7931
- }
7932
- var external_async_mutex_y = (x) => (() => (x))
7933
- 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) });
7934
7944
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storySlideViewModel/storySlideViewModel.ts
7935
7945
  var storySlideViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
7936
7946
  var useValue = arguments.length > 2;
@@ -7980,21 +7990,35 @@ var storySlideViewModel_classPrivateFieldSet = (undefined && undefined.__classPr
7980
7990
 
7981
7991
 
7982
7992
 
7983
-
7984
7993
  const SWIPE_UP_THRESHOLD = 10;
7985
7994
  const SLIDE_CLICK_THRESHOLD = 0.3;
7986
7995
  const SHOW_SLIDE_TIMEOUT = 500;
7987
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 = {}));
7988
8007
  let StorySlideViewModel = (() => {
7989
- var _a, _StorySlideViewModel__disabledNextClick_accessor_storage;
8008
+ var _a, _StorySlideViewModel__disabledNextClick_accessor_storage, _StorySlideViewModel__cover_accessor_storage;
7990
8009
  let _instanceExtraInitializers = [];
7991
8010
  let __disabledNextClick_decorators;
7992
8011
  let __disabledNextClick_initializers = [];
7993
8012
  let __disabledNextClick_extraInitializers = [];
7994
- let _start_decorators;
8013
+ let __cover_decorators;
8014
+ let __cover_initializers = [];
8015
+ let __cover_extraInitializers = [];
8016
+ let _commit_decorators;
7995
8017
  return _a = class StorySlideViewModel {
7996
8018
  get _disabledNextClick() { return storySlideViewModel_classPrivateFieldGet(this, _StorySlideViewModel__disabledNextClick_accessor_storage, "f"); }
7997
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"); }
7998
8022
  constructor(_story, _index, slideApi, slide, cacheManager) {
7999
8023
  Object.defineProperty(this, "_story", {
8000
8024
  enumerable: true,
@@ -8027,35 +8051,28 @@ let StorySlideViewModel = (() => {
8027
8051
  value: cacheManager
8028
8052
  });
8029
8053
  _StorySlideViewModel__disabledNextClick_accessor_storage.set(this, storySlideViewModel_runInitializers(this, __disabledNextClick_initializers, false));
8030
- Object.defineProperty(this, "mutex", {
8031
- enumerable: true,
8032
- configurable: true,
8033
- writable: true,
8034
- value: (storySlideViewModel_runInitializers(this, __disabledNextClick_extraInitializers), new external_async_mutex_namespaceObject.Mutex())
8035
- });
8036
- Object.defineProperty(this, "isInited", {
8037
- enumerable: true,
8038
- configurable: true,
8039
- writable: true,
8040
- value: false
8041
- });
8042
- 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", {
8043
8056
  enumerable: true,
8044
8057
  configurable: true,
8045
8058
  writable: true,
8046
- value: false
8059
+ value: (storySlideViewModel_runInitializers(this, __cover_extraInitializers), false)
8047
8060
  });
8048
- Object.defineProperty(this, "preloaded", {
8061
+ Object.defineProperty(this, "isPreloading", {
8049
8062
  enumerable: true,
8050
8063
  configurable: true,
8051
8064
  writable: true,
8052
8065
  value: false
8053
8066
  });
8054
- Object.defineProperty(this, "isPreloading", {
8067
+ Object.defineProperty(this, "state", {
8055
8068
  enumerable: true,
8056
8069
  configurable: true,
8057
8070
  writable: true,
8058
- value: false
8071
+ value: external_mobx_namespaceObject.observable.object({
8072
+ inited: false,
8073
+ started: false,
8074
+ paused: false
8075
+ })
8059
8076
  });
8060
8077
  Object.defineProperty(this, "handleTouchEnd", {
8061
8078
  enumerable: true,
@@ -8096,6 +8113,9 @@ let StorySlideViewModel = (() => {
8096
8113
  get disabledNextClick() {
8097
8114
  return this._disabledNextClick;
8098
8115
  }
8116
+ get cover() {
8117
+ return this._cover;
8118
+ }
8099
8119
  mute() {
8100
8120
  this.slideApi.disableAudio();
8101
8121
  }
@@ -8115,8 +8135,7 @@ let StorySlideViewModel = (() => {
8115
8135
  this.slideApi.setWidgetGoodsComplete(elementId);
8116
8136
  }
8117
8137
  async init() {
8118
- const release = await this.mutex.acquire();
8119
- if (this.isInited)
8138
+ if (this.state.inited)
8120
8139
  return;
8121
8140
  let loaderShown = this.story.needShowLoaderScreen;
8122
8141
  let startTime = Date.now();
@@ -8125,12 +8144,12 @@ let StorySlideViewModel = (() => {
8125
8144
  loaderShown = true;
8126
8145
  startTime = Date.now();
8127
8146
  }, SHOW_SLIDE_TIMEOUT);
8147
+ let result = false;
8128
8148
  try {
8129
- debug(`[SLIDE][INIT]:${this.story.id}:${this.slide.index}`);
8130
- const { result, reason } = await this.slideApi.showSlide(this.html);
8131
- if (!result)
8132
- throw new Error(reason);
8133
- 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);
8134
8153
  }
8135
8154
  catch (error) {
8136
8155
  this.handleSlideError(error);
@@ -8138,124 +8157,112 @@ let StorySlideViewModel = (() => {
8138
8157
  finally {
8139
8158
  clearTimeout(loaderTimeout);
8140
8159
  await this.cleanupLoaderIfNeeded(Date.now() - startTime, loaderShown);
8141
- release();
8160
+ if (result)
8161
+ this._cover = this.getCoverByLayer();
8142
8162
  }
8163
+ this.commit({ inited: true });
8164
+ this.debug(`${StorySlideEmodji.Init} [Slide Lifecycle] inited: `);
8143
8165
  }
8144
8166
  async start() {
8145
- const release = await this.mutex.acquire();
8167
+ if (!this.state.inited || this.state.started)
8168
+ return;
8146
8169
  try {
8147
- if (!this.isInited || this.isStarted)
8148
- return;
8149
- debug(`[SLIDE][START]:${this.story.id}:${this.slide.index}`);
8150
8170
  await this.slideApi.slideStart({ muted: this._story.muted });
8151
8171
  this.story.touchController.on(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8152
- this.isStarted = true;
8153
8172
  }
8154
8173
  catch (error) {
8155
8174
  this.handleSlideError(error);
8156
8175
  }
8157
- finally {
8158
- release();
8159
- }
8176
+ this.commit({ started: true });
8177
+ this.debug(`${StorySlideEmodji.Start} [Slide Lifecycle] started: `);
8160
8178
  }
8161
8179
  async restart() {
8162
- const release = await this.mutex.acquire();
8163
8180
  try {
8164
8181
  this.story.hideErrorScreen();
8165
8182
  this.story.showLoaderScreen();
8166
8183
  await this.slideApi.slideRestart({ muted: this._story.muted });
8167
- this.isInited = true;
8168
- this.isStarted = true;
8184
+ this.commit({ inited: true, started: true, paused: false });
8169
8185
  }
8170
8186
  catch (error) {
8171
8187
  this.handleSlideError(error);
8172
8188
  }
8173
8189
  finally {
8174
8190
  this.story.hideLoaderScreen();
8175
- release();
8176
8191
  }
8192
+ this.debug(`${StorySlideEmodji.Restart} [Slide Lifecycle] restarted: `);
8177
8193
  }
8178
8194
  async resumeByApp() {
8179
- const release = await this.mutex.acquire();
8195
+ if (!this.state.paused)
8196
+ return;
8180
8197
  try {
8181
- if (!this.isStarted)
8182
- return;
8183
- debug(`[SLIDE][RESUME-BY-APP]:${this.story.id}:${this.slide.index}`);
8184
8198
  await this.slideApi.slideAppResume();
8185
8199
  }
8186
8200
  catch (error) {
8187
8201
  this.handleSlideError(error);
8188
8202
  }
8189
- finally {
8190
- release();
8191
- }
8203
+ this.commit({ paused: false });
8204
+ this.debug(`${StorySlideEmodji.Resume} [Slide Lifecycle] resume by app: `);
8192
8205
  }
8193
8206
  async pauseByApp() {
8194
- const release = await this.mutex.acquire();
8207
+ if (this.state.paused)
8208
+ return;
8195
8209
  try {
8196
- if (!this.isStarted)
8197
- return;
8198
- debug(`[SLIDE][PAUSE-BY-APP]:${this.story.id}:${this.slide.index}`);
8199
8210
  await this.slideApi.slideAppPause();
8200
8211
  }
8201
8212
  catch (error) {
8202
8213
  this.handleSlideError(error);
8203
8214
  }
8204
- finally {
8205
- release();
8206
- }
8215
+ this.debug(`${StorySlideEmodji.Pause} [Slide Lifecycle] pause by app: `);
8216
+ this.commit({ paused: true });
8207
8217
  }
8208
8218
  async resumeByUser() {
8209
- const release = await this.mutex.acquire();
8219
+ if (!this.state.paused)
8220
+ return;
8210
8221
  try {
8211
- if (!this.isStarted)
8212
- return;
8213
- debug(`[SLIDE][RESUME-BY-USER]:${this.story.id}:${this.slide.index}`);
8214
8222
  await this.slideApi.slideUserResume();
8215
8223
  }
8216
8224
  catch (error) {
8217
8225
  this.handleSlideError(error);
8218
8226
  }
8219
- finally {
8220
- release();
8221
- }
8227
+ this.commit({ paused: false });
8228
+ this.debug(`${StorySlideEmodji.Resume} [Slide Lifecycle] resume by user: `);
8222
8229
  }
8223
8230
  async pauseByUser() {
8224
- const release = await this.mutex.acquire();
8231
+ if (this.state.paused)
8232
+ return;
8225
8233
  try {
8226
- if (!this.isStarted)
8227
- return;
8228
- debug(`[SLIDE][PAUSE-BY-USER]:${this.story.id}:${this.slide.index}`);
8229
8234
  await this.slideApi.slideUserPause();
8230
8235
  }
8231
8236
  catch (error) {
8232
8237
  this.handleSlideError(error);
8233
8238
  }
8234
- finally {
8235
- release();
8236
- }
8239
+ this.commit({ paused: true });
8240
+ this.debug(`${StorySlideEmodji.Pause} [Slide Lifecycle] pause by user: `);
8237
8241
  }
8238
8242
  async stop(params) {
8239
- 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) {
8240
8255
  try {
8241
- if (!this.isInited || !this.isStarted)
8242
- return;
8243
- debug(`[SLIDE][STOP]:${this.story.id}:${this.slide.index}`);
8256
+ this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8244
8257
  await this.slideApi.slideStop(params);
8245
8258
  }
8246
8259
  catch (error) {
8247
8260
  this.handleSlideError(error);
8248
8261
  }
8249
- finally {
8250
- this.isStarted = false;
8251
- if (params.prepareForRestart === 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */)
8252
- this.isInited = false;
8253
- this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8254
- release();
8255
- }
8256
8262
  }
8257
8263
  showLayerByIndex(index) {
8258
8264
  this.slideApi.showLayer(index);
8265
+ this._cover = this.getCoverByLayer();
8259
8266
  }
8260
8267
  canGoNext() {
8261
8268
  const { canClickNext } = this.slideApi.slideClickHandler(null, "forward");
@@ -8298,20 +8305,17 @@ let StorySlideViewModel = (() => {
8298
8305
  }
8299
8306
  }
8300
8307
  async destroy() {
8301
- const release = await this.mutex.acquire();
8302
8308
  try {
8303
- this.isStarted = false;
8304
- this.isInited = false;
8305
- this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8306
8309
  if (this.cacheManager)
8307
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 */ });
8308
8315
  }
8309
8316
  catch (error) {
8310
8317
  console.error(error);
8311
8318
  }
8312
- finally {
8313
- release();
8314
- }
8315
8319
  }
8316
8320
  getNavigationDirection(event, currentTarget) {
8317
8321
  const xPercent = this.getClickPosition(event, currentTarget);
@@ -8355,14 +8359,37 @@ let StorySlideViewModel = (() => {
8355
8359
  this.story.hideLoaderScreen();
8356
8360
  }
8357
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
+ }
8358
8382
  },
8359
8383
  _StorySlideViewModel__disabledNextClick_accessor_storage = new WeakMap(),
8384
+ _StorySlideViewModel__cover_accessor_storage = new WeakMap(),
8360
8385
  (() => {
8361
8386
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
8362
8387
  __disabledNextClick_decorators = [external_mobx_namespaceObject.observable];
8363
- _start_decorators = [noConcurrent];
8388
+ __cover_decorators = [external_mobx_namespaceObject.observable];
8389
+ _commit_decorators = [external_mobx_namespaceObject.action];
8364
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);
8365
- 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);
8366
8393
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
8367
8394
  })(),
8368
8395
  _a;
@@ -9600,6 +9627,12 @@ let TextInputViewModel = (() => {
9600
9627
  const SLIDE_RATIO = 310 / 480;
9601
9628
  const MOBILE_ASPECT_RATIO = 428 / 805;
9602
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) });
9603
9636
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyViewModel/storyViewModel.ts
9604
9637
  var storyViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
9605
9638
  var useValue = arguments.length > 2;
@@ -9663,11 +9696,22 @@ var storyViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivate
9663
9696
 
9664
9697
  var StoryEvent;
9665
9698
  (function (StoryEvent) {
9666
- StoryEvent["ShowToast"] = "showToast";
9699
+ StoryEvent["Started"] = "started";
9667
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 = {}));
9668
9710
  const ACTIVE_SLIDE_PRELOAD_PRIORITY = 1000;
9711
+ const ACTIVE_STORY_PRELOAD_PRIORITY = 1000;
9712
+ const NON_ACTIVE_STORY_PRELOAD_PRIORITY = 0;
9669
9713
  let StoryViewModel = (() => {
9670
- 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;
9671
9715
  var _b;
9672
9716
  let _classSuper = ViewModel;
9673
9717
  let _instanceExtraInitializers = [];
@@ -9686,13 +9730,9 @@ let StoryViewModel = (() => {
9686
9730
  let __$root_decorators;
9687
9731
  let __$root_initializers = [];
9688
9732
  let __$root_extraInitializers = [];
9689
- let _isInited_decorators;
9690
- let _isInited_initializers = [];
9691
- let _isInited_extraInitializers = [];
9692
9733
  let _get_needShowErrorScreen_decorators;
9693
9734
  let _get_needShowLoaderScreen_decorators;
9694
9735
  let _get_activeSlide_decorators;
9695
- let _get_displayedSlideImage_decorators;
9696
9736
  let _get_reachEnd_decorators;
9697
9737
  let _get_reachStart_decorators;
9698
9738
  let _get_pauseState_decorators;
@@ -9705,6 +9745,7 @@ let StoryViewModel = (() => {
9705
9745
  let _showSlide_decorators;
9706
9746
  let _markAsOpened_decorators;
9707
9747
  let _markWasShown_decorators;
9748
+ let _commit_decorators;
9708
9749
  return _a = class StoryViewModel extends _classSuper {
9709
9750
  get _activeSlideIndex() { return storyViewModel_classPrivateFieldGet(this, _StoryViewModel__activeSlideIndex_accessor_storage, "f"); }
9710
9751
  set _activeSlideIndex(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__activeSlideIndex_accessor_storage, value, "f"); }
@@ -9716,9 +9757,7 @@ let StoryViewModel = (() => {
9716
9757
  set _needShowLoaderScreen(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__needShowLoaderScreen_accessor_storage, value, "f"); }
9717
9758
  get _$root() { return storyViewModel_classPrivateFieldGet(this, _StoryViewModel__$root_accessor_storage, "f"); }
9718
9759
  set _$root(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__$root_accessor_storage, value, "f"); }
9719
- get isInited() { return storyViewModel_classPrivateFieldGet(this, _StoryViewModel_isInited_accessor_storage, "f"); }
9720
- set isInited(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel_isInited_accessor_storage, value, "f"); }
9721
- constructor(storyManager, storyReader, story, storySlideApiHandlersFactory, storyReaderStatisticV1Service, storyReaderStatisticV2Service, cacheManager) {
9760
+ constructor(storyManager, storyReader, story, storySlideApiHandlersFactory, statisticV1Service, statisticV2Service, cacheManager) {
9722
9761
  super();
9723
9762
  Object.defineProperty(this, "storyManager", {
9724
9763
  enumerable: true,
@@ -9744,17 +9783,17 @@ let StoryViewModel = (() => {
9744
9783
  writable: true,
9745
9784
  value: storySlideApiHandlersFactory
9746
9785
  });
9747
- Object.defineProperty(this, "storyReaderStatisticV1Service", {
9786
+ Object.defineProperty(this, "statisticV1Service", {
9748
9787
  enumerable: true,
9749
9788
  configurable: true,
9750
9789
  writable: true,
9751
- value: storyReaderStatisticV1Service
9790
+ value: statisticV1Service
9752
9791
  });
9753
- Object.defineProperty(this, "storyReaderStatisticV2Service", {
9792
+ Object.defineProperty(this, "statisticV2Service", {
9754
9793
  enumerable: true,
9755
9794
  configurable: true,
9756
9795
  writable: true,
9757
- value: storyReaderStatisticV2Service
9796
+ value: statisticV2Service
9758
9797
  });
9759
9798
  Object.defineProperty(this, "cacheManager", {
9760
9799
  enumerable: true,
@@ -9767,24 +9806,11 @@ let StoryViewModel = (() => {
9767
9806
  _StoryViewModel__needShowErrorScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __slides_extraInitializers), storyViewModel_runInitializers(this, __needShowErrorScreen_initializers, false)));
9768
9807
  _StoryViewModel__needShowLoaderScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowErrorScreen_extraInitializers), storyViewModel_runInitializers(this, __needShowLoaderScreen_initializers, false)));
9769
9808
  _StoryViewModel__$root_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowLoaderScreen_extraInitializers), storyViewModel_runInitializers(this, __$root_initializers, null)));
9770
- _StoryViewModel_isInited_accessor_storage.set(this, (storyViewModel_runInitializers(this, __$root_extraInitializers), storyViewModel_runInitializers(this, _isInited_initializers, false)));
9771
- Object.defineProperty(this, "isStarted", {
9772
- enumerable: true,
9773
- configurable: true,
9774
- writable: true,
9775
- value: (storyViewModel_runInitializers(this, _isInited_extraInitializers), false)
9776
- });
9777
9809
  Object.defineProperty(this, "_activeSlideStartTime", {
9778
9810
  enumerable: true,
9779
9811
  configurable: true,
9780
9812
  writable: true,
9781
- value: 0
9782
- });
9783
- Object.defineProperty(this, "mutex", {
9784
- enumerable: true,
9785
- configurable: true,
9786
- writable: true,
9787
- value: new external_async_mutex_namespaceObject.Mutex()
9813
+ value: (storyViewModel_runInitializers(this, __$root_extraInitializers), 0)
9788
9814
  });
9789
9815
  // internal services
9790
9816
  Object.defineProperty(this, "slideApi", {
@@ -9799,12 +9825,6 @@ let StoryViewModel = (() => {
9799
9825
  writable: true,
9800
9826
  value: void 0
9801
9827
  });
9802
- Object.defineProperty(this, "storySlidesReactionDisposer", {
9803
- enumerable: true,
9804
- configurable: true,
9805
- writable: true,
9806
- value: void 0
9807
- });
9808
9828
  // UI
9809
9829
  Object.defineProperty(this, "timeline", {
9810
9830
  enumerable: true,
@@ -9848,23 +9868,37 @@ let StoryViewModel = (() => {
9848
9868
  writable: true,
9849
9869
  value: void 0
9850
9870
  });
9871
+ Object.defineProperty(this, "mutex", {
9872
+ enumerable: true,
9873
+ configurable: true,
9874
+ writable: true,
9875
+ value: new external_async_mutex_namespaceObject.Mutex()
9876
+ });
9851
9877
  Object.defineProperty(this, "toast", {
9852
9878
  enumerable: true,
9853
9879
  configurable: true,
9854
9880
  writable: true,
9855
9881
  value: null
9856
9882
  });
9857
- Object.defineProperty(this, "attachRoot", {
9883
+ Object.defineProperty(this, "state", {
9858
9884
  enumerable: true,
9859
9885
  configurable: true,
9860
9886
  writable: true,
9861
- value: async (el) => {
9862
- this._$root = el;
9863
- // Reaction to `layout` (modern or classic) change
9864
- // TODO: add test with example
9865
- await this.reinit();
9866
- await this.restart();
9867
- }
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
9868
9902
  });
9869
9903
  Object.defineProperty(this, "handleKeydown", {
9870
9904
  enumerable: true,
@@ -9889,18 +9923,20 @@ let StoryViewModel = (() => {
9889
9923
  this.pauseManager = new StoryPauseManager(this);
9890
9924
  this.touchController = this.storyReader.touchController;
9891
9925
  this.slideApiHandlers = this.storySlideApiHandlersFactory.create(this);
9892
- this.goodsWidget = new StoryGoodsWidgetViewModel(this.storyManager, this, this.storyReaderStatisticV2Service);
9893
- 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);
9894
9928
  this.timeline = new StoryTimelineViewModel(this);
9895
9929
  this.sharePanel = new SharePanelViewModel(this.storyManager, this, this.storyReader.touchController);
9896
- this.actionPanel = new StoryActionPanelViewModel(this.storyManager, this, this.sharePanel, this.storyReaderStatisticV2Service);
9897
- 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);
9898
9932
  }
9899
9933
  get needShowErrorScreen() {
9900
9934
  return this._needShowErrorScreen || Boolean(this.error);
9901
9935
  }
9902
9936
  get needShowLoaderScreen() {
9903
- 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;
9904
9940
  }
9905
9941
  get id() {
9906
9942
  return this.story.id;
@@ -9923,9 +9959,6 @@ let StoryViewModel = (() => {
9923
9959
  get displayStrategy() {
9924
9960
  return this.storyReader.displayStrategy;
9925
9961
  }
9926
- get canBeShown() {
9927
- return this.story.canBeShown && this.slides.length > 0 && Boolean(this._$root);
9928
- }
9929
9962
  get context() {
9930
9963
  return this.story.context;
9931
9964
  }
@@ -9950,9 +9983,6 @@ let StoryViewModel = (() => {
9950
9983
  get slidesCount() {
9951
9984
  return this.story.slidesCount;
9952
9985
  }
9953
- get displayedSlideImage() {
9954
- return this.story.getImagesPerSlide(this.activeSlideIndex);
9955
- }
9956
9986
  get reachEnd() {
9957
9987
  return this.slides.length === 0 || this.activeSlideIndex === this.slides.length - 1;
9958
9988
  }
@@ -9982,7 +10012,10 @@ let StoryViewModel = (() => {
9982
10012
  return this.storyReader.dir;
9983
10013
  }
9984
10014
  get isSlideRendered() {
9985
- return this.isInited;
10015
+ return this.state.inited;
10016
+ }
10017
+ get cover() {
10018
+ return this.activeSlide.cover;
9986
10019
  }
9987
10020
  get isNextDisabled() {
9988
10021
  return ((this.storyReader.reachEnd && this.reachEnd) ||
@@ -10039,6 +10072,8 @@ let StoryViewModel = (() => {
10039
10072
  }
10040
10073
  setError(error) {
10041
10074
  this.story.setError(error);
10075
+ if (error)
10076
+ this.handleStoryError(error);
10042
10077
  }
10043
10078
  async reset() {
10044
10079
  this.textInput.close();
@@ -10055,7 +10090,7 @@ let StoryViewModel = (() => {
10055
10090
  }
10056
10091
  async prevSlideOrStory() {
10057
10092
  if (this.reachStart && this.storyReader.reachStart) {
10058
- if (!this.isStarted)
10093
+ if (!this.state.started)
10059
10094
  return;
10060
10095
  await this.activeSlide.restart();
10061
10096
  return;
@@ -10073,6 +10108,17 @@ let StoryViewModel = (() => {
10073
10108
  this.storyReader.unmute();
10074
10109
  this.activeSlide.unmute();
10075
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
+ }
10076
10122
  pauseUser() {
10077
10123
  if (this.timeline.paused)
10078
10124
  return;
@@ -10103,22 +10149,56 @@ let StoryViewModel = (() => {
10103
10149
  async updateNarrativeData(data) {
10104
10150
  await this.storyManager.rootStore.storyStore.updateNarrativeData(this.id, data);
10105
10151
  }
10106
- detachRoot() {
10107
- var _b;
10152
+ async detach(ui) {
10153
+ var _b, _c;
10154
+ if (ui.container || !this.state.attached)
10155
+ return;
10108
10156
  this._$root = null;
10109
- const isInited = this.isInited;
10110
- const isStarted = this.isStarted;
10111
- this.stop();
10112
- (_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();
10113
10163
  for (const slide of this._slides)
10114
- slide.destroy();
10115
- this.isInited = isInited;
10116
- 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
+ }
10117
10200
  }
10118
10201
  async preloadSlides(start, end, priority) {
10119
- if (!this.story.canBeShown)
10120
- this.showLoaderScreen();
10121
- await (0,external_mobx_namespaceObject.when)(() => this.story.canBeShown);
10122
10202
  end = end !== null && end !== void 0 ? end : this._slides.length;
10123
10203
  priority = priority !== null && priority !== void 0 ? priority : 0;
10124
10204
  await Promise.all(this._slides.slice(start, end).map((slide, index) => slide.preload(end - index + priority)));
@@ -10126,41 +10206,36 @@ let StoryViewModel = (() => {
10126
10206
  async preloadActiveSlide(priority) {
10127
10207
  this.preloadSlides(this._activeSlideIndex, this._activeSlideIndex + 1, priority);
10128
10208
  }
10129
- async init() {
10130
- await this.mutex.runExclusive(async () => {
10131
- if (this.isInited)
10132
- return;
10133
- if (!this.story.canBeShown)
10134
- this.showLoaderScreen();
10135
- await (0,external_mobx_namespaceObject.when)(() => this.canBeShown);
10136
- await this.activeSlide.init();
10137
- this.isInited = true;
10138
- });
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 });
10139
10215
  }
10140
- async start() {
10141
- await this.mutex.runExclusive(async () => {
10142
- if (this.isStarted || !this.isInited)
10143
- return;
10144
- await this.activeSlide.start();
10145
- document.addEventListener("visibilitychange", this.handleVisibilityChange);
10146
- document.addEventListener("keydown", this.handleKeydown);
10147
- this.isStarted = true;
10148
- this._activeSlideStartTime = Date.now();
10149
- });
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 });
10150
10226
  }
10151
- async stop() {
10152
- await this.mutex.runExclusive(async () => {
10153
- var _b;
10154
- if (!this.isStarted || !this.isInited)
10155
- return;
10156
- (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
10157
- this.isStarted = false;
10158
- this.slideApiHandlers.clearNarrativeSessionDataCache();
10159
- this.resumeAll();
10160
- document.removeEventListener("visibilitychange", this.handleVisibilityChange);
10161
- document.removeEventListener("keydown", this.handleKeydown);
10162
- await this.activeSlide.stop({ prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */ });
10163
- });
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 });
10164
10239
  }
10165
10240
  canGoNext() {
10166
10241
  return this.activeSlide.canGoNext();
@@ -10176,23 +10251,15 @@ let StoryViewModel = (() => {
10176
10251
  }
10177
10252
  async destroy() {
10178
10253
  var _b, _c;
10179
- this._$root = null;
10180
10254
  document.removeEventListener("visibilitychange", this.handleVisibilityChange);
10181
10255
  document.removeEventListener("keydown", this.handleKeydown);
10182
- this.storySlidesReactionDisposer();
10183
10256
  this.sharePanel.close();
10184
10257
  this.textInput.close();
10185
10258
  this.timeline.destroy();
10186
10259
  this.goodsWidget.close();
10187
- const activeSlide = this.getSlideByIndex(this._activeSlideIndex);
10188
10260
  this.slideApiHandlers.clearNarrativeSessionDataCache();
10189
- if (this.isStarted)
10190
- await activeSlide.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ });
10191
- await activeSlide.destroy();
10192
10261
  (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
10193
10262
  (_c = this.toast) === null || _c === void 0 ? void 0 : _c.destroy();
10194
- this.isInited = false;
10195
- this.isStarted = false;
10196
10263
  }
10197
10264
  notifyPauseStateChange() {
10198
10265
  if (this.pauseManager.isUserPaused)
@@ -10206,7 +10273,7 @@ let StoryViewModel = (() => {
10206
10273
  }
10207
10274
  emitSlideV2Stat(index, durationMs) {
10208
10275
  var _b;
10209
- this.storyReaderStatisticV2Service.sendSlideEvent({
10276
+ this.statisticV2Service.sendSlideEvent({
10210
10277
  durationMs,
10211
10278
  storyId: this.id,
10212
10279
  activeSlideIndex: index,
@@ -10216,21 +10283,11 @@ let StoryViewModel = (() => {
10216
10283
  emitSlideV1Stat(index) {
10217
10284
  const event = new ShowSlideEvent(this);
10218
10285
  this.storyManager.emit(event.name, event.toJSON());
10219
- this.storyReaderStatisticV1Service.sendOpenStoryEvent({
10286
+ this.statisticV1Service.sendOpenStoryEvent({
10220
10287
  storyId: this.id,
10221
10288
  slideIndex: index
10222
10289
  });
10223
10290
  }
10224
- observeStorySlides() {
10225
- return (0,external_mobx_namespaceObject.reaction)(() => ({ storySlides: this.story.slides, canBeShown: this.story.canBeShown && Boolean(this._$root) }), ({ storySlides, canBeShown }) => {
10226
- if (!this._$root || !canBeShown || !storySlides.length)
10227
- return [];
10228
- this.slideApi = this.createSlideApi(this._$root);
10229
- return this.createSlidesViewModels(storySlides, this.slideApi);
10230
- }, {
10231
- fireImmediately: true
10232
- });
10233
- }
10234
10291
  createSlideApi(root) {
10235
10292
  const slideApi = new slide_api_namespaceObject.SlideApi(this.slideApiHandlers, {
10236
10293
  root,
@@ -10284,17 +10341,39 @@ let StoryViewModel = (() => {
10284
10341
  console.error(error);
10285
10342
  }
10286
10343
  }
10287
- async reinit() {
10288
- if (this.isInited) {
10289
- this.isInited = false;
10290
- await this.init();
10291
- }
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());
10292
10352
  }
10293
- async restart() {
10294
- if (this.isStarted) {
10295
- this.isStarted = false;
10296
- 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;
10297
10369
  }
10370
+ if (!this.state.inited) {
10371
+ this.state.started = false;
10372
+ this.state.prefetched = false;
10373
+ }
10374
+ }
10375
+ debug(message) {
10376
+ //debug(message, { storyId: this.id });
10298
10377
  }
10299
10378
  },
10300
10379
  _StoryViewModel__activeSlideIndex_accessor_storage = new WeakMap(),
@@ -10302,7 +10381,6 @@ let StoryViewModel = (() => {
10302
10381
  _StoryViewModel__needShowErrorScreen_accessor_storage = new WeakMap(),
10303
10382
  _StoryViewModel__needShowLoaderScreen_accessor_storage = new WeakMap(),
10304
10383
  _StoryViewModel__$root_accessor_storage = new WeakMap(),
10305
- _StoryViewModel_isInited_accessor_storage = new WeakMap(),
10306
10384
  (() => {
10307
10385
  var _b;
10308
10386
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
@@ -10311,11 +10389,9 @@ let StoryViewModel = (() => {
10311
10389
  __needShowErrorScreen_decorators = [external_mobx_namespaceObject.observable];
10312
10390
  __needShowLoaderScreen_decorators = [external_mobx_namespaceObject.observable];
10313
10391
  __$root_decorators = [external_mobx_namespaceObject.observable];
10314
- _isInited_decorators = [external_mobx_namespaceObject.observable];
10315
10392
  _get_needShowErrorScreen_decorators = [external_mobx_namespaceObject.computed];
10316
10393
  _get_needShowLoaderScreen_decorators = [external_mobx_namespaceObject.computed];
10317
10394
  _get_activeSlide_decorators = [external_mobx_namespaceObject.computed];
10318
- _get_displayedSlideImage_decorators = [external_mobx_namespaceObject.computed];
10319
10395
  _get_reachEnd_decorators = [external_mobx_namespaceObject.computed];
10320
10396
  _get_reachStart_decorators = [external_mobx_namespaceObject.computed];
10321
10397
  _get_pauseState_decorators = [(_b = external_mobx_namespaceObject.computed).struct.bind(_b)];
@@ -10328,16 +10404,15 @@ let StoryViewModel = (() => {
10328
10404
  _showSlide_decorators = [external_mobx_namespaceObject.action];
10329
10405
  _markAsOpened_decorators = [external_mobx_namespaceObject.action];
10330
10406
  _markWasShown_decorators = [external_mobx_namespaceObject.action];
10407
+ _commit_decorators = [external_mobx_namespaceObject.action];
10331
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);
10332
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);
10333
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);
10334
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);
10335
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);
10336
- 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);
10337
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);
10338
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);
10339
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);
10340
- 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);
10341
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);
10342
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);
10343
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);
@@ -10350,18 +10425,13 @@ let StoryViewModel = (() => {
10350
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);
10351
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);
10352
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);
10353
10429
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
10354
10430
  })(),
10355
10431
  _a;
10356
10432
  })();
10357
10433
 
10358
10434
 
10359
- ;// CONCATENATED MODULE: external "lodash/isEmpty.js"
10360
- var isEmpty_js_x = (y) => {
10361
- var x = {}; __webpack_require__.d(x, y); return x
10362
- }
10363
- var isEmpty_js_y = (x) => (() => (x))
10364
- const isEmpty_js_namespaceObject = isEmpty_js_x({ ["default"]: () => (__WEBPACK_EXTERNAL_MODULE_lodash_isEmpty_js_f1e1789b__["default"]) });
10365
10435
  ;// CONCATENATED MODULE: external "lodash/isObject.js"
10366
10436
  var isObject_js_x = (y) => {
10367
10437
  var x = {}; __webpack_require__.d(x, y); return x
@@ -10473,7 +10543,7 @@ class GameClientConfig {
10473
10543
  value: void 0
10474
10544
  });
10475
10545
  const storyManagerConfig = this.storyManager.config;
10476
- const sdkVersion = "1.9.3";
10546
+ const sdkVersion = "1.9.5";
10477
10547
  const placeholders = this.storyManager.rootStore.placeholderStore.placeholders;
10478
10548
  const session = this.storyManager.rootStore.sessionStore.session;
10479
10549
  this.sessionId = session.id;
@@ -10930,8 +11000,10 @@ class GameSession extends events.EventEmitter {
10930
11000
  if (event.origin !== this.origin)
10931
11001
  return;
10932
11002
  try {
10933
- if (!Array.isArray(event.data))
10934
- 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
+ }
10935
11007
  const [gameEvent, ...restData] = event.data;
10936
11008
  this.emit(gameEvent, ...restData);
10937
11009
  }
@@ -11072,11 +11144,7 @@ const dataUrlToFile = async ({ file, name, type }) => {
11072
11144
  ;// CONCATENATED MODULE: ../core/src/domain/gameCenter/modules/shareModule/shareModule.ts
11073
11145
 
11074
11146
 
11075
- var shareModule_ShareType;
11076
- (function (ShareType) {
11077
- ShareType["Social"] = "social";
11078
- ShareType["SlideScreenshot"] = "slide-screenshot";
11079
- })(shareModule_ShareType || (shareModule_ShareType = {}));
11147
+
11080
11148
  class GameShareModule {
11081
11149
  constructor(storyManager, shareNotifier) {
11082
11150
  Object.defineProperty(this, "storyManager", {
@@ -11096,24 +11164,20 @@ class GameShareModule {
11096
11164
  configurable: true,
11097
11165
  writable: true,
11098
11166
  value: async (shareId, configDto) => {
11099
- var _a, _b;
11167
+ var _a;
11100
11168
  const config = this.getFilteredConfigDto(configDto);
11101
- let sharePath = (_b = (_a = config === null || config === void 0 ? void 0 : config.url) !== null && _a !== void 0 ? _a : config.text) !== null && _b !== void 0 ? _b : "";
11169
+ let shareLink = (_a = config === null || config === void 0 ? void 0 : config.url) !== null && _a !== void 0 ? _a : "";
11102
11170
  try {
11103
11171
  const files = await this.getShareFiles(configDto);
11104
11172
  config.files = files.length > 0 ? files : undefined;
11105
- if (!((config.files && config.files.length > 0) || config.url)) {
11106
- this.shareNotifier.notifyShareCompleted({ shareId, isSuccess: false });
11107
- return;
11108
- }
11109
11173
  if (isDesktopMode_isDesktopMode) {
11110
- this.openSharePanel({ shareConfig: config, sharePath, shareId });
11174
+ this.openSharePanel({ shareConfig: config, shareLink, shareId, shareText: config.text });
11111
11175
  return;
11112
11176
  }
11113
11177
  await this.startNativeSharing(shareId, config);
11114
11178
  }
11115
11179
  catch (err) {
11116
- this.openSharePanel({ shareConfig: config, sharePath, shareId });
11180
+ this.openSharePanel({ shareConfig: config, shareLink, shareId, shareText: config.text });
11117
11181
  }
11118
11182
  }
11119
11183
  });
@@ -11158,17 +11222,19 @@ class GameShareModule {
11158
11222
  }
11159
11223
  return newConfig;
11160
11224
  }
11161
- openSharePanel({ shareConfig, sharePath, shareId }) {
11162
- let shareType = shareModule_ShareType.Social;
11163
- let shareLink = sharePath;
11225
+ openSharePanel({ shareConfig, shareLink, shareId, shareText }) {
11226
+ let shareType = ShareType.Link;
11227
+ if (!shareLink)
11228
+ shareType = ShareType.Text;
11164
11229
  if (shareConfig.files && shareConfig.files.length > 0) {
11165
- shareType = shareModule_ShareType.SlideScreenshot;
11230
+ shareType = ShareType.Image;
11166
11231
  shareLink = URL.createObjectURL(shareConfig.files[0]);
11167
11232
  }
11168
11233
  this.shareNotifier.notifyOpenSharePanel({
11169
11234
  shareId,
11170
11235
  shareType,
11171
- shareLink
11236
+ shareLink,
11237
+ shareText
11172
11238
  });
11173
11239
  }
11174
11240
  }
@@ -11440,7 +11506,6 @@ var gameReaderViewModel_classPrivateFieldSet = (undefined && undefined.__classPr
11440
11506
 
11441
11507
 
11442
11508
 
11443
-
11444
11509
  var GameReaderEvent;
11445
11510
  (function (GameReaderEvent) {
11446
11511
  GameReaderEvent["Close"] = "close";
@@ -11694,12 +11759,12 @@ let GameReaderViewModel = (() => {
11694
11759
  }
11695
11760
  async closeGame() {
11696
11761
  var _b;
11697
- if (!this._isOpened || !this._game)
11762
+ if (!this._isOpened)
11698
11763
  return false;
11699
11764
  if (this._isGameInited)
11700
11765
  (_b = this.gameSession) === null || _b === void 0 ? void 0 : _b.closeGameReader();
11701
11766
  else
11702
- this.finishGame({ result: {} });
11767
+ this.finishGame();
11703
11768
  return true;
11704
11769
  }
11705
11770
  async reloadGame() {
@@ -11722,7 +11787,7 @@ let GameReaderViewModel = (() => {
11722
11787
  }
11723
11788
  subscribeToGameSession(session) {
11724
11789
  session.on("gameComplete" /* GameSessionEvent.GameComplete */, (result, arg1, arg2, openStory, gameInstance) => {
11725
- this.finishGame({ result, openStory, gameInstance });
11790
+ this.finishGame({ openStory, gameInstance });
11726
11791
  });
11727
11792
  session.on("reloadGameReader" /* GameSessionEvent.ReloadGameReader */, () => {
11728
11793
  this.restartGame();
@@ -11744,12 +11809,8 @@ let GameReaderViewModel = (() => {
11744
11809
  var _b;
11745
11810
  (_b = this.gameSession) === null || _b === void 0 ? void 0 : _b.shareComplete(shareId, isSuccess);
11746
11811
  }
11747
- notifyOpenSharePanel({ shareId, shareType, shareLink }) {
11748
- this.emit(GameReaderEvent.OpenSharePanel, {
11749
- shareId,
11750
- shareType,
11751
- shareLink
11752
- });
11812
+ notifyOpenSharePanel(event) {
11813
+ this.emit(GameReaderEvent.OpenSharePanel, event);
11753
11814
  }
11754
11815
  async waitForeground(session) {
11755
11816
  const payload = await session.waitForeground();
@@ -11780,15 +11841,14 @@ let GameReaderViewModel = (() => {
11780
11841
  this.resetFlags();
11781
11842
  this.resetGameData();
11782
11843
  }
11783
- finishGame({ result, openStory, gameInstance }) {
11784
- const gameId = this.ensureGameIsOpen();
11844
+ finishGame(params = {}) {
11785
11845
  this.resetScrollbar();
11786
11846
  this.closeSession();
11787
11847
  this.resetFlags();
11788
11848
  this.resetGameData();
11789
11849
  this.resetCounters();
11790
- this.emitGameCompletion(gameId, result);
11791
- this.navigateAfterGame({ gameInstance, openStory });
11850
+ this.storyManager.emit("closeGame");
11851
+ this.navigateAfterGame(params);
11792
11852
  }
11793
11853
  resetScrollbar() {
11794
11854
  this.scrollbarHelper.disable();
@@ -11810,18 +11870,6 @@ let GameReaderViewModel = (() => {
11810
11870
  resetCounters() {
11811
11871
  this.retryAttempts = 0;
11812
11872
  }
11813
- ensureGameIsOpen() {
11814
- var _b;
11815
- const gameId = (_b = this.game) === null || _b === void 0 ? void 0 : _b.id;
11816
- if (!gameId)
11817
- throw new NoOpenedGameError();
11818
- return gameId;
11819
- }
11820
- emitGameCompletion(gameId, result) {
11821
- const event = (0,isEmpty_js_namespaceObject["default"])(result) ? "closeGame" : "finishGame";
11822
- const payload = (0,isEmpty_js_namespaceObject["default"])(result) ? { id: gameId } : { id: gameId, result };
11823
- this.storyManager.emit(event, payload);
11824
- }
11825
11873
  navigateAfterGame(params) {
11826
11874
  var _b, _c;
11827
11875
  if ((_b = params.gameInstance) === null || _b === void 0 ? void 0 : _b.id) {
@@ -12508,15 +12556,7 @@ class StorySlideApiHandlers {
12508
12556
  });
12509
12557
  }
12510
12558
  showLayer(index) {
12511
- var _a;
12512
- this.statisticV2Service.sendSlideLayout({
12513
- layoutIndex: index,
12514
- storyId: this.story.id,
12515
- activeSlideIndex: this.story.activeSlideIndex,
12516
- feedSlug: (_a = this.storyReader.feed) === null || _a === void 0 ? void 0 : _a.slug
12517
- });
12518
- this.story.resumeUser();
12519
- this.story.activeSlide.showLayerByIndex(index);
12559
+ this.story.showLayer(index);
12520
12560
  }
12521
12561
  showCardSlide(slideIndex) {
12522
12562
  this.story.showSlide(slideIndex);
@@ -12867,679 +12907,134 @@ class SafeAreaFrameCalculator {
12867
12907
 
12868
12908
 
12869
12909
 
12870
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/baseStoryReaderEvent.ts
12871
-
12910
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showOnboardingStoriesStrategy.ts
12872
12911
 
12873
- class BaseStoryReaderEvent {
12874
- constructor(story, payload = {}) {
12875
- var _a, _b, _c, _d;
12876
- Object.defineProperty(this, "story", {
12912
+ class ShowOnboardingStoriesStrategy {
12913
+ constructor(showMultipleStoriesStrategy, storyManager) {
12914
+ Object.defineProperty(this, "showMultipleStoriesStrategy", {
12877
12915
  enumerable: true,
12878
12916
  configurable: true,
12879
12917
  writable: true,
12880
- value: story
12918
+ value: showMultipleStoriesStrategy
12881
12919
  });
12882
- Object.defineProperty(this, "payload", {
12920
+ Object.defineProperty(this, "storyManager", {
12883
12921
  enumerable: true,
12884
12922
  configurable: true,
12885
12923
  writable: true,
12886
- value: payload
12924
+ value: storyManager
12887
12925
  });
12888
- Object.defineProperty(this, "title", {
12926
+ Object.defineProperty(this, "_feed", {
12889
12927
  enumerable: true,
12890
12928
  configurable: true,
12891
12929
  writable: true,
12892
12930
  value: null
12893
12931
  });
12894
- Object.defineProperty(this, "tags", {
12895
- enumerable: true,
12896
- configurable: true,
12897
- writable: true,
12898
- 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
12899
12944
  });
12900
- Object.defineProperty(this, "slidesCount", {
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
12955
+ });
12956
+ return feedLoadEvent;
12957
+ }
12958
+ async handleNextStoryByIndex(nextStoryIndex) {
12959
+ this.showMultipleStoriesStrategy.handleNextStoryByIndex(nextStoryIndex);
12960
+ }
12961
+ emitFeedLoad(event) {
12962
+ this.storyManager.emit("feedLoad", event);
12963
+ }
12964
+ getFeedLoadEvent(feed, onboardingStories) {
12965
+ const stories = onboardingStories.map(story => {
12966
+ const additionalPayload = {
12967
+ title: null,
12968
+ slidesCount: null
12969
+ };
12970
+ if (story) {
12971
+ additionalPayload.title = story.statTitle;
12972
+ additionalPayload.slidesCount = story.slidesCount;
12973
+ }
12974
+ return Object.assign({ id: story.id }, additionalPayload);
12975
+ });
12976
+ const eventData = {
12977
+ stories,
12978
+ feed: null,
12979
+ filter: null
12980
+ };
12981
+ eventData.feed = feed;
12982
+ return eventData;
12983
+ }
12984
+ async reload(payload) {
12985
+ this.showMultipleStoriesStrategy.reload(payload);
12986
+ }
12987
+ throwIfAborted(signal) {
12988
+ if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
12989
+ throw new DOMException("Aborted", "AbortError");
12990
+ }
12991
+ }
12992
+ }
12993
+
12994
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showMultipleStoriesStrategy.ts
12995
+ const NUMBER_OF_LAZY_LOADED_STORIES = 2;
12996
+ class ShowMultipleStoriesStrategy {
12997
+ constructor(storyManager, storyReaderViewModel) {
12998
+ Object.defineProperty(this, "storyManager", {
12901
12999
  enumerable: true,
12902
13000
  configurable: true,
12903
13001
  writable: true,
12904
- value: null
13002
+ value: storyManager
12905
13003
  });
12906
- Object.defineProperty(this, "feedSlug", {
13004
+ Object.defineProperty(this, "storyReaderViewModel", {
12907
13005
  enumerable: true,
12908
13006
  configurable: true,
12909
13007
  writable: true,
12910
- value: null
13008
+ value: storyReaderViewModel
12911
13009
  });
12912
- Object.defineProperty(this, "filter", {
13010
+ Object.defineProperty(this, "storyStore", {
12913
13011
  enumerable: true,
12914
13012
  configurable: true,
12915
13013
  writable: true,
12916
- value: null
13014
+ value: void 0
12917
13015
  });
12918
- Object.defineProperty(this, "actionSource", {
13016
+ Object.defineProperty(this, "stories", {
12919
13017
  enumerable: true,
12920
13018
  configurable: true,
12921
13019
  writable: true,
12922
- value: StoryActionSource.list
13020
+ value: []
12923
13021
  });
12924
- Object.defineProperty(this, "ugcPayload", {
13022
+ Object.defineProperty(this, "storyIndex", {
12925
13023
  enumerable: true,
12926
13024
  configurable: true,
12927
13025
  writable: true,
12928
- value: null
13026
+ value: 0
12929
13027
  });
12930
- Object.defineProperty(this, "slideEventPayload", {
13028
+ Object.defineProperty(this, "storyFeed", {
12931
13029
  enumerable: true,
12932
13030
  configurable: true,
12933
13031
  writable: true,
12934
- value: null
13032
+ value: void 0
12935
13033
  });
12936
- const feed = (_a = this.story.displayStrategy) === null || _a === void 0 ? void 0 : _a.feed;
12937
- const feedType = feed === null || feed === void 0 ? void 0 : feed.type;
12938
- const feedSlug = (_b = feed === null || feed === void 0 ? void 0 : feed.slug) !== null && _b !== void 0 ? _b : null;
12939
- const filter = feed instanceof UgcStoryFeed ? feed.filter : null;
12940
- this.title = this.story.statTitle;
12941
- this.slidesCount = this.story.slidesCount;
12942
- this.ugcPayload = feedType === StoryFeedType.UGC ? this.story.ugcPayload : null;
12943
- this.feedSlug = feedType === StoryFeedType.DEFAULT ? feedSlug : null;
12944
- this.filter = filter;
12945
- this.actionSource = feedType != null ? this.getStorySourceByFeedType(feedType) : StoryActionSource.direct;
12946
- this.slideEventPayload = (_d = (_c = story.activeSlide.eventPayload) === null || _c === void 0 ? void 0 : _c.payload) !== null && _d !== void 0 ? _d : null;
13034
+ this.storyStore = this.storyManager.rootStore.storyStore;
12947
13035
  }
12948
- toJSON() {
12949
- 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);
12950
- }
12951
- getStorySourceByFeedType(feedType) {
12952
- switch (feedType) {
12953
- case StoryFeedType.DEFAULT:
12954
- return StoryActionSource.list;
12955
- case StoryFeedType.UGC:
12956
- return StoryActionSource.list;
12957
- case StoryFeedType.FAVORITE:
12958
- return StoryActionSource.favorite;
12959
- case StoryFeedType.ONBOARDING:
12960
- return StoryActionSource.onboarding;
12961
- default:
12962
- return StoryActionSource.list;
12963
- }
12964
- }
12965
- }
12966
-
12967
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/closeStoryEvent.ts
12968
-
12969
- class CloseStoryEvent extends BaseStoryReaderEvent {
12970
- get name() {
12971
- return "closeStory";
12972
- }
12973
- toJSON() {
12974
- return Object.assign(Object.assign({}, super.toJSON()), { action: this.payload.action });
12975
- }
12976
- }
12977
-
12978
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/closeStoryReaderEvent.ts
12979
-
12980
- class CloseStoryReaderEvent extends BaseStoryReaderEvent {
12981
- get name() {
12982
- return "closeStoryReader";
12983
- }
12984
- toJSON() {
12985
- return Object.assign(Object.assign({}, super.toJSON()), { action: this.payload.action });
12986
- }
12987
- }
12988
-
12989
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/dislikeStoryEvent.ts
12990
-
12991
- class DislikeStoryEvent extends BaseStoryReaderEvent {
12992
- get name() {
12993
- return "dislikeStory";
12994
- }
12995
- toJSON() {
12996
- return Object.assign(Object.assign({}, super.toJSON()), { value: this.payload.value });
12997
- }
12998
- }
12999
-
13000
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/favoriteStoryEvent.ts
13001
-
13002
- class FavoriteStoryEvent extends BaseStoryReaderEvent {
13003
- get name() {
13004
- return "favoriteStory";
13005
- }
13006
- toJSON() {
13007
- return Object.assign(Object.assign({}, super.toJSON()), { value: this.payload.value });
13008
- }
13009
- }
13010
-
13011
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/likeStoryEvent.ts
13012
-
13013
- class LikeStoryEvent extends BaseStoryReaderEvent {
13014
- get name() {
13015
- return "likeStory";
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/shareStoryEvent.ts
13023
-
13024
- class ShareStoryEvent extends BaseStoryReaderEvent {
13025
- get name() {
13026
- return "shareStory";
13027
- }
13028
- }
13029
-
13030
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/shareStoryWithPathEvent.ts
13031
-
13032
- class ShareStoryWithPathEvent extends BaseStoryReaderEvent {
13033
- get name() {
13034
- return "shareStoryWithPath";
13035
- }
13036
- toJSON() {
13037
- return Object.assign(Object.assign({}, super.toJSON()), { value: this.payload.url });
13038
- }
13039
- }
13040
-
13041
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/showSlideEvent.ts
13042
-
13043
- class ShowSlideEvent extends BaseStoryReaderEvent {
13044
- get name() {
13045
- return "showSlide";
13046
- }
13047
- }
13048
-
13049
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/showStoryEvent.ts
13050
-
13051
- class ShowStoryEvent extends BaseStoryReaderEvent {
13052
- get name() {
13053
- return "showStory";
13054
- }
13055
- toJSON() {
13056
- const data = super.toJSON();
13057
- data.payload = null;
13058
- return data;
13059
- }
13060
- }
13061
-
13062
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/showStoryFailed.ts
13063
- class ShowStoryFailed {
13064
- constructor(payload) {
13065
- Object.defineProperty(this, "payload", {
13066
- enumerable: true,
13067
- configurable: true,
13068
- writable: true,
13069
- value: payload
13070
- });
13071
- }
13072
- get name() {
13073
- return "showStoryFailed";
13074
- }
13075
- toJSON() {
13076
- return {
13077
- id: this.payload.id,
13078
- title: this.payload.title,
13079
- name: this.payload.name,
13080
- message: this.payload.message
13081
- };
13082
- }
13083
- }
13084
-
13085
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/index.ts
13086
-
13087
-
13088
-
13089
-
13090
-
13091
-
13092
-
13093
-
13094
-
13095
-
13096
-
13097
-
13098
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyReaderNavigationController.ts
13099
- var storyReaderNavigationController_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
13100
- var useValue = arguments.length > 2;
13101
- for (var i = 0; i < initializers.length; i++) {
13102
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
13103
- }
13104
- return useValue ? value : void 0;
13105
- };
13106
- var storyReaderNavigationController_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
13107
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
13108
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
13109
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13110
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13111
- var _, done = false;
13112
- for (var i = decorators.length - 1; i >= 0; i--) {
13113
- var context = {};
13114
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
13115
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
13116
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13117
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13118
- if (kind === "accessor") {
13119
- if (result === void 0) continue;
13120
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
13121
- if (_ = accept(result.get)) descriptor.get = _;
13122
- if (_ = accept(result.set)) descriptor.set = _;
13123
- if (_ = accept(result.init)) initializers.unshift(_);
13124
- }
13125
- else if (_ = accept(result)) {
13126
- if (kind === "field") initializers.unshift(_);
13127
- else descriptor[key] = _;
13128
- }
13129
- }
13130
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
13131
- done = true;
13132
- };
13133
- var storyReaderNavigationController_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13134
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13135
- 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");
13136
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13137
- };
13138
- var storyReaderNavigationController_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13139
- if (kind === "m") throw new TypeError("Private method is not writable");
13140
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
13141
- 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");
13142
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
13143
- };
13144
-
13145
-
13146
-
13147
- const STORY_INIT_RANGE = 1;
13148
- const ACTIVE_STORY_PRELOAD_PRIORITY = 1000;
13149
- const NON_ACTIVE_STORY_PRELOAD_PRIORITY = 0;
13150
- let StoryReaderNavigationController = (() => {
13151
- var _a, _StoryReaderNavigationController__activeStory_accessor_storage, _StoryReaderNavigationController__currentIndex_accessor_storage, _StoryReaderNavigationController__targetTransitionIndex_accessor_storage;
13152
- let _instanceExtraInitializers = [];
13153
- let __activeStory_decorators;
13154
- let __activeStory_initializers = [];
13155
- let __activeStory_extraInitializers = [];
13156
- let __currentIndex_decorators;
13157
- let __currentIndex_initializers = [];
13158
- let __currentIndex_extraInitializers = [];
13159
- let __targetTransitionIndex_decorators;
13160
- let __targetTransitionIndex_initializers = [];
13161
- let __targetTransitionIndex_extraInitializers = [];
13162
- let _get_reachStart_decorators;
13163
- let _get_reachEnd_decorators;
13164
- let _get_targetTransitionStory_decorators;
13165
- let _nextStory_decorators;
13166
- let _prevStory_decorators;
13167
- let _nextStoryWithAnimation_decorators;
13168
- let _prevStoryWithAnimation_decorators;
13169
- let _navigateStoryWithAnimation_decorators;
13170
- let _handleTransitionEnd_decorators;
13171
- return _a = class StoryReaderNavigationController {
13172
- get _activeStory() { return storyReaderNavigationController_classPrivateFieldGet(this, _StoryReaderNavigationController__activeStory_accessor_storage, "f"); }
13173
- set _activeStory(value) { storyReaderNavigationController_classPrivateFieldSet(this, _StoryReaderNavigationController__activeStory_accessor_storage, value, "f"); }
13174
- get _currentIndex() { return storyReaderNavigationController_classPrivateFieldGet(this, _StoryReaderNavigationController__currentIndex_accessor_storage, "f"); }
13175
- set _currentIndex(value) { storyReaderNavigationController_classPrivateFieldSet(this, _StoryReaderNavigationController__currentIndex_accessor_storage, value, "f"); }
13176
- get _targetTransitionIndex() { return storyReaderNavigationController_classPrivateFieldGet(this, _StoryReaderNavigationController__targetTransitionIndex_accessor_storage, "f"); }
13177
- set _targetTransitionIndex(value) { storyReaderNavigationController_classPrivateFieldSet(this, _StoryReaderNavigationController__targetTransitionIndex_accessor_storage, value, "f"); }
13178
- constructor(storyManager, storyReader, statistics) {
13179
- Object.defineProperty(this, "storyManager", {
13180
- enumerable: true,
13181
- configurable: true,
13182
- writable: true,
13183
- value: (storyReaderNavigationController_runInitializers(this, _instanceExtraInitializers), storyManager)
13184
- });
13185
- Object.defineProperty(this, "storyReader", {
13186
- enumerable: true,
13187
- configurable: true,
13188
- writable: true,
13189
- value: storyReader
13190
- });
13191
- Object.defineProperty(this, "statistics", {
13192
- enumerable: true,
13193
- configurable: true,
13194
- writable: true,
13195
- value: statistics
13196
- });
13197
- _StoryReaderNavigationController__activeStory_accessor_storage.set(this, storyReaderNavigationController_runInitializers(this, __activeStory_initializers, null));
13198
- _StoryReaderNavigationController__currentIndex_accessor_storage.set(this, (storyReaderNavigationController_runInitializers(this, __activeStory_extraInitializers), storyReaderNavigationController_runInitializers(this, __currentIndex_initializers, 0)));
13199
- _StoryReaderNavigationController__targetTransitionIndex_accessor_storage.set(this, (storyReaderNavigationController_runInitializers(this, __currentIndex_extraInitializers), storyReaderNavigationController_runInitializers(this, __targetTransitionIndex_initializers, -1)));
13200
- Object.defineProperty(this, "animatedNavigationController", {
13201
- enumerable: true,
13202
- configurable: true,
13203
- writable: true,
13204
- value: (storyReaderNavigationController_runInitializers(this, __targetTransitionIndex_extraInitializers), null)
13205
- });
13206
- Object.defineProperty(this, "currentStoryDisplayStrategy", {
13207
- enumerable: true,
13208
- configurable: true,
13209
- writable: true,
13210
- value: null
13211
- });
13212
- Object.defineProperty(this, "_activeStoryStartTime", {
13213
- enumerable: true,
13214
- configurable: true,
13215
- writable: true,
13216
- value: 0
13217
- });
13218
- }
13219
- get reachStart() {
13220
- return this._currentIndex === 0;
13221
- }
13222
- get reachEnd() {
13223
- return this._currentIndex === this.storyReader.stories.length - 1;
13224
- }
13225
- get targetTransitionStory() {
13226
- return this.storyReader.stories[this._targetTransitionIndex];
13227
- }
13228
- get targetTransitionIndex() {
13229
- return this._targetTransitionIndex;
13230
- }
13231
- get activeStory() {
13232
- return this._activeStory;
13233
- }
13234
- get currentIndex() {
13235
- return this._currentIndex;
13236
- }
13237
- get activeStoryDuration() {
13238
- return Date.now() - this._activeStoryStartTime;
13239
- }
13240
- setAnimatedNavigationController(animatedNavigationController) {
13241
- this.animatedNavigationController = animatedNavigationController;
13242
- }
13243
- setCurrentStoryDisplayStrategy(currentStoryDisplayStrategy) {
13244
- this.currentStoryDisplayStrategy = currentStoryDisplayStrategy;
13245
- }
13246
- nextStory() {
13247
- if (this.reachEnd)
13248
- return;
13249
- this.setActiveStoryByIndex(this._currentIndex + 1);
13250
- }
13251
- prevStory() {
13252
- if (this.reachStart)
13253
- return;
13254
- this.setActiveStoryByIndex(this._currentIndex - 1);
13255
- }
13256
- nextStoryWithAnimation(action) {
13257
- if (this.storyReader.reachEnd)
13258
- this.handleStoryReaderReachEnd(action);
13259
- else
13260
- this.navigateStoryWithAnimation(this._currentIndex + 1, action);
13261
- }
13262
- prevStoryWithAnimation(action) {
13263
- if (!this.reachStart)
13264
- this.navigateStoryWithAnimation(this.currentIndex - 1, action);
13265
- }
13266
- destroy() {
13267
- this._activeStory = null;
13268
- }
13269
- setActiveStoryById(storyId) {
13270
- const stories = this.storyReader.stories;
13271
- const index = stories.findIndex(story => story.id === storyId);
13272
- if (index === -1)
13273
- throw new Error(`[IAS]: No story found with ID ${storyId}`);
13274
- this.initStoriesWithinRange(index);
13275
- return this.setActiveStoryByIndex(index);
13276
- }
13277
- async navigateStoryWithAnimation(index, action = "lastSlideClick") {
13278
- if (!this.animatedNavigationController ||
13279
- this.animatedNavigationController.animating ||
13280
- this._targetTransitionIndex !== -1)
13281
- return;
13282
- index = this.limitIndex(index);
13283
- this._targetTransitionIndex = index;
13284
- this.currentStoryDisplayStrategy.handleNextStoryByIndex(index);
13285
- this.initStoriesWithinRange(index);
13286
- await this.animatedNavigationController.transitionByIndex(index, this.currentIndex);
13287
- await this.handleTransitionEnd(index, action);
13288
- }
13289
- handleStoryReaderReachEnd(action) {
13290
- var _b;
13291
- if (action !== CloseStoryReaderAction.CloseByTimer) {
13292
- this.storyReader.close(CloseStoryReaderAction.CloseByLastSlideClick);
13293
- }
13294
- else if ((_b = this.animatedNavigationController) === null || _b === void 0 ? void 0 : _b.options.closeOnLastSlideByTimer) {
13295
- this.storyReader.close(CloseStoryReaderAction.CloseByTimer);
13296
- }
13297
- }
13298
- async handleTransitionEnd(index, navigationAction) {
13299
- if (this.activeStory) {
13300
- const event = new CloseStoryEvent(this.activeStory, {
13301
- action: navigationAction
13302
- });
13303
- this.storyManager.emit(event.name, event.toJSON());
13304
- }
13305
- await this.setActiveStoryByIndex(index);
13306
- this._targetTransitionIndex = -1;
13307
- }
13308
- async setActiveStoryByIndex(index) {
13309
- const prevIndex = this._currentIndex;
13310
- const prevStory = this._activeStory;
13311
- const newActiveStory = this.storyReader.stories[index];
13312
- if (!newActiveStory)
13313
- return;
13314
- await this.updateActiveStory(index, prevStory, newActiveStory);
13315
- this.statistics.emitTransitionEvents(prevIndex, index, prevStory, newActiveStory, this.activeStoryDuration);
13316
- this.handleActiveStoryError(this._activeStory);
13317
- newActiveStory.markAsOpened();
13318
- return newActiveStory;
13319
- }
13320
- async updateActiveStory(index, prevStory, activeStory) {
13321
- this._currentIndex = index;
13322
- this.runNextStory(prevStory, activeStory);
13323
- this._activeStoryStartTime = Date.now();
13324
- this._activeStory = activeStory;
13325
- return activeStory;
13326
- }
13327
- async runNextStory(prevStory, story) {
13328
- try {
13329
- await (prevStory === null || prevStory === void 0 ? void 0 : prevStory.stop());
13330
- await this.preloadActiveStory(story);
13331
- await story.init();
13332
- await story.start();
13333
- }
13334
- catch (error) {
13335
- console.error(error);
13336
- }
13337
- }
13338
- async initStoriesWithinRange(currentIndex) {
13339
- const stories = this.storyReader.stories;
13340
- const start = Math.max(currentIndex - STORY_INIT_RANGE, 0);
13341
- const end = Math.min(currentIndex + STORY_INIT_RANGE, stories.length - 1);
13342
- const storiesToInit = [];
13343
- for (let i = start; i <= end; i++) {
13344
- if (i !== currentIndex)
13345
- storiesToInit.push(stories[i]);
13346
- }
13347
- await this.preloadSiblingStories(storiesToInit);
13348
- return Promise.allSettled(storiesToInit.map(story => story.init()));
13349
- }
13350
- handleActiveStoryError(story) {
13351
- if (!(story === null || story === void 0 ? void 0 : story.error))
13352
- return;
13353
- const event = new ShowStoryFailed({
13354
- id: story.id,
13355
- title: story.title,
13356
- name: story.error.name,
13357
- message: story.error.message
13358
- });
13359
- this.storyManager.emit(event.name, event.toJSON());
13360
- }
13361
- limitIndex(index) {
13362
- return Math.max(0, Math.min(this.storyReader.stories.length - 1, index));
13363
- }
13364
- async preloadActiveStory(story) {
13365
- const cacheConfig = this.storyManager.config.cache;
13366
- if (!cacheConfig)
13367
- return;
13368
- if (cacheConfig.prefetch) {
13369
- await story.preloadSlides(0, story.slidesCount, ACTIVE_STORY_PRELOAD_PRIORITY);
13370
- }
13371
- else {
13372
- await story.preloadActiveSlide(ACTIVE_STORY_PRELOAD_PRIORITY);
13373
- }
13374
- }
13375
- async preloadSiblingStories(stories) {
13376
- const cacheConfig = this.storyManager.config.cache;
13377
- if (!cacheConfig)
13378
- return;
13379
- if (cacheConfig.prefetch) {
13380
- await Promise.all(stories.map(story => story.preloadSlides(0, 2, NON_ACTIVE_STORY_PRELOAD_PRIORITY)));
13381
- }
13382
- else {
13383
- await Promise.all(stories.map(story => story.preloadActiveSlide(NON_ACTIVE_STORY_PRELOAD_PRIORITY)));
13384
- }
13385
- }
13386
- },
13387
- _StoryReaderNavigationController__activeStory_accessor_storage = new WeakMap(),
13388
- _StoryReaderNavigationController__currentIndex_accessor_storage = new WeakMap(),
13389
- _StoryReaderNavigationController__targetTransitionIndex_accessor_storage = new WeakMap(),
13390
- (() => {
13391
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
13392
- __activeStory_decorators = [external_mobx_namespaceObject.observable];
13393
- __currentIndex_decorators = [external_mobx_namespaceObject.observable];
13394
- __targetTransitionIndex_decorators = [external_mobx_namespaceObject.observable];
13395
- _get_reachStart_decorators = [external_mobx_namespaceObject.computed];
13396
- _get_reachEnd_decorators = [external_mobx_namespaceObject.computed];
13397
- _get_targetTransitionStory_decorators = [external_mobx_namespaceObject.computed];
13398
- _nextStory_decorators = [external_mobx_namespaceObject.action];
13399
- _prevStory_decorators = [external_mobx_namespaceObject.action];
13400
- _nextStoryWithAnimation_decorators = [external_mobx_namespaceObject.action];
13401
- _prevStoryWithAnimation_decorators = [external_mobx_namespaceObject.action];
13402
- _navigateStoryWithAnimation_decorators = [external_mobx_namespaceObject.action];
13403
- _handleTransitionEnd_decorators = [external_mobx_namespaceObject.action];
13404
- 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);
13405
- 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);
13406
- 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);
13407
- 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);
13408
- 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);
13409
- 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);
13410
- 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);
13411
- 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);
13412
- 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);
13413
- 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);
13414
- 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);
13415
- 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);
13416
- if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
13417
- })(),
13418
- _a;
13419
- })();
13420
-
13421
-
13422
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showOnboardingStoriesStrategy.ts
13423
-
13424
- class ShowOnboardingStoriesStrategy {
13425
- constructor(showMultipleStoriesStrategy, storyManager) {
13426
- Object.defineProperty(this, "showMultipleStoriesStrategy", {
13427
- enumerable: true,
13428
- configurable: true,
13429
- writable: true,
13430
- value: showMultipleStoriesStrategy
13431
- });
13432
- Object.defineProperty(this, "storyManager", {
13433
- enumerable: true,
13434
- configurable: true,
13435
- writable: true,
13436
- value: storyManager
13437
- });
13438
- Object.defineProperty(this, "_feed", {
13439
- enumerable: true,
13440
- configurable: true,
13441
- writable: true,
13442
- value: null
13443
- });
13444
- }
13445
- get feed() {
13446
- return this._feed;
13447
- }
13448
- async show(payload) {
13449
- var _a, _b;
13450
- const storyFeedStore = this.storyManager.rootStore.onboardingFeedStore;
13451
- const onboardingFeed = await storyFeedStore.fetchOnboardingFeed({
13452
- feedSlug: payload.feedSlug,
13453
- tags: (_a = payload.customTags) !== null && _a !== void 0 ? _a : [],
13454
- limit: (_b = payload.limit) !== null && _b !== void 0 ? _b : undefined
13455
- });
13456
- this._feed = onboardingFeed;
13457
- const feedLoadEvent = this.getFeedLoadEvent(onboardingFeed.slug, onboardingFeed.stories);
13458
- this.emitFeedLoad(feedLoadEvent);
13459
- if (!onboardingFeed.stories.length)
13460
- return feedLoadEvent;
13461
- await this.showMultipleStoriesStrategy.show({
13462
- windowReferer: STORY_READER_WINDOW_REFERER.default,
13463
- storyFeed: onboardingFeed,
13464
- storyId: onboardingFeed.stories[0].id
13465
- });
13466
- return feedLoadEvent;
13467
- }
13468
- async handleNextStoryByIndex(nextStoryIndex) {
13469
- this.showMultipleStoriesStrategy.handleNextStoryByIndex(nextStoryIndex);
13470
- }
13471
- emitFeedLoad(event) {
13472
- this.storyManager.emit("feedLoad", event);
13473
- }
13474
- getFeedLoadEvent(feed, onboardingStories) {
13475
- const stories = onboardingStories.map(story => {
13476
- const additionalPayload = {
13477
- title: null,
13478
- slidesCount: null
13479
- };
13480
- if (story) {
13481
- additionalPayload.title = story.statTitle;
13482
- additionalPayload.slidesCount = story.slidesCount;
13483
- }
13484
- return Object.assign({ id: story.id }, additionalPayload);
13485
- });
13486
- const eventData = {
13487
- stories,
13488
- feed: null,
13489
- filter: null
13490
- };
13491
- eventData.feed = feed;
13492
- return eventData;
13493
- }
13494
- async reload(payload) {
13495
- this.showMultipleStoriesStrategy.reload(payload);
13496
- }
13497
- }
13498
-
13499
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showMultipleStoriesStrategy.ts
13500
- const NUMBER_OF_LAZY_LOADED_STORIES = 2;
13501
- class ShowMultipleStoriesStrategy {
13502
- constructor(storyManager, storyReaderViewModel) {
13503
- Object.defineProperty(this, "storyManager", {
13504
- enumerable: true,
13505
- configurable: true,
13506
- writable: true,
13507
- value: storyManager
13508
- });
13509
- Object.defineProperty(this, "storyReaderViewModel", {
13510
- enumerable: true,
13511
- configurable: true,
13512
- writable: true,
13513
- value: storyReaderViewModel
13514
- });
13515
- Object.defineProperty(this, "storyStore", {
13516
- enumerable: true,
13517
- configurable: true,
13518
- writable: true,
13519
- value: void 0
13520
- });
13521
- Object.defineProperty(this, "stories", {
13522
- enumerable: true,
13523
- configurable: true,
13524
- writable: true,
13525
- value: []
13526
- });
13527
- Object.defineProperty(this, "storyIndex", {
13528
- enumerable: true,
13529
- configurable: true,
13530
- writable: true,
13531
- value: 0
13532
- });
13533
- Object.defineProperty(this, "storyFeed", {
13534
- enumerable: true,
13535
- configurable: true,
13536
- writable: true,
13537
- value: void 0
13538
- });
13539
- this.storyStore = this.storyManager.rootStore.storyStore;
13540
- }
13541
- get feed() {
13542
- return this.storyFeed;
13036
+ get feed() {
13037
+ return this.storyFeed;
13543
13038
  }
13544
13039
  async show(payload) {
13545
13040
  const { storyId, windowReferer } = payload;
@@ -13595,7 +13090,8 @@ class ShowStoryFromSharePageStrategy {
13595
13090
  async show(payload) {
13596
13091
  await this.showStoryStrategy.show({
13597
13092
  storyId: payload.storyId,
13598
- fetchShareUrl: payload.fetchShareUrl
13093
+ fetchShareUrl: payload.fetchShareUrl,
13094
+ signal: payload.signal
13599
13095
  });
13600
13096
  }
13601
13097
  async reload(payload) {
@@ -13627,12 +13123,14 @@ class ShowStoryOnceStrategy {
13627
13123
  }
13628
13124
  async show(payload) {
13629
13125
  try {
13126
+ this.throwIfAborted(payload.signal);
13630
13127
  const storyStore = this.storyManager.rootStore.storyStore;
13631
13128
  const story = await storyStore.fetchStoryById({
13632
13129
  storyId: payload.storyId,
13633
13130
  feedSlug: "",
13634
13131
  once: true
13635
13132
  });
13133
+ this.throwIfAborted(payload.signal);
13636
13134
  if (story.error)
13637
13135
  throw story.error;
13638
13136
  if (story.isOpened)
@@ -13653,6 +13151,11 @@ class ShowStoryOnceStrategy {
13653
13151
  }
13654
13152
  async handleNextStoryByIndex(storyIndex) { }
13655
13153
  async reload(payload) { }
13154
+ throwIfAborted(signal) {
13155
+ if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
13156
+ throw new DOMException("Aborted", "AbortError");
13157
+ }
13158
+ }
13656
13159
  }
13657
13160
 
13658
13161
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showStoryStrategy.ts
@@ -13676,12 +13179,14 @@ class ShowStoryStrategy {
13676
13179
  return null;
13677
13180
  }
13678
13181
  async show(payload) {
13182
+ this.throwIfAborted(payload.signal);
13679
13183
  const storyStore = this.storyManager.rootStore.storyStore;
13680
13184
  const story = await storyStore.fetchStoryById({
13681
13185
  storyId: payload.storyId,
13682
13186
  feedSlug: "",
13683
13187
  fetchShareUrl: payload.fetchShareUrl
13684
13188
  });
13189
+ this.throwIfAborted(payload.signal);
13685
13190
  this.openStoryReader(story, payload);
13686
13191
  }
13687
13192
  openStoryReader(story, payload) {
@@ -13693,6 +13198,11 @@ class ShowStoryStrategy {
13693
13198
  }
13694
13199
  async handleNextStoryByIndex(storyIndex) { }
13695
13200
  async reload(payload) { }
13201
+ throwIfAborted(signal) {
13202
+ if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
13203
+ throw new DOMException("Aborted", "AbortError");
13204
+ }
13205
+ }
13696
13206
  }
13697
13207
 
13698
13208
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/storyDisplayStrategyFactory.ts
@@ -13738,6 +13248,234 @@ class StoryDisplayStrategyFactory {
13738
13248
 
13739
13249
 
13740
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
13431
+
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", {
13447
+ enumerable: true,
13448
+ configurable: true,
13449
+ writable: true,
13450
+ value: payload
13451
+ });
13452
+ }
13453
+ get name() {
13454
+ return "showStoryFailed";
13455
+ }
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
+ };
13463
+ }
13464
+ }
13465
+
13466
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/events/index.ts
13467
+
13468
+
13469
+
13470
+
13471
+
13472
+
13473
+
13474
+
13475
+
13476
+
13477
+
13478
+
13741
13479
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyReaderStatisticsController.ts
13742
13480
 
13743
13481
 
@@ -14408,7 +14146,6 @@ var storyReaderViewModel_classPrivateFieldSet = (undefined && undefined.__classP
14408
14146
 
14409
14147
 
14410
14148
 
14411
-
14412
14149
  var StoryReaderEvent;
14413
14150
  (function (StoryReaderEvent) {
14414
14151
  StoryReaderEvent["Close"] = "closeStoryReader";
@@ -14424,7 +14161,7 @@ var CloseStoryReaderAction;
14424
14161
  CloseStoryReaderAction["AppClose"] = "app-close";
14425
14162
  })(CloseStoryReaderAction || (CloseStoryReaderAction = {}));
14426
14163
  let StoryReaderViewModel = (() => {
14427
- 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;
14428
14165
  let _classSuper = ViewModel;
14429
14166
  let _instanceExtraInitializers = [];
14430
14167
  let __muted_decorators;
@@ -14436,6 +14173,16 @@ let StoryReaderViewModel = (() => {
14436
14173
  let __stories_decorators;
14437
14174
  let __stories_initializers = [];
14438
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;
14439
14186
  let _get_isOpened_decorators;
14440
14187
  let _get_reachStart_decorators;
14441
14188
  let _get_reachEnd_decorators;
@@ -14457,6 +14204,8 @@ let StoryReaderViewModel = (() => {
14457
14204
  let _unmute_decorators;
14458
14205
  let _enableCloseGesture_decorators;
14459
14206
  let _disableCloseGesture_decorators;
14207
+ let _navigateStoryWithAnimation_decorators;
14208
+ let _handleTransitionEnd_decorators;
14460
14209
  return _a = class StoryReaderViewModel extends _classSuper {
14461
14210
  get _muted() { return storyReaderViewModel_classPrivateFieldGet(this, _StoryReaderViewModel__muted_accessor_storage, "f"); }
14462
14211
  set _muted(value) { storyReaderViewModel_classPrivateFieldSet(this, _StoryReaderViewModel__muted_accessor_storage, value, "f"); }
@@ -14464,6 +14213,12 @@ let StoryReaderViewModel = (() => {
14464
14213
  set _closeGestureInAction(value) { storyReaderViewModel_classPrivateFieldSet(this, _StoryReaderViewModel__closeGestureInAction_accessor_storage, value, "f"); }
14465
14214
  get _stories() { return storyReaderViewModel_classPrivateFieldGet(this, _StoryReaderViewModel__stories_accessor_storage, "f"); }
14466
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"); }
14467
14222
  constructor(storyManager, storyReaderStatisticV1Service, storyReaderStatisticV2Service, storyFeedStatisticV1Service) {
14468
14223
  super();
14469
14224
  Object.defineProperty(this, "storyManager", {
@@ -14523,11 +14278,20 @@ let StoryReaderViewModel = (() => {
14523
14278
  writable: true,
14524
14279
  value: new TouchController({ touchStartTimeout: 200 })
14525
14280
  });
14526
- 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", {
14527
14285
  enumerable: true,
14528
14286
  configurable: true,
14529
14287
  writable: true,
14530
- 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
14531
14295
  });
14532
14296
  Object.defineProperty(this, "useModernLayout", {
14533
14297
  enumerable: true,
@@ -14541,17 +14305,23 @@ let StoryReaderViewModel = (() => {
14541
14305
  writable: true,
14542
14306
  value: null
14543
14307
  });
14308
+ Object.defineProperty(this, "statisticsController", {
14309
+ enumerable: true,
14310
+ configurable: true,
14311
+ writable: true,
14312
+ value: void 0
14313
+ });
14544
14314
  this.handleWindowUnload = this.handleWindowUnload.bind(this);
14545
14315
  this.handleKeydown = this.handleKeydown.bind(this);
14546
14316
  window.addEventListener("beforeunload", this.handleWindowUnload);
14547
14317
  this.storyDisplayStrategyFactory = new StoryDisplayStrategyFactory(storyManager, this);
14548
- this.navigationController = new StoryReaderNavigationController(this.storyManager, this, new StoryReaderStatisticsController(this, this.storyManager, this.storyReaderStatisticV1Service, this.storyFeedStatisticV1Service, this.storyReaderStatisticV2Service));
14549
- }
14550
- get targetTransitionIndex() {
14551
- return this.navigationController.targetTransitionIndex;
14318
+ this.statisticsController = new StoryReaderStatisticsController(this, this.storyManager, this.storyReaderStatisticV1Service, this.storyFeedStatisticV1Service, this.storyReaderStatisticV2Service);
14552
14319
  }
14553
14320
  get targetTransitionStory() {
14554
- return this.navigationController.targetTransitionStory;
14321
+ return this.stories[this._targetTransitionIndex];
14322
+ }
14323
+ get targetTransitionIndex() {
14324
+ return this._targetTransitionIndex;
14555
14325
  }
14556
14326
  get touchController() {
14557
14327
  return this._touchController;
@@ -14573,22 +14343,26 @@ let StoryReaderViewModel = (() => {
14573
14343
  return this._stories;
14574
14344
  }
14575
14345
  get activeStory() {
14576
- return this.navigationController.activeStory;
14346
+ return this._activeStory;
14347
+ }
14348
+ get activeStoryDuration() {
14349
+ return Date.now() - this._activeStoryStartTime;
14577
14350
  }
14578
14351
  get dir() {
14579
14352
  return this.storyManager.config.dir;
14580
14353
  }
14581
14354
  get isOpened() {
14582
- return Boolean(this.navigationController.activeStory);
14355
+ return Boolean(this.activeStory);
14583
14356
  }
14584
14357
  get activeStoryIndex() {
14585
- return this.navigationController.currentIndex;
14358
+ return this._activeStoryIndex;
14586
14359
  }
14587
14360
  get reachStart() {
14588
- return this.navigationController.reachStart || this._stories[0] === this.targetTransitionStory;
14361
+ return this._activeStoryIndex === 0 || this._stories[0] === this.targetTransitionStory;
14589
14362
  }
14590
14363
  get reachEnd() {
14591
- 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);
14592
14366
  }
14593
14367
  open(payload) {
14594
14368
  var _b, _c;
@@ -14598,8 +14372,7 @@ let StoryReaderViewModel = (() => {
14598
14372
  this.cacheManager = new CacheManager(this.storyManager.config.cache);
14599
14373
  this.windowReferer = payload.windowReferer;
14600
14374
  this.setStories(payload.stories);
14601
- const activeStory = this.navigationController.setActiveStoryById(payload.id);
14602
- this.navigationController.setCurrentStoryDisplayStrategy(this._currentStoryDisplayStrategy);
14375
+ this.setActiveStoryById(payload.id);
14603
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 });
14604
14377
  this._touchController.init(document.body);
14605
14378
  this.setScrollBar(payload.windowReferer);
@@ -14626,7 +14399,7 @@ let StoryReaderViewModel = (() => {
14626
14399
  this.storyReaderStatisticV2Service.sendCloseReaderEvent({
14627
14400
  action,
14628
14401
  totalSlides: activeStory.slidesCount,
14629
- durationMs: this.navigationController.activeStoryDuration,
14402
+ durationMs: this.activeStoryDuration,
14630
14403
  storyId: activeStory.id,
14631
14404
  activeSlideIndex: activeStory.activeSlideIndex,
14632
14405
  feedSlug: (_b = this.feed) === null || _b === void 0 ? void 0 : _b.slug
@@ -14647,27 +14420,24 @@ let StoryReaderViewModel = (() => {
14647
14420
  this.clearStoryViewModels();
14648
14421
  this._touchController.destroy();
14649
14422
  document.removeEventListener("keydown", this.handleKeydown);
14650
- this.navigationController.destroy();
14423
+ this._activeStory = null;
14651
14424
  (_b = this.cacheManager) === null || _b === void 0 ? void 0 : _b.destroy();
14652
14425
  }
14653
14426
  canBeClosed() {
14654
14427
  return this.activeStory ? !this.activeStory.disableClose : false;
14655
14428
  }
14656
- async showStory(storyId) {
14429
+ async showStory(storyId, options = {}) {
14657
14430
  this._currentStoryDisplayStrategy = this.storyDisplayStrategyFactory.createShowStory();
14658
- await this._currentStoryDisplayStrategy.show({ storyId });
14431
+ await this._currentStoryDisplayStrategy.show(Object.assign({ storyId }, options));
14659
14432
  }
14660
- async showStoryOnce(storyId) {
14433
+ async showStoryOnce(storyId, options = {}) {
14661
14434
  this._currentStoryDisplayStrategy = this.storyDisplayStrategyFactory.createShowStoryOnce();
14662
- await this._currentStoryDisplayStrategy.show({ storyId });
14435
+ await this._currentStoryDisplayStrategy.show(Object.assign({ storyId }, options));
14663
14436
  }
14664
- async showStoryFromSharePage(storyId) {
14437
+ async showStoryFromSharePage(storyId, options = {}) {
14665
14438
  const showStoryFromSharePageDisplayStrategy = this.storyDisplayStrategyFactory.createShowStoryFromSharePage();
14666
14439
  this._currentStoryDisplayStrategy = showStoryFromSharePageDisplayStrategy;
14667
- await showStoryFromSharePageDisplayStrategy.show({
14668
- storyId,
14669
- fetchShareUrl: this.storyManager.isStatisticsDisabled
14670
- });
14440
+ await showStoryFromSharePageDisplayStrategy.show(Object.assign({ storyId, fetchShareUrl: this.storyManager.isStatisticsDisabled }, options));
14671
14441
  }
14672
14442
  async showOnboardingStories(options) {
14673
14443
  const config = await this.storyManager.waitForConfig();
@@ -14698,24 +14468,32 @@ let StoryReaderViewModel = (() => {
14698
14468
  });
14699
14469
  }
14700
14470
  nextStory() {
14701
- return this.navigationController.nextStory();
14471
+ if (this.reachEnd)
14472
+ return;
14473
+ this.setActiveStoryByIndex(this._activeStoryIndex + 1);
14702
14474
  }
14703
14475
  prevStory() {
14704
- return this.navigationController.prevStory();
14476
+ if (this.reachStart)
14477
+ return;
14478
+ this.setActiveStoryByIndex(this._activeStoryIndex - 1);
14705
14479
  }
14706
14480
  nextStoryWithAnimation(action) {
14707
- return this.navigationController.nextStoryWithAnimation(action);
14481
+ if (this.reachEnd)
14482
+ this.handleStoryReaderReachEnd(action);
14483
+ else
14484
+ this.navigateStoryWithAnimation(this._activeStoryIndex + 1, action);
14708
14485
  }
14709
14486
  prevStoryWithAnimation(action) {
14710
- return this.navigationController.prevStoryWithAnimation(action);
14487
+ if (!this.reachStart)
14488
+ this.navigateStoryWithAnimation(this._activeStoryIndex - 1, action);
14711
14489
  }
14712
14490
  toStoryWithAnimationByIndex(index) {
14713
14491
  if (this.activeStoryIndex === index)
14714
14492
  return;
14715
- return this.navigationController.navigateStoryWithAnimation(index, "");
14493
+ return this.navigateStoryWithAnimation(index, "");
14716
14494
  }
14717
14495
  navigateStoryWithAnimationByIndex(index, action) {
14718
- this.navigationController.navigateStoryWithAnimation(index, action);
14496
+ this.navigateStoryWithAnimation(index, action);
14719
14497
  }
14720
14498
  destroy() {
14721
14499
  var _b;
@@ -14732,7 +14510,7 @@ let StoryReaderViewModel = (() => {
14732
14510
  (_b = this.activeStory) === null || _b === void 0 ? void 0 : _b.goodsWidget.close();
14733
14511
  }
14734
14512
  setAnimatedNavigationController(animatedNavigationController) {
14735
- this.navigationController.setAnimatedNavigationController(animatedNavigationController);
14513
+ this.animatedNavigationController = animatedNavigationController;
14736
14514
  }
14737
14515
  mute() {
14738
14516
  this._muted = true;
@@ -14836,16 +14614,82 @@ let StoryReaderViewModel = (() => {
14836
14614
  });
14837
14615
  this.storyReaderStatisticV1Service.sendData();
14838
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
+ }
14839
14676
  },
14840
14677
  _StoryReaderViewModel__muted_accessor_storage = new WeakMap(),
14841
14678
  _StoryReaderViewModel__closeGestureInAction_accessor_storage = new WeakMap(),
14842
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(),
14843
14683
  (() => {
14844
14684
  var _b;
14845
14685
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
14846
14686
  __muted_decorators = [external_mobx_namespaceObject.observable];
14847
14687
  __closeGestureInAction_decorators = [external_mobx_namespaceObject.observable];
14848
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];
14849
14693
  _get_isOpened_decorators = [external_mobx_namespaceObject.computed];
14850
14694
  _get_reachStart_decorators = [external_mobx_namespaceObject.computed];
14851
14695
  _get_reachEnd_decorators = [external_mobx_namespaceObject.computed];
@@ -14867,9 +14711,15 @@ let StoryReaderViewModel = (() => {
14867
14711
  _unmute_decorators = [external_mobx_namespaceObject.action];
14868
14712
  _enableCloseGesture_decorators = [external_mobx_namespaceObject.action];
14869
14713
  _disableCloseGesture_decorators = [external_mobx_namespaceObject.action];
14714
+ _navigateStoryWithAnimation_decorators = [external_mobx_namespaceObject.action];
14715
+ _handleTransitionEnd_decorators = [external_mobx_namespaceObject.action];
14870
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);
14871
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);
14872
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);
14873
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);
14874
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);
14875
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);
@@ -14891,14 +14741,10 @@ let StoryReaderViewModel = (() => {
14891
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);
14892
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);
14893
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);
14894
14746
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
14895
14747
  })(),
14896
- Object.defineProperty(_a, "id", {
14897
- enumerable: true,
14898
- configurable: true,
14899
- writable: true,
14900
- value: "StoryReaderViewModel"
14901
- }),
14902
14748
  _a;
14903
14749
  })();
14904
14750
 
@@ -14930,7 +14776,6 @@ class StoryReaderViewModelFactory {
14930
14776
 
14931
14777
 
14932
14778
 
14933
-
14934
14779
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/index.ts
14935
14780
 
14936
14781
 
@@ -17316,20 +17161,22 @@ let IamReaderViewModel = (() => {
17316
17161
  return messages;
17317
17162
  }
17318
17163
  async showMessageById(messageId, options = {}) {
17319
- const config = await this.storyManager.waitForConfig();
17320
- if (config.anonymous)
17321
- throw new IamMessageAnonymousOpen(messageId);
17322
- this.checkMessageNotOpened();
17164
+ this.throwIfAborted(options.signal);
17165
+ await this.throwIfAnonymousUser(messageId);
17166
+ this.throwIfMessageOpened();
17167
+ this.throwIfAborted(options.signal);
17323
17168
  const message = await this.iamDisplayService.getMessageById(messageId, options);
17169
+ this.throwIfAborted(options.signal);
17324
17170
  await this.open(message);
17325
17171
  return message;
17326
17172
  }
17327
17173
  async showMessageByEvent(eventName, options = {}) {
17328
- const config = await this.storyManager.waitForConfig();
17329
- if (config.anonymous)
17330
- throw new IamMessageAnonymousOpen(eventName);
17331
- this.checkMessageNotOpened();
17174
+ this.throwIfAborted(options.signal);
17175
+ await this.throwIfAnonymousUser(eventName);
17176
+ this.throwIfMessageOpened();
17177
+ this.throwIfAborted(options.signal);
17332
17178
  const message = await this.iamDisplayService.getMessageByEvent(eventName, options);
17179
+ this.throwIfAborted(options.signal);
17333
17180
  await this.open(message);
17334
17181
  return message;
17335
17182
  }
@@ -17399,10 +17246,20 @@ let IamReaderViewModel = (() => {
17399
17246
  slideAnalytics: activeMessage.slidesAnalytics
17400
17247
  });
17401
17248
  }
17402
- checkMessageNotOpened() {
17249
+ throwIfMessageOpened() {
17403
17250
  if (this.activeMessage)
17404
17251
  throw new IamMessageOpenError(this.activeMessage.id);
17405
17252
  }
17253
+ async throwIfAnonymousUser(messageId) {
17254
+ const config = await this.storyManager.waitForConfig();
17255
+ if (config.anonymous)
17256
+ throw new IamMessageAnonymousOpen(messageId);
17257
+ }
17258
+ throwIfAborted(signal) {
17259
+ if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
17260
+ throw new DOMException("Aborted", "AbortError");
17261
+ }
17262
+ }
17406
17263
  },
17407
17264
  _IamReaderViewModel__activeMessage_accessor_storage = new WeakMap(),
17408
17265
  (() => {
@@ -21038,7 +20895,7 @@ class UgcEditorStore {
21038
20895
  const session = await this.storyManager.rootStore.sessionStore.open();
21039
20896
  const ugcEditorConfigDto = await this.ugcEditorApi.fetchUgcEditorConfig();
21040
20897
  const storyManagerConfig = this.storyManager.config;
21041
- const sdkVersion = "1.9.3";
20898
+ const sdkVersion = "1.9.5";
21042
20899
  this._config = {
21043
20900
  sessionId: session.id,
21044
20901
  apiKey: storyManagerConfig.apiKey,
@@ -21509,11 +21366,11 @@ class StoryManager extends TypedEventEmitter {
21509
21366
  return deviceDescriptor.deviceId;
21510
21367
  }
21511
21368
  get sdkVersionName() {
21512
- const sdkVersionName = "1.9.3";
21369
+ const sdkVersionName = "1.9.5";
21513
21370
  return sdkVersionName || "0.0.0";
21514
21371
  }
21515
21372
  get sdkVersionCode() {
21516
- const sdkVersionCode = 10903;
21373
+ const sdkVersionCode = 10905;
21517
21374
  return sdkVersionCode ? parseInt(sdkVersionCode) : 0;
21518
21375
  }
21519
21376
  get lang() {
@@ -21577,7 +21434,7 @@ class StoryManager extends TypedEventEmitter {
21577
21434
  this.rootStore.storyManagerConfigStore.setConfig(configDto);
21578
21435
  }
21579
21436
  setUserAgent(userAgent) {
21580
- const sdkVersionCode = 10903;
21437
+ const sdkVersionCode = 10905;
21581
21438
  const buildVersion = sdkVersionCode ? parseInt(sdkVersionCode) : 0;
21582
21439
  // According to RFC5987, HTTP header values can legitimately be supplied using the ISO-8859-1 encoding.
21583
21440
  this._userAgent = `${userAgent} ${convertStrToLatin1(navigator.userAgent)}`;
@@ -21590,23 +21447,24 @@ class StoryManager extends TypedEventEmitter {
21590
21447
  return this.storyReader.showOnboardingStories({
21591
21448
  feedSlug: (_a = options === null || options === void 0 ? void 0 : options.feed) !== null && _a !== void 0 ? _a : undefined,
21592
21449
  customTags: options === null || options === void 0 ? void 0 : options.customTags,
21593
- limit: (_b = options === null || options === void 0 ? void 0 : options.limit) !== null && _b !== void 0 ? _b : undefined
21450
+ limit: (_b = options === null || options === void 0 ? void 0 : options.limit) !== null && _b !== void 0 ? _b : undefined,
21451
+ signal: options === null || options === void 0 ? void 0 : options.signal
21594
21452
  });
21595
21453
  }
21596
- async showStory(storyId) {
21454
+ async showStory(storyId, options = {}) {
21597
21455
  if (typeof storyId === "string")
21598
21456
  storyId = +storyId || storyId;
21599
- await this.storyReader.showStory(storyId);
21457
+ await this.storyReader.showStory(storyId, options);
21600
21458
  }
21601
- async showStoryOnce(storyId) {
21459
+ async showStoryOnce(storyId, options = {}) {
21602
21460
  if (typeof storyId === "string")
21603
21461
  storyId = +storyId || storyId;
21604
- await this.storyReader.showStoryOnce(storyId);
21462
+ await this.storyReader.showStoryOnce(storyId, options);
21605
21463
  }
21606
- async showSharePage(storyId) {
21464
+ async showSharePage(storyId, options = {}) {
21607
21465
  if (typeof storyId === "string")
21608
21466
  storyId = +storyId || storyId;
21609
- await this.storyReader.showStoryFromSharePage(storyId);
21467
+ await this.storyReader.showStoryFromSharePage(storyId, options);
21610
21468
  }
21611
21469
  closeAllReaders() {
21612
21470
  this.storyReader.close();
@@ -22697,6 +22555,47 @@ var socialSharePanelBody_module_update = injectStylesIntoStyleTag_default()(soci
22697
22555
 
22698
22556
 
22699
22557
  /* harmony default export */ const SocialSharePanelBody_socialSharePanelBody_module = (socialSharePanelBody_module/* default */.A.locals || {});
22558
+ // EXTERNAL MODULE: ../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!../../node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./src/UI/SharePanel/ShareCopyButton/shareCopyButton.module.scss
22559
+ var shareCopyButton_module = __webpack_require__(827);
22560
+ ;// CONCATENATED MODULE: ./src/UI/SharePanel/ShareCopyButton/shareCopyButton.module.scss
22561
+
22562
+
22563
+
22564
+ var shareCopyButton_module_options = {};
22565
+
22566
+ shareCopyButton_module_options.insert = "head";
22567
+ shareCopyButton_module_options.singleton = false;
22568
+
22569
+ var shareCopyButton_module_update = injectStylesIntoStyleTag_default()(shareCopyButton_module/* default */.A, shareCopyButton_module_options);
22570
+
22571
+
22572
+
22573
+ /* harmony default export */ const ShareCopyButton_shareCopyButton_module = (shareCopyButton_module/* default */.A.locals || {});
22574
+ ;// CONCATENATED MODULE: ./src/UI/SharePanel/ShareCopyButton/ShareCopyButton.tsx
22575
+
22576
+
22577
+
22578
+ const ShareCopyButton = (props) => {
22579
+ var _a, _b, _c;
22580
+ return ((0,jsx_runtime_namespaceObject.jsxs)("a", { className: `${SharePanel_sharePanel_module["share-item"]} ${ShareCopyButton_shareCopyButton_module["ias-copy-button"]}`, onClick: props.onClick, children: [(0,jsx_runtime_namespaceObject.jsx)("div", { dangerouslySetInnerHTML: {
22581
+ __html: (_c = (_b = (_a = props.options.copyButton) === null || _a === void 0 ? void 0 : _a.svgSrc) === null || _b === void 0 ? void 0 : _b.baseState) !== null && _c !== void 0 ? _c : ""
22582
+ } }), (0,jsx_runtime_namespaceObject.jsx)("span", { className: SharePanel_sharePanel_module["share-item-title"], style: props.options.text, children: props.label })] }));
22583
+ };
22584
+
22585
+ ;// CONCATENATED MODULE: ./src/UI/SharePanel/ShareCopyButton/index.ts
22586
+
22587
+
22588
+ ;// CONCATENATED MODULE: ./src/UI/SharePanel/Divider/Divider.tsx
22589
+
22590
+
22591
+ const Divider = (props) => {
22592
+ var _a;
22593
+ return ((0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-separator"], style: { background: (_a = props.options.divider) === null || _a === void 0 ? void 0 : _a.background } }));
22594
+ };
22595
+
22596
+ ;// CONCATENATED MODULE: ./src/UI/SharePanel/Divider/index.ts
22597
+
22598
+
22700
22599
  ;// CONCATENATED MODULE: ./src/UI/SharePanel/SocialSharePanelBody/Favicon.tsx
22701
22600
 
22702
22601
 
@@ -22728,10 +22627,13 @@ var SocialSharePanelBody_rest = (undefined && undefined.__rest) || function (s,
22728
22627
 
22729
22628
 
22730
22629
 
22630
+
22631
+
22632
+
22731
22633
  const SocialSharePanelBody = (_a) => {
22732
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
22733
- var { shareLink, sharePanelOptions, onShareComplete } = _a, props = SocialSharePanelBody_rest(_a, ["shareLink", "sharePanelOptions", "onShareComplete"]);
22734
- const getShareUrlDomain = () => {
22634
+ var _b, _c, _d, _e, _f, _g, _h;
22635
+ var { shareLink, shareText, sharePanelOptions, onShareComplete } = _a, props = SocialSharePanelBody_rest(_a, ["shareLink", "shareText", "sharePanelOptions", "onShareComplete"]);
22636
+ const getShareUrlDomain = (shareLink) => {
22735
22637
  try {
22736
22638
  return new URL(shareLink).host;
22737
22639
  }
@@ -22740,12 +22642,12 @@ const SocialSharePanelBody = (_a) => {
22740
22642
  return null;
22741
22643
  }
22742
22644
  };
22743
- const getShareUrl = () => {
22645
+ const getShareUrl = (shareLink) => {
22744
22646
  try {
22745
22647
  return new URL(shareLink);
22746
22648
  }
22747
- catch (e) {
22748
- console.error(e);
22649
+ catch (error) {
22650
+ console.error(error);
22749
22651
  return null;
22750
22652
  }
22751
22653
  };
@@ -22753,52 +22655,71 @@ const SocialSharePanelBody = (_a) => {
22753
22655
  window.removeEventListener("focus", handleShareCompleteByWindowFocus);
22754
22656
  onShareComplete();
22755
22657
  };
22756
- const getEncodedShareText = () => {
22757
- return getShareUrlDomain() ? "" : encodeURIComponent(shareLink);
22658
+ const getShareText = () => {
22659
+ if (shareLink) {
22660
+ return getShareUrlDomain(shareLink) ? "" : encodeURIComponent(shareLink);
22661
+ }
22662
+ else {
22663
+ return shareText !== null && shareText !== void 0 ? shareText : "";
22664
+ }
22758
22665
  };
22759
22666
  const openWindow = (url, target, features) => {
22760
22667
  window.addEventListener("focus", handleShareCompleteByWindowFocus);
22761
22668
  window.open(url, target, features);
22762
22669
  };
22763
- const onCopyClick = () => {
22764
- new Clipboard().copy(shareLink);
22670
+ const onCopyClick = (content) => {
22671
+ new Clipboard().copy(content);
22765
22672
  onShareComplete();
22766
22673
  };
22767
22674
  const getUrlByTarget = (target) => {
22768
- var _a, _b;
22769
- const shareUrl = getShareUrl();
22770
- if (!shareUrl)
22771
- return "#";
22772
- const shareTargetParams = (_a = sharePanelOptions.targetParams) === null || _a === void 0 ? void 0 : _a[target];
22773
- return (_b = shareTargetParams === null || shareTargetParams === void 0 ? void 0 : shareTargetParams.getUrl) === null || _b === void 0 ? void 0 : _b.call(shareTargetParams, {
22675
+ var _a, _b, _c, _d;
22676
+ const shareUrl = shareLink
22677
+ ? (_a = getShareUrl(shareLink)) !== null && _a !== void 0 ? _a : ""
22678
+ : (_b = window.location.origin) !== null && _b !== void 0 ? _b : window.parent.location.origin;
22679
+ const shareTargetParams = (_c = sharePanelOptions.targetParams) === null || _c === void 0 ? void 0 : _c[target];
22680
+ return (_d = shareTargetParams === null || shareTargetParams === void 0 ? void 0 : shareTargetParams.getUrl) === null || _d === void 0 ? void 0 : _d.call(shareTargetParams, {
22774
22681
  url: shareUrl.toString(),
22775
- text: getEncodedShareText()
22682
+ text: getShareText()
22776
22683
  });
22777
22684
  };
22778
22685
  const textStyles = sharePanelOptions.text;
22779
- return ((0,jsx_runtime_namespaceObject.jsxs)("div", { className: SharePanel_sharePanel_module["share-panel__body"], children: [(0,jsx_runtime_namespaceObject.jsxs)("div", { className: `${SharePanel_sharePanel_module["share-panel-row"]} ${SharePanel_sharePanel_module["title-row"]}`, children: [(0,jsx_runtime_namespaceObject.jsx)(Favicon, { shareDomain: getShareUrlDomain(), sharePanelOptions: sharePanelOptions, faviconApiUrl: props.faviconApiUrl }), (0,jsx_runtime_namespaceObject.jsx)("span", { className: SharePanel_sharePanel_module["title"], dir: props.dir, style: textStyles, children: (_c = (_b = sharePanelOptions.title) === null || _b === void 0 ? void 0 : _b.getValue) === null || _c === void 0 ? void 0 : _c.call(_b, { url: shareLink, text: getEncodedShareText() }) })] }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-separator"], style: { background: (_d = sharePanelOptions.divider) === null || _d === void 0 ? void 0 : _d.background } }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: `${SharePanel_sharePanel_module["share-panel-row"]} ${SocialSharePanelBody_socialSharePanelBody_module["social-list"]}`, children: (_e = sharePanelOptions.targets) === null || _e === void 0 ? void 0 : _e.map((target, index) => {
22686
+ const favicon = (_b = sharePanelOptions.title) === null || _b === void 0 ? void 0 : _b.favicon;
22687
+ return ((0,jsx_runtime_namespaceObject.jsxs)("div", { className: SharePanel_sharePanel_module["share-panel__body"], children: [(0,jsx_runtime_namespaceObject.jsxs)("div", { className: `${SharePanel_sharePanel_module["share-panel-row"]} ${SharePanel_sharePanel_module["title-row"]}`, children: [shareLink && getShareUrlDomain(shareLink) && Boolean(favicon === null || favicon === void 0 ? void 0 : favicon.display) && ((0,jsx_runtime_namespaceObject.jsx)(Favicon, { shareDomain: getShareUrlDomain(shareLink), sharePanelOptions: sharePanelOptions, faviconApiUrl: props.faviconApiUrl })), (0,jsx_runtime_namespaceObject.jsxs)("span", { className: SharePanel_sharePanel_module["title"], dir: props.dir, style: textStyles, children: [props.type === ShareType.Link && shareLink
22688
+ ? (_d = (_c = sharePanelOptions.title) === null || _c === void 0 ? void 0 : _c.getValue) === null || _d === void 0 ? void 0 : _d.call(_c, {
22689
+ url: shareLink,
22690
+ text: getShareUrlDomain(shareLink) ? "" : encodeURIComponent(shareLink)
22691
+ })
22692
+ : "", props.type === ShareType.Text && shareText
22693
+ ? (_f = (_e = sharePanelOptions.title) === null || _e === void 0 ? void 0 : _e.getValue) === null || _f === void 0 ? void 0 : _f.call(_e, { url: shareLink, text: shareText })
22694
+ : ""] })] }), (0,jsx_runtime_namespaceObject.jsx)(Divider, { options: sharePanelOptions }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: `${SharePanel_sharePanel_module["share-panel-row"]} ${SocialSharePanelBody_socialSharePanelBody_module["social-list"]}`, children: (_g = sharePanelOptions.targets) === null || _g === void 0 ? void 0 : _g.map((target, index) => {
22780
22695
  var _a, _b, _c;
22781
22696
  const socialTargetParams = (_a = sharePanelOptions.targetParams) === null || _a === void 0 ? void 0 : _a[target];
22782
22697
  const iconSvg = (_c = (_b = socialTargetParams === null || socialTargetParams === void 0 ? void 0 : socialTargetParams.icon) === null || _b === void 0 ? void 0 : _b.svgSrc.baseState) !== null && _c !== void 0 ? _c : "<svg></svg>";
22783
22698
  return ((0,jsx_runtime_namespaceObject.jsx)("div", { className: SocialSharePanelBody_socialSharePanelBody_module["social-list__item"], children: (0,jsx_runtime_namespaceObject.jsxs)("a", { href: getUrlByTarget(target), onClick: () => openWindow(getUrlByTarget(target), "newwindow", "width=650,height=570"), target: "_blank", rel: "noopener noreferrer", className: `${SharePanel_sharePanel_module["share-item"]} ${SocialSharePanelBody_socialSharePanelBody_module["share-item"]}`, children: [(0,jsx_runtime_namespaceObject.jsx)("div", { dangerouslySetInnerHTML: {
22784
22699
  __html: iconSvg
22785
22700
  } }), (0,jsx_runtime_namespaceObject.jsx)("span", { className: SharePanel_sharePanel_module["share-item-title"], style: textStyles, children: socialTargetParams === null || socialTargetParams === void 0 ? void 0 : socialTargetParams.label })] }) }, index));
22786
- }) }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-separator"], style: { background: (_f = sharePanelOptions.divider) === null || _f === void 0 ? void 0 : _f.background } }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-row"], children: (0,jsx_runtime_namespaceObject.jsxs)("a", { className: `${SharePanel_sharePanel_module["share-item"]} ${SocialSharePanelBody_socialSharePanelBody_module["share-item"]}`, onClick: onCopyClick, children: [(0,jsx_runtime_namespaceObject.jsx)("div", { dangerouslySetInnerHTML: {
22787
- __html: (_j = (_h = (_g = sharePanelOptions.copyButton) === null || _g === void 0 ? void 0 : _g.svgSrc) === null || _h === void 0 ? void 0 : _h.baseState) !== null && _j !== void 0 ? _j : ""
22788
- } }), (0,jsx_runtime_namespaceObject.jsx)("span", { className: SharePanel_sharePanel_module["share-item-title"], style: textStyles, children: (_k = sharePanelOptions.copyButton) === null || _k === void 0 ? void 0 : _k.label })] }) })] }));
22701
+ }) }), (0,jsx_runtime_namespaceObject.jsx)(Divider, { options: sharePanelOptions }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-row"], children: (0,jsx_runtime_namespaceObject.jsx)(ShareCopyButton, { options: sharePanelOptions, label: (_h = sharePanelOptions.copyButton) === null || _h === void 0 ? void 0 : _h.getLabel({
22702
+ url: shareLink,
22703
+ text: shareText,
22704
+ type: props.type
22705
+ }), onClick: () => {
22706
+ let content = "";
22707
+ switch (props.type) {
22708
+ case ShareType.Text:
22709
+ content = shareText !== null && shareText !== void 0 ? shareText : "";
22710
+ break;
22711
+ case ShareType.Link:
22712
+ content = shareLink !== null && shareLink !== void 0 ? shareLink : "";
22713
+ break;
22714
+ }
22715
+ onCopyClick(content);
22716
+ } }) })] }));
22789
22717
  };
22790
22718
 
22791
22719
  ;// CONCATENATED MODULE: ./src/UI/SharePanel/SocialSharePanelBody/index.ts
22792
22720
 
22793
22721
 
22794
22722
 
22795
- ;// CONCATENATED MODULE: ./src/UI/SharePanel/types.ts
22796
- var types_ShareType;
22797
- (function (ShareType) {
22798
- ShareType["Social"] = "social";
22799
- ShareType["SlideScreenshot"] = "slide-screenshot";
22800
- })(types_ShareType || (types_ShareType = {}));
22801
-
22802
22723
  ;// CONCATENATED MODULE: ./src/UI/SharePanel/SharePanel.tsx
22803
22724
 
22804
22725
 
@@ -22837,12 +22758,13 @@ const SharePanel = ({ shareType, shareLink, shareText, onShareCompelete, sharePa
22837
22758
  background: sharePanelOptions.background,
22838
22759
  borderTopLeftRadius: sharePanelOptions.borderRadius + "px",
22839
22760
  borderTopRightRadius: sharePanelOptions.borderRadius + "px"
22840
- }, children: [shareType === types_ShareType.SlideScreenshot && ((0,jsx_runtime_namespaceObject.jsx)(ScreenshotSharePanelBody, { shareText: shareText, shareLink: shareLink, onShareComplete: handleShareComplete, sharePanelOptions: sharePanelOptions })), shareType === types_ShareType.Social && ((0,jsx_runtime_namespaceObject.jsx)(SocialSharePanelBody, { shareLink: shareLink, onShareComplete: handleShareComplete, sharePanelOptions: sharePanelOptions, dir: dir })), (0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-separator"] })] })] }));
22761
+ }, children: [shareType === ShareType.Image && ((0,jsx_runtime_namespaceObject.jsx)(ScreenshotSharePanelBody, { shareText: shareText, shareLink: shareLink, onShareComplete: handleShareComplete, sharePanelOptions: sharePanelOptions })), (shareType === ShareType.Link || shareType === ShareType.Text) && ((0,jsx_runtime_namespaceObject.jsx)(SocialSharePanelBody, { shareLink: shareLink, shareText: shareText, onShareComplete: handleShareComplete, sharePanelOptions: sharePanelOptions, type: shareType, dir: dir }))] })] }));
22841
22762
  };
22842
22763
 
22843
22764
  ;// CONCATENATED MODULE: ./src/UI/SharePanel/index.ts
22844
22765
 
22845
22766
 
22767
+
22846
22768
  ;// CONCATENATED MODULE: ./src/GameReader/hooks/useSharePanel.ts
22847
22769
 
22848
22770
  const useSharePanel = (gameReaderViewModel) => {
@@ -22888,6 +22810,7 @@ var gameSplashScreen_module_update = injectStylesIntoStyleTag_default()(gameSpla
22888
22810
  ;// CONCATENATED MODULE: ./src/GameReader/GameSplashScreen/SplashLottie/SplashLottie.tsx
22889
22811
 
22890
22812
 
22813
+
22891
22814
  const SplashLottie = props => {
22892
22815
  const canvasRef = (0,external_react_namespaceObject.useRef)(null);
22893
22816
  const [lottiePlayer, setLottiePlayer] = (0,external_react_namespaceObject.useState)(null);
@@ -22902,6 +22825,17 @@ const SplashLottie = props => {
22902
22825
  if (lottiePlayer && props.forceEnd)
22903
22826
  lottiePlayer.stop();
22904
22827
  }, [lottiePlayer, props.forceEnd]);
22828
+ (0,external_react_namespaceObject.useEffect)(() => {
22829
+ if (!lottiePlayer)
22830
+ return;
22831
+ const handleResize = (0,debounce_js_namespaceObject["default"])(() => {
22832
+ lottiePlayer.resize();
22833
+ }, 300);
22834
+ window.addEventListener("resize", handleResize);
22835
+ return () => {
22836
+ window.addEventListener("resize", handleResize);
22837
+ };
22838
+ }, [lottiePlayer]);
22905
22839
  (0,external_react_namespaceObject.useEffect)(() => {
22906
22840
  if (!lottiePlayer)
22907
22841
  return;
@@ -22981,7 +22915,8 @@ const GameSplashScreen_GameSplashScreen = (props) => {
22981
22915
  return ((0,jsx_runtime_namespaceObject.jsxs)("div", { className: (0,external_classnames_namespaceObject["default"])(GameSplashScreen_gameSplashScreen_module["splash-container"], {
22982
22916
  [GameSplashScreen_gameSplashScreen_module["splash-container--fadeIn"]]: props.game,
22983
22917
  [GameSplashScreen_gameSplashScreen_module["splash-container--fadeOut"]]: props.gameShouldBeShown,
22984
- [GameSplashScreen_gameSplashScreen_module["splash-container--isLoading"]]: needShowSpinner
22918
+ [GameSplashScreen_gameSplashScreen_module["splash-container--isLoading"]]: needShowSpinner,
22919
+ [GameSplashScreen_gameSplashScreen_module["splash-container--widescreen"]]: props.isWidescreen
22985
22920
  }), children: [(0,jsx_runtime_namespaceObject.jsx)("div", { className: GameSplashScreen_gameSplashScreen_module["splash-container__image"], style: { backgroundColor: props.splashImageBackgroundColor }, children: getGameSplashScreen() && ((0,jsx_runtime_namespaceObject.jsx)("img", { src: getGameSplashScreen(), onLoad: () => {
22986
22921
  setGameSplashScreenLoaded(true);
22987
22922
  } })) }), lottieSplashScreen && $dotLottie && ((0,jsx_runtime_namespaceObject.jsx)("div", { className: GameSplashScreen_gameSplashScreen_module["splash-container__lottie"], children: (0,jsx_runtime_namespaceObject.jsx)(SplashLottie, { "$dotLottie": $dotLottie, forceEnd: props.gameShouldBeShown, config: lottieSplashScreen, onError: () => {
@@ -23240,7 +23175,7 @@ const useGameReaderViewModel = ({ storyManager }) => {
23240
23175
 
23241
23176
  const GameReader = (0,external_mobx_react_lite_namespaceObject.observer)(({ gameReader }) => {
23242
23177
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
23243
- const { gameReaderOptions: options, storyReaderOptions } = useIASContainer();
23178
+ const { gameReaderOptions: options } = useIASContainer();
23244
23179
  const gameReaderIframeRef = (0,external_react_namespaceObject.useRef)(null);
23245
23180
  const { sharePanelOpeningParams, handleShareComplete, closeSharePanel } = useSharePanel(gameReader);
23246
23181
  const { gameGeometry, isDesktopGeometry } = useGameGeometry();
@@ -23286,7 +23221,7 @@ const GameReader = (0,external_mobx_react_lite_namespaceObject.observer)(({ game
23286
23221
  filter: ((_g = options.backdrop) === null || _g === void 0 ? void 0 : _g.blur) ? `blur(${options.backdrop.blur}px)` : "none"
23287
23222
  };
23288
23223
  const backdropColor = (_j = (_h = options.game) === null || _h === void 0 ? void 0 : _h.backdropColor) !== null && _j !== void 0 ? _j : "";
23289
- return (0,external_react_dom_namespaceObject.createPortal)((0,jsx_runtime_namespaceObject.jsx)("div", { className: GameReader_gameReader_module["game-reader-container"], style: getRootStyle(), children: (0,jsx_runtime_namespaceObject.jsxs)("div", { className: gameReaderClasses, children: [(0,jsx_runtime_namespaceObject.jsx)("div", { className: GameReader_gameReader_module["game-reader__backdrop"], style: gameBackdropStyle }), (0,jsx_runtime_namespaceObject.jsxs)(AspectRatioBox, { className: GameReader_gameReader_module["game-reader__game-box"], isWidescreen: isWidescreen, geometry: gameGeometry, children: [(0,jsx_runtime_namespaceObject.jsx)(GameSplashScreen_GameSplashScreen, { onSplashCanBeHidden: notifyGameCanBeStarted, isDesktopGeometry: isDesktopGeometry, isGameInited: gameReader.isGameInited, isGameLoading: isGameLoading, isGameLoadingError: Boolean(gameReader.gameError), gameShouldBeShown: gameReader.gameShouldBeShown, game: (_k = gameReader.game) !== null && _k !== void 0 ? _k : undefined, splashImageBackgroundColor: gameReader.game ? backdropColor : gameBackdropStyle.background }), gameError && ((0,jsx_runtime_namespaceObject.jsx)(RefreshIcon, { className: GameReader_gameReader_module["game-reader__refresh-btn"], onClick: retryLoadingGame })), (!gameReader.gameShouldBeShown || closeBtnVisible) && ((0,jsx_runtime_namespaceObject.jsx)(CloseButton, { closeButtonPosition: options.closeButtonPosition, dir: gameReader.dir, onCloseGame: closeGame, closeButtonOptions: options.closeButton })), game && ((0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, { children: [(0,jsx_runtime_namespaceObject.jsx)("iframe", { src: game.url, onLoad: handleIframeLoaded, style: { opacity: gameReader.gameShouldBeShown ? 1 : 0 }, frameBorder: "0", className: GameReader_gameReader_module["game-reader__iframe"], sandbox: "allow-same-origin allow-top-navigation allow-forms allow-scripts allow-downloads allow-top-navigation-to-custom-protocols", allow: "fullscreen" }), sharePanelOpeningParams && ((0,jsx_runtime_namespaceObject.jsx)(SharePanel, { dir: gameReader.dir, shareType: sharePanelOpeningParams.shareType, shareLink: sharePanelOpeningParams.shareLink, onShareCompelete: handleShareComplete, sharePanelOptions: storyReaderOptions.sharePanel }))] }))] }), game && options.forceCheckOrientation && ((0,jsx_runtime_namespaceObject.jsx)(ScreenOrientationLock, { orientation: o9n_SCREEN_ORIENTATIONS.PORTRAIT_PRIMARY, onOrientationChange: handleOrientationChange }))] }) }), document.body);
23224
+ return (0,external_react_dom_namespaceObject.createPortal)((0,jsx_runtime_namespaceObject.jsx)("div", { className: GameReader_gameReader_module["game-reader-container"], style: getRootStyle(), children: (0,jsx_runtime_namespaceObject.jsxs)("div", { className: gameReaderClasses, children: [(0,jsx_runtime_namespaceObject.jsx)("div", { className: GameReader_gameReader_module["game-reader__backdrop"], style: gameBackdropStyle }), (0,jsx_runtime_namespaceObject.jsxs)(AspectRatioBox, { className: GameReader_gameReader_module["game-reader__game-box"], isWidescreen: isWidescreen, geometry: gameGeometry, children: [(0,jsx_runtime_namespaceObject.jsx)(GameSplashScreen_GameSplashScreen, { onSplashCanBeHidden: notifyGameCanBeStarted, isDesktopGeometry: isDesktopGeometry, isWidescreen: isWidescreen, isGameInited: gameReader.isGameInited, isGameLoading: isGameLoading, isGameLoadingError: Boolean(gameReader.gameError), gameShouldBeShown: gameReader.gameShouldBeShown, game: (_k = gameReader.game) !== null && _k !== void 0 ? _k : undefined, splashImageBackgroundColor: gameReader.game ? backdropColor : gameBackdropStyle.background }), gameError && ((0,jsx_runtime_namespaceObject.jsx)(RefreshIcon, { className: GameReader_gameReader_module["game-reader__refresh-btn"], onClick: retryLoadingGame })), (!gameReader.gameShouldBeShown || closeBtnVisible) && ((0,jsx_runtime_namespaceObject.jsx)(CloseButton, { closeButtonPosition: options.closeButtonPosition, dir: gameReader.dir, onCloseGame: closeGame, closeButtonOptions: options.closeButton })), game && ((0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, { children: [(0,jsx_runtime_namespaceObject.jsx)("iframe", { src: game.url, onLoad: handleIframeLoaded, style: { opacity: gameReader.gameShouldBeShown ? 1 : 0 }, frameBorder: "0", className: GameReader_gameReader_module["game-reader__iframe"], sandbox: "allow-same-origin allow-top-navigation allow-forms allow-scripts allow-downloads allow-top-navigation-to-custom-protocols", allow: "fullscreen" }), sharePanelOpeningParams && ((0,jsx_runtime_namespaceObject.jsx)(SharePanel, { dir: gameReader.dir, shareText: sharePanelOpeningParams.shareText, shareType: sharePanelOpeningParams.shareType, shareLink: sharePanelOpeningParams.shareLink, onShareCompelete: handleShareComplete, sharePanelOptions: options.sharePanel }))] }))] }), game && options.forceCheckOrientation && ((0,jsx_runtime_namespaceObject.jsx)(ScreenOrientationLock, { orientation: o9n_SCREEN_ORIENTATIONS.PORTRAIT_PRIMARY, onOrientationChange: handleOrientationChange }))] }) }), document.body);
23290
23225
  });
23291
23226
 
23292
23227
  ;// CONCATENATED MODULE: ./src/GameReader/index.ts
@@ -23526,11 +23461,11 @@ const StoryReaderRoot = (0,external_mobx_react_lite_namespaceObject.observer)((p
23526
23461
  const getSlideBackdropStyle = () => {
23527
23462
  var _a, _b, _c;
23528
23463
  const imageOptions = [];
23529
- 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;
23530
23465
  if (options.slideBackdrop != null && Array.isArray(options.slideBackdrop.linearGradientOverlay))
23531
23466
  imageOptions.push(`linear-gradient(${options.slideBackdrop.linearGradientOverlay.join(", ")})`);
23532
- if (displayedSlideImage != null)
23533
- imageOptions.push(`url(${displayedSlideImage})`);
23467
+ if (cover != null)
23468
+ imageOptions.push(`url(${cover})`);
23534
23469
  return {
23535
23470
  backgroundImage: imageOptions.join(", "),
23536
23471
  opacity: ((_b = options.slideBackdrop) === null || _b === void 0 ? void 0 : _b.opacity) || 0,
@@ -25565,13 +25500,7 @@ class StorySlidesContainer extends HTMLElement {
25565
25500
  writable: true,
25566
25501
  value: null
25567
25502
  });
25568
- Object.defineProperty(this, "story", {
25569
- enumerable: true,
25570
- configurable: true,
25571
- writable: true,
25572
- value: null
25573
- });
25574
- Object.defineProperty(this, "mountPoint", {
25503
+ Object.defineProperty(this, "_mountPoint", {
25575
25504
  enumerable: true,
25576
25505
  configurable: true,
25577
25506
  writable: true,
@@ -25588,22 +25517,22 @@ class StorySlidesContainer extends HTMLElement {
25588
25517
  configurable: true,
25589
25518
  writable: true,
25590
25519
  value: (event) => {
25591
- var _a;
25592
25520
  if (!this.shadowRoot)
25593
25521
  return;
25594
- const isActiveStory = this.getAttribute("is-active-story") === "true";
25595
- if (!isActiveStory)
25596
- return;
25597
- (_a = this.story) === null || _a === void 0 ? void 0 : _a.activeSlide.onClick({
25598
- event,
25599
- currentTarget: this.mountPoint,
25600
- preventNavigation: this.getAttribute("prevent-navigation") === "true"
25601
- });
25522
+ this.dispatchEvent(new CustomEvent("click", {
25523
+ detail: {
25524
+ event,
25525
+ currentTarget: this._mountPoint
25526
+ }
25527
+ }));
25602
25528
  }
25603
25529
  });
25604
25530
  }
25531
+ getMountPoint() {
25532
+ return this._mountPoint;
25533
+ }
25605
25534
  setStyle(cssString) {
25606
- if (!this.mountPoint)
25535
+ if (!this._mountPoint)
25607
25536
  return;
25608
25537
  if (this.styleElement && this.styleElement.parentNode)
25609
25538
  this.styleElement.parentNode.removeChild(this.styleElement);
@@ -25611,30 +25540,20 @@ class StorySlidesContainer extends HTMLElement {
25611
25540
  style.textContent = cssString;
25612
25541
  style.setAttribute("nonce", getNonce());
25613
25542
  this.styleElement = style;
25614
- this.mountPoint.prepend(style);
25615
- }
25616
- attach(story) {
25617
- /** 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. */
25618
- if (!this.mountPoint)
25619
- throw new Error("[IAS]: Mount point was undefined");
25620
- this.story = story;
25621
- this.story.attachRoot(this.mountPoint);
25622
- this.mountPoint.addEventListener("click", this.handleClick);
25623
- }
25624
- detach() {
25625
- var _a, _b;
25626
- /** 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. */
25627
- (_a = this.story) === null || _a === void 0 ? void 0 : _a.detachRoot();
25628
- (_b = this.mountPoint) === null || _b === void 0 ? void 0 : _b.removeEventListener("click", this.handleClick);
25543
+ this._mountPoint.prepend(style);
25629
25544
  }
25630
25545
  connectedCallback() {
25631
25546
  const shadowRoot = this.attachShadow({ mode: "open" });
25632
- this.mountPoint = document.createElement("div");
25633
- this.mountPoint.style.height = "100%";
25634
- this.mountPoint.style.width = "100%";
25635
- 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);
25636
25556
  }
25637
- disconnectedCallback() { }
25638
25557
  }
25639
25558
  customElements.get("story-slides-container") || customElements.define("story-slides-container", StorySlidesContainer);
25640
25559
 
@@ -25655,7 +25574,7 @@ var StorySlidesRenderer_rest = (undefined && undefined.__rest) || function (s, e
25655
25574
 
25656
25575
 
25657
25576
  const StorySlidesRenderer = (0,external_mobx_react_lite_namespaceObject.observer)((0,external_react_namespaceObject.forwardRef)((_a, ref) => {
25658
- 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"]);
25659
25578
  const storySlidesRef = (0,external_react_namespaceObject.useRef)(null);
25660
25579
  (0,external_react_namespaceObject.useImperativeHandle)(ref, () => {
25661
25580
  return {
@@ -25663,23 +25582,85 @@ const StorySlidesRenderer = (0,external_mobx_react_lite_namespaceObject.observer
25663
25582
  var _a;
25664
25583
  (_a = storySlidesRef.current) === null || _a === void 0 ? void 0 : _a.setStyle(style);
25665
25584
  },
25666
- attach: (story) => {
25667
- var _a;
25668
- (_a = storySlidesRef.current) === null || _a === void 0 ? void 0 : _a.attach(story);
25669
- },
25670
- detach: () => {
25671
- var _a;
25672
- (_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;
25673
25588
  }
25674
25589
  };
25675
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]);
25676
25603
  const bottomOffset = !props.isDesktopGeometry ? `${story.actionPanel.height}px` : "0px";
25677
25604
  // Bug with attributes in React 19. Explicit cast to string required
25678
25605
  return ((0,jsx_runtime_namespaceObject.jsx)("story-slides-container", { ref: storySlidesRef, style: {
25679
25606
  bottom: bottomOffset
25680
- }, class: className, dir: story.dir, "prevent-navigation": preventNavigation.toString(), "is-active-story": isActiveStory.toString() }));
25607
+ }, class: className, dir: story.dir }));
25681
25608
  }));
25682
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
+
25683
25664
  ;// CONCATENATED MODULE: ./src/StoryReader/Story/Story.tsx
25684
25665
  var Story_rest = (undefined && undefined.__rest) || function (s, e) {
25685
25666
  var t = {};
@@ -25706,37 +25687,21 @@ var Story_rest = (undefined && undefined.__rest) || function (s, e) {
25706
25687
 
25707
25688
 
25708
25689
 
25690
+
25709
25691
  const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) => {
25710
25692
  var { story, geometry, className } = _a, props = Story_rest(_a, ["story", "geometry", "className"]);
25711
- const { storyReaderOptions, commonOptions, goodsWidgetOptions } = useIASContainer();
25712
25693
  const storyRef = (0,external_react_namespaceObject.useRef)(null);
25713
25694
  const slideRef = (0,external_react_namespaceObject.useRef)(null);
25714
- const isActiveStory = story === props.activeStory;
25715
- const isDesktopGeometry = geometry instanceof DesktopStoryGeometry;
25716
- const useModernLayout = storyReaderOptions.layout === StoryReaderLayout.Modern;
25717
- const shouldHideHeader = isDesktopGeometry && useModernLayout
25718
- ? !isActiveStory || story.pauseState.isUIPaused
25719
- : story.pauseState.isUIPaused;
25720
- const shouldHideActionPanel = isDesktopGeometry && ((useModernLayout && !isActiveStory) || story.textInput.isOpened);
25721
- (0,external_react_namespaceObject.useLayoutEffect)(() => {
25722
- const bottomOffset = parseFloat(String(storyReaderOptions.actionPanelBottomOffset));
25723
- story.actionPanel.setOptions(commonOptions);
25724
- story.actionPanel.setActionPanelHeight(bottomOffset);
25725
- }, [story, commonOptions, storyReaderOptions.actionPanelBottomOffset, isDesktopGeometry]);
25726
- (0,external_react_namespaceObject.useLayoutEffect)(() => {
25727
- if (!slideRef.current)
25728
- return;
25729
- slideRef.current.setStyle(story.context.style);
25730
- }, [story.context.style]);
25731
- (0,external_react_namespaceObject.useLayoutEffect)(() => {
25732
- if (!slideRef.current)
25733
- return;
25734
- const storySlides = slideRef.current;
25735
- storySlides.attach(story);
25736
- return () => {
25737
- storySlides.detach();
25738
- };
25739
- }, [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
+ });
25740
25705
  const handleReloadStory = async () => {
25741
25706
  const storyError = Boolean(story.error);
25742
25707
  try {
@@ -25749,13 +25714,28 @@ const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) =
25749
25714
  console.error(error);
25750
25715
  }
25751
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);
25752
25724
  return ((0,jsx_runtime_namespaceObject.jsxs)("div", { ref: storyRef, className: (0,external_classnames_namespaceObject["default"])(Story_story_module["story"], className, {
25753
25725
  [Story_story_module["story_mobile"]]: !isDesktopGeometry
25754
25726
  }), onMouseDown: () => {
25755
25727
  story.sharePanel.completeNativeSharing({ result: false });
25756
25728
  }, onTouchStart: () => {
25757
25729
  story.sharePanel.completeNativeSharing({ result: false });
25758
- }, "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 })] }));
25759
25739
  });
25760
25740
 
25761
25741
  ;// CONCATENATED MODULE: ./src/StoryReader/Story/index.ts
@@ -26087,6 +26067,15 @@ const ModernStoryList = (0,external_mobx_react_lite_namespaceObject.observer)((p
26087
26067
  const borderRadius = parseFloat(String(storyReaderOptions.borderRadius));
26088
26068
  const maxWidth = parseFloat(props.storyGeometry.getWidth()) * STORIES_PER_VIEWPORT;
26089
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
+ };
26090
26079
  return ((0,jsx_runtime_namespaceObject.jsx)("div", { className: (0,external_classnames_namespaceObject["default"])(ModernStoryList_modernStoryList_module["stories-list-container"]), style: {
26091
26080
  "--slide-border-radius": `${borderRadius}px`,
26092
26081
  maxWidth
@@ -26102,7 +26091,8 @@ const ModernStoryList = (0,external_mobx_react_lite_namespaceObject.observer)((p
26102
26091
  if (uiDisabled)
26103
26092
  return;
26104
26093
  props.storyReader.toStoryWithAnimationByIndex(index);
26105
- }, 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: () => {
26106
26096
  props.storyReader.goNext();
26107
26097
  }, onPrev: () => {
26108
26098
  props.storyReader.goPrev();
@@ -26927,13 +26917,22 @@ const MobileStoryList = (0,external_mobx_react_lite_namespaceObject.observer)((p
26927
26917
  : 0;
26928
26918
  const uiPaused = activeStory.pauseState.isUIPaused || slider.api.animating;
26929
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
+ };
26930
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"], {
26931
26930
  [StoryReader_MobileStoryList_storyList_module["stories-list-container_swipe-up"]]: props.storyReader.closeGestureInAction,
26932
26931
  [StoryReader_MobileStoryList_storyList_module["stories-list-container_desktop"]]: props.isDesktopGeometry
26933
26932
  }), style: Object.assign({ WebkitPerspective: `${slider.perspective}px`, perspective: `${slider.perspective}px`, width: props.storyGeometry.getWidth(), backgroundColor: !props.isDesktopGeometry &&
26934
26933
  props.safeAreaFrameCalculator.shouldBeShownSafeAreaInsets &&
26935
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) => {
26936
- 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));
26937
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() }))] }));
26938
26937
  });
26939
26938
 
@@ -28849,7 +28848,7 @@ const useStoryManagerConfig = (config) => {
28849
28848
  ;// CONCATENATED MODULE: ./src/IASContainer/hooks/useStoryManagerEvents.ts
28850
28849
 
28851
28850
 
28852
- 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 }) => {
28853
28852
  (0,external_react_namespaceObject.useEffect)(() => {
28854
28853
  const handlers = [
28855
28854
  { event: "clickOnStory", handler: onClickOnStory },
@@ -28866,7 +28865,6 @@ const useStoryManagerEvents = ({ onClickOnStory, onClickOnButton, onShowStory, o
28866
28865
  { event: "widgetEvent", handler: onWidgetEvent },
28867
28866
  { event: "startGame", handler: onStartGame },
28868
28867
  { event: "closeGame", handler: onCloseGame },
28869
- { event: "finishGame", handler: onFinishGame },
28870
28868
  { event: "eventGame", handler: onEventGame },
28871
28869
  { event: "clickOnButton", handler: onClickOnButton },
28872
28870
  { event: "closeStoryReader", handler: onCloseStoryReader },
@@ -28891,7 +28889,6 @@ const useStoryManagerEvents = ({ onClickOnStory, onClickOnButton, onShowStory, o
28891
28889
  onShowSlide,
28892
28890
  onStartGame,
28893
28891
  onCloseGame,
28894
- onFinishGame,
28895
28892
  onEventGame,
28896
28893
  onLikeStory,
28897
28894
  onDislikeStory,