@inappstory/react-sdk 1.7.9 → 1.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.mjs +874 -344
- package/dist/index.esm.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/types/storyManager.d.ts +36 -1
- package/package.json +1 -1
package/dist/index.esm.mjs
CHANGED
|
@@ -4565,7 +4565,7 @@ class StoriesApi {
|
|
|
4565
4565
|
const config = {
|
|
4566
4566
|
url: `${feedSlug === UGCFeedSlug ? "ugc/" : ""}story/${id}`,
|
|
4567
4567
|
method: "GET",
|
|
4568
|
-
params: { expand: expandFields.join(",") }
|
|
4568
|
+
params: { expand: expandFields.join(",") /* , src_list: "true" */ }
|
|
4569
4569
|
};
|
|
4570
4570
|
config.params.once = Number(Boolean(once));
|
|
4571
4571
|
if (!allFields) {
|
|
@@ -5114,6 +5114,7 @@ let StorySlide = (() => {
|
|
|
5114
5114
|
return this._html;
|
|
5115
5115
|
}
|
|
5116
5116
|
constructor(storySlideDto) {
|
|
5117
|
+
var _b, _c;
|
|
5117
5118
|
_StorySlide__html_accessor_storage.set(this, (storySlide_runInitializers(this, _instanceExtraInitializers), storySlide_runInitializers(this, __html_initializers, "")));
|
|
5118
5119
|
Object.defineProperty(this, "index", {
|
|
5119
5120
|
enumerable: true,
|
|
@@ -5145,6 +5146,18 @@ let StorySlide = (() => {
|
|
|
5145
5146
|
writable: true,
|
|
5146
5147
|
value: void 0
|
|
5147
5148
|
});
|
|
5149
|
+
Object.defineProperty(this, "resources", {
|
|
5150
|
+
enumerable: true,
|
|
5151
|
+
configurable: true,
|
|
5152
|
+
writable: true,
|
|
5153
|
+
value: []
|
|
5154
|
+
});
|
|
5155
|
+
Object.defineProperty(this, "_resourcesByBlob", {
|
|
5156
|
+
enumerable: true,
|
|
5157
|
+
configurable: true,
|
|
5158
|
+
writable: true,
|
|
5159
|
+
value: {}
|
|
5160
|
+
});
|
|
5148
5161
|
this.index = storySlideDto.index;
|
|
5149
5162
|
this.timeline = {
|
|
5150
5163
|
foreground: storySlideDto.timeline.foreground,
|
|
@@ -5153,6 +5166,17 @@ let StorySlide = (() => {
|
|
|
5153
5166
|
this.duration = storySlideDto.duration;
|
|
5154
5167
|
this.screenshotShare = storySlideDto.screenshot_share;
|
|
5155
5168
|
this.eventPayload = storySlideDto.event_payload;
|
|
5169
|
+
// TODO: don't map in the slide model.
|
|
5170
|
+
// The model should not know anything about the DTO
|
|
5171
|
+
this.resources =
|
|
5172
|
+
(_c = (_b = storySlideDto.resources) === null || _b === void 0 ? void 0 : _b.map(resource => ({
|
|
5173
|
+
type: resource.type,
|
|
5174
|
+
key: resource.key,
|
|
5175
|
+
url: resource.url,
|
|
5176
|
+
rangeStart: resource.range_start,
|
|
5177
|
+
rangeEnd: resource.range_end,
|
|
5178
|
+
contentType: resource.content_type
|
|
5179
|
+
}))) !== null && _c !== void 0 ? _c : [];
|
|
5156
5180
|
this._html = this.replaceSlideNonce(storySlideDto.html);
|
|
5157
5181
|
}
|
|
5158
5182
|
static createEmpty() {
|
|
@@ -5167,16 +5191,39 @@ let StorySlide = (() => {
|
|
|
5167
5191
|
html: ""
|
|
5168
5192
|
});
|
|
5169
5193
|
}
|
|
5170
|
-
replaceSlideNonce(slideHtml) {
|
|
5171
|
-
var _b;
|
|
5172
|
-
return replaceAll(slideHtml, `{{nonce}}`, (_b = getNonce()) !== null && _b !== void 0 ? _b : "");
|
|
5173
|
-
}
|
|
5174
5194
|
updatePlaceholders(placeholders) {
|
|
5175
5195
|
let slideHtml = this._html;
|
|
5176
5196
|
for (const placeholder of placeholders)
|
|
5177
5197
|
slideHtml = replaceAll(slideHtml, `%${placeholder.key}%`, placeholder.value);
|
|
5178
5198
|
this._html = slideHtml;
|
|
5179
5199
|
}
|
|
5200
|
+
applyBlobUrls(resourceUrls, resourcesByBlob) {
|
|
5201
|
+
var _b;
|
|
5202
|
+
let updatedHtml = this._html;
|
|
5203
|
+
for (const resourceUrl of resourceUrls) {
|
|
5204
|
+
const blobUrl = (_b = resourcesByBlob[resourceUrl]) === null || _b === void 0 ? void 0 : _b.blobUrl;
|
|
5205
|
+
if (!blobUrl)
|
|
5206
|
+
continue;
|
|
5207
|
+
updatedHtml = replaceAll(updatedHtml, resourceUrl, blobUrl);
|
|
5208
|
+
this._resourcesByBlob[resourceUrl] = blobUrl;
|
|
5209
|
+
}
|
|
5210
|
+
this._html = updatedHtml;
|
|
5211
|
+
}
|
|
5212
|
+
restoreOriginalResourceUrls() {
|
|
5213
|
+
let restoredHtml = this._html;
|
|
5214
|
+
for (const [resourceUrl, blobUrl] of Object.entries(this._resourcesByBlob)) {
|
|
5215
|
+
restoredHtml = replaceAll(restoredHtml, blobUrl, resourceUrl);
|
|
5216
|
+
}
|
|
5217
|
+
this._html = restoredHtml;
|
|
5218
|
+
}
|
|
5219
|
+
parseResources() {
|
|
5220
|
+
const resources = Array.from(this._html.matchAll(/src="([^"]+)"/gi), t => t[1]).filter(src => !src.startsWith("blob:"));
|
|
5221
|
+
return Array.from(new Set(resources));
|
|
5222
|
+
}
|
|
5223
|
+
replaceSlideNonce(slideHtml) {
|
|
5224
|
+
var _b;
|
|
5225
|
+
return replaceAll(slideHtml, `{{nonce}}`, (_b = getNonce()) !== null && _b !== void 0 ? _b : "");
|
|
5226
|
+
}
|
|
5180
5227
|
},
|
|
5181
5228
|
_StorySlide__html_accessor_storage = new WeakMap(),
|
|
5182
5229
|
(() => {
|
|
@@ -7777,7 +7824,7 @@ var external_async_mutex_x = (y) => {
|
|
|
7777
7824
|
var x = {}; __webpack_require__.d(x, y); return x
|
|
7778
7825
|
}
|
|
7779
7826
|
var external_async_mutex_y = (x) => (() => (x))
|
|
7780
|
-
const external_async_mutex_namespaceObject = external_async_mutex_x({ ["Mutex"]: () => (__WEBPACK_EXTERNAL_MODULE_async_mutex_052338b1__.Mutex) });
|
|
7827
|
+
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) });
|
|
7781
7828
|
;// CONCATENATED MODULE: ../core/src/readers/storyReader/storySlideViewModel/storySlideViewModel.ts
|
|
7782
7829
|
var storySlideViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
|
|
7783
7830
|
var useValue = arguments.length > 2;
|
|
@@ -7842,7 +7889,7 @@ let StorySlideViewModel = (() => {
|
|
|
7842
7889
|
return _a = class StorySlideViewModel {
|
|
7843
7890
|
get _disabledNextClick() { return storySlideViewModel_classPrivateFieldGet(this, _StorySlideViewModel__disabledNextClick_accessor_storage, "f"); }
|
|
7844
7891
|
set _disabledNextClick(value) { storySlideViewModel_classPrivateFieldSet(this, _StorySlideViewModel__disabledNextClick_accessor_storage, value, "f"); }
|
|
7845
|
-
constructor(_story, _index, slideApi, slide) {
|
|
7892
|
+
constructor(_story, _index, slideApi, slide, cacheManager) {
|
|
7846
7893
|
Object.defineProperty(this, "_story", {
|
|
7847
7894
|
enumerable: true,
|
|
7848
7895
|
configurable: true,
|
|
@@ -7867,6 +7914,12 @@ let StorySlideViewModel = (() => {
|
|
|
7867
7914
|
writable: true,
|
|
7868
7915
|
value: slide
|
|
7869
7916
|
});
|
|
7917
|
+
Object.defineProperty(this, "cacheManager", {
|
|
7918
|
+
enumerable: true,
|
|
7919
|
+
configurable: true,
|
|
7920
|
+
writable: true,
|
|
7921
|
+
value: cacheManager
|
|
7922
|
+
});
|
|
7870
7923
|
_StorySlideViewModel__disabledNextClick_accessor_storage.set(this, storySlideViewModel_runInitializers(this, __disabledNextClick_initializers, false));
|
|
7871
7924
|
Object.defineProperty(this, "mutex", {
|
|
7872
7925
|
enumerable: true,
|
|
@@ -7886,6 +7939,18 @@ let StorySlideViewModel = (() => {
|
|
|
7886
7939
|
writable: true,
|
|
7887
7940
|
value: false
|
|
7888
7941
|
});
|
|
7942
|
+
Object.defineProperty(this, "preloaded", {
|
|
7943
|
+
enumerable: true,
|
|
7944
|
+
configurable: true,
|
|
7945
|
+
writable: true,
|
|
7946
|
+
value: false
|
|
7947
|
+
});
|
|
7948
|
+
Object.defineProperty(this, "isPreloading", {
|
|
7949
|
+
enumerable: true,
|
|
7950
|
+
configurable: true,
|
|
7951
|
+
writable: true,
|
|
7952
|
+
value: false
|
|
7953
|
+
});
|
|
7889
7954
|
Object.defineProperty(this, "handleTouchEnd", {
|
|
7890
7955
|
enumerable: true,
|
|
7891
7956
|
configurable: true,
|
|
@@ -8097,6 +8162,23 @@ let StorySlideViewModel = (() => {
|
|
|
8097
8162
|
const { canClickNext } = this.slideApi.slideClickHandler(null, "backward");
|
|
8098
8163
|
return canClickNext;
|
|
8099
8164
|
}
|
|
8165
|
+
async preload(priority) {
|
|
8166
|
+
if (!this.cacheManager || this.preloaded || this.isPreloading)
|
|
8167
|
+
return;
|
|
8168
|
+
this.isPreloading = true;
|
|
8169
|
+
const resourceUrls = this.slide.parseResources();
|
|
8170
|
+
const cacheEntries = await this.cacheManager.preload(resourceUrls.map(resourceUrl => ({
|
|
8171
|
+
url: resourceUrl,
|
|
8172
|
+
priority
|
|
8173
|
+
})));
|
|
8174
|
+
const resourcesByUrl = {};
|
|
8175
|
+
for (const cacheEntry of cacheEntries)
|
|
8176
|
+
resourcesByUrl[cacheEntry.url] = cacheEntry;
|
|
8177
|
+
if (!this.cacheManager.isDestroyed)
|
|
8178
|
+
this.slide.applyBlobUrls(resourceUrls, resourcesByUrl);
|
|
8179
|
+
this.preloaded = true;
|
|
8180
|
+
this.isPreloading = false;
|
|
8181
|
+
}
|
|
8100
8182
|
onClick({ event, currentTarget, preventNavigation = false }) {
|
|
8101
8183
|
if (!event.target)
|
|
8102
8184
|
return;
|
|
@@ -8117,6 +8199,8 @@ let StorySlideViewModel = (() => {
|
|
|
8117
8199
|
this.isStarted = false;
|
|
8118
8200
|
this.isInited = false;
|
|
8119
8201
|
this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
|
|
8202
|
+
if (this.cacheManager)
|
|
8203
|
+
this.slide.restoreOriginalResourceUrls();
|
|
8120
8204
|
await this.slideApi.destroy();
|
|
8121
8205
|
}
|
|
8122
8206
|
catch (error) {
|
|
@@ -9475,8 +9559,9 @@ var StoryEvent;
|
|
|
9475
9559
|
(function (StoryEvent) {
|
|
9476
9560
|
StoryEvent["ShowToast"] = "showToast";
|
|
9477
9561
|
})(StoryEvent || (StoryEvent = {}));
|
|
9562
|
+
const ACTIVE_SLIDE_PRELOAD_PRIORITY = 1000;
|
|
9478
9563
|
let StoryViewModel = (() => {
|
|
9479
|
-
var _a, _StoryViewModel__activeSlideIndex_accessor_storage, _StoryViewModel__slides_accessor_storage, _StoryViewModel__needShowErrorScreen_accessor_storage, _StoryViewModel__needShowLoaderScreen_accessor_storage, _StoryViewModel__$root_accessor_storage;
|
|
9564
|
+
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;
|
|
9480
9565
|
var _b;
|
|
9481
9566
|
let _classSuper = ViewModel;
|
|
9482
9567
|
let _instanceExtraInitializers = [];
|
|
@@ -9495,6 +9580,9 @@ let StoryViewModel = (() => {
|
|
|
9495
9580
|
let __$root_decorators;
|
|
9496
9581
|
let __$root_initializers = [];
|
|
9497
9582
|
let __$root_extraInitializers = [];
|
|
9583
|
+
let _isInited_decorators;
|
|
9584
|
+
let _isInited_initializers = [];
|
|
9585
|
+
let _isInited_extraInitializers = [];
|
|
9498
9586
|
let _get_needShowErrorScreen_decorators;
|
|
9499
9587
|
let _get_needShowLoaderScreen_decorators;
|
|
9500
9588
|
let _get_activeSlide_decorators;
|
|
@@ -9522,7 +9610,9 @@ let StoryViewModel = (() => {
|
|
|
9522
9610
|
set _needShowLoaderScreen(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__needShowLoaderScreen_accessor_storage, value, "f"); }
|
|
9523
9611
|
get _$root() { return storyViewModel_classPrivateFieldGet(this, _StoryViewModel__$root_accessor_storage, "f"); }
|
|
9524
9612
|
set _$root(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__$root_accessor_storage, value, "f"); }
|
|
9525
|
-
|
|
9613
|
+
get isInited() { return storyViewModel_classPrivateFieldGet(this, _StoryViewModel_isInited_accessor_storage, "f"); }
|
|
9614
|
+
set isInited(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel_isInited_accessor_storage, value, "f"); }
|
|
9615
|
+
constructor(storyManager, storyReader, story, storySlideApiHandlersFactory, storyReaderStatisticV1Service, storyReaderStatisticV2Service, cacheManager) {
|
|
9526
9616
|
super();
|
|
9527
9617
|
Object.defineProperty(this, "storyManager", {
|
|
9528
9618
|
enumerable: true,
|
|
@@ -9560,22 +9650,23 @@ let StoryViewModel = (() => {
|
|
|
9560
9650
|
writable: true,
|
|
9561
9651
|
value: storyReaderStatisticV2Service
|
|
9562
9652
|
});
|
|
9653
|
+
Object.defineProperty(this, "cacheManager", {
|
|
9654
|
+
enumerable: true,
|
|
9655
|
+
configurable: true,
|
|
9656
|
+
writable: true,
|
|
9657
|
+
value: cacheManager
|
|
9658
|
+
});
|
|
9563
9659
|
_StoryViewModel__activeSlideIndex_accessor_storage.set(this, storyViewModel_runInitializers(this, __activeSlideIndex_initializers, 0));
|
|
9564
9660
|
_StoryViewModel__slides_accessor_storage.set(this, (storyViewModel_runInitializers(this, __activeSlideIndex_extraInitializers), storyViewModel_runInitializers(this, __slides_initializers, [])));
|
|
9565
9661
|
_StoryViewModel__needShowErrorScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __slides_extraInitializers), storyViewModel_runInitializers(this, __needShowErrorScreen_initializers, false)));
|
|
9566
9662
|
_StoryViewModel__needShowLoaderScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowErrorScreen_extraInitializers), storyViewModel_runInitializers(this, __needShowLoaderScreen_initializers, false)));
|
|
9567
9663
|
_StoryViewModel__$root_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowLoaderScreen_extraInitializers), storyViewModel_runInitializers(this, __$root_initializers, null)));
|
|
9568
|
-
|
|
9569
|
-
enumerable: true,
|
|
9570
|
-
configurable: true,
|
|
9571
|
-
writable: true,
|
|
9572
|
-
value: (storyViewModel_runInitializers(this, __$root_extraInitializers), false)
|
|
9573
|
-
});
|
|
9664
|
+
_StoryViewModel_isInited_accessor_storage.set(this, (storyViewModel_runInitializers(this, __$root_extraInitializers), storyViewModel_runInitializers(this, _isInited_initializers, false)));
|
|
9574
9665
|
Object.defineProperty(this, "isStarted", {
|
|
9575
9666
|
enumerable: true,
|
|
9576
9667
|
configurable: true,
|
|
9577
9668
|
writable: true,
|
|
9578
|
-
value: false
|
|
9669
|
+
value: (storyViewModel_runInitializers(this, _isInited_extraInitializers), false)
|
|
9579
9670
|
});
|
|
9580
9671
|
Object.defineProperty(this, "_activeSlideStartTime", {
|
|
9581
9672
|
enumerable: true,
|
|
@@ -9651,12 +9742,6 @@ let StoryViewModel = (() => {
|
|
|
9651
9742
|
writable: true,
|
|
9652
9743
|
value: void 0
|
|
9653
9744
|
});
|
|
9654
|
-
Object.defineProperty(this, "initOnce", {
|
|
9655
|
-
enumerable: true,
|
|
9656
|
-
configurable: true,
|
|
9657
|
-
writable: true,
|
|
9658
|
-
value: false
|
|
9659
|
-
});
|
|
9660
9745
|
Object.defineProperty(this, "toast", {
|
|
9661
9746
|
enumerable: true,
|
|
9662
9747
|
configurable: true,
|
|
@@ -9733,7 +9818,7 @@ let StoryViewModel = (() => {
|
|
|
9733
9818
|
return this.storyReader.displayStrategy;
|
|
9734
9819
|
}
|
|
9735
9820
|
get canBeShown() {
|
|
9736
|
-
return this.story.canBeShown && this.slides.length > 0;
|
|
9821
|
+
return this.story.canBeShown && this.slides.length > 0 && Boolean(this._$root);
|
|
9737
9822
|
}
|
|
9738
9823
|
get context() {
|
|
9739
9824
|
return this.story.context;
|
|
@@ -9790,6 +9875,9 @@ let StoryViewModel = (() => {
|
|
|
9790
9875
|
get dir() {
|
|
9791
9876
|
return this.storyReader.dir;
|
|
9792
9877
|
}
|
|
9878
|
+
get isSlideRendered() {
|
|
9879
|
+
return this.isInited;
|
|
9880
|
+
}
|
|
9793
9881
|
get isNextDisabled() {
|
|
9794
9882
|
return ((this.storyReader.reachEnd && this.reachEnd) ||
|
|
9795
9883
|
this.activeSlide.disabledNextClick ||
|
|
@@ -9921,15 +10009,24 @@ let StoryViewModel = (() => {
|
|
|
9921
10009
|
this.isInited = isInited;
|
|
9922
10010
|
this.isStarted = isStarted;
|
|
9923
10011
|
}
|
|
10012
|
+
async preloadSlides(start, end, priority) {
|
|
10013
|
+
if (!this.story.canBeShown)
|
|
10014
|
+
this.showLoaderScreen();
|
|
10015
|
+
await (0,external_mobx_namespaceObject.when)(() => this.story.canBeShown);
|
|
10016
|
+
end = end !== null && end !== void 0 ? end : this._slides.length;
|
|
10017
|
+
priority = priority !== null && priority !== void 0 ? priority : 0;
|
|
10018
|
+
await Promise.all(this._slides.slice(start, end).map((slide, index) => slide.preload(end - index + priority)));
|
|
10019
|
+
}
|
|
10020
|
+
async preloadActiveSlide(priority) {
|
|
10021
|
+
this.preloadSlides(this._activeSlideIndex, this._activeSlideIndex + 1, priority);
|
|
10022
|
+
}
|
|
9924
10023
|
async init() {
|
|
9925
10024
|
await this.mutex.runExclusive(async () => {
|
|
9926
10025
|
if (this.isInited)
|
|
9927
10026
|
return;
|
|
9928
|
-
if (!this.
|
|
10027
|
+
if (!this.story.canBeShown)
|
|
9929
10028
|
this.showLoaderScreen();
|
|
9930
|
-
|
|
9931
|
-
}
|
|
9932
|
-
await (0,external_mobx_namespaceObject.when)(() => this.canBeShown && Boolean(this._$root));
|
|
10029
|
+
await (0,external_mobx_namespaceObject.when)(() => this.canBeShown);
|
|
9933
10030
|
await this.activeSlide.init();
|
|
9934
10031
|
this.isInited = true;
|
|
9935
10032
|
});
|
|
@@ -10043,7 +10140,7 @@ let StoryViewModel = (() => {
|
|
|
10043
10140
|
return slideApi;
|
|
10044
10141
|
}
|
|
10045
10142
|
async createSlidesViewModels(slides, slideApi) {
|
|
10046
|
-
this._slides = slides.map((slide, index) => new StorySlideViewModel(this, index, slideApi, slide));
|
|
10143
|
+
this._slides = slides.map((slide, index) => new StorySlideViewModel(this, index, slideApi, slide, this.cacheManager));
|
|
10047
10144
|
}
|
|
10048
10145
|
handleSpaceKeydown(e) {
|
|
10049
10146
|
if (e.code !== "Space")
|
|
@@ -10062,6 +10159,7 @@ let StoryViewModel = (() => {
|
|
|
10062
10159
|
this.mute();
|
|
10063
10160
|
}
|
|
10064
10161
|
async onSlideChange(index) {
|
|
10162
|
+
var _b;
|
|
10065
10163
|
try {
|
|
10066
10164
|
if (!this.isInited || !this.isStarted)
|
|
10067
10165
|
return;
|
|
@@ -10070,6 +10168,8 @@ let StoryViewModel = (() => {
|
|
|
10070
10168
|
this._activeSlideIndex = index;
|
|
10071
10169
|
this.hideErrorScreen();
|
|
10072
10170
|
this.resumeAll();
|
|
10171
|
+
if (!((_b = this.storyManager.config.cache) === null || _b === void 0 ? void 0 : _b.prefetch))
|
|
10172
|
+
await this.preloadActiveSlide(ACTIVE_SLIDE_PRELOAD_PRIORITY);
|
|
10073
10173
|
await activeSlide.init();
|
|
10074
10174
|
await (lastSlide === null || lastSlide === void 0 ? void 0 : lastSlide.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ }));
|
|
10075
10175
|
await activeSlide.start();
|
|
@@ -10097,6 +10197,7 @@ let StoryViewModel = (() => {
|
|
|
10097
10197
|
_StoryViewModel__needShowErrorScreen_accessor_storage = new WeakMap(),
|
|
10098
10198
|
_StoryViewModel__needShowLoaderScreen_accessor_storage = new WeakMap(),
|
|
10099
10199
|
_StoryViewModel__$root_accessor_storage = new WeakMap(),
|
|
10200
|
+
_StoryViewModel_isInited_accessor_storage = new WeakMap(),
|
|
10100
10201
|
(() => {
|
|
10101
10202
|
var _b;
|
|
10102
10203
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
|
|
@@ -10105,6 +10206,7 @@ let StoryViewModel = (() => {
|
|
|
10105
10206
|
__needShowErrorScreen_decorators = [external_mobx_namespaceObject.observable];
|
|
10106
10207
|
__needShowLoaderScreen_decorators = [external_mobx_namespaceObject.observable];
|
|
10107
10208
|
__$root_decorators = [external_mobx_namespaceObject.observable];
|
|
10209
|
+
_isInited_decorators = [external_mobx_namespaceObject.observable];
|
|
10108
10210
|
_get_needShowErrorScreen_decorators = [external_mobx_namespaceObject.computed];
|
|
10109
10211
|
_get_needShowLoaderScreen_decorators = [external_mobx_namespaceObject.computed];
|
|
10110
10212
|
_get_activeSlide_decorators = [external_mobx_namespaceObject.computed];
|
|
@@ -10126,6 +10228,7 @@ let StoryViewModel = (() => {
|
|
|
10126
10228
|
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);
|
|
10127
10229
|
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);
|
|
10128
10230
|
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);
|
|
10231
|
+
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);
|
|
10129
10232
|
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);
|
|
10130
10233
|
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);
|
|
10131
10234
|
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);
|
|
@@ -10589,7 +10692,7 @@ class GameClientConfig {
|
|
|
10589
10692
|
value: void 0
|
|
10590
10693
|
});
|
|
10591
10694
|
const storyManagerConfig = this.storyManager.config;
|
|
10592
|
-
const sdkVersion = "1.7.
|
|
10695
|
+
const sdkVersion = "1.7.10";
|
|
10593
10696
|
const placeholders = this.storyManager.rootStore.placeholderStore.placeholders;
|
|
10594
10697
|
const session = this.storyManager.rootStore.sessionStore.session;
|
|
10595
10698
|
this.sessionId = session.id;
|
|
@@ -12805,6 +12908,8 @@ var storyReaderNavigationController_classPrivateFieldSet = (undefined && undefin
|
|
|
12805
12908
|
|
|
12806
12909
|
|
|
12807
12910
|
const STORY_INIT_RANGE = 1;
|
|
12911
|
+
const ACTIVE_STORY_PRELOAD_PRIORITY = 1000;
|
|
12912
|
+
const NON_ACTIVE_STORY_PRELOAD_PRIORITY = 0;
|
|
12808
12913
|
let StoryReaderNavigationController = (() => {
|
|
12809
12914
|
var _a, _StoryReaderNavigationController__activeStory_accessor_storage, _StoryReaderNavigationController__currentIndex_accessor_storage, _StoryReaderNavigationController__targetTransitionIndex_accessor_storage;
|
|
12810
12915
|
let _instanceExtraInitializers = [];
|
|
@@ -12942,7 +13047,6 @@ let StoryReaderNavigationController = (() => {
|
|
|
12942
13047
|
this.currentStoryDisplayStrategy.handleNextStoryByIndex(index);
|
|
12943
13048
|
this.initStoriesWithinRange(index);
|
|
12944
13049
|
await this.animatedNavigationController.transitionByIndex(index, this.currentIndex);
|
|
12945
|
-
//await Promise.all([p1, p2]);
|
|
12946
13050
|
await this.handleTransitionEnd(index, action);
|
|
12947
13051
|
}
|
|
12948
13052
|
handleStoryReaderReachEnd(action) {
|
|
@@ -12986,6 +13090,7 @@ let StoryReaderNavigationController = (() => {
|
|
|
12986
13090
|
async runNextStory(prevStory, story) {
|
|
12987
13091
|
try {
|
|
12988
13092
|
await (prevStory === null || prevStory === void 0 ? void 0 : prevStory.stop());
|
|
13093
|
+
await this.preloadActiveStory(story);
|
|
12989
13094
|
await story.init();
|
|
12990
13095
|
await story.start();
|
|
12991
13096
|
}
|
|
@@ -12994,11 +13099,16 @@ let StoryReaderNavigationController = (() => {
|
|
|
12994
13099
|
}
|
|
12995
13100
|
}
|
|
12996
13101
|
async initStoriesWithinRange(currentIndex) {
|
|
12997
|
-
|
|
13102
|
+
const stories = this.storyReader.stories;
|
|
12998
13103
|
const start = Math.max(currentIndex - STORY_INIT_RANGE, 0);
|
|
12999
13104
|
const end = Math.min(currentIndex + STORY_INIT_RANGE, stories.length - 1);
|
|
13000
|
-
|
|
13001
|
-
|
|
13105
|
+
const storiesToInit = [];
|
|
13106
|
+
for (let i = start; i <= end; i++) {
|
|
13107
|
+
if (i !== currentIndex)
|
|
13108
|
+
storiesToInit.push(stories[i]);
|
|
13109
|
+
}
|
|
13110
|
+
await this.preloadSiblingStories(storiesToInit);
|
|
13111
|
+
return Promise.allSettled(storiesToInit.map(story => story.init()));
|
|
13002
13112
|
}
|
|
13003
13113
|
handleActiveStoryError(story) {
|
|
13004
13114
|
if (!(story === null || story === void 0 ? void 0 : story.error))
|
|
@@ -13014,6 +13124,28 @@ let StoryReaderNavigationController = (() => {
|
|
|
13014
13124
|
limitIndex(index) {
|
|
13015
13125
|
return Math.max(0, Math.min(this.storyReader.stories.length - 1, index));
|
|
13016
13126
|
}
|
|
13127
|
+
async preloadActiveStory(story) {
|
|
13128
|
+
const cacheConfig = this.storyManager.config.cache;
|
|
13129
|
+
if (!cacheConfig)
|
|
13130
|
+
return;
|
|
13131
|
+
if (cacheConfig.prefetch) {
|
|
13132
|
+
await story.preloadSlides(0, story.slidesCount, ACTIVE_STORY_PRELOAD_PRIORITY);
|
|
13133
|
+
}
|
|
13134
|
+
else {
|
|
13135
|
+
await story.preloadActiveSlide(ACTIVE_STORY_PRELOAD_PRIORITY);
|
|
13136
|
+
}
|
|
13137
|
+
}
|
|
13138
|
+
async preloadSiblingStories(stories) {
|
|
13139
|
+
const cacheConfig = this.storyManager.config.cache;
|
|
13140
|
+
if (!cacheConfig)
|
|
13141
|
+
return;
|
|
13142
|
+
if (cacheConfig.prefetch) {
|
|
13143
|
+
await Promise.all(stories.map(story => story.preloadSlides(0, 2, NON_ACTIVE_STORY_PRELOAD_PRIORITY)));
|
|
13144
|
+
}
|
|
13145
|
+
else {
|
|
13146
|
+
await Promise.all(stories.map(story => story.preloadActiveSlide(NON_ACTIVE_STORY_PRELOAD_PRIORITY)));
|
|
13147
|
+
}
|
|
13148
|
+
}
|
|
13017
13149
|
},
|
|
13018
13150
|
_StoryReaderNavigationController__activeStory_accessor_storage = new WeakMap(),
|
|
13019
13151
|
_StoryReaderNavigationController__currentIndex_accessor_storage = new WeakMap(),
|
|
@@ -13051,129 +13183,81 @@ let StoryReaderNavigationController = (() => {
|
|
|
13051
13183
|
|
|
13052
13184
|
|
|
13053
13185
|
;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showOnboardingStoriesStrategy.ts
|
|
13054
|
-
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13186
|
+
|
|
13187
|
+
class ShowOnboardingStoriesStrategy {
|
|
13188
|
+
constructor(showMultipleStoriesStrategy, storyManager) {
|
|
13189
|
+
Object.defineProperty(this, "showMultipleStoriesStrategy", {
|
|
13190
|
+
enumerable: true,
|
|
13191
|
+
configurable: true,
|
|
13192
|
+
writable: true,
|
|
13193
|
+
value: showMultipleStoriesStrategy
|
|
13194
|
+
});
|
|
13195
|
+
Object.defineProperty(this, "storyManager", {
|
|
13196
|
+
enumerable: true,
|
|
13197
|
+
configurable: true,
|
|
13198
|
+
writable: true,
|
|
13199
|
+
value: storyManager
|
|
13200
|
+
});
|
|
13201
|
+
Object.defineProperty(this, "_feed", {
|
|
13202
|
+
enumerable: true,
|
|
13203
|
+
configurable: true,
|
|
13204
|
+
writable: true,
|
|
13205
|
+
value: null
|
|
13206
|
+
});
|
|
13058
13207
|
}
|
|
13059
|
-
|
|
13060
|
-
|
|
13061
|
-
var showOnboardingStoriesStrategy_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
13062
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
13063
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
13064
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
13065
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13066
|
-
var _, done = false;
|
|
13067
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
13068
|
-
var context = {};
|
|
13069
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
13070
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
13071
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13072
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13073
|
-
if (kind === "accessor") {
|
|
13074
|
-
if (result === void 0) continue;
|
|
13075
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
13076
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
13077
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
13078
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
13079
|
-
}
|
|
13080
|
-
else if (_ = accept(result)) {
|
|
13081
|
-
if (kind === "field") initializers.unshift(_);
|
|
13082
|
-
else descriptor[key] = _;
|
|
13083
|
-
}
|
|
13208
|
+
get feed() {
|
|
13209
|
+
return this._feed;
|
|
13084
13210
|
}
|
|
13085
|
-
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13090
|
-
|
|
13091
|
-
|
|
13092
|
-
|
|
13093
|
-
|
|
13094
|
-
|
|
13095
|
-
|
|
13096
|
-
|
|
13097
|
-
|
|
13098
|
-
|
|
13099
|
-
|
|
13100
|
-
|
|
13101
|
-
|
|
13102
|
-
|
|
13103
|
-
|
|
13104
|
-
|
|
13105
|
-
|
|
13106
|
-
|
|
13107
|
-
|
|
13108
|
-
|
|
13109
|
-
|
|
13110
|
-
|
|
13111
|
-
|
|
13112
|
-
|
|
13113
|
-
|
|
13114
|
-
|
|
13115
|
-
|
|
13116
|
-
|
|
13117
|
-
|
|
13118
|
-
|
|
13119
|
-
|
|
13120
|
-
const storyFeedStore = this.storyManager.rootStore.onboardingFeedStore;
|
|
13121
|
-
const onboardingFeed = await storyFeedStore.fetchOnboardingFeed({
|
|
13122
|
-
feedSlug: payload.feedSlug,
|
|
13123
|
-
tags: (_b = payload.customTags) !== null && _b !== void 0 ? _b : [],
|
|
13124
|
-
limit: (_c = payload.limit) !== null && _c !== void 0 ? _c : undefined
|
|
13125
|
-
});
|
|
13126
|
-
this._feed = onboardingFeed;
|
|
13127
|
-
const feedLoadEvent = this.getFeedLoadEvent(onboardingFeed.slug, onboardingFeed.stories);
|
|
13128
|
-
this.emitFeedLoad(feedLoadEvent);
|
|
13129
|
-
if (!onboardingFeed.stories.length)
|
|
13130
|
-
return feedLoadEvent;
|
|
13131
|
-
await this.showMultipleStoriesStrategy.show({
|
|
13132
|
-
windowReferer: STORY_READER_WINDOW_REFERER.default,
|
|
13133
|
-
storyFeed: onboardingFeed,
|
|
13134
|
-
storyId: onboardingFeed.stories[0].id
|
|
13135
|
-
});
|
|
13136
|
-
return feedLoadEvent;
|
|
13137
|
-
}
|
|
13138
|
-
async handleNextStoryByIndex(nextStoryIndex) {
|
|
13139
|
-
this.showMultipleStoriesStrategy.handleNextStoryByIndex(nextStoryIndex);
|
|
13140
|
-
}
|
|
13141
|
-
emitFeedLoad(event) {
|
|
13142
|
-
this.storyManager.emit("feedLoad", event);
|
|
13143
|
-
}
|
|
13144
|
-
getFeedLoadEvent(feed, onboardingStories) {
|
|
13145
|
-
const stories = onboardingStories.map(story => {
|
|
13146
|
-
const additionalPayload = {
|
|
13147
|
-
title: null,
|
|
13148
|
-
slidesCount: null
|
|
13149
|
-
};
|
|
13150
|
-
if (story) {
|
|
13151
|
-
additionalPayload.title = story.statTitle;
|
|
13152
|
-
additionalPayload.slidesCount = story.slidesCount;
|
|
13153
|
-
}
|
|
13154
|
-
return Object.assign({ id: story.id }, additionalPayload);
|
|
13155
|
-
});
|
|
13156
|
-
const eventData = {
|
|
13157
|
-
stories,
|
|
13158
|
-
feed: null,
|
|
13159
|
-
filter: null
|
|
13160
|
-
};
|
|
13161
|
-
eventData.feed = feed;
|
|
13162
|
-
return eventData;
|
|
13163
|
-
}
|
|
13164
|
-
async reload(payload) {
|
|
13165
|
-
this.showMultipleStoriesStrategy.reload(payload);
|
|
13211
|
+
async show(payload) {
|
|
13212
|
+
var _a, _b;
|
|
13213
|
+
const storyFeedStore = this.storyManager.rootStore.onboardingFeedStore;
|
|
13214
|
+
const onboardingFeed = await storyFeedStore.fetchOnboardingFeed({
|
|
13215
|
+
feedSlug: payload.feedSlug,
|
|
13216
|
+
tags: (_a = payload.customTags) !== null && _a !== void 0 ? _a : [],
|
|
13217
|
+
limit: (_b = payload.limit) !== null && _b !== void 0 ? _b : undefined
|
|
13218
|
+
});
|
|
13219
|
+
this._feed = onboardingFeed;
|
|
13220
|
+
const feedLoadEvent = this.getFeedLoadEvent(onboardingFeed.slug, onboardingFeed.stories);
|
|
13221
|
+
this.emitFeedLoad(feedLoadEvent);
|
|
13222
|
+
if (!onboardingFeed.stories.length)
|
|
13223
|
+
return feedLoadEvent;
|
|
13224
|
+
await this.showMultipleStoriesStrategy.show({
|
|
13225
|
+
windowReferer: STORY_READER_WINDOW_REFERER.default,
|
|
13226
|
+
storyFeed: onboardingFeed,
|
|
13227
|
+
storyId: onboardingFeed.stories[0].id
|
|
13228
|
+
});
|
|
13229
|
+
return feedLoadEvent;
|
|
13230
|
+
}
|
|
13231
|
+
async handleNextStoryByIndex(nextStoryIndex) {
|
|
13232
|
+
this.showMultipleStoriesStrategy.handleNextStoryByIndex(nextStoryIndex);
|
|
13233
|
+
}
|
|
13234
|
+
emitFeedLoad(event) {
|
|
13235
|
+
this.storyManager.emit("feedLoad", event);
|
|
13236
|
+
}
|
|
13237
|
+
getFeedLoadEvent(feed, onboardingStories) {
|
|
13238
|
+
const stories = onboardingStories.map(story => {
|
|
13239
|
+
const additionalPayload = {
|
|
13240
|
+
title: null,
|
|
13241
|
+
slidesCount: null
|
|
13242
|
+
};
|
|
13243
|
+
if (story) {
|
|
13244
|
+
additionalPayload.title = story.statTitle;
|
|
13245
|
+
additionalPayload.slidesCount = story.slidesCount;
|
|
13166
13246
|
}
|
|
13167
|
-
|
|
13168
|
-
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
|
|
13172
|
-
|
|
13173
|
-
}
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
|
|
13247
|
+
return Object.assign({ id: story.id }, additionalPayload);
|
|
13248
|
+
});
|
|
13249
|
+
const eventData = {
|
|
13250
|
+
stories,
|
|
13251
|
+
feed: null,
|
|
13252
|
+
filter: null
|
|
13253
|
+
};
|
|
13254
|
+
eventData.feed = feed;
|
|
13255
|
+
return eventData;
|
|
13256
|
+
}
|
|
13257
|
+
async reload(payload) {
|
|
13258
|
+
this.showMultipleStoriesStrategy.reload(payload);
|
|
13259
|
+
}
|
|
13260
|
+
}
|
|
13177
13261
|
|
|
13178
13262
|
;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showMultipleStoriesStrategy.ts
|
|
13179
13263
|
const NUMBER_OF_LAZY_LOADED_STORIES = 2;
|
|
@@ -13284,191 +13368,95 @@ class ShowStoryFromSharePageStrategy {
|
|
|
13284
13368
|
}
|
|
13285
13369
|
|
|
13286
13370
|
;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showStoryOnceStrategy.ts
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
|
|
13371
|
+
|
|
13372
|
+
|
|
13373
|
+
class ShowStoryOnceStrategy {
|
|
13374
|
+
constructor(storyManager, storyReaderViewModel) {
|
|
13375
|
+
Object.defineProperty(this, "storyManager", {
|
|
13376
|
+
enumerable: true,
|
|
13377
|
+
configurable: true,
|
|
13378
|
+
writable: true,
|
|
13379
|
+
value: storyManager
|
|
13380
|
+
});
|
|
13381
|
+
Object.defineProperty(this, "storyReaderViewModel", {
|
|
13382
|
+
enumerable: true,
|
|
13383
|
+
configurable: true,
|
|
13384
|
+
writable: true,
|
|
13385
|
+
value: storyReaderViewModel
|
|
13386
|
+
});
|
|
13291
13387
|
}
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
|
|
13296
|
-
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13308
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
13309
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
13310
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
13311
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
13388
|
+
get feed() {
|
|
13389
|
+
return null;
|
|
13390
|
+
}
|
|
13391
|
+
async show(payload) {
|
|
13392
|
+
try {
|
|
13393
|
+
const storyStore = this.storyManager.rootStore.storyStore;
|
|
13394
|
+
const story = await storyStore.fetchStoryById({
|
|
13395
|
+
storyId: payload.storyId,
|
|
13396
|
+
feedSlug: "",
|
|
13397
|
+
once: true
|
|
13398
|
+
});
|
|
13399
|
+
if (story.error)
|
|
13400
|
+
throw story.error;
|
|
13401
|
+
if (story.isOpened)
|
|
13402
|
+
throw new IasStoryAlreadyShownError(payload.storyId.toString());
|
|
13403
|
+
this.openStoryReader(story);
|
|
13312
13404
|
}
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13405
|
+
catch (error) {
|
|
13406
|
+
this.storyReaderViewModel.close();
|
|
13407
|
+
throw error;
|
|
13316
13408
|
}
|
|
13317
13409
|
}
|
|
13318
|
-
|
|
13319
|
-
|
|
13320
|
-
|
|
13321
|
-
|
|
13410
|
+
openStoryReader(story) {
|
|
13411
|
+
this.storyReaderViewModel.open({
|
|
13412
|
+
windowReferer: STORY_READER_WINDOW_REFERER.default,
|
|
13413
|
+
id: story.id,
|
|
13414
|
+
stories: [story]
|
|
13415
|
+
});
|
|
13416
|
+
}
|
|
13417
|
+
async handleNextStoryByIndex(storyIndex) { }
|
|
13418
|
+
async reload(payload) { }
|
|
13419
|
+
}
|
|
13322
13420
|
|
|
13421
|
+
;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showStoryStrategy.ts
|
|
13323
13422
|
|
|
13324
|
-
|
|
13325
|
-
|
|
13326
|
-
|
|
13327
|
-
|
|
13328
|
-
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13333
|
-
|
|
13334
|
-
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
configurable: true,
|
|
13339
|
-
writable: true,
|
|
13340
|
-
value: storyReaderViewModel
|
|
13341
|
-
});
|
|
13342
|
-
}
|
|
13343
|
-
get feed() {
|
|
13344
|
-
return null;
|
|
13345
|
-
}
|
|
13346
|
-
async show(payload) {
|
|
13347
|
-
try {
|
|
13348
|
-
const storyStore = this.storyManager.rootStore.storyStore;
|
|
13349
|
-
const story = await storyStore.fetchStoryById({
|
|
13350
|
-
storyId: payload.storyId,
|
|
13351
|
-
feedSlug: "",
|
|
13352
|
-
once: true
|
|
13353
|
-
});
|
|
13354
|
-
if (story.error)
|
|
13355
|
-
throw story.error;
|
|
13356
|
-
if (story.isOpened)
|
|
13357
|
-
throw new IasStoryAlreadyShownError(payload.storyId.toString());
|
|
13358
|
-
this.openStoryReader(story);
|
|
13359
|
-
}
|
|
13360
|
-
catch (error) {
|
|
13361
|
-
this.storyReaderViewModel.close();
|
|
13362
|
-
throw error;
|
|
13363
|
-
}
|
|
13364
|
-
}
|
|
13365
|
-
openStoryReader(story) {
|
|
13366
|
-
this.storyReaderViewModel.open({
|
|
13367
|
-
windowReferer: STORY_READER_WINDOW_REFERER.default,
|
|
13368
|
-
id: story.id,
|
|
13369
|
-
stories: [story]
|
|
13370
|
-
});
|
|
13371
|
-
}
|
|
13372
|
-
async handleNextStoryByIndex(storyIndex) { }
|
|
13373
|
-
async reload(payload) { }
|
|
13374
|
-
},
|
|
13375
|
-
(() => {
|
|
13376
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
13377
|
-
_show_decorators = [noConcurrent];
|
|
13378
|
-
showStoryOnceStrategy_esDecorate(_a, null, _show_decorators, { kind: "method", name: "show", static: false, private: false, access: { has: obj => "show" in obj, get: obj => obj.show }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
13379
|
-
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
13380
|
-
})(),
|
|
13381
|
-
_a;
|
|
13382
|
-
})();
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showStoryStrategy.ts
|
|
13386
|
-
var showStoryStrategy_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
|
|
13387
|
-
var useValue = arguments.length > 2;
|
|
13388
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
13389
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
13423
|
+
class ShowStoryStrategy {
|
|
13424
|
+
constructor(storyManager, storyReaderViewModel) {
|
|
13425
|
+
Object.defineProperty(this, "storyManager", {
|
|
13426
|
+
enumerable: true,
|
|
13427
|
+
configurable: true,
|
|
13428
|
+
writable: true,
|
|
13429
|
+
value: storyManager
|
|
13430
|
+
});
|
|
13431
|
+
Object.defineProperty(this, "storyReaderViewModel", {
|
|
13432
|
+
enumerable: true,
|
|
13433
|
+
configurable: true,
|
|
13434
|
+
writable: true,
|
|
13435
|
+
value: storyReaderViewModel
|
|
13436
|
+
});
|
|
13390
13437
|
}
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
var showStoryStrategy_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
13394
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
13395
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
13396
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
13397
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13398
|
-
var _, done = false;
|
|
13399
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
13400
|
-
var context = {};
|
|
13401
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
13402
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
13403
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13404
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13405
|
-
if (kind === "accessor") {
|
|
13406
|
-
if (result === void 0) continue;
|
|
13407
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
13408
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
13409
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
13410
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
13411
|
-
}
|
|
13412
|
-
else if (_ = accept(result)) {
|
|
13413
|
-
if (kind === "field") initializers.unshift(_);
|
|
13414
|
-
else descriptor[key] = _;
|
|
13415
|
-
}
|
|
13438
|
+
get feed() {
|
|
13439
|
+
return null;
|
|
13416
13440
|
}
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
configurable: true,
|
|
13437
|
-
writable: true,
|
|
13438
|
-
value: storyReaderViewModel
|
|
13439
|
-
});
|
|
13440
|
-
}
|
|
13441
|
-
get feed() {
|
|
13442
|
-
return null;
|
|
13443
|
-
}
|
|
13444
|
-
async show(payload) {
|
|
13445
|
-
const storyStore = this.storyManager.rootStore.storyStore;
|
|
13446
|
-
const story = await storyStore.fetchStoryById({
|
|
13447
|
-
storyId: payload.storyId,
|
|
13448
|
-
feedSlug: "",
|
|
13449
|
-
fetchShareUrl: payload.fetchShareUrl
|
|
13450
|
-
});
|
|
13451
|
-
this.openStoryReader(story, payload);
|
|
13452
|
-
}
|
|
13453
|
-
openStoryReader(story, payload) {
|
|
13454
|
-
this.storyReaderViewModel.open({
|
|
13455
|
-
windowReferer: STORY_READER_WINDOW_REFERER.default,
|
|
13456
|
-
id: story.id,
|
|
13457
|
-
stories: [story]
|
|
13458
|
-
});
|
|
13459
|
-
}
|
|
13460
|
-
async handleNextStoryByIndex(storyIndex) { }
|
|
13461
|
-
async reload(payload) { }
|
|
13462
|
-
},
|
|
13463
|
-
(() => {
|
|
13464
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
13465
|
-
_show_decorators = [noConcurrent];
|
|
13466
|
-
showStoryStrategy_esDecorate(_a, null, _show_decorators, { kind: "method", name: "show", static: false, private: false, access: { has: obj => "show" in obj, get: obj => obj.show }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
13467
|
-
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
13468
|
-
})(),
|
|
13469
|
-
_a;
|
|
13470
|
-
})();
|
|
13471
|
-
|
|
13441
|
+
async show(payload) {
|
|
13442
|
+
const storyStore = this.storyManager.rootStore.storyStore;
|
|
13443
|
+
const story = await storyStore.fetchStoryById({
|
|
13444
|
+
storyId: payload.storyId,
|
|
13445
|
+
feedSlug: "",
|
|
13446
|
+
fetchShareUrl: payload.fetchShareUrl
|
|
13447
|
+
});
|
|
13448
|
+
this.openStoryReader(story, payload);
|
|
13449
|
+
}
|
|
13450
|
+
openStoryReader(story, payload) {
|
|
13451
|
+
this.storyReaderViewModel.open({
|
|
13452
|
+
windowReferer: STORY_READER_WINDOW_REFERER.default,
|
|
13453
|
+
id: story.id,
|
|
13454
|
+
stories: [story]
|
|
13455
|
+
});
|
|
13456
|
+
}
|
|
13457
|
+
async handleNextStoryByIndex(storyIndex) { }
|
|
13458
|
+
async reload(payload) { }
|
|
13459
|
+
}
|
|
13472
13460
|
|
|
13473
13461
|
;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/storyDisplayStrategyFactory.ts
|
|
13474
13462
|
|
|
@@ -13623,6 +13611,509 @@ class StoryReaderStatisticsController {
|
|
|
13623
13611
|
}
|
|
13624
13612
|
}
|
|
13625
13613
|
|
|
13614
|
+
;// CONCATENATED MODULE: ../core/src/cache/models/cacheEntry.ts
|
|
13615
|
+
class CacheEntry {
|
|
13616
|
+
constructor(url, blob, lastAccessed = Date.now()) {
|
|
13617
|
+
Object.defineProperty(this, "url", {
|
|
13618
|
+
enumerable: true,
|
|
13619
|
+
configurable: true,
|
|
13620
|
+
writable: true,
|
|
13621
|
+
value: url
|
|
13622
|
+
});
|
|
13623
|
+
Object.defineProperty(this, "blob", {
|
|
13624
|
+
enumerable: true,
|
|
13625
|
+
configurable: true,
|
|
13626
|
+
writable: true,
|
|
13627
|
+
value: blob
|
|
13628
|
+
});
|
|
13629
|
+
Object.defineProperty(this, "lastAccessed", {
|
|
13630
|
+
enumerable: true,
|
|
13631
|
+
configurable: true,
|
|
13632
|
+
writable: true,
|
|
13633
|
+
value: lastAccessed
|
|
13634
|
+
});
|
|
13635
|
+
Object.defineProperty(this, "blobUrl", {
|
|
13636
|
+
enumerable: true,
|
|
13637
|
+
configurable: true,
|
|
13638
|
+
writable: true,
|
|
13639
|
+
value: void 0
|
|
13640
|
+
});
|
|
13641
|
+
}
|
|
13642
|
+
updateLastAccessed() {
|
|
13643
|
+
this.lastAccessed = Date.now();
|
|
13644
|
+
}
|
|
13645
|
+
getOrCreateBlobUrl() {
|
|
13646
|
+
if (!this.blobUrl) {
|
|
13647
|
+
this.blobUrl = URL.createObjectURL(this.blob);
|
|
13648
|
+
}
|
|
13649
|
+
return this.blobUrl;
|
|
13650
|
+
}
|
|
13651
|
+
unlinkBlob() {
|
|
13652
|
+
if (this.blobUrl)
|
|
13653
|
+
URL.revokeObjectURL(this.blobUrl);
|
|
13654
|
+
}
|
|
13655
|
+
destroy() {
|
|
13656
|
+
this.unlinkBlob();
|
|
13657
|
+
}
|
|
13658
|
+
}
|
|
13659
|
+
|
|
13660
|
+
;// CONCATENATED MODULE: ../core/src/cache/cacheRepository.ts
|
|
13661
|
+
|
|
13662
|
+
class CacheRepository {
|
|
13663
|
+
constructor(driver) {
|
|
13664
|
+
Object.defineProperty(this, "driver", {
|
|
13665
|
+
enumerable: true,
|
|
13666
|
+
configurable: true,
|
|
13667
|
+
writable: true,
|
|
13668
|
+
value: driver
|
|
13669
|
+
});
|
|
13670
|
+
Object.defineProperty(this, "entries", {
|
|
13671
|
+
enumerable: true,
|
|
13672
|
+
configurable: true,
|
|
13673
|
+
writable: true,
|
|
13674
|
+
value: new Map()
|
|
13675
|
+
});
|
|
13676
|
+
}
|
|
13677
|
+
async get(url) {
|
|
13678
|
+
let entry = this.entries.get(url);
|
|
13679
|
+
if (!entry) {
|
|
13680
|
+
const record = await this.driver.get(url);
|
|
13681
|
+
if (!record)
|
|
13682
|
+
return;
|
|
13683
|
+
entry = new CacheEntry(record.url, record.blob, record.lastAccessed);
|
|
13684
|
+
this.entries.set(url, entry);
|
|
13685
|
+
}
|
|
13686
|
+
return entry;
|
|
13687
|
+
}
|
|
13688
|
+
async loadAllEntries() {
|
|
13689
|
+
const records = await this.driver.getAll();
|
|
13690
|
+
const entities = [];
|
|
13691
|
+
for (const record of records) {
|
|
13692
|
+
const entry = new CacheEntry(record.url, record.blob, record.lastAccessed);
|
|
13693
|
+
this.entries.set(record.url, entry);
|
|
13694
|
+
entities.push(entry);
|
|
13695
|
+
}
|
|
13696
|
+
return entities;
|
|
13697
|
+
}
|
|
13698
|
+
async save(entry) {
|
|
13699
|
+
this.entries.set(entry.url, entry);
|
|
13700
|
+
await this.driver.set({
|
|
13701
|
+
url: entry.url,
|
|
13702
|
+
blob: entry.blob,
|
|
13703
|
+
lastAccessed: entry.lastAccessed
|
|
13704
|
+
});
|
|
13705
|
+
}
|
|
13706
|
+
async updateAccessTime(entry) {
|
|
13707
|
+
this.entries.set(entry.url, entry);
|
|
13708
|
+
await this.driver.updateAccessTime(entry.url, entry.lastAccessed);
|
|
13709
|
+
}
|
|
13710
|
+
async delete(url) {
|
|
13711
|
+
this.entries.delete(url);
|
|
13712
|
+
await this.driver.delete(url);
|
|
13713
|
+
}
|
|
13714
|
+
async getAll() {
|
|
13715
|
+
return Array.from(this.entries.values());
|
|
13716
|
+
}
|
|
13717
|
+
async clear() {
|
|
13718
|
+
for (const entry of this.entries.values())
|
|
13719
|
+
entry.destroy();
|
|
13720
|
+
this.entries.clear();
|
|
13721
|
+
//await this.driver.clear();
|
|
13722
|
+
}
|
|
13723
|
+
}
|
|
13724
|
+
|
|
13725
|
+
;// CONCATENATED MODULE: ../core/src/cache/drivers/indexedDBDriver.ts
|
|
13726
|
+
class IndexedDBCacheDriver {
|
|
13727
|
+
constructor(dbName, storeName) {
|
|
13728
|
+
Object.defineProperty(this, "dbName", {
|
|
13729
|
+
enumerable: true,
|
|
13730
|
+
configurable: true,
|
|
13731
|
+
writable: true,
|
|
13732
|
+
value: void 0
|
|
13733
|
+
});
|
|
13734
|
+
Object.defineProperty(this, "storeName", {
|
|
13735
|
+
enumerable: true,
|
|
13736
|
+
configurable: true,
|
|
13737
|
+
writable: true,
|
|
13738
|
+
value: void 0
|
|
13739
|
+
});
|
|
13740
|
+
this.dbName = dbName;
|
|
13741
|
+
this.storeName = storeName;
|
|
13742
|
+
}
|
|
13743
|
+
async getDB() {
|
|
13744
|
+
return new Promise((resolve, reject) => {
|
|
13745
|
+
const request = indexedDB.open(this.dbName, 1);
|
|
13746
|
+
request.onupgradeneeded = () => {
|
|
13747
|
+
const db = request.result;
|
|
13748
|
+
if (!db.objectStoreNames.contains(this.storeName)) {
|
|
13749
|
+
const store = db.createObjectStore(this.storeName, { keyPath: "url" });
|
|
13750
|
+
store.createIndex("lastAccessed", "lastAccessed");
|
|
13751
|
+
}
|
|
13752
|
+
};
|
|
13753
|
+
request.onsuccess = () => resolve(request.result);
|
|
13754
|
+
request.onerror = () => reject(request.error);
|
|
13755
|
+
});
|
|
13756
|
+
}
|
|
13757
|
+
async get(url) {
|
|
13758
|
+
const db = await this.getDB();
|
|
13759
|
+
return new Promise((resolve, reject) => {
|
|
13760
|
+
const tx = db.transaction(this.storeName, "readonly");
|
|
13761
|
+
const store = tx.objectStore(this.storeName);
|
|
13762
|
+
const request = store.get(url);
|
|
13763
|
+
request.onsuccess = () => {
|
|
13764
|
+
const result = request.result;
|
|
13765
|
+
resolve(result ? { url, lastAccessed: result.lastAccessed, blob: result.blob } : undefined);
|
|
13766
|
+
};
|
|
13767
|
+
request.onerror = () => reject(request.error);
|
|
13768
|
+
});
|
|
13769
|
+
}
|
|
13770
|
+
async set(record) {
|
|
13771
|
+
const db = await this.getDB();
|
|
13772
|
+
return new Promise((resolve, reject) => {
|
|
13773
|
+
const tx = db.transaction(this.storeName, "readwrite");
|
|
13774
|
+
tx.objectStore(this.storeName).put(record);
|
|
13775
|
+
tx.oncomplete = () => resolve();
|
|
13776
|
+
tx.onerror = () => reject(tx.error);
|
|
13777
|
+
});
|
|
13778
|
+
}
|
|
13779
|
+
async updateAccessTime(url, lastAccessed) {
|
|
13780
|
+
const db = await this.getDB();
|
|
13781
|
+
const tx = db.transaction(this.storeName, "readwrite");
|
|
13782
|
+
const store = tx.objectStore(this.storeName);
|
|
13783
|
+
const existing = await new Promise((resolve, reject) => {
|
|
13784
|
+
const req = store.get(url);
|
|
13785
|
+
req.onsuccess = () => resolve(req.result);
|
|
13786
|
+
req.onerror = () => reject(req.error);
|
|
13787
|
+
});
|
|
13788
|
+
if (existing) {
|
|
13789
|
+
existing.lastAccessed = lastAccessed;
|
|
13790
|
+
store.put(existing);
|
|
13791
|
+
}
|
|
13792
|
+
return new Promise((resolve, reject) => {
|
|
13793
|
+
tx.oncomplete = () => resolve();
|
|
13794
|
+
tx.onerror = () => reject(tx.error);
|
|
13795
|
+
});
|
|
13796
|
+
}
|
|
13797
|
+
async delete(url) {
|
|
13798
|
+
const db = await this.getDB();
|
|
13799
|
+
return new Promise((resolve, reject) => {
|
|
13800
|
+
const tx = db.transaction(this.storeName, "readwrite");
|
|
13801
|
+
tx.objectStore(this.storeName).delete(url);
|
|
13802
|
+
tx.oncomplete = () => resolve();
|
|
13803
|
+
tx.onerror = () => reject(tx.error);
|
|
13804
|
+
});
|
|
13805
|
+
}
|
|
13806
|
+
async getAll() {
|
|
13807
|
+
const db = await this.getDB();
|
|
13808
|
+
return new Promise((resolve, reject) => {
|
|
13809
|
+
const tx = db.transaction(this.storeName, "readonly");
|
|
13810
|
+
const store = tx.objectStore(this.storeName);
|
|
13811
|
+
const request = store.getAll();
|
|
13812
|
+
request.onsuccess = () => resolve(request.result);
|
|
13813
|
+
request.onerror = () => reject(request.error);
|
|
13814
|
+
});
|
|
13815
|
+
}
|
|
13816
|
+
async clear() {
|
|
13817
|
+
const db = await this.getDB();
|
|
13818
|
+
return new Promise((resolve, reject) => {
|
|
13819
|
+
const tx = db.transaction(this.storeName, "readwrite");
|
|
13820
|
+
tx.objectStore(this.storeName).clear();
|
|
13821
|
+
tx.oncomplete = () => resolve();
|
|
13822
|
+
tx.onerror = () => reject(tx.error);
|
|
13823
|
+
});
|
|
13824
|
+
}
|
|
13825
|
+
}
|
|
13826
|
+
|
|
13827
|
+
;// CONCATENATED MODULE: ../core/src/cache/drivers/memoryCacheDriver.ts
|
|
13828
|
+
class MemoryCacheDriver {
|
|
13829
|
+
constructor() {
|
|
13830
|
+
Object.defineProperty(this, "store", {
|
|
13831
|
+
enumerable: true,
|
|
13832
|
+
configurable: true,
|
|
13833
|
+
writable: true,
|
|
13834
|
+
value: new Map()
|
|
13835
|
+
});
|
|
13836
|
+
}
|
|
13837
|
+
async get(url) {
|
|
13838
|
+
return this.store.get(url);
|
|
13839
|
+
}
|
|
13840
|
+
async set(record) {
|
|
13841
|
+
this.store.set(record.url, record);
|
|
13842
|
+
}
|
|
13843
|
+
async delete(url) {
|
|
13844
|
+
this.store.delete(url);
|
|
13845
|
+
}
|
|
13846
|
+
async getAll() {
|
|
13847
|
+
return Array.from(this.store.values());
|
|
13848
|
+
}
|
|
13849
|
+
async clear() {
|
|
13850
|
+
this.store.clear();
|
|
13851
|
+
}
|
|
13852
|
+
async updateAccessTime(url, lastAccessed) {
|
|
13853
|
+
const record = await this.get(url);
|
|
13854
|
+
if (!record)
|
|
13855
|
+
return;
|
|
13856
|
+
record.lastAccessed = lastAccessed;
|
|
13857
|
+
this.set(record);
|
|
13858
|
+
}
|
|
13859
|
+
}
|
|
13860
|
+
|
|
13861
|
+
;// CONCATENATED MODULE: ../core/src/cache/lruCache.ts
|
|
13862
|
+
|
|
13863
|
+
|
|
13864
|
+
class LRUCache {
|
|
13865
|
+
constructor(repository, loader, options) {
|
|
13866
|
+
var _a, _b;
|
|
13867
|
+
Object.defineProperty(this, "repository", {
|
|
13868
|
+
enumerable: true,
|
|
13869
|
+
configurable: true,
|
|
13870
|
+
writable: true,
|
|
13871
|
+
value: repository
|
|
13872
|
+
});
|
|
13873
|
+
Object.defineProperty(this, "loader", {
|
|
13874
|
+
enumerable: true,
|
|
13875
|
+
configurable: true,
|
|
13876
|
+
writable: true,
|
|
13877
|
+
value: loader
|
|
13878
|
+
});
|
|
13879
|
+
Object.defineProperty(this, "urlLocks", {
|
|
13880
|
+
enumerable: true,
|
|
13881
|
+
configurable: true,
|
|
13882
|
+
writable: true,
|
|
13883
|
+
value: new Map()
|
|
13884
|
+
});
|
|
13885
|
+
Object.defineProperty(this, "options", {
|
|
13886
|
+
enumerable: true,
|
|
13887
|
+
configurable: true,
|
|
13888
|
+
writable: true,
|
|
13889
|
+
value: void 0
|
|
13890
|
+
});
|
|
13891
|
+
this.options = {
|
|
13892
|
+
maxSize: (_a = options === null || options === void 0 ? void 0 : options.maxSize) !== null && _a !== void 0 ? _a : 20,
|
|
13893
|
+
debug: Boolean(options === null || options === void 0 ? void 0 : options.debug),
|
|
13894
|
+
ttl: (_b = options === null || options === void 0 ? void 0 : options.ttl) !== null && _b !== void 0 ? _b : 3600
|
|
13895
|
+
};
|
|
13896
|
+
}
|
|
13897
|
+
async init() {
|
|
13898
|
+
await this.repository.loadAllEntries();
|
|
13899
|
+
await this.tryEvict();
|
|
13900
|
+
}
|
|
13901
|
+
async getAll() {
|
|
13902
|
+
return this.repository.getAll();
|
|
13903
|
+
}
|
|
13904
|
+
async get(url, priority) {
|
|
13905
|
+
const mutex = this.getMutexForUrl(url);
|
|
13906
|
+
const release = await mutex.acquire();
|
|
13907
|
+
try {
|
|
13908
|
+
let entry = await this.repository.get(url);
|
|
13909
|
+
if (!entry)
|
|
13910
|
+
entry = await this.add(url, priority);
|
|
13911
|
+
entry.updateLastAccessed();
|
|
13912
|
+
entry.getOrCreateBlobUrl();
|
|
13913
|
+
if (this.options.debug)
|
|
13914
|
+
console.log("[IAS]: Get from cache", entry);
|
|
13915
|
+
await this.repository.updateAccessTime(entry);
|
|
13916
|
+
return entry;
|
|
13917
|
+
}
|
|
13918
|
+
finally {
|
|
13919
|
+
release();
|
|
13920
|
+
}
|
|
13921
|
+
}
|
|
13922
|
+
async tryEvict() {
|
|
13923
|
+
const expiredEntries = await this.evictExpired();
|
|
13924
|
+
const oldestEntries = await this.evictOldest();
|
|
13925
|
+
return [...expiredEntries, ...oldestEntries];
|
|
13926
|
+
}
|
|
13927
|
+
async evictOldest() {
|
|
13928
|
+
const entries = await this.repository.getAll();
|
|
13929
|
+
if (entries.length <= this.options.maxSize)
|
|
13930
|
+
return [];
|
|
13931
|
+
const evictedEntries = [];
|
|
13932
|
+
const sorted = entries.sort((a, b) => a.lastAccessed - b.lastAccessed);
|
|
13933
|
+
while (sorted.length > this.options.maxSize) {
|
|
13934
|
+
const entry = sorted.shift();
|
|
13935
|
+
if (!entry)
|
|
13936
|
+
continue;
|
|
13937
|
+
if (this.options.debug)
|
|
13938
|
+
console.log("[IAS]: Remove oldest entry from cache", entry);
|
|
13939
|
+
await this.removeEntry(entry);
|
|
13940
|
+
evictedEntries.push(entry);
|
|
13941
|
+
}
|
|
13942
|
+
return evictedEntries;
|
|
13943
|
+
}
|
|
13944
|
+
async wait() {
|
|
13945
|
+
await Promise.all(Array.from(this.urlLocks.values()).map(urlLock => urlLock.waitForUnlock()));
|
|
13946
|
+
}
|
|
13947
|
+
async evictExpired() {
|
|
13948
|
+
if (this.options.ttl === 0)
|
|
13949
|
+
return [];
|
|
13950
|
+
const entries = await this.repository.getAll();
|
|
13951
|
+
const now = Date.now();
|
|
13952
|
+
const evictedEntries = [];
|
|
13953
|
+
for (const entry of entries) {
|
|
13954
|
+
if (entry.lastAccessed + this.options.ttl * 1000 < now) {
|
|
13955
|
+
if (this.options.debug)
|
|
13956
|
+
console.log("[IAS]: Remove expired entry from cache", entry);
|
|
13957
|
+
await this.removeEntry(entry);
|
|
13958
|
+
evictedEntries.push(entry);
|
|
13959
|
+
}
|
|
13960
|
+
}
|
|
13961
|
+
return evictedEntries;
|
|
13962
|
+
}
|
|
13963
|
+
async add(url, priority) {
|
|
13964
|
+
const blob = await this.loader.enqueue(url, priority);
|
|
13965
|
+
const entry = new CacheEntry(url, blob);
|
|
13966
|
+
await this.repository.save(entry);
|
|
13967
|
+
await this.tryEvict();
|
|
13968
|
+
if (this.options.debug)
|
|
13969
|
+
console.log("[IAS]: Add to cache", entry);
|
|
13970
|
+
return entry;
|
|
13971
|
+
}
|
|
13972
|
+
getMutexForUrl(url) {
|
|
13973
|
+
let mutex = this.urlLocks.get(url);
|
|
13974
|
+
if (!mutex) {
|
|
13975
|
+
mutex = new external_async_mutex_namespaceObject.Mutex();
|
|
13976
|
+
this.urlLocks.set(url, mutex);
|
|
13977
|
+
}
|
|
13978
|
+
return mutex;
|
|
13979
|
+
}
|
|
13980
|
+
cleanupLock(url) {
|
|
13981
|
+
this.urlLocks.delete(url);
|
|
13982
|
+
}
|
|
13983
|
+
async removeEntry(entry) {
|
|
13984
|
+
entry.destroy();
|
|
13985
|
+
this.cleanupLock(entry.url);
|
|
13986
|
+
await this.repository.delete(entry.url);
|
|
13987
|
+
}
|
|
13988
|
+
}
|
|
13989
|
+
|
|
13990
|
+
;// CONCATENATED MODULE: ../core/src/cache/resourceLoader.ts
|
|
13991
|
+
|
|
13992
|
+
class ResourceLoader {
|
|
13993
|
+
constructor(concurrency) {
|
|
13994
|
+
Object.defineProperty(this, "concurrency", {
|
|
13995
|
+
enumerable: true,
|
|
13996
|
+
configurable: true,
|
|
13997
|
+
writable: true,
|
|
13998
|
+
value: concurrency
|
|
13999
|
+
});
|
|
14000
|
+
Object.defineProperty(this, "semaphore", {
|
|
14001
|
+
enumerable: true,
|
|
14002
|
+
configurable: true,
|
|
14003
|
+
writable: true,
|
|
14004
|
+
value: void 0
|
|
14005
|
+
});
|
|
14006
|
+
this.semaphore = new external_async_mutex_namespaceObject.Semaphore(concurrency);
|
|
14007
|
+
}
|
|
14008
|
+
async enqueue(url, priority) {
|
|
14009
|
+
return await this.semaphore.runExclusive(async () => {
|
|
14010
|
+
const response = await fetch(url, { cache: "no-store" });
|
|
14011
|
+
const blob = await response.blob();
|
|
14012
|
+
return blob;
|
|
14013
|
+
}, 1, priority);
|
|
14014
|
+
}
|
|
14015
|
+
wait() {
|
|
14016
|
+
return this.semaphore.waitForUnlock(this.concurrency);
|
|
14017
|
+
}
|
|
14018
|
+
clear() {
|
|
14019
|
+
this.semaphore.cancel();
|
|
14020
|
+
}
|
|
14021
|
+
async destroy() {
|
|
14022
|
+
this.clear();
|
|
14023
|
+
await this.wait();
|
|
14024
|
+
}
|
|
14025
|
+
}
|
|
14026
|
+
|
|
14027
|
+
;// CONCATENATED MODULE: ../core/src/cache/cacheManager.ts
|
|
14028
|
+
|
|
14029
|
+
|
|
14030
|
+
|
|
14031
|
+
|
|
14032
|
+
const CACHE_VERSION = 1;
|
|
14033
|
+
class CacheManager {
|
|
14034
|
+
get isDestroyed() {
|
|
14035
|
+
return this._isDestroyed;
|
|
14036
|
+
}
|
|
14037
|
+
constructor(options) {
|
|
14038
|
+
var _a, _b, _c, _d, _e;
|
|
14039
|
+
Object.defineProperty(this, "lruCache", {
|
|
14040
|
+
enumerable: true,
|
|
14041
|
+
configurable: true,
|
|
14042
|
+
writable: true,
|
|
14043
|
+
value: void 0
|
|
14044
|
+
});
|
|
14045
|
+
Object.defineProperty(this, "loader", {
|
|
14046
|
+
enumerable: true,
|
|
14047
|
+
configurable: true,
|
|
14048
|
+
writable: true,
|
|
14049
|
+
value: void 0
|
|
14050
|
+
});
|
|
14051
|
+
Object.defineProperty(this, "cacheRepository", {
|
|
14052
|
+
enumerable: true,
|
|
14053
|
+
configurable: true,
|
|
14054
|
+
writable: true,
|
|
14055
|
+
value: void 0
|
|
14056
|
+
});
|
|
14057
|
+
Object.defineProperty(this, "options", {
|
|
14058
|
+
enumerable: true,
|
|
14059
|
+
configurable: true,
|
|
14060
|
+
writable: true,
|
|
14061
|
+
value: void 0
|
|
14062
|
+
});
|
|
14063
|
+
Object.defineProperty(this, "_isDestroyed", {
|
|
14064
|
+
enumerable: true,
|
|
14065
|
+
configurable: true,
|
|
14066
|
+
writable: true,
|
|
14067
|
+
value: false
|
|
14068
|
+
});
|
|
14069
|
+
this.options = {
|
|
14070
|
+
maxSize: (_a = options.maxSize) !== null && _a !== void 0 ? _a : 20,
|
|
14071
|
+
concurrency: (_b = options.concurrency) !== null && _b !== void 0 ? _b : 5,
|
|
14072
|
+
debug: Boolean(options.debug),
|
|
14073
|
+
ttl: (_c = options.ttl) !== null && _c !== void 0 ? _c : 3600,
|
|
14074
|
+
type: (_d = options.type) !== null && _d !== void 0 ? _d : "indexeddb",
|
|
14075
|
+
storeName: (_e = options.storeName) !== null && _e !== void 0 ? _e : "resources"
|
|
14076
|
+
};
|
|
14077
|
+
const driver = this.createCacheDriver();
|
|
14078
|
+
this.cacheRepository = new CacheRepository(driver);
|
|
14079
|
+
this.loader = new ResourceLoader(this.options.concurrency);
|
|
14080
|
+
this.lruCache = new LRUCache(this.cacheRepository, this.loader, {
|
|
14081
|
+
maxSize: this.options.maxSize,
|
|
14082
|
+
debug: this.options.debug,
|
|
14083
|
+
ttl: this.options.ttl
|
|
14084
|
+
});
|
|
14085
|
+
this.lruCache.init().catch(error => console.error("[IAS]: LRU cache init error", error));
|
|
14086
|
+
}
|
|
14087
|
+
async preload(requests) {
|
|
14088
|
+
const results = await Promise.allSettled(requests.map(async (request) => {
|
|
14089
|
+
return await this.lruCache.get(request.url, request.priority);
|
|
14090
|
+
}));
|
|
14091
|
+
return results
|
|
14092
|
+
.filter((r) => r.status === "fulfilled" && r.value !== null)
|
|
14093
|
+
.map(r => r.value);
|
|
14094
|
+
}
|
|
14095
|
+
async destroy() {
|
|
14096
|
+
try {
|
|
14097
|
+
this._isDestroyed = true;
|
|
14098
|
+
await this.loader.destroy();
|
|
14099
|
+
await this.lruCache.wait();
|
|
14100
|
+
}
|
|
14101
|
+
finally {
|
|
14102
|
+
await this.cacheRepository.clear();
|
|
14103
|
+
if (this.options.debug)
|
|
14104
|
+
console.log("[IAS]: Destroy LRU cache");
|
|
14105
|
+
}
|
|
14106
|
+
}
|
|
14107
|
+
createCacheDriver() {
|
|
14108
|
+
if (this.options.type === "indexeddb")
|
|
14109
|
+
return new IndexedDBCacheDriver(`ias-cache-v${CACHE_VERSION}`, this.options.storeName);
|
|
14110
|
+
return new MemoryCacheDriver();
|
|
14111
|
+
}
|
|
14112
|
+
}
|
|
14113
|
+
|
|
14114
|
+
;// CONCATENATED MODULE: ../core/src/cache/index.ts
|
|
14115
|
+
|
|
14116
|
+
|
|
13626
14117
|
;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyReaderViewModel.ts
|
|
13627
14118
|
var storyReaderViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
|
|
13628
14119
|
var useValue = arguments.length > 2;
|
|
@@ -13679,6 +14170,8 @@ var storyReaderViewModel_classPrivateFieldSet = (undefined && undefined.__classP
|
|
|
13679
14170
|
|
|
13680
14171
|
|
|
13681
14172
|
|
|
14173
|
+
|
|
14174
|
+
|
|
13682
14175
|
var StoryReaderEvent;
|
|
13683
14176
|
(function (StoryReaderEvent) {
|
|
13684
14177
|
StoryReaderEvent["Close"] = "closeStoryReader";
|
|
@@ -13711,6 +14204,11 @@ let StoryReaderViewModel = (() => {
|
|
|
13711
14204
|
let _get_reachEnd_decorators;
|
|
13712
14205
|
let _open_decorators;
|
|
13713
14206
|
let _close_decorators;
|
|
14207
|
+
let _showStory_decorators;
|
|
14208
|
+
let _showStoryOnce_decorators;
|
|
14209
|
+
let _showStoryFromSharePage_decorators;
|
|
14210
|
+
let _showOnboardingStories_decorators;
|
|
14211
|
+
let _showMultipleStories_decorators;
|
|
13714
14212
|
let _reloadStory_decorators;
|
|
13715
14213
|
let _nextStory_decorators;
|
|
13716
14214
|
let _prevStory_decorators;
|
|
@@ -13800,6 +14298,12 @@ let StoryReaderViewModel = (() => {
|
|
|
13800
14298
|
writable: true,
|
|
13801
14299
|
value: false
|
|
13802
14300
|
});
|
|
14301
|
+
Object.defineProperty(this, "cacheManager", {
|
|
14302
|
+
enumerable: true,
|
|
14303
|
+
configurable: true,
|
|
14304
|
+
writable: true,
|
|
14305
|
+
value: null
|
|
14306
|
+
});
|
|
13803
14307
|
this.handleWindowUnload = this.handleWindowUnload.bind(this);
|
|
13804
14308
|
this.handleKeydown = this.handleKeydown.bind(this);
|
|
13805
14309
|
window.addEventListener("beforeunload", this.handleWindowUnload);
|
|
@@ -13853,6 +14357,8 @@ let StoryReaderViewModel = (() => {
|
|
|
13853
14357
|
var _b, _c;
|
|
13854
14358
|
if (this.activeStory)
|
|
13855
14359
|
this.resetReaderToDefaultState(this.activeStory);
|
|
14360
|
+
if (this.storyManager.config.cache)
|
|
14361
|
+
this.cacheManager = new CacheManager(this.storyManager.config.cache);
|
|
13856
14362
|
this.windowReferer = payload.windowReferer;
|
|
13857
14363
|
this.setStories(payload.stories);
|
|
13858
14364
|
const activeStory = this.navigationController.setActiveStoryById(payload.id);
|
|
@@ -13890,6 +14396,7 @@ let StoryReaderViewModel = (() => {
|
|
|
13890
14396
|
});
|
|
13891
14397
|
}
|
|
13892
14398
|
resetReaderToDefaultState(activeStory, closeAction) {
|
|
14399
|
+
var _b;
|
|
13893
14400
|
const event = new CloseStoryEvent(activeStory, {
|
|
13894
14401
|
action: closeAction
|
|
13895
14402
|
});
|
|
@@ -13904,6 +14411,7 @@ let StoryReaderViewModel = (() => {
|
|
|
13904
14411
|
this._touchController.destroy();
|
|
13905
14412
|
document.removeEventListener("keydown", this.handleKeydown);
|
|
13906
14413
|
this.navigationController.destroy();
|
|
14414
|
+
(_b = this.cacheManager) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
13907
14415
|
}
|
|
13908
14416
|
canBeClosed() {
|
|
13909
14417
|
return this.activeStory ? !this.activeStory.disableClose : false;
|
|
@@ -13973,12 +14481,14 @@ let StoryReaderViewModel = (() => {
|
|
|
13973
14481
|
this.navigationController.navigateStoryWithAnimation(index, action);
|
|
13974
14482
|
}
|
|
13975
14483
|
destroy() {
|
|
14484
|
+
var _b;
|
|
13976
14485
|
if (this.activeStory) {
|
|
13977
14486
|
this.emitCloseEvents(this.activeStory, CloseStoryReaderAction.AppClose);
|
|
13978
14487
|
this.resetReaderToDefaultState(this.activeStory);
|
|
13979
14488
|
}
|
|
13980
14489
|
this.removeAllListeners();
|
|
13981
14490
|
window.removeEventListener("beforeunload", this.handleWindowUnload);
|
|
14491
|
+
(_b = this.cacheManager) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
13982
14492
|
}
|
|
13983
14493
|
closeGoodsWidget() {
|
|
13984
14494
|
var _b;
|
|
@@ -14049,7 +14559,7 @@ let StoryReaderViewModel = (() => {
|
|
|
14049
14559
|
setStories(stories) {
|
|
14050
14560
|
const slideApiHandlersFactory = new StorySlideApiHandlersFactory(this.storyManager, this, this.storyReaderStatisticV1Service, this.storyReaderStatisticV2Service);
|
|
14051
14561
|
for (const story of stories) {
|
|
14052
|
-
this._stories.push(new StoryViewModel(this.storyManager, this, story, slideApiHandlersFactory, this.storyReaderStatisticV1Service, this.storyReaderStatisticV2Service));
|
|
14562
|
+
this._stories.push(new StoryViewModel(this.storyManager, this, story, slideApiHandlersFactory, this.storyReaderStatisticV1Service, this.storyReaderStatisticV2Service, this.cacheManager));
|
|
14053
14563
|
}
|
|
14054
14564
|
}
|
|
14055
14565
|
handleKeydown(e) {
|
|
@@ -14104,6 +14614,11 @@ let StoryReaderViewModel = (() => {
|
|
|
14104
14614
|
_get_reachEnd_decorators = [external_mobx_namespaceObject.computed];
|
|
14105
14615
|
_open_decorators = [external_mobx_namespaceObject.action];
|
|
14106
14616
|
_close_decorators = [external_mobx_namespaceObject.action];
|
|
14617
|
+
_showStory_decorators = [noConcurrent];
|
|
14618
|
+
_showStoryOnce_decorators = [noConcurrent];
|
|
14619
|
+
_showStoryFromSharePage_decorators = [noConcurrent];
|
|
14620
|
+
_showOnboardingStories_decorators = [noConcurrent];
|
|
14621
|
+
_showMultipleStories_decorators = [noConcurrent];
|
|
14107
14622
|
_reloadStory_decorators = [external_mobx_namespaceObject.action];
|
|
14108
14623
|
_nextStory_decorators = [external_mobx_namespaceObject.action];
|
|
14109
14624
|
_prevStory_decorators = [external_mobx_namespaceObject.action];
|
|
@@ -14123,6 +14638,11 @@ let StoryReaderViewModel = (() => {
|
|
|
14123
14638
|
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);
|
|
14124
14639
|
storyReaderViewModel_esDecorate(_a, null, _open_decorators, { kind: "method", name: "open", static: false, private: false, access: { has: obj => "open" in obj, get: obj => obj.open }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
14125
14640
|
storyReaderViewModel_esDecorate(_a, null, _close_decorators, { kind: "method", name: "close", static: false, private: false, access: { has: obj => "close" in obj, get: obj => obj.close }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
14641
|
+
storyReaderViewModel_esDecorate(_a, null, _showStory_decorators, { kind: "method", name: "showStory", static: false, private: false, access: { has: obj => "showStory" in obj, get: obj => obj.showStory }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
14642
|
+
storyReaderViewModel_esDecorate(_a, null, _showStoryOnce_decorators, { kind: "method", name: "showStoryOnce", static: false, private: false, access: { has: obj => "showStoryOnce" in obj, get: obj => obj.showStoryOnce }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
14643
|
+
storyReaderViewModel_esDecorate(_a, null, _showStoryFromSharePage_decorators, { kind: "method", name: "showStoryFromSharePage", static: false, private: false, access: { has: obj => "showStoryFromSharePage" in obj, get: obj => obj.showStoryFromSharePage }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
14644
|
+
storyReaderViewModel_esDecorate(_a, null, _showOnboardingStories_decorators, { kind: "method", name: "showOnboardingStories", static: false, private: false, access: { has: obj => "showOnboardingStories" in obj, get: obj => obj.showOnboardingStories }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
14645
|
+
storyReaderViewModel_esDecorate(_a, null, _showMultipleStories_decorators, { kind: "method", name: "showMultipleStories", static: false, private: false, access: { has: obj => "showMultipleStories" in obj, get: obj => obj.showMultipleStories }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
14126
14646
|
storyReaderViewModel_esDecorate(_a, null, _reloadStory_decorators, { kind: "method", name: "reloadStory", static: false, private: false, access: { has: obj => "reloadStory" in obj, get: obj => obj.reloadStory }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
14127
14647
|
storyReaderViewModel_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);
|
|
14128
14648
|
storyReaderViewModel_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);
|
|
@@ -15140,8 +15660,12 @@ let StoryManagerConfig = (() => {
|
|
|
15140
15660
|
});
|
|
15141
15661
|
_StoryManagerConfig__anonymous_accessor_storage.set(this, storyManagerConfig_runInitializers(this, __anonymous_initializers, false));
|
|
15142
15662
|
_StoryManagerConfig__options_accessor_storage.set(this, (storyManagerConfig_runInitializers(this, __anonymous_extraInitializers), storyManagerConfig_runInitializers(this, __options_initializers, {})));
|
|
15143
|
-
|
|
15144
|
-
|
|
15663
|
+
Object.defineProperty(this, "_cache", {
|
|
15664
|
+
enumerable: true,
|
|
15665
|
+
configurable: true,
|
|
15666
|
+
writable: true,
|
|
15667
|
+
value: (storyManagerConfig_runInitializers(this, __options_extraInitializers), null)
|
|
15668
|
+
});
|
|
15145
15669
|
this.update(configDto);
|
|
15146
15670
|
this._isInited = true;
|
|
15147
15671
|
}
|
|
@@ -15187,6 +15711,9 @@ let StoryManagerConfig = (() => {
|
|
|
15187
15711
|
get options() {
|
|
15188
15712
|
return this._options;
|
|
15189
15713
|
}
|
|
15714
|
+
get cache() {
|
|
15715
|
+
return this._cache;
|
|
15716
|
+
}
|
|
15190
15717
|
disableStatistic() {
|
|
15191
15718
|
this._isStatisticsDisabled = true;
|
|
15192
15719
|
}
|
|
@@ -15271,7 +15798,7 @@ let StoryManagerConfig = (() => {
|
|
|
15271
15798
|
this._options = options;
|
|
15272
15799
|
}
|
|
15273
15800
|
update(configDto) {
|
|
15274
|
-
var _b, _c, _d, _e, _f;
|
|
15801
|
+
var _b, _c, _d, _e, _f, _g;
|
|
15275
15802
|
this._appPackageId = (_b = configDto.appPackageId) !== null && _b !== void 0 ? _b : "";
|
|
15276
15803
|
this._disableDeviceId = Boolean(configDto.disableDeviceId);
|
|
15277
15804
|
this.setOptions(configDto.options);
|
|
@@ -15283,6 +15810,7 @@ let StoryManagerConfig = (() => {
|
|
|
15283
15810
|
this.setImagePlaceholders((_e = configDto.imagePlaceholders) !== null && _e !== void 0 ? _e : {});
|
|
15284
15811
|
this.setTags((_f = configDto.tags) !== null && _f !== void 0 ? _f : []);
|
|
15285
15812
|
this.setDir(configDto.dir);
|
|
15813
|
+
this._cache = configDto.cache ? Object.assign(Object.assign({}, configDto.cache), { prefetch: (_g = configDto.cache.prefetch) !== null && _g !== void 0 ? _g : true }) : null;
|
|
15286
15814
|
}
|
|
15287
15815
|
mapTextPlaceholders(textPlaceholderDtos) {
|
|
15288
15816
|
const textPlaceholders = [];
|
|
@@ -15388,6 +15916,9 @@ class NullStoryManagerConfig {
|
|
|
15388
15916
|
get options() {
|
|
15389
15917
|
return {};
|
|
15390
15918
|
}
|
|
15919
|
+
get cache() {
|
|
15920
|
+
return null;
|
|
15921
|
+
}
|
|
15391
15922
|
disableStatistic() { }
|
|
15392
15923
|
enableStatistic() { }
|
|
15393
15924
|
async setApiKey(apiKey) { }
|
|
@@ -17146,7 +17677,7 @@ let IamReaderViewModel = (() => {
|
|
|
17146
17677
|
this.clearActiveMessage();
|
|
17147
17678
|
this.visibilityObserver.unsubscribe();
|
|
17148
17679
|
this.touchController.destroy();
|
|
17149
|
-
this.scrollbarHelper.
|
|
17680
|
+
this.scrollbarHelper.disable();
|
|
17150
17681
|
}
|
|
17151
17682
|
async close() {
|
|
17152
17683
|
var _b;
|
|
@@ -17159,7 +17690,7 @@ let IamReaderViewModel = (() => {
|
|
|
17159
17690
|
this.touchController.init(document.body);
|
|
17160
17691
|
this.setActiveMessage(message);
|
|
17161
17692
|
this.visibilityObserver.subscribe();
|
|
17162
|
-
this.scrollbarHelper.
|
|
17693
|
+
this.scrollbarHelper.enable();
|
|
17163
17694
|
}
|
|
17164
17695
|
destroy() { }
|
|
17165
17696
|
emitWidgetEvent(widgetEvent) {
|
|
@@ -20434,7 +20965,7 @@ class UgcEditorStore {
|
|
|
20434
20965
|
const session = await this.storyManager.rootStore.sessionStore.open();
|
|
20435
20966
|
const ugcEditorConfigDto = await this.ugcEditorApi.fetchUgcEditorConfig();
|
|
20436
20967
|
const storyManagerConfig = this.storyManager.config;
|
|
20437
|
-
const sdkVersion = "1.7.
|
|
20968
|
+
const sdkVersion = "1.7.10";
|
|
20438
20969
|
this._config = {
|
|
20439
20970
|
sessionId: session.id,
|
|
20440
20971
|
apiKey: storyManagerConfig.apiKey,
|
|
@@ -20866,11 +21397,11 @@ class StoryManager extends TypedEventEmitter {
|
|
|
20866
21397
|
return this._userAgent;
|
|
20867
21398
|
}
|
|
20868
21399
|
get sdkVersionName() {
|
|
20869
|
-
const sdkVersionName = "1.7.
|
|
21400
|
+
const sdkVersionName = "1.7.10";
|
|
20870
21401
|
return sdkVersionName || "0.0.0";
|
|
20871
21402
|
}
|
|
20872
21403
|
get sdkVersionCode() {
|
|
20873
|
-
const sdkVersionCode =
|
|
21404
|
+
const sdkVersionCode = 10710;
|
|
20874
21405
|
return sdkVersionCode ? parseInt(sdkVersionCode) : 0;
|
|
20875
21406
|
}
|
|
20876
21407
|
get lang() {
|
|
@@ -20927,7 +21458,7 @@ class StoryManager extends TypedEventEmitter {
|
|
|
20927
21458
|
this.rootStore.storyManagerConfigStore.setConfig(configDto);
|
|
20928
21459
|
}
|
|
20929
21460
|
setUserAgent(userAgent) {
|
|
20930
|
-
const sdkVersionCode =
|
|
21461
|
+
const sdkVersionCode = 10710;
|
|
20931
21462
|
const buildVersion = sdkVersionCode ? parseInt(sdkVersionCode) : 0;
|
|
20932
21463
|
// According to RFC5987, HTTP header values can legitimately be supplied using the ISO-8859-1 encoding.
|
|
20933
21464
|
this._userAgent = `${userAgent} ${convertStrToLatin1(navigator.userAgent)}`;
|
|
@@ -25047,8 +25578,7 @@ const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) =
|
|
|
25047
25578
|
const shouldHideHeader = isDesktopGeometry && useModernLayout
|
|
25048
25579
|
? !isActiveStory || story.pauseState.isUIPaused
|
|
25049
25580
|
: story.pauseState.isUIPaused;
|
|
25050
|
-
const shouldHideActionPanel = isDesktopGeometry &&
|
|
25051
|
-
((useModernLayout && !isActiveStory) || story.textInput.isOpened);
|
|
25581
|
+
const shouldHideActionPanel = isDesktopGeometry && ((useModernLayout && !isActiveStory) || story.textInput.isOpened);
|
|
25052
25582
|
(0,external_react_namespaceObject.useLayoutEffect)(() => {
|
|
25053
25583
|
const bottomOffset = parseFloat(String(storyReaderOptions.actionPanelBottomOffset));
|
|
25054
25584
|
story.actionPanel.setOptions(commonOptions);
|
|
@@ -25072,7 +25602,7 @@ const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) =
|
|
|
25072
25602
|
story.sharePanel.completeNativeSharing({ result: false });
|
|
25073
25603
|
}, onTouchStart: () => {
|
|
25074
25604
|
story.sharePanel.completeNativeSharing({ result: false });
|
|
25075
|
-
}, "data-testid": "story", children: [isDesktopGeometry && useModernLayout && (
|
|
25605
|
+
}, "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, 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 })] }));
|
|
25076
25606
|
});
|
|
25077
25607
|
|
|
25078
25608
|
;// CONCATENATED MODULE: ./src/StoryReader/Story/index.ts
|
|
@@ -25419,7 +25949,7 @@ const ModernStoryList = (0,external_mobx_react_lite_namespaceObject.observer)((p
|
|
|
25419
25949
|
if (uiDisabled)
|
|
25420
25950
|
return;
|
|
25421
25951
|
props.storyReader.toStoryWithAnimationByIndex(index);
|
|
25422
|
-
}, 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) && ((0,jsx_runtime_namespaceObject.jsx)(ModernStoryListControls, { dir: props.storyReader.dir, display: isActiveStory && activeStory.canBeShown, disabled: uiDisabled, isNextDisabled: isNextDisabled, isPrevDisabled: isPrevDisabled, navigationOptions: storyReaderOptions.navigation, onNext: () => {
|
|
25952
|
+
}, 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: () => {
|
|
25423
25953
|
props.storyReader.goNext();
|
|
25424
25954
|
}, onPrev: () => {
|
|
25425
25955
|
props.storyReader.goPrev();
|