@inappstory/react-sdk 1.8.0-rc.8 → 1.8.0

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.
@@ -1,7 +1,5 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_lodash_isFunction_js_8e5fd566__ from "lodash/isFunction.js";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_uuid__ from "uuid";
3
- import * as __WEBPACK_EXTERNAL_MODULE_lodash_isObject_js_84bb7d23__ from "lodash/isObject.js";
4
- import * as __WEBPACK_EXTERNAL_MODULE_lodash_isNil_js_d3a2677a__ from "lodash/isNil.js";
5
3
  import * as __WEBPACK_EXTERNAL_MODULE_mobx__ from "mobx";
6
4
  import * as __WEBPACK_EXTERNAL_MODULE_lodash_isString_js_204e00fb__ from "lodash/isString.js";
7
5
  import * as __WEBPACK_EXTERNAL_MODULE_bowser__ from "bowser";
@@ -12,6 +10,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_lodash_debounce_js_35379ba8__ from "lodash
12
10
  import * as __WEBPACK_EXTERNAL_MODULE__inappstory_slide_api_2e636188__ from "@inappstory/slide-api";
13
11
  import * as __WEBPACK_EXTERNAL_MODULE_async_mutex_052338b1__ from "async-mutex";
14
12
  import * as __WEBPACK_EXTERNAL_MODULE_lodash_isEmpty_js_f1e1789b__ from "lodash/isEmpty.js";
13
+ import * as __WEBPACK_EXTERNAL_MODULE_lodash_isObject_js_84bb7d23__ from "lodash/isObject.js";
15
14
  import * as __WEBPACK_EXTERNAL_MODULE_lodash_isNumber_js_09f2ee09__ from "lodash/isNumber.js";
16
15
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_179142b8__ from "react/jsx-runtime";
17
16
  import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
@@ -2175,7 +2174,7 @@ function convertModelToFormData(formData, data, previousKey) {
2175
2174
  ;// CONCATENATED MODULE: ../core/src/api/exceptions/apiRequestError.ts
2176
2175
  class ApiRequestError extends Error {
2177
2176
  constructor(networkStatus, networkMessage, response) {
2178
- super();
2177
+ super(networkMessage);
2179
2178
  Object.defineProperty(this, "name", {
2180
2179
  enumerable: true,
2181
2180
  configurable: true,
@@ -2204,7 +2203,7 @@ class ApiRequestError extends Error {
2204
2203
  this.networkStatus = networkStatus;
2205
2204
  this.networkMessage = networkMessage;
2206
2205
  this.response = response !== null && response !== void 0 ? response : null;
2207
- console.error({ name: this.name, networkStatus, networkMessage, response });
2206
+ /* console.error({ name: this.name, networkStatus, networkMessage, response }); */
2208
2207
  }
2209
2208
  static createByRequestError(response) {
2210
2209
  return new ApiRequestError(null, JSON.stringify(response.data), response);
@@ -2212,23 +2211,13 @@ class ApiRequestError extends Error {
2212
2211
  static createByFetchError(error) {
2213
2212
  const isOnline = window.navigator && window.navigator.onLine;
2214
2213
  if (isOnline)
2215
- return new ApiRequestError(null, error.message);
2214
+ return new ApiRequestError(null, error.name === "AbortError"
2215
+ ? "The operation was aborted by the AbortController signal. Make sure you don't destroy the InAppStoryManager while it's running."
2216
+ : error.message);
2216
2217
  return new ApiRequestError(null, "net::ERR_INTERNET_DISCONNECTED");
2217
2218
  }
2218
2219
  }
2219
2220
 
2220
- ;// CONCATENATED MODULE: external "lodash/isObject.js"
2221
- var isObject_js_x = (y) => {
2222
- var x = {}; __webpack_require__.d(x, y); return x
2223
- }
2224
- var isObject_js_y = (x) => (() => (x))
2225
- const isObject_js_namespaceObject = isObject_js_x({ ["default"]: () => (__WEBPACK_EXTERNAL_MODULE_lodash_isObject_js_84bb7d23__["default"]) });
2226
- ;// CONCATENATED MODULE: external "lodash/isNil.js"
2227
- var isNil_js_x = (y) => {
2228
- var x = {}; __webpack_require__.d(x, y); return x
2229
- }
2230
- var isNil_js_y = (x) => (() => (x))
2231
- const isNil_js_namespaceObject = isNil_js_x({ ["default"]: () => (__WEBPACK_EXTERNAL_MODULE_lodash_isNil_js_d3a2677a__["default"]) });
2232
2221
  ;// CONCATENATED MODULE: ../core/src/helpers/classificators/isNumeric.ts
2233
2222
  function isNumeric(str) {
2234
2223
  if (typeof str != "string")
@@ -2417,11 +2406,39 @@ function queryCache(originalMethod, context) {
2417
2406
  };
2418
2407
  }
2419
2408
 
2409
+ ;// CONCATENATED MODULE: ../core/src/helpers/decorators/safeCustomElement.ts
2410
+ /**
2411
+ * HMR-safe version of @customElement
2412
+ * Prevents an error when re-registering a component.
2413
+ */
2414
+ function safeCustomElement(tagName) {
2415
+ return function (classDef, context) {
2416
+ const defineIfNeeded = (ctor) => {
2417
+ if (!customElements.get(tagName)) {
2418
+ customElements.define(tagName, ctor);
2419
+ }
2420
+ else {
2421
+ console.warn(`[IAS] Element "${tagName}" is already registered. Skipping re-definition`);
2422
+ }
2423
+ };
2424
+ // New decorator specification: context is available and has addInitializer
2425
+ if (context && typeof context.addInitializer === "function") {
2426
+ context.addInitializer(() => defineIfNeeded(classDef));
2427
+ }
2428
+ else {
2429
+ // Legacy-style decorators: just call define right away
2430
+ defineIfNeeded(classDef);
2431
+ }
2432
+ return classDef;
2433
+ };
2434
+ }
2435
+
2420
2436
  ;// CONCATENATED MODULE: ../core/src/helpers/decorators/index.ts
2421
2437
 
2422
2438
 
2423
2439
 
2424
2440
 
2441
+
2425
2442
  ;// CONCATENATED MODULE: ../core/src/helpers/encodeSvg.ts
2426
2443
  const symbols = /[\r\n%#()<>?[\\\]^`{|}]/g;
2427
2444
  function encodeSVG(data, externalQuotesValue = "double") {
@@ -3116,6 +3133,41 @@ class DeviceDescriptor {
3116
3133
  }
3117
3134
  const deviceDescriptor = new DeviceDescriptor();
3118
3135
 
3136
+ ;// CONCATENATED MODULE: ../core/src/api/InterceptorManager.ts
3137
+ class InterceptorManager {
3138
+ constructor() {
3139
+ Object.defineProperty(this, "handlers", {
3140
+ enumerable: true,
3141
+ configurable: true,
3142
+ writable: true,
3143
+ value: []
3144
+ });
3145
+ }
3146
+ use(fulfilled, rejected) {
3147
+ this.handlers.push({ fulfilled, rejected });
3148
+ return this.handlers.length - 1;
3149
+ }
3150
+ async run(value) {
3151
+ let current = Promise.resolve(value);
3152
+ for (const h of this.handlers) {
3153
+ current = current.then(h.fulfilled, h.rejected);
3154
+ }
3155
+ return current;
3156
+ }
3157
+ }
3158
+
3159
+ ;// CONCATENATED MODULE: ../core/src/api/exceptions/apiAbortRequestError.ts
3160
+ class IasAbortRequestError extends Error {
3161
+ constructor(url) {
3162
+ super(`The request with URL <${url}> was aborted. Make sure you don't destroy the InAppStoryManager while it's running.`);
3163
+ this.name = "IasAbortRequestError";
3164
+ }
3165
+ }
3166
+
3167
+ ;// CONCATENATED MODULE: ../core/src/api/exceptions/index.ts
3168
+
3169
+
3170
+
3119
3171
  ;// CONCATENATED MODULE: ../core/src/api/api.ts
3120
3172
 
3121
3173
 
@@ -3124,9 +3176,6 @@ const deviceDescriptor = new DeviceDescriptor();
3124
3176
 
3125
3177
 
3126
3178
 
3127
- function mergeObjects(obj1, obj2) {
3128
- return Object.assign(Object.assign({}, obj1), obj2);
3129
- }
3130
3179
  class API {
3131
3180
  constructor(config) {
3132
3181
  var _a;
@@ -3136,122 +3185,129 @@ class API {
3136
3185
  writable: true,
3137
3186
  value: void 0
3138
3187
  });
3139
- Object.defineProperty(this, "_deviceInfoPromise", {
3140
- enumerable: true,
3141
- configurable: true,
3142
- writable: true,
3143
- value: null
3144
- });
3145
3188
  Object.defineProperty(this, "_baseHeaders", {
3146
3189
  enumerable: true,
3147
3190
  configurable: true,
3148
3191
  writable: true,
3149
3192
  value: {}
3150
3193
  });
3151
- Object.defineProperty(this, "requestInterceptors", {
3152
- enumerable: true,
3153
- configurable: true,
3154
- writable: true,
3155
- value: []
3156
- });
3157
3194
  Object.defineProperty(this, "interceptors", {
3158
3195
  enumerable: true,
3159
3196
  configurable: true,
3160
3197
  writable: true,
3161
3198
  value: {
3162
- request: {
3163
- use: (cb) => {
3164
- this.requestInterceptors.push(cb);
3165
- }
3166
- }
3199
+ request: new InterceptorManager(),
3200
+ response: new InterceptorManager()
3167
3201
  }
3168
3202
  });
3169
3203
  this._baseURL = (_a = config === null || config === void 0 ? void 0 : config.baseURL) !== null && _a !== void 0 ? _a : "";
3170
3204
  }
3171
- set deviceInfoPromise(promise) {
3172
- this._deviceInfoPromise = promise;
3173
- }
3174
- set baseHeaders(headers) {
3175
- this._baseHeaders = headers;
3176
- }
3177
3205
  get baseURL() {
3178
3206
  return this._baseURL;
3179
3207
  }
3180
3208
  set baseURL(value) {
3181
3209
  this._baseURL = value;
3182
3210
  }
3211
+ set baseHeaders(headers) {
3212
+ this._baseHeaders = headers;
3213
+ }
3183
3214
  async request(config) {
3184
- return new Promise((resolve, reject) => {
3185
- const cb = async () => {
3186
- try {
3187
- if (!(0,isObject_js_namespaceObject["default"])(config.headers) || config.headers == null) {
3188
- config.headers = {};
3189
- }
3190
- config.headers = mergeObjects(this._baseHeaders, config.headers);
3191
- if (this.requestInterceptors.length) {
3192
- for (const interceptor of this.requestInterceptors) {
3193
- interceptor(config);
3194
- }
3195
- }
3196
- let search = "";
3197
- if (!(0,isNil_js_namespaceObject["default"])(config.params) && (0,isObject_js_namespaceObject["default"])(config.params)) {
3198
- search = new URLSearchParams(Object.entries(config.params).filter(([key, value]) => value != null && value !== "")).toString();
3199
- }
3200
- let url = new URL(`${trimStartSlash(config.url)}${search ? "?" + search : ""}`, this._baseURL);
3201
- let method = "GET";
3202
- if (!(0,isNil_js_namespaceObject["default"])(config.method)) {
3203
- method = config.method.toUpperCase();
3204
- }
3205
- let headers = {};
3206
- if (!(0,isNil_js_namespaceObject["default"])(config.headers) && (0,isObject_js_namespaceObject["default"])(config.headers)) {
3207
- headers = config.headers;
3208
- }
3209
- let body = null;
3210
- if (!(0,isNil_js_namespaceObject["default"])(config.data) && (0,isObject_js_namespaceObject["default"])(config.data)) {
3211
- body = JSON.stringify(config.data);
3212
- headers["Content-Type"] = "application/json";
3213
- }
3214
- const response = await fetch(url.toString(), {
3215
- method,
3216
- body: method === "GET" || method === "HEAD" ? null : body, // If the request method is GET or HEAD and the body is non-null or not undefined <fetch> throws a network error..
3217
- headers,
3218
- credentials: "omit"
3219
- });
3220
- let json = {};
3221
- if (response.status !== 204)
3222
- json = await response.json();
3223
- const apiResponse = {
3224
- data: json,
3225
- headersRaw: response.headers,
3226
- // @ts-ignore
3227
- headers: Object.fromEntries([...response.headers]),
3228
- status: response.status,
3229
- statusText: response.statusText,
3230
- ok: response.ok
3231
- };
3232
- if (!response.ok) {
3233
- reject(ApiRequestError.createByRequestError(apiResponse));
3234
- return;
3235
- }
3236
- resolve(apiResponse);
3237
- }
3238
- catch (error) {
3239
- reject(ApiRequestError.createByFetchError(error));
3240
- }
3241
- };
3242
- if (this._deviceInfoPromise) {
3243
- this._deviceInfoPromise.finally(cb);
3215
+ try {
3216
+ const processedConfig = await this.interceptors.request.run(config);
3217
+ const response = await this.dispatchRequest(processedConfig);
3218
+ return await this.interceptors.response.run(response);
3219
+ }
3220
+ catch (error) {
3221
+ if (error instanceof ApiRequestError)
3222
+ throw error;
3223
+ throw ApiRequestError.createByFetchError(error);
3224
+ }
3225
+ }
3226
+ get(url, config = {}) {
3227
+ return this.request(Object.assign(Object.assign({}, config), { method: "get", url }));
3228
+ }
3229
+ post(url, data, config = {}) {
3230
+ return this.request(Object.assign(Object.assign({}, config), { method: "post", url, data }));
3231
+ }
3232
+ put(url, data, config = {}) {
3233
+ return this.request(Object.assign(Object.assign({}, config), { method: "put", url, data }));
3234
+ }
3235
+ patch(url, data, config = {}) {
3236
+ return this.request(Object.assign(Object.assign({}, config), { method: "patch", url, data }));
3237
+ }
3238
+ async dispatchRequest(config) {
3239
+ const headers = Object.assign(Object.assign({}, this._baseHeaders), config.headers);
3240
+ const url = this.buildURL(config.url, config.params);
3241
+ const method = config.method ? config.method.toUpperCase() : "GET";
3242
+ let body = null;
3243
+ if (config.data) {
3244
+ body = JSON.stringify(this.buildBody(config.data));
3245
+ headers["Content-Type"] = "application/json";
3246
+ }
3247
+ const response = await fetch(url.toString(), {
3248
+ method,
3249
+ body: method === "GET" || method === "HEAD" ? null : body, // If the request method is GET or HEAD and the body is non-null or not undefined <fetch> throws a network error..
3250
+ headers,
3251
+ credentials: "omit",
3252
+ signal: config.signal
3253
+ });
3254
+ let data = {};
3255
+ if (response.status !== 204) {
3256
+ try {
3257
+ data = await response.json();
3258
+ }
3259
+ catch (_a) {
3260
+ data = {};
3261
+ }
3262
+ }
3263
+ const result = {
3264
+ data,
3265
+ status: response.status,
3266
+ statusText: response.statusText,
3267
+ headersRaw: response.headers,
3268
+ headers: Object.fromEntries(response.headers.entries()),
3269
+ ok: response.ok
3270
+ };
3271
+ if (!response.ok)
3272
+ throw ApiRequestError.createByRequestError(result);
3273
+ return result;
3274
+ }
3275
+ buildURL(url, params) {
3276
+ const qs = params ? new URLSearchParams(this.buildQuery(params)).toString() : "";
3277
+ return new URL(`${trimStartSlash(url)}${qs ? "?" + qs : ""}`, this._baseURL);
3278
+ }
3279
+ buildQuery(obj, prefix) {
3280
+ const pairs = [];
3281
+ for (const [key, value] of Object.entries(obj)) {
3282
+ if (value == null || value === "" || Number.isNaN(value))
3283
+ continue;
3284
+ const fullKey = prefix ? `${prefix}[${key}]` : key;
3285
+ if (typeof value === "object" && !Array.isArray(value)) {
3286
+ pairs.push(...this.buildQuery(value, fullKey));
3244
3287
  }
3245
3288
  else {
3246
- cb();
3289
+ pairs.push([fullKey, value]);
3247
3290
  }
3248
- });
3249
- }
3250
- async post(path, data, params = {}) {
3251
- return this.request({ method: "post", url: path, data, params });
3291
+ }
3292
+ return pairs;
3252
3293
  }
3253
- async get(path, params = {}) {
3254
- return this.request({ method: "get", url: path, params });
3294
+ buildBody(obj) {
3295
+ const result = {};
3296
+ for (const [key, value] of Object.entries(obj)) {
3297
+ if (value == null || value === "") {
3298
+ continue;
3299
+ }
3300
+ if (typeof value === "object" && !Array.isArray(value)) {
3301
+ const filteredNested = this.buildBody(value);
3302
+ if (Object.keys(filteredNested).length) {
3303
+ result[key] = filteredNested;
3304
+ }
3305
+ }
3306
+ else {
3307
+ result[key] = value;
3308
+ }
3309
+ }
3310
+ return result;
3255
3311
  }
3256
3312
  }
3257
3313
  const APIInstance = new API();
@@ -3260,14 +3316,13 @@ APIInstance.interceptors.request.use(config => {
3260
3316
  const storyManagerConfig = storyManager.config;
3261
3317
  const session = storyManager.rootStore.sessionStore.session;
3262
3318
  const sessionId = session === null || session === void 0 ? void 0 : session.id;
3263
- config.headers = mergeObjects((_a = config.headers) !== null && _a !== void 0 ? _a : {}, {
3264
- Authorization: `Bearer ${storyManagerConfig.apiKey}`,
3265
- "Accept-Language": storyManagerConfig.lang.toString(),
3266
- "X-Request-Id": (0,external_uuid_namespaceObject.v4)(),
3267
- "X-User-Agent": storyManager.userAgent
3268
- });
3319
+ if (!storyManagerConfig.apiKey)
3320
+ throw new IasAbortRequestError(config.url);
3321
+ if (!Boolean((_a = config.meta) === null || _a === void 0 ? void 0 : _a.public) && !sessionId)
3322
+ throw new IasAbortRequestError(config.url);
3323
+ config.headers = Object.assign(Object.assign({}, config.headers), { Authorization: `Bearer ${storyManagerConfig.apiKey}`, "Accept-Language": storyManagerConfig.lang.toString(), "X-Request-Id": (0,external_uuid_namespaceObject.v4)(), "X-User-Agent": storyManager.userAgent });
3269
3324
  if (storyManagerConfig.userId && !storyManagerConfig.anonymous) {
3270
- config.headers["X-User-Id"] = storyManagerConfig.userId;
3325
+ config.headers["X-User-Id"] = storyManagerConfig.userId.toString();
3271
3326
  }
3272
3327
  if (sessionId) {
3273
3328
  config.headers["Auth-Session-Id"] = sessionId;
@@ -3450,7 +3505,7 @@ var __esDecorate = (undefined && undefined.__esDecorate) || function (ctor, desc
3450
3505
 
3451
3506
 
3452
3507
 
3453
- const messageFields = "campaign_name,id,events,appearance,slides_html,type,frequency_limit,display_to,display_from,need_placeholders,has_limit";
3508
+ const messageFields = "campaign_name,id,events,appearance,slides_html,type,frequency_limit,display_to,display_from,disable_close,need_placeholders,has_limit";
3454
3509
  const messageFieldsWithPrefix = messageFields
3455
3510
  .split(",")
3456
3511
  .map(field => `messages.${field}`)
@@ -3470,23 +3525,29 @@ let IamApi = (() => {
3470
3525
  value: (__runInitializers(this, _instanceExtraInitializers), storyManager)
3471
3526
  });
3472
3527
  }
3473
- async fetchAll({ tags }) {
3474
- const response = await api.get("inappmessaging", {
3475
- fields: messageFieldsWithPrefix,
3476
- tag: tags.join(",")
3528
+ async fetchAll({ tags, options }) {
3529
+ const response = await api.post("inappmessaging", {
3530
+ tags: tags.join(","),
3531
+ options
3532
+ }, {
3533
+ params: {
3534
+ fields: messageFieldsWithPrefix
3535
+ }
3477
3536
  });
3478
3537
  return response.data.messages;
3479
3538
  }
3480
3539
  async fetchContext() {
3481
3540
  const response = await api.get("inappmessaging/message-context", {
3482
- fields: "style,widgetsData"
3541
+ params: { fields: "style,widgetsData" }
3483
3542
  });
3484
3543
  return response.data;
3485
3544
  }
3486
3545
  async fetchById(messageId) {
3487
3546
  const response = await api.get(`inappmessaging/message/${messageId}`, {
3488
- expand: "slides_html",
3489
- fields: messageFields
3547
+ params: {
3548
+ expand: "slides_html",
3549
+ fields: messageFields
3550
+ }
3490
3551
  });
3491
3552
  const messageDto = response.data;
3492
3553
  if (!messageDto)
@@ -3503,7 +3564,9 @@ let IamApi = (() => {
3503
3564
  });
3504
3565
  return;
3505
3566
  }
3506
- await api.post(`/inappmessaging/message/${messageId}/event/${messageEvent.type}`, {}, messageEvent.toQueryParams());
3567
+ await api.post(`/inappmessaging/message/${messageId}/event/${messageEvent.type}`, {}, {
3568
+ params: messageEvent.toQueryParams()
3569
+ });
3507
3570
  }
3508
3571
  catch (error) {
3509
3572
  console.error(error);
@@ -3572,13 +3635,21 @@ let IamApi = (() => {
3572
3635
  ;// CONCATENATED MODULE: ../core/src/domain/inAppMessaging/models/appearanceOptions/iamCommonAppearanceOptions.ts
3573
3636
  class IamAppearanceCommonOptions {
3574
3637
  constructor(optionsDto) {
3638
+ var _a;
3575
3639
  Object.defineProperty(this, "background", {
3576
3640
  enumerable: true,
3577
3641
  configurable: true,
3578
3642
  writable: true,
3579
3643
  value: void 0
3580
3644
  });
3645
+ Object.defineProperty(this, "cardAppearance", {
3646
+ enumerable: true,
3647
+ configurable: true,
3648
+ writable: true,
3649
+ value: {}
3650
+ });
3581
3651
  this.background = this.mapBackgroundDtoToModel(optionsDto.background);
3652
+ this.cardAppearance = (_a = optionsDto.card_appearance) !== null && _a !== void 0 ? _a : {};
3582
3653
  }
3583
3654
  mapBackgroundDtoToModel(backgroundDto) {
3584
3655
  if (!backgroundDto || backgroundDto.alpha === 0)
@@ -3884,8 +3955,13 @@ class SessionApi {
3884
3955
  async open(payload) {
3885
3956
  const data = await this.getOpenSessionPayload(payload);
3886
3957
  const response = await api.post("session/open", data, {
3887
- expand: "cache",
3888
- fields: openFields
3958
+ params: {
3959
+ expand: "cache",
3960
+ fields: openFields
3961
+ },
3962
+ meta: {
3963
+ public: true
3964
+ }
3889
3965
  });
3890
3966
  return response.data;
3891
3967
  }
@@ -4458,25 +4534,25 @@ class StoriesApi {
4458
4534
  }
4459
4535
  async fetchStorySlides({ id, feedSlug }) {
4460
4536
  const { url, params } = this.getStoryRequestConfig(id, feedSlug);
4461
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4537
+ const response = await api.get(url, { params });
4462
4538
  return response.data;
4463
4539
  }
4464
4540
  async fetchStory({ id, feedSlug, fetchShareUrl, once }) {
4465
4541
  const { url, params } = this.getStoryRequestConfig(id, feedSlug, true, fetchShareUrl, once);
4466
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4542
+ const response = await api.get(url, { params });
4467
4543
  if (response.status === 204 && once)
4468
4544
  throw new IasStoryAlreadyShownError(id.toString());
4469
4545
  return response.data;
4470
4546
  }
4471
4547
  async fetchStoryContext({ ids }) {
4472
4548
  const { url, params } = this.getStoryContextRequestConfig(ids);
4473
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4549
+ const response = await api.get(url, { params });
4474
4550
  return response.data;
4475
4551
  }
4476
4552
  async fetchStoryCSS() {
4477
4553
  var _a;
4478
4554
  const { url, params } = this.getStoryCSSRequestConfig();
4479
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4555
+ const response = await api.get(url, { params });
4480
4556
  return (_a = response.data.style) !== null && _a !== void 0 ? _a : "";
4481
4557
  }
4482
4558
  async setStoryLike(storyId, like) {
@@ -4508,7 +4584,7 @@ class StoriesApi {
4508
4584
  localStorageSet(key, data);
4509
4585
  }
4510
4586
  async fetchStorySharePath(storyId) {
4511
- const response = await api.get(`story-share/${storyId}`, {});
4587
+ const response = await api.get(`story-share/${storyId}`);
4512
4588
  if (!response.data.url)
4513
4589
  throw new IasShareUrlUndefinedError(storyId);
4514
4590
  return response.data.url;
@@ -4530,7 +4606,7 @@ class StoriesApi {
4530
4606
  const config = {
4531
4607
  url: `${feedSlug === UGCFeedSlug ? "ugc/" : ""}story/${id}`,
4532
4608
  method: "GET",
4533
- params: { expand: expandFields.join(",") }
4609
+ params: { expand: expandFields.join(",") /* , src_list: "true" */ }
4534
4610
  };
4535
4611
  config.params.once = Number(Boolean(once));
4536
4612
  if (!allFields) {
@@ -4574,43 +4650,50 @@ class StoryFeedsApi {
4574
4650
  value: storyManager
4575
4651
  });
4576
4652
  }
4577
- async fetchUgcFeed({ filter, tags, testKey }) {
4653
+ async fetchUgcFeed({ filter, tags, testKey, options }) {
4578
4654
  const url = "ugc/feed";
4579
4655
  const params = {
4580
4656
  tags: tags.join(","),
4581
4657
  test: testKey,
4582
- f: filter && JSON.stringify(filter)
4658
+ f: filter && JSON.stringify(filter),
4659
+ options
4583
4660
  };
4584
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4661
+ const response = await api.get(url, { params });
4585
4662
  return response.data;
4586
4663
  }
4587
- async fetchDefaultFeed({ feedSlug, tags, testKey }) {
4664
+ async fetchDefaultFeed({ feedSlug, tags, testKey, options }) {
4588
4665
  const url = `feed/${feedSlug}`;
4589
- const params = {
4666
+ const response = await api.post(url, {
4590
4667
  tags: tags.join(","),
4591
- test: testKey
4592
- };
4593
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4668
+ options
4669
+ }, {
4670
+ params: {
4671
+ test: testKey
4672
+ }
4673
+ });
4594
4674
  response.data.feedSlug = feedSlug;
4595
4675
  return response.data;
4596
4676
  }
4597
4677
  async fetchFavoriteFeed({ tags }) {
4598
4678
  const url = "story";
4599
- const params = {
4600
- tags: tags.join(","),
4601
- favorite: 1
4602
- };
4603
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4679
+ const response = await api.get(url, {
4680
+ params: {
4681
+ tags: tags.join(","),
4682
+ favorite: 1
4683
+ }
4684
+ });
4604
4685
  return response.data;
4605
4686
  }
4606
4687
  async fetchOnboardingFeed(payload) {
4607
4688
  const url = `feed/${payload.feedSlug}/onboarding`;
4608
- const tags = payload.tags.join(",");
4609
- const params = {
4610
- tags: tags,
4611
- limit: payload.limit
4612
- };
4613
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4689
+ const response = await api.post(url, {
4690
+ tags: payload.tags.join(","),
4691
+ options: payload.options
4692
+ }, {
4693
+ params: {
4694
+ limit: payload.limit
4695
+ }
4696
+ });
4614
4697
  response.data.feedSlug = payload.feedSlug;
4615
4698
  return response.data;
4616
4699
  }
@@ -4676,7 +4759,7 @@ class StatisticV2Api {
4676
4759
  }
4677
4760
  async sendFallbackFetch(path, params) {
4678
4761
  const api = new API({ baseURL: domains.apiUrl });
4679
- await api.get(path, params);
4762
+ await api.get(path, { params });
4680
4763
  }
4681
4764
  }
4682
4765
 
@@ -5078,6 +5161,7 @@ let StorySlide = (() => {
5078
5161
  return this._html;
5079
5162
  }
5080
5163
  constructor(storySlideDto) {
5164
+ var _b, _c;
5081
5165
  _StorySlide__html_accessor_storage.set(this, (storySlide_runInitializers(this, _instanceExtraInitializers), storySlide_runInitializers(this, __html_initializers, "")));
5082
5166
  Object.defineProperty(this, "index", {
5083
5167
  enumerable: true,
@@ -5109,6 +5193,18 @@ let StorySlide = (() => {
5109
5193
  writable: true,
5110
5194
  value: void 0
5111
5195
  });
5196
+ Object.defineProperty(this, "resources", {
5197
+ enumerable: true,
5198
+ configurable: true,
5199
+ writable: true,
5200
+ value: []
5201
+ });
5202
+ Object.defineProperty(this, "_resourcesByBlob", {
5203
+ enumerable: true,
5204
+ configurable: true,
5205
+ writable: true,
5206
+ value: {}
5207
+ });
5112
5208
  this.index = storySlideDto.index;
5113
5209
  this.timeline = {
5114
5210
  foreground: storySlideDto.timeline.foreground,
@@ -5117,6 +5213,17 @@ let StorySlide = (() => {
5117
5213
  this.duration = storySlideDto.duration;
5118
5214
  this.screenshotShare = storySlideDto.screenshot_share;
5119
5215
  this.eventPayload = storySlideDto.event_payload;
5216
+ // TODO: don't map in the slide model.
5217
+ // The model should not know anything about the DTO
5218
+ this.resources =
5219
+ (_c = (_b = storySlideDto.resources) === null || _b === void 0 ? void 0 : _b.map(resource => ({
5220
+ type: resource.type,
5221
+ key: resource.key,
5222
+ url: resource.url,
5223
+ rangeStart: resource.range_start,
5224
+ rangeEnd: resource.range_end,
5225
+ contentType: resource.content_type
5226
+ }))) !== null && _c !== void 0 ? _c : [];
5120
5227
  this._html = this.replaceSlideNonce(storySlideDto.html);
5121
5228
  }
5122
5229
  static createEmpty() {
@@ -5131,16 +5238,39 @@ let StorySlide = (() => {
5131
5238
  html: ""
5132
5239
  });
5133
5240
  }
5134
- replaceSlideNonce(slideHtml) {
5135
- var _b;
5136
- return replaceAll(slideHtml, `{{nonce}}`, (_b = getNonce()) !== null && _b !== void 0 ? _b : "");
5137
- }
5138
5241
  updatePlaceholders(placeholders) {
5139
5242
  let slideHtml = this._html;
5140
5243
  for (const placeholder of placeholders)
5141
5244
  slideHtml = replaceAll(slideHtml, `%${placeholder.key}%`, placeholder.value);
5142
5245
  this._html = slideHtml;
5143
5246
  }
5247
+ applyBlobUrls(resourceUrls, resourcesByBlob) {
5248
+ var _b;
5249
+ let updatedHtml = this._html;
5250
+ for (const resourceUrl of resourceUrls) {
5251
+ const blobUrl = (_b = resourcesByBlob[resourceUrl]) === null || _b === void 0 ? void 0 : _b.blobUrl;
5252
+ if (!blobUrl)
5253
+ continue;
5254
+ updatedHtml = replaceAll(updatedHtml, resourceUrl, blobUrl);
5255
+ this._resourcesByBlob[resourceUrl] = blobUrl;
5256
+ }
5257
+ this._html = updatedHtml;
5258
+ }
5259
+ restoreOriginalResourceUrls() {
5260
+ let restoredHtml = this._html;
5261
+ for (const [resourceUrl, blobUrl] of Object.entries(this._resourcesByBlob)) {
5262
+ restoredHtml = replaceAll(restoredHtml, blobUrl, resourceUrl);
5263
+ }
5264
+ this._html = restoredHtml;
5265
+ }
5266
+ parseResources() {
5267
+ const resources = Array.from(this._html.matchAll(/src="([^"]+)"/gi), t => t[1]).filter(src => !src.startsWith("blob:"));
5268
+ return Array.from(new Set(resources));
5269
+ }
5270
+ replaceSlideNonce(slideHtml) {
5271
+ var _b;
5272
+ return replaceAll(slideHtml, `{{nonce}}`, (_b = getNonce()) !== null && _b !== void 0 ? _b : "");
5273
+ }
5144
5274
  },
5145
5275
  _StorySlide__html_accessor_storage = new WeakMap(),
5146
5276
  (() => {
@@ -7741,7 +7871,7 @@ var external_async_mutex_x = (y) => {
7741
7871
  var x = {}; __webpack_require__.d(x, y); return x
7742
7872
  }
7743
7873
  var external_async_mutex_y = (x) => (() => (x))
7744
- const external_async_mutex_namespaceObject = external_async_mutex_x({ ["Mutex"]: () => (__WEBPACK_EXTERNAL_MODULE_async_mutex_052338b1__.Mutex) });
7874
+ 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) });
7745
7875
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storySlideViewModel/storySlideViewModel.ts
7746
7876
  var storySlideViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
7747
7877
  var useValue = arguments.length > 2;
@@ -7806,7 +7936,7 @@ let StorySlideViewModel = (() => {
7806
7936
  return _a = class StorySlideViewModel {
7807
7937
  get _disabledNextClick() { return storySlideViewModel_classPrivateFieldGet(this, _StorySlideViewModel__disabledNextClick_accessor_storage, "f"); }
7808
7938
  set _disabledNextClick(value) { storySlideViewModel_classPrivateFieldSet(this, _StorySlideViewModel__disabledNextClick_accessor_storage, value, "f"); }
7809
- constructor(_story, _index, slideApi, slide) {
7939
+ constructor(_story, _index, slideApi, slide, cacheManager) {
7810
7940
  Object.defineProperty(this, "_story", {
7811
7941
  enumerable: true,
7812
7942
  configurable: true,
@@ -7831,6 +7961,12 @@ let StorySlideViewModel = (() => {
7831
7961
  writable: true,
7832
7962
  value: slide
7833
7963
  });
7964
+ Object.defineProperty(this, "cacheManager", {
7965
+ enumerable: true,
7966
+ configurable: true,
7967
+ writable: true,
7968
+ value: cacheManager
7969
+ });
7834
7970
  _StorySlideViewModel__disabledNextClick_accessor_storage.set(this, storySlideViewModel_runInitializers(this, __disabledNextClick_initializers, false));
7835
7971
  Object.defineProperty(this, "mutex", {
7836
7972
  enumerable: true,
@@ -7838,6 +7974,30 @@ let StorySlideViewModel = (() => {
7838
7974
  writable: true,
7839
7975
  value: (storySlideViewModel_runInitializers(this, __disabledNextClick_extraInitializers), new external_async_mutex_namespaceObject.Mutex())
7840
7976
  });
7977
+ Object.defineProperty(this, "isInited", {
7978
+ enumerable: true,
7979
+ configurable: true,
7980
+ writable: true,
7981
+ value: false
7982
+ });
7983
+ Object.defineProperty(this, "isStarted", {
7984
+ enumerable: true,
7985
+ configurable: true,
7986
+ writable: true,
7987
+ value: false
7988
+ });
7989
+ Object.defineProperty(this, "preloaded", {
7990
+ enumerable: true,
7991
+ configurable: true,
7992
+ writable: true,
7993
+ value: false
7994
+ });
7995
+ Object.defineProperty(this, "isPreloading", {
7996
+ enumerable: true,
7997
+ configurable: true,
7998
+ writable: true,
7999
+ value: false
8000
+ });
7841
8001
  Object.defineProperty(this, "handleTouchEnd", {
7842
8002
  enumerable: true,
7843
8003
  configurable: true,
@@ -7850,9 +8010,6 @@ let StorySlideViewModel = (() => {
7850
8010
  }
7851
8011
  });
7852
8012
  }
7853
- get state() {
7854
- return this.slideApi.state;
7855
- }
7856
8013
  get index() {
7857
8014
  return this._index;
7858
8015
  }
@@ -7900,6 +8057,8 @@ let StorySlideViewModel = (() => {
7900
8057
  }
7901
8058
  async init() {
7902
8059
  const release = await this.mutex.acquire();
8060
+ if (this.isInited)
8061
+ return;
7903
8062
  let loaderShown = this.story.needShowLoaderScreen;
7904
8063
  let startTime = Date.now();
7905
8064
  const loaderTimeout = setTimeout(() => {
@@ -7912,6 +8071,7 @@ let StorySlideViewModel = (() => {
7912
8071
  const { result, reason } = await this.slideApi.showSlide(this.html);
7913
8072
  if (!result)
7914
8073
  throw new Error(reason);
8074
+ this.isInited = true;
7915
8075
  }
7916
8076
  catch (error) {
7917
8077
  this.handleSlideError(error);
@@ -7925,9 +8085,12 @@ let StorySlideViewModel = (() => {
7925
8085
  async start() {
7926
8086
  const release = await this.mutex.acquire();
7927
8087
  try {
8088
+ if (!this.isInited || this.isStarted)
8089
+ return;
7928
8090
  debug(`[SLIDE][START]:${this.story.id}:${this.slide.index}`);
7929
8091
  await this.slideApi.slideStart({ muted: this._story.muted });
7930
8092
  this.story.touchController.on(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8093
+ this.isStarted = true;
7931
8094
  }
7932
8095
  catch (error) {
7933
8096
  this.handleSlideError(error);
@@ -7942,6 +8105,8 @@ let StorySlideViewModel = (() => {
7942
8105
  this.story.hideErrorScreen();
7943
8106
  this.story.showLoaderScreen();
7944
8107
  await this.slideApi.slideRestart({ muted: this._story.muted });
8108
+ this.isInited = true;
8109
+ this.isStarted = true;
7945
8110
  }
7946
8111
  catch (error) {
7947
8112
  this.handleSlideError(error);
@@ -7954,6 +8119,8 @@ let StorySlideViewModel = (() => {
7954
8119
  async resumeByApp() {
7955
8120
  const release = await this.mutex.acquire();
7956
8121
  try {
8122
+ if (!this.isStarted)
8123
+ return;
7957
8124
  debug(`[SLIDE][RESUME-BY-APP]:${this.story.id}:${this.slide.index}`);
7958
8125
  await this.slideApi.slideAppResume();
7959
8126
  }
@@ -7967,6 +8134,8 @@ let StorySlideViewModel = (() => {
7967
8134
  async pauseByApp() {
7968
8135
  const release = await this.mutex.acquire();
7969
8136
  try {
8137
+ if (!this.isStarted)
8138
+ return;
7970
8139
  debug(`[SLIDE][PAUSE-BY-APP]:${this.story.id}:${this.slide.index}`);
7971
8140
  await this.slideApi.slideAppPause();
7972
8141
  }
@@ -7980,6 +8149,8 @@ let StorySlideViewModel = (() => {
7980
8149
  async resumeByUser() {
7981
8150
  const release = await this.mutex.acquire();
7982
8151
  try {
8152
+ if (!this.isStarted)
8153
+ return;
7983
8154
  debug(`[SLIDE][RESUME-BY-USER]:${this.story.id}:${this.slide.index}`);
7984
8155
  await this.slideApi.slideUserResume();
7985
8156
  }
@@ -7993,6 +8164,8 @@ let StorySlideViewModel = (() => {
7993
8164
  async pauseByUser() {
7994
8165
  const release = await this.mutex.acquire();
7995
8166
  try {
8167
+ if (!this.isStarted)
8168
+ return;
7996
8169
  debug(`[SLIDE][PAUSE-BY-USER]:${this.story.id}:${this.slide.index}`);
7997
8170
  await this.slideApi.slideUserPause();
7998
8171
  }
@@ -8006,6 +8179,8 @@ let StorySlideViewModel = (() => {
8006
8179
  async stop(params) {
8007
8180
  const release = await this.mutex.acquire();
8008
8181
  try {
8182
+ if (!this.isInited || !this.isStarted)
8183
+ return;
8009
8184
  debug(`[SLIDE][STOP]:${this.story.id}:${this.slide.index}`);
8010
8185
  await this.slideApi.slideStop(params);
8011
8186
  }
@@ -8013,6 +8188,9 @@ let StorySlideViewModel = (() => {
8013
8188
  this.handleSlideError(error);
8014
8189
  }
8015
8190
  finally {
8191
+ this.isStarted = false;
8192
+ if (params.prepareForRestart === 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */)
8193
+ this.isInited = false;
8016
8194
  this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8017
8195
  release();
8018
8196
  }
@@ -8028,6 +8206,23 @@ let StorySlideViewModel = (() => {
8028
8206
  const { canClickNext } = this.slideApi.slideClickHandler(null, "backward");
8029
8207
  return canClickNext;
8030
8208
  }
8209
+ async preload(priority) {
8210
+ if (!this.cacheManager || this.preloaded || this.isPreloading)
8211
+ return;
8212
+ this.isPreloading = true;
8213
+ const resourceUrls = this.slide.parseResources();
8214
+ const cacheEntries = await this.cacheManager.preload(resourceUrls.map(resourceUrl => ({
8215
+ url: resourceUrl,
8216
+ priority
8217
+ })));
8218
+ const resourcesByUrl = {};
8219
+ for (const cacheEntry of cacheEntries)
8220
+ resourcesByUrl[cacheEntry.url] = cacheEntry;
8221
+ if (!this.cacheManager.isDestroyed)
8222
+ this.slide.applyBlobUrls(resourceUrls, resourcesByUrl);
8223
+ this.preloaded = true;
8224
+ this.isPreloading = false;
8225
+ }
8031
8226
  onClick({ event, currentTarget, preventNavigation = false }) {
8032
8227
  if (!event.target)
8033
8228
  return;
@@ -8044,13 +8239,20 @@ let StorySlideViewModel = (() => {
8044
8239
  }
8045
8240
  }
8046
8241
  async destroy() {
8242
+ const release = await this.mutex.acquire();
8047
8243
  try {
8244
+ this.isStarted = false;
8245
+ this.isInited = false;
8048
8246
  this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8049
- await this.slideApi.destroy();
8247
+ if (this.cacheManager)
8248
+ this.slide.restoreOriginalResourceUrls();
8050
8249
  }
8051
8250
  catch (error) {
8052
8251
  console.error(error);
8053
8252
  }
8253
+ finally {
8254
+ release();
8255
+ }
8054
8256
  }
8055
8257
  getNavigationDirection(event, currentTarget) {
8056
8258
  const xPercent = this.getClickPosition(event, currentTarget);
@@ -9399,12 +9601,14 @@ var storyViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivate
9399
9601
 
9400
9602
 
9401
9603
 
9604
+
9402
9605
  var StoryEvent;
9403
9606
  (function (StoryEvent) {
9404
9607
  StoryEvent["ShowToast"] = "showToast";
9405
9608
  })(StoryEvent || (StoryEvent = {}));
9609
+ const ACTIVE_SLIDE_PRELOAD_PRIORITY = 1000;
9406
9610
  let StoryViewModel = (() => {
9407
- var _a, _StoryViewModel__activeSlideIndex_accessor_storage, _StoryViewModel__slides_accessor_storage, _StoryViewModel__needShowErrorScreen_accessor_storage, _StoryViewModel__needShowLoaderScreen_accessor_storage, _StoryViewModel__$root_accessor_storage;
9611
+ 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;
9408
9612
  var _b;
9409
9613
  let _classSuper = ViewModel;
9410
9614
  let _instanceExtraInitializers = [];
@@ -9423,6 +9627,9 @@ let StoryViewModel = (() => {
9423
9627
  let __$root_decorators;
9424
9628
  let __$root_initializers = [];
9425
9629
  let __$root_extraInitializers = [];
9630
+ let _isInited_decorators;
9631
+ let _isInited_initializers = [];
9632
+ let _isInited_extraInitializers = [];
9426
9633
  let _get_needShowErrorScreen_decorators;
9427
9634
  let _get_needShowLoaderScreen_decorators;
9428
9635
  let _get_activeSlide_decorators;
@@ -9450,7 +9657,9 @@ let StoryViewModel = (() => {
9450
9657
  set _needShowLoaderScreen(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__needShowLoaderScreen_accessor_storage, value, "f"); }
9451
9658
  get _$root() { return storyViewModel_classPrivateFieldGet(this, _StoryViewModel__$root_accessor_storage, "f"); }
9452
9659
  set _$root(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__$root_accessor_storage, value, "f"); }
9453
- constructor(storyManager, storyReader, story, storySlideApiHandlersFactory, storyReaderStatisticV1Service, storyReaderStatisticV2Service) {
9660
+ get isInited() { return storyViewModel_classPrivateFieldGet(this, _StoryViewModel_isInited_accessor_storage, "f"); }
9661
+ set isInited(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel_isInited_accessor_storage, value, "f"); }
9662
+ constructor(storyManager, storyReader, story, storySlideApiHandlersFactory, storyReaderStatisticV1Service, storyReaderStatisticV2Service, cacheManager) {
9454
9663
  super();
9455
9664
  Object.defineProperty(this, "storyManager", {
9456
9665
  enumerable: true,
@@ -9488,28 +9697,35 @@ let StoryViewModel = (() => {
9488
9697
  writable: true,
9489
9698
  value: storyReaderStatisticV2Service
9490
9699
  });
9700
+ Object.defineProperty(this, "cacheManager", {
9701
+ enumerable: true,
9702
+ configurable: true,
9703
+ writable: true,
9704
+ value: cacheManager
9705
+ });
9491
9706
  _StoryViewModel__activeSlideIndex_accessor_storage.set(this, storyViewModel_runInitializers(this, __activeSlideIndex_initializers, 0));
9492
9707
  _StoryViewModel__slides_accessor_storage.set(this, (storyViewModel_runInitializers(this, __activeSlideIndex_extraInitializers), storyViewModel_runInitializers(this, __slides_initializers, [])));
9493
9708
  _StoryViewModel__needShowErrorScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __slides_extraInitializers), storyViewModel_runInitializers(this, __needShowErrorScreen_initializers, false)));
9494
9709
  _StoryViewModel__needShowLoaderScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowErrorScreen_extraInitializers), storyViewModel_runInitializers(this, __needShowLoaderScreen_initializers, false)));
9495
9710
  _StoryViewModel__$root_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowLoaderScreen_extraInitializers), storyViewModel_runInitializers(this, __$root_initializers, null)));
9496
- Object.defineProperty(this, "isInited", {
9711
+ _StoryViewModel_isInited_accessor_storage.set(this, (storyViewModel_runInitializers(this, __$root_extraInitializers), storyViewModel_runInitializers(this, _isInited_initializers, false)));
9712
+ Object.defineProperty(this, "isStarted", {
9497
9713
  enumerable: true,
9498
9714
  configurable: true,
9499
9715
  writable: true,
9500
- value: (storyViewModel_runInitializers(this, __$root_extraInitializers), false)
9716
+ value: (storyViewModel_runInitializers(this, _isInited_extraInitializers), false)
9501
9717
  });
9502
- Object.defineProperty(this, "isActive", {
9718
+ Object.defineProperty(this, "_activeSlideStartTime", {
9503
9719
  enumerable: true,
9504
9720
  configurable: true,
9505
9721
  writable: true,
9506
- value: false
9722
+ value: 0
9507
9723
  });
9508
- Object.defineProperty(this, "_activeSlideStartTime", {
9724
+ Object.defineProperty(this, "mutex", {
9509
9725
  enumerable: true,
9510
9726
  configurable: true,
9511
9727
  writable: true,
9512
- value: 0
9728
+ value: new external_async_mutex_namespaceObject.Mutex()
9513
9729
  });
9514
9730
  // internal services
9515
9731
  Object.defineProperty(this, "slideApi", {
@@ -9573,12 +9789,6 @@ let StoryViewModel = (() => {
9573
9789
  writable: true,
9574
9790
  value: void 0
9575
9791
  });
9576
- Object.defineProperty(this, "initOnce", {
9577
- enumerable: true,
9578
- configurable: true,
9579
- writable: true,
9580
- value: false
9581
- });
9582
9792
  Object.defineProperty(this, "toast", {
9583
9793
  enumerable: true,
9584
9794
  configurable: true,
@@ -9591,6 +9801,10 @@ let StoryViewModel = (() => {
9591
9801
  writable: true,
9592
9802
  value: async (el) => {
9593
9803
  this._$root = el;
9804
+ // Reaction to `layout` (modern or classic) change
9805
+ // TODO: add test with example
9806
+ await this.reinit();
9807
+ await this.restart();
9594
9808
  }
9595
9809
  });
9596
9810
  Object.defineProperty(this, "handleKeydown", {
@@ -9651,7 +9865,7 @@ let StoryViewModel = (() => {
9651
9865
  return this.storyReader.displayStrategy;
9652
9866
  }
9653
9867
  get canBeShown() {
9654
- return this.story.canBeShown && this.slides.length > 0;
9868
+ return this.story.canBeShown && this.slides.length > 0 && Boolean(this._$root);
9655
9869
  }
9656
9870
  get context() {
9657
9871
  return this.story.context;
@@ -9708,6 +9922,9 @@ let StoryViewModel = (() => {
9708
9922
  get dir() {
9709
9923
  return this.storyReader.dir;
9710
9924
  }
9925
+ get isSlideRendered() {
9926
+ return this.isInited;
9927
+ }
9711
9928
  get isNextDisabled() {
9712
9929
  return ((this.storyReader.reachEnd && this.reachEnd) ||
9713
9930
  this.activeSlide.disabledNextClick ||
@@ -9779,7 +9996,7 @@ let StoryViewModel = (() => {
9779
9996
  }
9780
9997
  async prevSlideOrStory() {
9781
9998
  if (this.reachStart && this.storyReader.reachStart) {
9782
- if (!this.isActive)
9999
+ if (!this.isStarted)
9783
10000
  return;
9784
10001
  await this.activeSlide.restart();
9785
10002
  return;
@@ -9828,41 +10045,63 @@ let StoryViewModel = (() => {
9828
10045
  await this.storyManager.rootStore.storyStore.updateNarrativeData(this.id, data);
9829
10046
  }
9830
10047
  detachRoot() {
10048
+ var _b;
9831
10049
  this._$root = null;
10050
+ const isInited = this.isInited;
10051
+ const isStarted = this.isStarted;
10052
+ this.stop();
10053
+ (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
10054
+ for (const slide of this._slides)
10055
+ slide.destroy();
10056
+ this.isInited = isInited;
10057
+ this.isStarted = isStarted;
9832
10058
  }
9833
- async init() {
9834
- if (this.isInited)
9835
- return;
9836
- if (!this.initOnce && !this.story.canBeShown) {
10059
+ async preloadSlides(start, end, priority) {
10060
+ if (!this.story.canBeShown)
9837
10061
  this.showLoaderScreen();
9838
- this.initOnce = true;
9839
- }
9840
- await (0,external_mobx_namespaceObject.when)(() => this.canBeShown && Boolean(this._$root));
9841
- await this.activeSlide.init();
9842
- this.isInited = true;
10062
+ await (0,external_mobx_namespaceObject.when)(() => this.story.canBeShown);
10063
+ end = end !== null && end !== void 0 ? end : this._slides.length;
10064
+ priority = priority !== null && priority !== void 0 ? priority : 0;
10065
+ await Promise.all(this._slides.slice(start, end).map((slide, index) => slide.preload(end - index + priority)));
10066
+ }
10067
+ async preloadActiveSlide(priority) {
10068
+ this.preloadSlides(this._activeSlideIndex, this._activeSlideIndex + 1, priority);
10069
+ }
10070
+ async init() {
10071
+ await this.mutex.runExclusive(async () => {
10072
+ if (this.isInited)
10073
+ return;
10074
+ if (!this.story.canBeShown)
10075
+ this.showLoaderScreen();
10076
+ await (0,external_mobx_namespaceObject.when)(() => this.canBeShown);
10077
+ await this.activeSlide.init();
10078
+ this.isInited = true;
10079
+ });
9843
10080
  }
9844
10081
  async start() {
9845
- if (!this.isInited)
9846
- throw new Error("[IAS]: story was not initialized error. Please contact IAS support.");
9847
- if (this.isActive)
9848
- return;
9849
- await this.activeSlide.start();
9850
- document.addEventListener("visibilitychange", this.handleVisibilityChange);
9851
- document.addEventListener("keydown", this.handleKeydown);
9852
- this.isActive = true;
9853
- this._activeSlideStartTime = Date.now();
10082
+ await this.mutex.runExclusive(async () => {
10083
+ if (this.isStarted || !this.isInited)
10084
+ return;
10085
+ await this.activeSlide.start();
10086
+ document.addEventListener("visibilitychange", this.handleVisibilityChange);
10087
+ document.addEventListener("keydown", this.handleKeydown);
10088
+ this.isStarted = true;
10089
+ this._activeSlideStartTime = Date.now();
10090
+ });
9854
10091
  }
9855
10092
  async stop() {
9856
- var _b;
9857
- if (!this.isActive || !this.isInited)
9858
- return;
9859
- (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
9860
- this.isActive = false;
9861
- this.slideApiHandlers.clearNarrativeSessionDataCache();
9862
- this.resumeAll();
9863
- await this.activeSlide.stop({ prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */ });
9864
- document.removeEventListener("visibilitychange", this.handleVisibilityChange);
9865
- document.removeEventListener("keydown", this.handleKeydown);
10093
+ await this.mutex.runExclusive(async () => {
10094
+ var _b;
10095
+ if (!this.isStarted || !this.isInited)
10096
+ return;
10097
+ (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
10098
+ this.isStarted = false;
10099
+ this.slideApiHandlers.clearNarrativeSessionDataCache();
10100
+ this.resumeAll();
10101
+ await this.activeSlide.stop({ prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */ });
10102
+ document.removeEventListener("visibilitychange", this.handleVisibilityChange);
10103
+ document.removeEventListener("keydown", this.handleKeydown);
10104
+ });
9866
10105
  }
9867
10106
  canGoNext() {
9868
10107
  return this.activeSlide.canGoNext();
@@ -9888,13 +10127,13 @@ let StoryViewModel = (() => {
9888
10127
  this.goodsWidget.close();
9889
10128
  const activeSlide = this.getSlideByIndex(this._activeSlideIndex);
9890
10129
  this.slideApiHandlers.clearNarrativeSessionDataCache();
9891
- if (this.isActive)
10130
+ if (this.isStarted)
9892
10131
  await activeSlide.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ });
9893
10132
  await activeSlide.destroy();
9894
10133
  (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
9895
10134
  (_c = this.toast) === null || _c === void 0 ? void 0 : _c.destroy();
9896
10135
  this.isInited = false;
9897
- this.isActive = false;
10136
+ this.isStarted = false;
9898
10137
  }
9899
10138
  notifyPauseStateChange() {
9900
10139
  if (this.pauseManager.isUserPaused)
@@ -9942,15 +10181,14 @@ let StoryViewModel = (() => {
9942
10181
  viewport: window,
9943
10182
  userResizeHandler: undefined,
9944
10183
  VODPlayer: this.storyManager.globalProperties.$videoOnDemand,
9945
- overlappingActionBarHeight: this.actionPanel.height
10184
+ overlappingActionBarHeight: this.actionPanel.height,
10185
+ useSdkCacheForMultislideMode: false
9946
10186
  });
9947
10187
  slideApi.setSdkClientVariables(this.storyManager.config.options);
9948
10188
  return slideApi;
9949
10189
  }
9950
10190
  async createSlidesViewModels(slides, slideApi) {
9951
- this._slides = slides.map((slide, index) => new StorySlideViewModel(this, index, slideApi, slide));
9952
- // Reaction to `layout` (modern or classsic) change
9953
- await this.onSlideChange(this.activeSlideIndex);
10191
+ this._slides = slides.map((slide, index) => new StorySlideViewModel(this, index, slideApi, slide, this.cacheManager));
9954
10192
  }
9955
10193
  handleSpaceKeydown(e) {
9956
10194
  if (e.code !== "Space")
@@ -9969,17 +10207,35 @@ let StoryViewModel = (() => {
9969
10207
  this.mute();
9970
10208
  }
9971
10209
  async onSlideChange(index) {
9972
- const lastSlide = this.getSlideByIndex(this._activeSlideIndex);
9973
- const activeSlide = this.getSlideByIndex(index);
9974
- this._activeSlideIndex = index;
9975
- if (this.isInited)
9976
- await activeSlide.init();
9977
- if (this.isActive) {
10210
+ var _b;
10211
+ try {
10212
+ const lastSlide = this.getSlideByIndex(this._activeSlideIndex);
10213
+ const activeSlide = this.getSlideByIndex(index);
10214
+ this._activeSlideIndex = index;
10215
+ this.hideErrorScreen();
9978
10216
  this.resumeAll();
10217
+ if (!((_b = this.storyManager.config.cache) === null || _b === void 0 ? void 0 : _b.prefetch))
10218
+ await this.preloadActiveSlide(ACTIVE_SLIDE_PRELOAD_PRIORITY);
10219
+ await activeSlide.init();
9979
10220
  await (lastSlide === null || lastSlide === void 0 ? void 0 : lastSlide.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ }));
9980
10221
  await activeSlide.start();
9981
10222
  this._activeSlideStartTime = Date.now();
9982
10223
  }
10224
+ catch (error) {
10225
+ console.error(error);
10226
+ }
10227
+ }
10228
+ async reinit() {
10229
+ if (this.isInited) {
10230
+ this.isInited = false;
10231
+ await this.init();
10232
+ }
10233
+ }
10234
+ async restart() {
10235
+ if (this.isStarted) {
10236
+ this.isStarted = false;
10237
+ await this.start();
10238
+ }
9983
10239
  }
9984
10240
  },
9985
10241
  _StoryViewModel__activeSlideIndex_accessor_storage = new WeakMap(),
@@ -9987,6 +10243,7 @@ let StoryViewModel = (() => {
9987
10243
  _StoryViewModel__needShowErrorScreen_accessor_storage = new WeakMap(),
9988
10244
  _StoryViewModel__needShowLoaderScreen_accessor_storage = new WeakMap(),
9989
10245
  _StoryViewModel__$root_accessor_storage = new WeakMap(),
10246
+ _StoryViewModel_isInited_accessor_storage = new WeakMap(),
9990
10247
  (() => {
9991
10248
  var _b;
9992
10249
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
@@ -9995,6 +10252,7 @@ let StoryViewModel = (() => {
9995
10252
  __needShowErrorScreen_decorators = [external_mobx_namespaceObject.observable];
9996
10253
  __needShowLoaderScreen_decorators = [external_mobx_namespaceObject.observable];
9997
10254
  __$root_decorators = [external_mobx_namespaceObject.observable];
10255
+ _isInited_decorators = [external_mobx_namespaceObject.observable];
9998
10256
  _get_needShowErrorScreen_decorators = [external_mobx_namespaceObject.computed];
9999
10257
  _get_needShowLoaderScreen_decorators = [external_mobx_namespaceObject.computed];
10000
10258
  _get_activeSlide_decorators = [external_mobx_namespaceObject.computed];
@@ -10016,6 +10274,7 @@ let StoryViewModel = (() => {
10016
10274
  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);
10017
10275
  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);
10018
10276
  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);
10277
+ 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);
10019
10278
  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);
10020
10279
  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);
10021
10280
  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);
@@ -10044,6 +10303,12 @@ var isEmpty_js_x = (y) => {
10044
10303
  }
10045
10304
  var isEmpty_js_y = (x) => (() => (x))
10046
10305
  const isEmpty_js_namespaceObject = isEmpty_js_x({ ["default"]: () => (__WEBPACK_EXTERNAL_MODULE_lodash_isEmpty_js_f1e1789b__["default"]) });
10306
+ ;// CONCATENATED MODULE: external "lodash/isObject.js"
10307
+ var isObject_js_x = (y) => {
10308
+ var x = {}; __webpack_require__.d(x, y); return x
10309
+ }
10310
+ var isObject_js_y = (x) => (() => (x))
10311
+ const isObject_js_namespaceObject = isObject_js_x({ ["default"]: () => (__WEBPACK_EXTERNAL_MODULE_lodash_isObject_js_84bb7d23__["default"]) });
10047
10312
  ;// CONCATENATED MODULE: ../core/src/readers/gameReader/gameSessionHandlers/gameInstanceLocalDataHandlers/gameInstanceStorage.ts
10048
10313
 
10049
10314
 
@@ -10386,7 +10651,7 @@ class GameCenterApi {
10386
10651
  const body = {};
10387
10652
  if (gameOptions && (0,isObject_js_namespaceObject["default"])(gameOptions) && gameOptions.demoMode != null)
10388
10653
  body.demoMode = Boolean(gameOptions.demoMode);
10389
- const response = await api.post(`game/${gameInstanceId}/launch`, body, params);
10654
+ const response = await api.post(`game/${gameInstanceId}/launch`, body, { params });
10390
10655
  return response.data;
10391
10656
  }
10392
10657
  }
@@ -10479,7 +10744,7 @@ class GameClientConfig {
10479
10744
  value: void 0
10480
10745
  });
10481
10746
  const storyManagerConfig = this.storyManager.config;
10482
- const sdkVersion = "1.8.0-rc.8";
10747
+ const sdkVersion = "1.8.0";
10483
10748
  const placeholders = this.storyManager.rootStore.placeholderStore.placeholders;
10484
10749
  const session = this.storyManager.rootStore.sessionStore.session;
10485
10750
  this.sessionId = session.id;
@@ -11948,6 +12213,9 @@ class StorySlideApiHandlers {
11948
12213
  value: new NarrativeDataCache()
11949
12214
  });
11950
12215
  }
12216
+ onEvent(name, event) { }
12217
+ onCardLoadingStateChange(state) { }
12218
+ ;
11951
12219
  clearNarrativeSessionDataCache() {
11952
12220
  this.sessionNarrativeDataCache.clear();
11953
12221
  }
@@ -12695,6 +12963,8 @@ var storyReaderNavigationController_classPrivateFieldSet = (undefined && undefin
12695
12963
 
12696
12964
 
12697
12965
  const STORY_INIT_RANGE = 1;
12966
+ const ACTIVE_STORY_PRELOAD_PRIORITY = 1000;
12967
+ const NON_ACTIVE_STORY_PRELOAD_PRIORITY = 0;
12698
12968
  let StoryReaderNavigationController = (() => {
12699
12969
  var _a, _StoryReaderNavigationController__activeStory_accessor_storage, _StoryReaderNavigationController__currentIndex_accessor_storage, _StoryReaderNavigationController__targetTransitionIndex_accessor_storage;
12700
12970
  let _instanceExtraInitializers = [];
@@ -12832,7 +13102,6 @@ let StoryReaderNavigationController = (() => {
12832
13102
  this.currentStoryDisplayStrategy.handleNextStoryByIndex(index);
12833
13103
  this.initStoriesWithinRange(index);
12834
13104
  await this.animatedNavigationController.transitionByIndex(index, this.currentIndex);
12835
- //await Promise.all([p1, p2]);
12836
13105
  await this.handleTransitionEnd(index, action);
12837
13106
  }
12838
13107
  handleStoryReaderReachEnd(action) {
@@ -12874,16 +13143,27 @@ let StoryReaderNavigationController = (() => {
12874
13143
  return activeStory;
12875
13144
  }
12876
13145
  async runNextStory(prevStory, story) {
12877
- await (prevStory === null || prevStory === void 0 ? void 0 : prevStory.stop());
12878
- await story.init();
12879
- await story.start();
13146
+ try {
13147
+ await (prevStory === null || prevStory === void 0 ? void 0 : prevStory.stop());
13148
+ await this.preloadActiveStory(story);
13149
+ await story.init();
13150
+ await story.start();
13151
+ }
13152
+ catch (error) {
13153
+ console.error(error);
13154
+ }
12880
13155
  }
12881
13156
  async initStoriesWithinRange(currentIndex) {
12882
- let stories = this.storyReader.stories;
13157
+ const stories = this.storyReader.stories;
12883
13158
  const start = Math.max(currentIndex - STORY_INIT_RANGE, 0);
12884
13159
  const end = Math.min(currentIndex + STORY_INIT_RANGE, stories.length - 1);
12885
- stories = stories.slice(start, end + 1);
12886
- return Promise.all(stories.map(story => story.init()));
13160
+ const storiesToInit = [];
13161
+ for (let i = start; i <= end; i++) {
13162
+ if (i !== currentIndex)
13163
+ storiesToInit.push(stories[i]);
13164
+ }
13165
+ await this.preloadSiblingStories(storiesToInit);
13166
+ return Promise.allSettled(storiesToInit.map(story => story.init()));
12887
13167
  }
12888
13168
  handleActiveStoryError(story) {
12889
13169
  if (!(story === null || story === void 0 ? void 0 : story.error))
@@ -12899,6 +13179,28 @@ let StoryReaderNavigationController = (() => {
12899
13179
  limitIndex(index) {
12900
13180
  return Math.max(0, Math.min(this.storyReader.stories.length - 1, index));
12901
13181
  }
13182
+ async preloadActiveStory(story) {
13183
+ const cacheConfig = this.storyManager.config.cache;
13184
+ if (!cacheConfig)
13185
+ return;
13186
+ if (cacheConfig.prefetch) {
13187
+ await story.preloadSlides(0, story.slidesCount, ACTIVE_STORY_PRELOAD_PRIORITY);
13188
+ }
13189
+ else {
13190
+ await story.preloadActiveSlide(ACTIVE_STORY_PRELOAD_PRIORITY);
13191
+ }
13192
+ }
13193
+ async preloadSiblingStories(stories) {
13194
+ const cacheConfig = this.storyManager.config.cache;
13195
+ if (!cacheConfig)
13196
+ return;
13197
+ if (cacheConfig.prefetch) {
13198
+ await Promise.all(stories.map(story => story.preloadSlides(0, 2, NON_ACTIVE_STORY_PRELOAD_PRIORITY)));
13199
+ }
13200
+ else {
13201
+ await Promise.all(stories.map(story => story.preloadActiveSlide(NON_ACTIVE_STORY_PRELOAD_PRIORITY)));
13202
+ }
13203
+ }
12902
13204
  },
12903
13205
  _StoryReaderNavigationController__activeStory_accessor_storage = new WeakMap(),
12904
13206
  _StoryReaderNavigationController__currentIndex_accessor_storage = new WeakMap(),
@@ -12936,129 +13238,81 @@ let StoryReaderNavigationController = (() => {
12936
13238
 
12937
13239
 
12938
13240
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showOnboardingStoriesStrategy.ts
12939
- var showOnboardingStoriesStrategy_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
12940
- var useValue = arguments.length > 2;
12941
- for (var i = 0; i < initializers.length; i++) {
12942
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
13241
+
13242
+ class ShowOnboardingStoriesStrategy {
13243
+ constructor(showMultipleStoriesStrategy, storyManager) {
13244
+ Object.defineProperty(this, "showMultipleStoriesStrategy", {
13245
+ enumerable: true,
13246
+ configurable: true,
13247
+ writable: true,
13248
+ value: showMultipleStoriesStrategy
13249
+ });
13250
+ Object.defineProperty(this, "storyManager", {
13251
+ enumerable: true,
13252
+ configurable: true,
13253
+ writable: true,
13254
+ value: storyManager
13255
+ });
13256
+ Object.defineProperty(this, "_feed", {
13257
+ enumerable: true,
13258
+ configurable: true,
13259
+ writable: true,
13260
+ value: null
13261
+ });
12943
13262
  }
12944
- return useValue ? value : void 0;
12945
- };
12946
- var showOnboardingStoriesStrategy_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
12947
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
12948
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
12949
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
12950
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
12951
- var _, done = false;
12952
- for (var i = decorators.length - 1; i >= 0; i--) {
12953
- var context = {};
12954
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
12955
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12956
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12957
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
12958
- if (kind === "accessor") {
12959
- if (result === void 0) continue;
12960
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
12961
- if (_ = accept(result.get)) descriptor.get = _;
12962
- if (_ = accept(result.set)) descriptor.set = _;
12963
- if (_ = accept(result.init)) initializers.unshift(_);
12964
- }
12965
- else if (_ = accept(result)) {
12966
- if (kind === "field") initializers.unshift(_);
12967
- else descriptor[key] = _;
12968
- }
13263
+ get feed() {
13264
+ return this._feed;
12969
13265
  }
12970
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
12971
- done = true;
12972
- };
12973
-
12974
-
12975
- let ShowOnboardingStoriesStrategy = (() => {
12976
- var _a;
12977
- let _instanceExtraInitializers = [];
12978
- let _show_decorators;
12979
- return _a = class ShowOnboardingStoriesStrategy {
12980
- constructor(showMultipleStoriesStrategy, storyManager) {
12981
- Object.defineProperty(this, "showMultipleStoriesStrategy", {
12982
- enumerable: true,
12983
- configurable: true,
12984
- writable: true,
12985
- value: (showOnboardingStoriesStrategy_runInitializers(this, _instanceExtraInitializers), showMultipleStoriesStrategy)
12986
- });
12987
- Object.defineProperty(this, "storyManager", {
12988
- enumerable: true,
12989
- configurable: true,
12990
- writable: true,
12991
- value: storyManager
12992
- });
12993
- Object.defineProperty(this, "_feed", {
12994
- enumerable: true,
12995
- configurable: true,
12996
- writable: true,
12997
- value: null
12998
- });
12999
- }
13000
- get feed() {
13001
- return this._feed;
13002
- }
13003
- async show(payload) {
13004
- var _b, _c;
13005
- const storyFeedStore = this.storyManager.rootStore.onboardingFeedStore;
13006
- const onboardingFeed = await storyFeedStore.fetchOnboardingFeed({
13007
- feedSlug: payload.feedSlug,
13008
- tags: (_b = payload.customTags) !== null && _b !== void 0 ? _b : [],
13009
- limit: (_c = payload.limit) !== null && _c !== void 0 ? _c : undefined
13010
- });
13011
- this._feed = onboardingFeed;
13012
- const feedLoadEvent = this.getFeedLoadEvent(onboardingFeed.slug, onboardingFeed.stories);
13013
- this.emitFeedLoad(feedLoadEvent);
13014
- if (!onboardingFeed.stories.length)
13015
- return feedLoadEvent;
13016
- await this.showMultipleStoriesStrategy.show({
13017
- windowReferer: STORY_READER_WINDOW_REFERER.default,
13018
- storyFeed: onboardingFeed,
13019
- storyId: onboardingFeed.stories[0].id
13020
- });
13021
- return feedLoadEvent;
13022
- }
13023
- async handleNextStoryByIndex(nextStoryIndex) {
13024
- this.showMultipleStoriesStrategy.handleNextStoryByIndex(nextStoryIndex);
13025
- }
13026
- emitFeedLoad(event) {
13027
- this.storyManager.emit("feedLoad", event);
13028
- }
13029
- getFeedLoadEvent(feed, onboardingStories) {
13030
- const stories = onboardingStories.map(story => {
13031
- const additionalPayload = {
13032
- title: null,
13033
- slidesCount: null
13034
- };
13035
- if (story) {
13036
- additionalPayload.title = story.statTitle;
13037
- additionalPayload.slidesCount = story.slidesCount;
13038
- }
13039
- return Object.assign({ id: story.id }, additionalPayload);
13040
- });
13041
- const eventData = {
13042
- stories,
13043
- feed: null,
13044
- filter: null
13045
- };
13046
- eventData.feed = feed;
13047
- return eventData;
13048
- }
13049
- async reload(payload) {
13050
- this.showMultipleStoriesStrategy.reload(payload);
13266
+ async show(payload) {
13267
+ var _a, _b;
13268
+ const storyFeedStore = this.storyManager.rootStore.onboardingFeedStore;
13269
+ const onboardingFeed = await storyFeedStore.fetchOnboardingFeed({
13270
+ feedSlug: payload.feedSlug,
13271
+ tags: (_a = payload.customTags) !== null && _a !== void 0 ? _a : [],
13272
+ limit: (_b = payload.limit) !== null && _b !== void 0 ? _b : undefined
13273
+ });
13274
+ this._feed = onboardingFeed;
13275
+ const feedLoadEvent = this.getFeedLoadEvent(onboardingFeed.slug, onboardingFeed.stories);
13276
+ this.emitFeedLoad(feedLoadEvent);
13277
+ if (!onboardingFeed.stories.length)
13278
+ return feedLoadEvent;
13279
+ await this.showMultipleStoriesStrategy.show({
13280
+ windowReferer: STORY_READER_WINDOW_REFERER.default,
13281
+ storyFeed: onboardingFeed,
13282
+ storyId: onboardingFeed.stories[0].id
13283
+ });
13284
+ return feedLoadEvent;
13285
+ }
13286
+ async handleNextStoryByIndex(nextStoryIndex) {
13287
+ this.showMultipleStoriesStrategy.handleNextStoryByIndex(nextStoryIndex);
13288
+ }
13289
+ emitFeedLoad(event) {
13290
+ this.storyManager.emit("feedLoad", event);
13291
+ }
13292
+ getFeedLoadEvent(feed, onboardingStories) {
13293
+ const stories = onboardingStories.map(story => {
13294
+ const additionalPayload = {
13295
+ title: null,
13296
+ slidesCount: null
13297
+ };
13298
+ if (story) {
13299
+ additionalPayload.title = story.statTitle;
13300
+ additionalPayload.slidesCount = story.slidesCount;
13051
13301
  }
13052
- },
13053
- (() => {
13054
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
13055
- _show_decorators = [noConcurrent];
13056
- showOnboardingStoriesStrategy_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);
13057
- if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
13058
- })(),
13059
- _a;
13060
- })();
13061
-
13302
+ return Object.assign({ id: story.id }, additionalPayload);
13303
+ });
13304
+ const eventData = {
13305
+ stories,
13306
+ feed: null,
13307
+ filter: null
13308
+ };
13309
+ eventData.feed = feed;
13310
+ return eventData;
13311
+ }
13312
+ async reload(payload) {
13313
+ this.showMultipleStoriesStrategy.reload(payload);
13314
+ }
13315
+ }
13062
13316
 
13063
13317
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showMultipleStoriesStrategy.ts
13064
13318
  const NUMBER_OF_LAZY_LOADED_STORIES = 2;
@@ -13169,191 +13423,95 @@ class ShowStoryFromSharePageStrategy {
13169
13423
  }
13170
13424
 
13171
13425
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showStoryOnceStrategy.ts
13172
- var showStoryOnceStrategy_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
13173
- var useValue = arguments.length > 2;
13174
- for (var i = 0; i < initializers.length; i++) {
13175
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
13426
+
13427
+
13428
+ class ShowStoryOnceStrategy {
13429
+ constructor(storyManager, storyReaderViewModel) {
13430
+ Object.defineProperty(this, "storyManager", {
13431
+ enumerable: true,
13432
+ configurable: true,
13433
+ writable: true,
13434
+ value: storyManager
13435
+ });
13436
+ Object.defineProperty(this, "storyReaderViewModel", {
13437
+ enumerable: true,
13438
+ configurable: true,
13439
+ writable: true,
13440
+ value: storyReaderViewModel
13441
+ });
13176
13442
  }
13177
- return useValue ? value : void 0;
13178
- };
13179
- var showStoryOnceStrategy_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
13180
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
13181
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
13182
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13183
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13184
- var _, done = false;
13185
- for (var i = decorators.length - 1; i >= 0; i--) {
13186
- var context = {};
13187
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
13188
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
13189
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13190
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13191
- if (kind === "accessor") {
13192
- if (result === void 0) continue;
13193
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
13194
- if (_ = accept(result.get)) descriptor.get = _;
13195
- if (_ = accept(result.set)) descriptor.set = _;
13196
- if (_ = accept(result.init)) initializers.unshift(_);
13443
+ get feed() {
13444
+ return null;
13445
+ }
13446
+ async show(payload) {
13447
+ try {
13448
+ const storyStore = this.storyManager.rootStore.storyStore;
13449
+ const story = await storyStore.fetchStoryById({
13450
+ storyId: payload.storyId,
13451
+ feedSlug: "",
13452
+ once: true
13453
+ });
13454
+ if (story.error)
13455
+ throw story.error;
13456
+ if (story.isOpened)
13457
+ throw new IasStoryAlreadyShownError(payload.storyId.toString());
13458
+ this.openStoryReader(story);
13197
13459
  }
13198
- else if (_ = accept(result)) {
13199
- if (kind === "field") initializers.unshift(_);
13200
- else descriptor[key] = _;
13460
+ catch (error) {
13461
+ this.storyReaderViewModel.close();
13462
+ throw error;
13201
13463
  }
13202
13464
  }
13203
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
13204
- done = true;
13205
- };
13465
+ openStoryReader(story) {
13466
+ this.storyReaderViewModel.open({
13467
+ windowReferer: STORY_READER_WINDOW_REFERER.default,
13468
+ id: story.id,
13469
+ stories: [story]
13470
+ });
13471
+ }
13472
+ async handleNextStoryByIndex(storyIndex) { }
13473
+ async reload(payload) { }
13474
+ }
13206
13475
 
13476
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showStoryStrategy.ts
13207
13477
 
13208
-
13209
- let ShowStoryOnceStrategy = (() => {
13210
- var _a;
13211
- let _instanceExtraInitializers = [];
13212
- let _show_decorators;
13213
- return _a = class ShowStoryOnceStrategy {
13214
- constructor(storyManager, storyReaderViewModel) {
13215
- Object.defineProperty(this, "storyManager", {
13216
- enumerable: true,
13217
- configurable: true,
13218
- writable: true,
13219
- value: (showStoryOnceStrategy_runInitializers(this, _instanceExtraInitializers), storyManager)
13220
- });
13221
- Object.defineProperty(this, "storyReaderViewModel", {
13222
- enumerable: true,
13223
- configurable: true,
13224
- writable: true,
13225
- value: storyReaderViewModel
13226
- });
13227
- }
13228
- get feed() {
13229
- return null;
13230
- }
13231
- async show(payload) {
13232
- try {
13233
- const storyStore = this.storyManager.rootStore.storyStore;
13234
- const story = await storyStore.fetchStoryById({
13235
- storyId: payload.storyId,
13236
- feedSlug: "",
13237
- once: true
13238
- });
13239
- if (story.error)
13240
- throw story.error;
13241
- if (story.isOpened)
13242
- throw new IasStoryAlreadyShownError(payload.storyId.toString());
13243
- this.openStoryReader(story);
13244
- }
13245
- catch (error) {
13246
- this.storyReaderViewModel.close();
13247
- throw error;
13248
- }
13249
- }
13250
- openStoryReader(story) {
13251
- this.storyReaderViewModel.open({
13252
- windowReferer: STORY_READER_WINDOW_REFERER.default,
13253
- id: story.id,
13254
- stories: [story]
13255
- });
13256
- }
13257
- async handleNextStoryByIndex(storyIndex) { }
13258
- async reload(payload) { }
13259
- },
13260
- (() => {
13261
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
13262
- _show_decorators = [noConcurrent];
13263
- 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);
13264
- if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
13265
- })(),
13266
- _a;
13267
- })();
13268
-
13269
-
13270
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showStoryStrategy.ts
13271
- var showStoryStrategy_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
13272
- var useValue = arguments.length > 2;
13273
- for (var i = 0; i < initializers.length; i++) {
13274
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
13275
- }
13276
- return useValue ? value : void 0;
13277
- };
13278
- var showStoryStrategy_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
13279
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
13280
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
13281
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13282
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13283
- var _, done = false;
13284
- for (var i = decorators.length - 1; i >= 0; i--) {
13285
- var context = {};
13286
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
13287
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
13288
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13289
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13290
- if (kind === "accessor") {
13291
- if (result === void 0) continue;
13292
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
13293
- if (_ = accept(result.get)) descriptor.get = _;
13294
- if (_ = accept(result.set)) descriptor.set = _;
13295
- if (_ = accept(result.init)) initializers.unshift(_);
13296
- }
13297
- else if (_ = accept(result)) {
13298
- if (kind === "field") initializers.unshift(_);
13299
- else descriptor[key] = _;
13300
- }
13301
- }
13302
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
13303
- done = true;
13304
- };
13305
-
13306
-
13307
- let ShowStoryStrategy = (() => {
13308
- var _a;
13309
- let _instanceExtraInitializers = [];
13310
- let _show_decorators;
13311
- return _a = class ShowStoryStrategy {
13312
- constructor(storyManager, storyReaderViewModel) {
13313
- Object.defineProperty(this, "storyManager", {
13314
- enumerable: true,
13315
- configurable: true,
13316
- writable: true,
13317
- value: (showStoryStrategy_runInitializers(this, _instanceExtraInitializers), storyManager)
13318
- });
13319
- Object.defineProperty(this, "storyReaderViewModel", {
13320
- enumerable: true,
13321
- configurable: true,
13322
- writable: true,
13323
- value: storyReaderViewModel
13324
- });
13325
- }
13326
- get feed() {
13327
- return null;
13328
- }
13329
- async show(payload) {
13330
- const storyStore = this.storyManager.rootStore.storyStore;
13331
- const story = await storyStore.fetchStoryById({
13332
- storyId: payload.storyId,
13333
- feedSlug: "",
13334
- fetchShareUrl: payload.fetchShareUrl
13335
- });
13336
- this.openStoryReader(story, payload);
13337
- }
13338
- openStoryReader(story, payload) {
13339
- this.storyReaderViewModel.open({
13340
- windowReferer: STORY_READER_WINDOW_REFERER.default,
13341
- id: story.id,
13342
- stories: [story]
13343
- });
13344
- }
13345
- async handleNextStoryByIndex(storyIndex) { }
13346
- async reload(payload) { }
13347
- },
13348
- (() => {
13349
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
13350
- _show_decorators = [noConcurrent];
13351
- 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);
13352
- if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
13353
- })(),
13354
- _a;
13355
- })();
13356
-
13478
+ class ShowStoryStrategy {
13479
+ constructor(storyManager, storyReaderViewModel) {
13480
+ Object.defineProperty(this, "storyManager", {
13481
+ enumerable: true,
13482
+ configurable: true,
13483
+ writable: true,
13484
+ value: storyManager
13485
+ });
13486
+ Object.defineProperty(this, "storyReaderViewModel", {
13487
+ enumerable: true,
13488
+ configurable: true,
13489
+ writable: true,
13490
+ value: storyReaderViewModel
13491
+ });
13492
+ }
13493
+ get feed() {
13494
+ return null;
13495
+ }
13496
+ async show(payload) {
13497
+ const storyStore = this.storyManager.rootStore.storyStore;
13498
+ const story = await storyStore.fetchStoryById({
13499
+ storyId: payload.storyId,
13500
+ feedSlug: "",
13501
+ fetchShareUrl: payload.fetchShareUrl
13502
+ });
13503
+ this.openStoryReader(story, payload);
13504
+ }
13505
+ openStoryReader(story, payload) {
13506
+ this.storyReaderViewModel.open({
13507
+ windowReferer: STORY_READER_WINDOW_REFERER.default,
13508
+ id: story.id,
13509
+ stories: [story]
13510
+ });
13511
+ }
13512
+ async handleNextStoryByIndex(storyIndex) { }
13513
+ async reload(payload) { }
13514
+ }
13357
13515
 
13358
13516
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/storyDisplayStrategyFactory.ts
13359
13517
 
@@ -13508,106 +13666,609 @@ class StoryReaderStatisticsController {
13508
13666
  }
13509
13667
  }
13510
13668
 
13511
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyReaderViewModel.ts
13512
- var storyReaderViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
13513
- var useValue = arguments.length > 2;
13514
- for (var i = 0; i < initializers.length; i++) {
13515
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
13669
+ ;// CONCATENATED MODULE: ../core/src/cache/models/cacheEntry.ts
13670
+ class CacheEntry {
13671
+ constructor(url, blob, lastAccessed = Date.now()) {
13672
+ Object.defineProperty(this, "url", {
13673
+ enumerable: true,
13674
+ configurable: true,
13675
+ writable: true,
13676
+ value: url
13677
+ });
13678
+ Object.defineProperty(this, "blob", {
13679
+ enumerable: true,
13680
+ configurable: true,
13681
+ writable: true,
13682
+ value: blob
13683
+ });
13684
+ Object.defineProperty(this, "lastAccessed", {
13685
+ enumerable: true,
13686
+ configurable: true,
13687
+ writable: true,
13688
+ value: lastAccessed
13689
+ });
13690
+ Object.defineProperty(this, "blobUrl", {
13691
+ enumerable: true,
13692
+ configurable: true,
13693
+ writable: true,
13694
+ value: void 0
13695
+ });
13516
13696
  }
13517
- return useValue ? value : void 0;
13518
- };
13519
- var storyReaderViewModel_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
13520
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
13521
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
13522
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13523
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13524
- var _, done = false;
13525
- for (var i = decorators.length - 1; i >= 0; i--) {
13526
- var context = {};
13527
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
13528
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
13529
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13530
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13531
- if (kind === "accessor") {
13532
- if (result === void 0) continue;
13533
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
13534
- if (_ = accept(result.get)) descriptor.get = _;
13535
- if (_ = accept(result.set)) descriptor.set = _;
13536
- if (_ = accept(result.init)) initializers.unshift(_);
13537
- }
13538
- else if (_ = accept(result)) {
13539
- if (kind === "field") initializers.unshift(_);
13540
- else descriptor[key] = _;
13697
+ updateLastAccessed() {
13698
+ this.lastAccessed = Date.now();
13699
+ }
13700
+ getOrCreateBlobUrl() {
13701
+ if (!this.blobUrl) {
13702
+ this.blobUrl = URL.createObjectURL(this.blob);
13541
13703
  }
13704
+ return this.blobUrl;
13542
13705
  }
13543
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
13544
- done = true;
13545
- };
13546
- var storyReaderViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13547
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13548
- 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");
13549
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13550
- };
13551
- var storyReaderViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13552
- if (kind === "m") throw new TypeError("Private method is not writable");
13553
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
13554
- 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");
13555
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
13556
- };
13557
-
13558
-
13559
-
13706
+ unlinkBlob() {
13707
+ if (this.blobUrl)
13708
+ URL.revokeObjectURL(this.blobUrl);
13709
+ }
13710
+ destroy() {
13711
+ this.unlinkBlob();
13712
+ }
13713
+ }
13560
13714
 
13715
+ ;// CONCATENATED MODULE: ../core/src/cache/cacheRepository.ts
13561
13716
 
13717
+ class CacheRepository {
13718
+ constructor(driver) {
13719
+ Object.defineProperty(this, "driver", {
13720
+ enumerable: true,
13721
+ configurable: true,
13722
+ writable: true,
13723
+ value: driver
13724
+ });
13725
+ Object.defineProperty(this, "entries", {
13726
+ enumerable: true,
13727
+ configurable: true,
13728
+ writable: true,
13729
+ value: new Map()
13730
+ });
13731
+ }
13732
+ async get(url) {
13733
+ let entry = this.entries.get(url);
13734
+ if (!entry) {
13735
+ const record = await this.driver.get(url);
13736
+ if (!record)
13737
+ return;
13738
+ entry = new CacheEntry(record.url, record.blob, record.lastAccessed);
13739
+ this.entries.set(url, entry);
13740
+ }
13741
+ return entry;
13742
+ }
13743
+ async loadAllEntries() {
13744
+ const records = await this.driver.getAll();
13745
+ const entities = [];
13746
+ for (const record of records) {
13747
+ const entry = new CacheEntry(record.url, record.blob, record.lastAccessed);
13748
+ this.entries.set(record.url, entry);
13749
+ entities.push(entry);
13750
+ }
13751
+ return entities;
13752
+ }
13753
+ async save(entry) {
13754
+ this.entries.set(entry.url, entry);
13755
+ await this.driver.set({
13756
+ url: entry.url,
13757
+ blob: entry.blob,
13758
+ lastAccessed: entry.lastAccessed
13759
+ });
13760
+ }
13761
+ async updateAccessTime(entry) {
13762
+ this.entries.set(entry.url, entry);
13763
+ await this.driver.updateAccessTime(entry.url, entry.lastAccessed);
13764
+ }
13765
+ async delete(url) {
13766
+ this.entries.delete(url);
13767
+ await this.driver.delete(url);
13768
+ }
13769
+ async getAll() {
13770
+ return Array.from(this.entries.values());
13771
+ }
13772
+ async clear() {
13773
+ for (const entry of this.entries.values())
13774
+ entry.destroy();
13775
+ this.entries.clear();
13776
+ //await this.driver.clear();
13777
+ }
13778
+ }
13562
13779
 
13780
+ ;// CONCATENATED MODULE: ../core/src/cache/drivers/indexedDBDriver.ts
13781
+ class IndexedDBCacheDriver {
13782
+ constructor(dbName, storeName) {
13783
+ Object.defineProperty(this, "dbName", {
13784
+ enumerable: true,
13785
+ configurable: true,
13786
+ writable: true,
13787
+ value: void 0
13788
+ });
13789
+ Object.defineProperty(this, "storeName", {
13790
+ enumerable: true,
13791
+ configurable: true,
13792
+ writable: true,
13793
+ value: void 0
13794
+ });
13795
+ this.dbName = dbName;
13796
+ this.storeName = storeName;
13797
+ }
13798
+ async getDB() {
13799
+ return new Promise((resolve, reject) => {
13800
+ const request = indexedDB.open(this.dbName, 1);
13801
+ request.onupgradeneeded = () => {
13802
+ const db = request.result;
13803
+ if (!db.objectStoreNames.contains(this.storeName)) {
13804
+ const store = db.createObjectStore(this.storeName, { keyPath: "url" });
13805
+ store.createIndex("lastAccessed", "lastAccessed");
13806
+ }
13807
+ };
13808
+ request.onsuccess = () => resolve(request.result);
13809
+ request.onerror = () => reject(request.error);
13810
+ });
13811
+ }
13812
+ async get(url) {
13813
+ const db = await this.getDB();
13814
+ return new Promise((resolve, reject) => {
13815
+ const tx = db.transaction(this.storeName, "readonly");
13816
+ const store = tx.objectStore(this.storeName);
13817
+ const request = store.get(url);
13818
+ request.onsuccess = () => {
13819
+ const result = request.result;
13820
+ resolve(result ? { url, lastAccessed: result.lastAccessed, blob: result.blob } : undefined);
13821
+ };
13822
+ request.onerror = () => reject(request.error);
13823
+ });
13824
+ }
13825
+ async set(record) {
13826
+ const db = await this.getDB();
13827
+ return new Promise((resolve, reject) => {
13828
+ const tx = db.transaction(this.storeName, "readwrite");
13829
+ tx.objectStore(this.storeName).put(record);
13830
+ tx.oncomplete = () => resolve();
13831
+ tx.onerror = () => reject(tx.error);
13832
+ });
13833
+ }
13834
+ async updateAccessTime(url, lastAccessed) {
13835
+ const db = await this.getDB();
13836
+ const tx = db.transaction(this.storeName, "readwrite");
13837
+ const store = tx.objectStore(this.storeName);
13838
+ const existing = await new Promise((resolve, reject) => {
13839
+ const req = store.get(url);
13840
+ req.onsuccess = () => resolve(req.result);
13841
+ req.onerror = () => reject(req.error);
13842
+ });
13843
+ if (existing) {
13844
+ existing.lastAccessed = lastAccessed;
13845
+ store.put(existing);
13846
+ }
13847
+ return new Promise((resolve, reject) => {
13848
+ tx.oncomplete = () => resolve();
13849
+ tx.onerror = () => reject(tx.error);
13850
+ });
13851
+ }
13852
+ async delete(url) {
13853
+ const db = await this.getDB();
13854
+ return new Promise((resolve, reject) => {
13855
+ const tx = db.transaction(this.storeName, "readwrite");
13856
+ tx.objectStore(this.storeName).delete(url);
13857
+ tx.oncomplete = () => resolve();
13858
+ tx.onerror = () => reject(tx.error);
13859
+ });
13860
+ }
13861
+ async getAll() {
13862
+ const db = await this.getDB();
13863
+ return new Promise((resolve, reject) => {
13864
+ const tx = db.transaction(this.storeName, "readonly");
13865
+ const store = tx.objectStore(this.storeName);
13866
+ const request = store.getAll();
13867
+ request.onsuccess = () => resolve(request.result);
13868
+ request.onerror = () => reject(request.error);
13869
+ });
13870
+ }
13871
+ async clear() {
13872
+ const db = await this.getDB();
13873
+ return new Promise((resolve, reject) => {
13874
+ const tx = db.transaction(this.storeName, "readwrite");
13875
+ tx.objectStore(this.storeName).clear();
13876
+ tx.oncomplete = () => resolve();
13877
+ tx.onerror = () => reject(tx.error);
13878
+ });
13879
+ }
13880
+ }
13563
13881
 
13882
+ ;// CONCATENATED MODULE: ../core/src/cache/drivers/memoryCacheDriver.ts
13883
+ class MemoryCacheDriver {
13884
+ constructor() {
13885
+ Object.defineProperty(this, "store", {
13886
+ enumerable: true,
13887
+ configurable: true,
13888
+ writable: true,
13889
+ value: new Map()
13890
+ });
13891
+ }
13892
+ async get(url) {
13893
+ return this.store.get(url);
13894
+ }
13895
+ async set(record) {
13896
+ this.store.set(record.url, record);
13897
+ }
13898
+ async delete(url) {
13899
+ this.store.delete(url);
13900
+ }
13901
+ async getAll() {
13902
+ return Array.from(this.store.values());
13903
+ }
13904
+ async clear() {
13905
+ this.store.clear();
13906
+ }
13907
+ async updateAccessTime(url, lastAccessed) {
13908
+ const record = await this.get(url);
13909
+ if (!record)
13910
+ return;
13911
+ record.lastAccessed = lastAccessed;
13912
+ this.set(record);
13913
+ }
13914
+ }
13564
13915
 
13916
+ ;// CONCATENATED MODULE: ../core/src/cache/lruCache.ts
13565
13917
 
13566
13918
 
13567
- var StoryReaderCommand;
13568
- (function (StoryReaderCommand) {
13569
- StoryReaderCommand["RedirectToStory"] = "redirectToStory";
13570
- StoryReaderCommand["CloseStory"] = "closeStory";
13571
- StoryReaderCommand["ShowMultipleStories"] = "showMultipleStories";
13572
- StoryReaderCommand["ReloadStory"] = "reloadStory";
13573
- })(StoryReaderCommand || (StoryReaderCommand = {}));
13574
- var StoryReaderEvent;
13575
- (function (StoryReaderEvent) {
13576
- StoryReaderEvent["Close"] = "closeStoryReader";
13577
- })(StoryReaderEvent || (StoryReaderEvent = {}));
13578
- var CloseStoryReaderAction;
13579
- (function (CloseStoryReaderAction) {
13580
- CloseStoryReaderAction["CloseByBtn"] = "closeReaderByCloseBtn";
13581
- CloseStoryReaderAction["CloseByTimer"] = "auto";
13582
- CloseStoryReaderAction["CloseByEsc"] = "closeReaderByEscBtn";
13583
- CloseStoryReaderAction["CloseByLastSlideClick"] = "lastSlideClick";
13584
- CloseStoryReaderAction["CloseBySwipeDown"] = "swipeDown";
13585
- CloseStoryReaderAction["CloseCustom"] = "customClose";
13586
- CloseStoryReaderAction["AppClose"] = "app-close";
13587
- })(CloseStoryReaderAction || (CloseStoryReaderAction = {}));
13588
- let StoryReaderViewModel = (() => {
13589
- var _a, _StoryReaderViewModel__muted_accessor_storage, _StoryReaderViewModel__closeGestureInAction_accessor_storage, _StoryReaderViewModel__stories_accessor_storage;
13590
- let _classSuper = ViewModel;
13591
- let _instanceExtraInitializers = [];
13592
- let __muted_decorators;
13593
- let __muted_initializers = [];
13594
- let __muted_extraInitializers = [];
13595
- let __closeGestureInAction_decorators;
13596
- let __closeGestureInAction_initializers = [];
13597
- let __closeGestureInAction_extraInitializers = [];
13598
- let __stories_decorators;
13599
- let __stories_initializers = [];
13600
- let __stories_extraInitializers = [];
13601
- let _get_isOpened_decorators;
13602
- let _get_reachStart_decorators;
13603
- let _get_reachEnd_decorators;
13604
- let _open_decorators;
13605
- let _close_decorators;
13606
- let _reloadStory_decorators;
13607
- let _nextStory_decorators;
13608
- let _prevStory_decorators;
13609
- let _nextStoryWithAnimation_decorators;
13610
- let _prevStoryWithAnimation_decorators;
13919
+ class LRUCache {
13920
+ constructor(repository, loader, options) {
13921
+ var _a, _b;
13922
+ Object.defineProperty(this, "repository", {
13923
+ enumerable: true,
13924
+ configurable: true,
13925
+ writable: true,
13926
+ value: repository
13927
+ });
13928
+ Object.defineProperty(this, "loader", {
13929
+ enumerable: true,
13930
+ configurable: true,
13931
+ writable: true,
13932
+ value: loader
13933
+ });
13934
+ Object.defineProperty(this, "urlLocks", {
13935
+ enumerable: true,
13936
+ configurable: true,
13937
+ writable: true,
13938
+ value: new Map()
13939
+ });
13940
+ Object.defineProperty(this, "options", {
13941
+ enumerable: true,
13942
+ configurable: true,
13943
+ writable: true,
13944
+ value: void 0
13945
+ });
13946
+ this.options = {
13947
+ maxSize: (_a = options === null || options === void 0 ? void 0 : options.maxSize) !== null && _a !== void 0 ? _a : 20,
13948
+ debug: Boolean(options === null || options === void 0 ? void 0 : options.debug),
13949
+ ttl: (_b = options === null || options === void 0 ? void 0 : options.ttl) !== null && _b !== void 0 ? _b : 3600
13950
+ };
13951
+ }
13952
+ async init() {
13953
+ await this.repository.loadAllEntries();
13954
+ await this.tryEvict();
13955
+ }
13956
+ async getAll() {
13957
+ return this.repository.getAll();
13958
+ }
13959
+ async get(url, priority) {
13960
+ const mutex = this.getMutexForUrl(url);
13961
+ const release = await mutex.acquire();
13962
+ try {
13963
+ let entry = await this.repository.get(url);
13964
+ if (!entry)
13965
+ entry = await this.add(url, priority);
13966
+ entry.updateLastAccessed();
13967
+ entry.getOrCreateBlobUrl();
13968
+ if (this.options.debug)
13969
+ console.log("[IAS]: Get from cache", entry);
13970
+ await this.repository.updateAccessTime(entry);
13971
+ return entry;
13972
+ }
13973
+ finally {
13974
+ release();
13975
+ }
13976
+ }
13977
+ async tryEvict() {
13978
+ const expiredEntries = await this.evictExpired();
13979
+ const oldestEntries = await this.evictOldest();
13980
+ return [...expiredEntries, ...oldestEntries];
13981
+ }
13982
+ async evictOldest() {
13983
+ const entries = await this.repository.getAll();
13984
+ if (entries.length <= this.options.maxSize)
13985
+ return [];
13986
+ const evictedEntries = [];
13987
+ const sorted = entries.sort((a, b) => a.lastAccessed - b.lastAccessed);
13988
+ while (sorted.length > this.options.maxSize) {
13989
+ const entry = sorted.shift();
13990
+ if (!entry)
13991
+ continue;
13992
+ if (this.options.debug)
13993
+ console.log("[IAS]: Remove oldest entry from cache", entry);
13994
+ await this.removeEntry(entry);
13995
+ evictedEntries.push(entry);
13996
+ }
13997
+ return evictedEntries;
13998
+ }
13999
+ async wait() {
14000
+ await Promise.all(Array.from(this.urlLocks.values()).map(urlLock => urlLock.waitForUnlock()));
14001
+ }
14002
+ async evictExpired() {
14003
+ if (this.options.ttl === 0)
14004
+ return [];
14005
+ const entries = await this.repository.getAll();
14006
+ const now = Date.now();
14007
+ const evictedEntries = [];
14008
+ for (const entry of entries) {
14009
+ if (entry.lastAccessed + this.options.ttl * 1000 < now) {
14010
+ if (this.options.debug)
14011
+ console.log("[IAS]: Remove expired entry from cache", entry);
14012
+ await this.removeEntry(entry);
14013
+ evictedEntries.push(entry);
14014
+ }
14015
+ }
14016
+ return evictedEntries;
14017
+ }
14018
+ async add(url, priority) {
14019
+ const blob = await this.loader.enqueue(url, priority);
14020
+ const entry = new CacheEntry(url, blob);
14021
+ await this.repository.save(entry);
14022
+ await this.tryEvict();
14023
+ if (this.options.debug)
14024
+ console.log("[IAS]: Add to cache", entry);
14025
+ return entry;
14026
+ }
14027
+ getMutexForUrl(url) {
14028
+ let mutex = this.urlLocks.get(url);
14029
+ if (!mutex) {
14030
+ mutex = new external_async_mutex_namespaceObject.Mutex();
14031
+ this.urlLocks.set(url, mutex);
14032
+ }
14033
+ return mutex;
14034
+ }
14035
+ cleanupLock(url) {
14036
+ this.urlLocks.delete(url);
14037
+ }
14038
+ async removeEntry(entry) {
14039
+ entry.destroy();
14040
+ this.cleanupLock(entry.url);
14041
+ await this.repository.delete(entry.url);
14042
+ }
14043
+ }
14044
+
14045
+ ;// CONCATENATED MODULE: ../core/src/cache/resourceLoader.ts
14046
+
14047
+ class ResourceLoader {
14048
+ constructor(concurrency) {
14049
+ Object.defineProperty(this, "concurrency", {
14050
+ enumerable: true,
14051
+ configurable: true,
14052
+ writable: true,
14053
+ value: concurrency
14054
+ });
14055
+ Object.defineProperty(this, "semaphore", {
14056
+ enumerable: true,
14057
+ configurable: true,
14058
+ writable: true,
14059
+ value: void 0
14060
+ });
14061
+ this.semaphore = new external_async_mutex_namespaceObject.Semaphore(concurrency);
14062
+ }
14063
+ async enqueue(url, priority) {
14064
+ return await this.semaphore.runExclusive(async () => {
14065
+ const response = await fetch(url, { cache: "no-store" });
14066
+ const blob = await response.blob();
14067
+ return blob;
14068
+ }, 1, priority);
14069
+ }
14070
+ wait() {
14071
+ return this.semaphore.waitForUnlock(this.concurrency);
14072
+ }
14073
+ clear() {
14074
+ this.semaphore.cancel();
14075
+ }
14076
+ async destroy() {
14077
+ this.clear();
14078
+ await this.wait();
14079
+ }
14080
+ }
14081
+
14082
+ ;// CONCATENATED MODULE: ../core/src/cache/cacheManager.ts
14083
+
14084
+
14085
+
14086
+
14087
+ const CACHE_VERSION = 1;
14088
+ class CacheManager {
14089
+ get isDestroyed() {
14090
+ return this._isDestroyed;
14091
+ }
14092
+ constructor(options) {
14093
+ var _a, _b, _c, _d, _e;
14094
+ Object.defineProperty(this, "lruCache", {
14095
+ enumerable: true,
14096
+ configurable: true,
14097
+ writable: true,
14098
+ value: void 0
14099
+ });
14100
+ Object.defineProperty(this, "loader", {
14101
+ enumerable: true,
14102
+ configurable: true,
14103
+ writable: true,
14104
+ value: void 0
14105
+ });
14106
+ Object.defineProperty(this, "cacheRepository", {
14107
+ enumerable: true,
14108
+ configurable: true,
14109
+ writable: true,
14110
+ value: void 0
14111
+ });
14112
+ Object.defineProperty(this, "options", {
14113
+ enumerable: true,
14114
+ configurable: true,
14115
+ writable: true,
14116
+ value: void 0
14117
+ });
14118
+ Object.defineProperty(this, "_isDestroyed", {
14119
+ enumerable: true,
14120
+ configurable: true,
14121
+ writable: true,
14122
+ value: false
14123
+ });
14124
+ this.options = {
14125
+ maxSize: (_a = options.maxSize) !== null && _a !== void 0 ? _a : 20,
14126
+ concurrency: (_b = options.concurrency) !== null && _b !== void 0 ? _b : 5,
14127
+ debug: Boolean(options.debug),
14128
+ ttl: (_c = options.ttl) !== null && _c !== void 0 ? _c : 3600,
14129
+ type: (_d = options.type) !== null && _d !== void 0 ? _d : "indexeddb",
14130
+ storeName: (_e = options.storeName) !== null && _e !== void 0 ? _e : "resources"
14131
+ };
14132
+ const driver = this.createCacheDriver();
14133
+ this.cacheRepository = new CacheRepository(driver);
14134
+ this.loader = new ResourceLoader(this.options.concurrency);
14135
+ this.lruCache = new LRUCache(this.cacheRepository, this.loader, {
14136
+ maxSize: this.options.maxSize,
14137
+ debug: this.options.debug,
14138
+ ttl: this.options.ttl
14139
+ });
14140
+ this.lruCache.init().catch(error => console.error("[IAS]: LRU cache init error", error));
14141
+ }
14142
+ async preload(requests) {
14143
+ const results = await Promise.allSettled(requests.map(async (request) => {
14144
+ return await this.lruCache.get(request.url, request.priority);
14145
+ }));
14146
+ return results
14147
+ .filter((r) => r.status === "fulfilled" && r.value !== null)
14148
+ .map(r => r.value);
14149
+ }
14150
+ async destroy() {
14151
+ try {
14152
+ this._isDestroyed = true;
14153
+ await this.loader.destroy();
14154
+ await this.lruCache.wait();
14155
+ }
14156
+ finally {
14157
+ await this.cacheRepository.clear();
14158
+ if (this.options.debug)
14159
+ console.log("[IAS]: Destroy LRU cache");
14160
+ }
14161
+ }
14162
+ createCacheDriver() {
14163
+ if (this.options.type === "indexeddb")
14164
+ return new IndexedDBCacheDriver(`ias-cache-v${CACHE_VERSION}`, this.options.storeName);
14165
+ return new MemoryCacheDriver();
14166
+ }
14167
+ }
14168
+
14169
+ ;// CONCATENATED MODULE: ../core/src/cache/index.ts
14170
+
14171
+
14172
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyReaderViewModel.ts
14173
+ var storyReaderViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
14174
+ var useValue = arguments.length > 2;
14175
+ for (var i = 0; i < initializers.length; i++) {
14176
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
14177
+ }
14178
+ return useValue ? value : void 0;
14179
+ };
14180
+ var storyReaderViewModel_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
14181
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
14182
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
14183
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
14184
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
14185
+ var _, done = false;
14186
+ for (var i = decorators.length - 1; i >= 0; i--) {
14187
+ var context = {};
14188
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
14189
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
14190
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
14191
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14192
+ if (kind === "accessor") {
14193
+ if (result === void 0) continue;
14194
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
14195
+ if (_ = accept(result.get)) descriptor.get = _;
14196
+ if (_ = accept(result.set)) descriptor.set = _;
14197
+ if (_ = accept(result.init)) initializers.unshift(_);
14198
+ }
14199
+ else if (_ = accept(result)) {
14200
+ if (kind === "field") initializers.unshift(_);
14201
+ else descriptor[key] = _;
14202
+ }
14203
+ }
14204
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
14205
+ done = true;
14206
+ };
14207
+ var storyReaderViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14208
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
14209
+ 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");
14210
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
14211
+ };
14212
+ var storyReaderViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
14213
+ if (kind === "m") throw new TypeError("Private method is not writable");
14214
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
14215
+ 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");
14216
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
14217
+ };
14218
+
14219
+
14220
+
14221
+
14222
+
14223
+
14224
+
14225
+
14226
+
14227
+
14228
+
14229
+
14230
+ var StoryReaderEvent;
14231
+ (function (StoryReaderEvent) {
14232
+ StoryReaderEvent["Close"] = "closeStoryReader";
14233
+ })(StoryReaderEvent || (StoryReaderEvent = {}));
14234
+ var CloseStoryReaderAction;
14235
+ (function (CloseStoryReaderAction) {
14236
+ CloseStoryReaderAction["CloseByBtn"] = "closeReaderByCloseBtn";
14237
+ CloseStoryReaderAction["CloseByTimer"] = "auto";
14238
+ CloseStoryReaderAction["CloseByEsc"] = "closeReaderByEscBtn";
14239
+ CloseStoryReaderAction["CloseByLastSlideClick"] = "lastSlideClick";
14240
+ CloseStoryReaderAction["CloseBySwipeDown"] = "swipeDown";
14241
+ CloseStoryReaderAction["CloseCustom"] = "customClose";
14242
+ CloseStoryReaderAction["AppClose"] = "app-close";
14243
+ })(CloseStoryReaderAction || (CloseStoryReaderAction = {}));
14244
+ let StoryReaderViewModel = (() => {
14245
+ var _a, _StoryReaderViewModel__muted_accessor_storage, _StoryReaderViewModel__closeGestureInAction_accessor_storage, _StoryReaderViewModel__stories_accessor_storage;
14246
+ let _classSuper = ViewModel;
14247
+ let _instanceExtraInitializers = [];
14248
+ let __muted_decorators;
14249
+ let __muted_initializers = [];
14250
+ let __muted_extraInitializers = [];
14251
+ let __closeGestureInAction_decorators;
14252
+ let __closeGestureInAction_initializers = [];
14253
+ let __closeGestureInAction_extraInitializers = [];
14254
+ let __stories_decorators;
14255
+ let __stories_initializers = [];
14256
+ let __stories_extraInitializers = [];
14257
+ let _get_isOpened_decorators;
14258
+ let _get_reachStart_decorators;
14259
+ let _get_reachEnd_decorators;
14260
+ let _open_decorators;
14261
+ let _close_decorators;
14262
+ let _showStory_decorators;
14263
+ let _showStoryOnce_decorators;
14264
+ let _showStoryFromSharePage_decorators;
14265
+ let _showOnboardingStories_decorators;
14266
+ let _showMultipleStories_decorators;
14267
+ let _reloadStory_decorators;
14268
+ let _nextStory_decorators;
14269
+ let _prevStory_decorators;
14270
+ let _nextStoryWithAnimation_decorators;
14271
+ let _prevStoryWithAnimation_decorators;
13611
14272
  let _toStoryWithAnimationByIndex_decorators;
13612
14273
  let _navigateStoryWithAnimationByIndex_decorators;
13613
14274
  let _mute_decorators;
@@ -13692,6 +14353,12 @@ let StoryReaderViewModel = (() => {
13692
14353
  writable: true,
13693
14354
  value: false
13694
14355
  });
14356
+ Object.defineProperty(this, "cacheManager", {
14357
+ enumerable: true,
14358
+ configurable: true,
14359
+ writable: true,
14360
+ value: null
14361
+ });
13695
14362
  this.handleWindowUnload = this.handleWindowUnload.bind(this);
13696
14363
  this.handleKeydown = this.handleKeydown.bind(this);
13697
14364
  window.addEventListener("beforeunload", this.handleWindowUnload);
@@ -13745,6 +14412,8 @@ let StoryReaderViewModel = (() => {
13745
14412
  var _b, _c;
13746
14413
  if (this.activeStory)
13747
14414
  this.resetReaderToDefaultState(this.activeStory);
14415
+ if (this.storyManager.config.cache)
14416
+ this.cacheManager = new CacheManager(this.storyManager.config.cache);
13748
14417
  this.windowReferer = payload.windowReferer;
13749
14418
  this.setStories(payload.stories);
13750
14419
  const activeStory = this.navigationController.setActiveStoryById(payload.id);
@@ -13782,6 +14451,7 @@ let StoryReaderViewModel = (() => {
13782
14451
  });
13783
14452
  }
13784
14453
  resetReaderToDefaultState(activeStory, closeAction) {
14454
+ var _b;
13785
14455
  const event = new CloseStoryEvent(activeStory, {
13786
14456
  action: closeAction
13787
14457
  });
@@ -13796,6 +14466,7 @@ let StoryReaderViewModel = (() => {
13796
14466
  this._touchController.destroy();
13797
14467
  document.removeEventListener("keydown", this.handleKeydown);
13798
14468
  this.navigationController.destroy();
14469
+ (_b = this.cacheManager) === null || _b === void 0 ? void 0 : _b.destroy();
13799
14470
  }
13800
14471
  canBeClosed() {
13801
14472
  return this.activeStory ? !this.activeStory.disableClose : false;
@@ -13865,12 +14536,14 @@ let StoryReaderViewModel = (() => {
13865
14536
  this.navigationController.navigateStoryWithAnimation(index, action);
13866
14537
  }
13867
14538
  destroy() {
14539
+ var _b;
13868
14540
  if (this.activeStory) {
13869
14541
  this.emitCloseEvents(this.activeStory, CloseStoryReaderAction.AppClose);
13870
14542
  this.resetReaderToDefaultState(this.activeStory);
13871
14543
  }
13872
14544
  this.removeAllListeners();
13873
14545
  window.removeEventListener("beforeunload", this.handleWindowUnload);
14546
+ (_b = this.cacheManager) === null || _b === void 0 ? void 0 : _b.destroy();
13874
14547
  }
13875
14548
  closeGoodsWidget() {
13876
14549
  var _b;
@@ -13941,7 +14614,7 @@ let StoryReaderViewModel = (() => {
13941
14614
  setStories(stories) {
13942
14615
  const slideApiHandlersFactory = new StorySlideApiHandlersFactory(this.storyManager, this, this.storyReaderStatisticV1Service, this.storyReaderStatisticV2Service);
13943
14616
  for (const story of stories) {
13944
- this._stories.push(new StoryViewModel(this.storyManager, this, story, slideApiHandlersFactory, this.storyReaderStatisticV1Service, this.storyReaderStatisticV2Service));
14617
+ this._stories.push(new StoryViewModel(this.storyManager, this, story, slideApiHandlersFactory, this.storyReaderStatisticV1Service, this.storyReaderStatisticV2Service, this.cacheManager));
13945
14618
  }
13946
14619
  }
13947
14620
  handleKeydown(e) {
@@ -13996,6 +14669,11 @@ let StoryReaderViewModel = (() => {
13996
14669
  _get_reachEnd_decorators = [external_mobx_namespaceObject.computed];
13997
14670
  _open_decorators = [external_mobx_namespaceObject.action];
13998
14671
  _close_decorators = [external_mobx_namespaceObject.action];
14672
+ _showStory_decorators = [noConcurrent];
14673
+ _showStoryOnce_decorators = [noConcurrent];
14674
+ _showStoryFromSharePage_decorators = [noConcurrent];
14675
+ _showOnboardingStories_decorators = [noConcurrent];
14676
+ _showMultipleStories_decorators = [noConcurrent];
13999
14677
  _reloadStory_decorators = [external_mobx_namespaceObject.action];
14000
14678
  _nextStory_decorators = [external_mobx_namespaceObject.action];
14001
14679
  _prevStory_decorators = [external_mobx_namespaceObject.action];
@@ -14015,6 +14693,11 @@ let StoryReaderViewModel = (() => {
14015
14693
  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);
14016
14694
  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);
14017
14695
  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);
14696
+ 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);
14697
+ 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);
14698
+ 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);
14699
+ 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);
14700
+ 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);
14018
14701
  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);
14019
14702
  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);
14020
14703
  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);
@@ -15032,8 +15715,12 @@ let StoryManagerConfig = (() => {
15032
15715
  });
15033
15716
  _StoryManagerConfig__anonymous_accessor_storage.set(this, storyManagerConfig_runInitializers(this, __anonymous_initializers, false));
15034
15717
  _StoryManagerConfig__options_accessor_storage.set(this, (storyManagerConfig_runInitializers(this, __anonymous_extraInitializers), storyManagerConfig_runInitializers(this, __options_initializers, {})));
15035
- storyManagerConfig_runInitializers(this, __options_extraInitializers);
15036
- this.storyManager = storyManager;
15718
+ Object.defineProperty(this, "_cache", {
15719
+ enumerable: true,
15720
+ configurable: true,
15721
+ writable: true,
15722
+ value: (storyManagerConfig_runInitializers(this, __options_extraInitializers), null)
15723
+ });
15037
15724
  this.update(configDto);
15038
15725
  this._isInited = true;
15039
15726
  }
@@ -15079,6 +15766,9 @@ let StoryManagerConfig = (() => {
15079
15766
  get options() {
15080
15767
  return this._options;
15081
15768
  }
15769
+ get cache() {
15770
+ return this._cache;
15771
+ }
15082
15772
  disableStatistic() {
15083
15773
  this._isStatisticsDisabled = true;
15084
15774
  }
@@ -15163,9 +15853,10 @@ let StoryManagerConfig = (() => {
15163
15853
  this._options = options;
15164
15854
  }
15165
15855
  update(configDto) {
15166
- var _b, _c, _d, _e, _f;
15856
+ var _b, _c, _d, _e, _f, _g;
15167
15857
  this._appPackageId = (_b = configDto.appPackageId) !== null && _b !== void 0 ? _b : "";
15168
15858
  this._disableDeviceId = Boolean(configDto.disableDeviceId);
15859
+ this.setOptions(configDto.options);
15169
15860
  this.setApiKey(configDto.apiKey);
15170
15861
  this.setAnonymous(configDto.anonymous);
15171
15862
  this.setUserId((_c = configDto.userId) !== null && _c !== void 0 ? _c : "", configDto.userIdSign);
@@ -15174,7 +15865,7 @@ let StoryManagerConfig = (() => {
15174
15865
  this.setImagePlaceholders((_e = configDto.imagePlaceholders) !== null && _e !== void 0 ? _e : {});
15175
15866
  this.setTags((_f = configDto.tags) !== null && _f !== void 0 ? _f : []);
15176
15867
  this.setDir(configDto.dir);
15177
- this.setOptions(configDto.options);
15868
+ this._cache = configDto.cache ? Object.assign(Object.assign({}, configDto.cache), { prefetch: (_g = configDto.cache.prefetch) !== null && _g !== void 0 ? _g : true }) : null;
15178
15869
  }
15179
15870
  mapTextPlaceholders(textPlaceholderDtos) {
15180
15871
  const textPlaceholders = [];
@@ -15280,6 +15971,9 @@ class NullStoryManagerConfig {
15280
15971
  get options() {
15281
15972
  return {};
15282
15973
  }
15974
+ get cache() {
15975
+ return null;
15976
+ }
15283
15977
  disableStatistic() { }
15284
15978
  enableStatistic() { }
15285
15979
  async setApiKey(apiKey) { }
@@ -15449,7 +16143,7 @@ var iamMessage_classPrivateFieldSet = (undefined && undefined.__classPrivateFiel
15449
16143
 
15450
16144
  const DEFAULT_ITERATION_ID = (0,external_uuid_namespaceObject.v4)();
15451
16145
  let IamMessage = (() => {
15452
- var _a, _IamMessage__id_accessor_storage, _IamMessage__events_accessor_storage, _IamMessage__type_accessor_storage, _IamMessage__slides_accessor_storage, _IamMessage__appearanceOptions_accessor_storage, _IamMessage__needPlaceholders_accessor_storage, _IamMessage__hasLimit_accessor_storage, _IamMessage__isOnceOpened_accessor_storage, _IamMessage__context_accessor_storage;
16146
+ var _a, _IamMessage__id_accessor_storage, _IamMessage__events_accessor_storage, _IamMessage__type_accessor_storage, _IamMessage__slides_accessor_storage, _IamMessage__appearanceOptions_accessor_storage, _IamMessage__needPlaceholders_accessor_storage, _IamMessage__hasLimit_accessor_storage, _IamMessage__disableClose_accessor_storage, _IamMessage__isOnceOpened_accessor_storage, _IamMessage__context_accessor_storage;
15453
16147
  let _instanceExtraInitializers = [];
15454
16148
  let __id_decorators;
15455
16149
  let __id_initializers = [];
@@ -15472,6 +16166,9 @@ let IamMessage = (() => {
15472
16166
  let __hasLimit_decorators;
15473
16167
  let __hasLimit_initializers = [];
15474
16168
  let __hasLimit_extraInitializers = [];
16169
+ let __disableClose_decorators;
16170
+ let __disableClose_initializers = [];
16171
+ let __disableClose_extraInitializers = [];
15475
16172
  let __isOnceOpened_decorators;
15476
16173
  let __isOnceOpened_initializers = [];
15477
16174
  let __isOnceOpened_extraInitializers = [];
@@ -15494,6 +16191,8 @@ let IamMessage = (() => {
15494
16191
  set _needPlaceholders(value) { iamMessage_classPrivateFieldSet(this, _IamMessage__needPlaceholders_accessor_storage, value, "f"); }
15495
16192
  get _hasLimit() { return iamMessage_classPrivateFieldGet(this, _IamMessage__hasLimit_accessor_storage, "f"); }
15496
16193
  set _hasLimit(value) { iamMessage_classPrivateFieldSet(this, _IamMessage__hasLimit_accessor_storage, value, "f"); }
16194
+ get _disableClose() { return iamMessage_classPrivateFieldGet(this, _IamMessage__disableClose_accessor_storage, "f"); }
16195
+ set _disableClose(value) { iamMessage_classPrivateFieldSet(this, _IamMessage__disableClose_accessor_storage, value, "f"); }
15497
16196
  get _isOnceOpened() { return iamMessage_classPrivateFieldGet(this, _IamMessage__isOnceOpened_accessor_storage, "f"); }
15498
16197
  set _isOnceOpened(value) { iamMessage_classPrivateFieldSet(this, _IamMessage__isOnceOpened_accessor_storage, value, "f"); }
15499
16198
  get _context() { return iamMessage_classPrivateFieldGet(this, _IamMessage__context_accessor_storage, "f"); }
@@ -15506,7 +16205,8 @@ let IamMessage = (() => {
15506
16205
  _IamMessage__appearanceOptions_accessor_storage.set(this, (iamMessage_runInitializers(this, __slides_extraInitializers), iamMessage_runInitializers(this, __appearanceOptions_initializers, new IamAppearanceCommonOptions({}))));
15507
16206
  _IamMessage__needPlaceholders_accessor_storage.set(this, (iamMessage_runInitializers(this, __appearanceOptions_extraInitializers), iamMessage_runInitializers(this, __needPlaceholders_initializers, false)));
15508
16207
  _IamMessage__hasLimit_accessor_storage.set(this, (iamMessage_runInitializers(this, __needPlaceholders_extraInitializers), iamMessage_runInitializers(this, __hasLimit_initializers, false)));
15509
- _IamMessage__isOnceOpened_accessor_storage.set(this, (iamMessage_runInitializers(this, __hasLimit_extraInitializers), iamMessage_runInitializers(this, __isOnceOpened_initializers, false)));
16208
+ _IamMessage__disableClose_accessor_storage.set(this, (iamMessage_runInitializers(this, __hasLimit_extraInitializers), iamMessage_runInitializers(this, __disableClose_initializers, false)));
16209
+ _IamMessage__isOnceOpened_accessor_storage.set(this, (iamMessage_runInitializers(this, __disableClose_extraInitializers), iamMessage_runInitializers(this, __isOnceOpened_initializers, false)));
15510
16210
  _IamMessage__context_accessor_storage.set(this, (iamMessage_runInitializers(this, __isOnceOpened_extraInitializers), iamMessage_runInitializers(this, __context_initializers, void 0)));
15511
16211
  /**
15512
16212
  * null - показывать однократно
@@ -15599,11 +16299,15 @@ let IamMessage = (() => {
15599
16299
  get type() {
15600
16300
  return this._type;
15601
16301
  }
16302
+ get disableClose() {
16303
+ return this._disableClose;
16304
+ }
15602
16305
  destroy() { }
15603
16306
  updateByDto(messageDto) {
15604
16307
  var _b, _c, _d;
15605
16308
  this._events = this.mapMessageEventsByDto((_b = messageDto.events) !== null && _b !== void 0 ? _b : []);
15606
16309
  this._type = messageDto.type;
16310
+ this._disableClose = Boolean(messageDto.disable_close);
15607
16311
  this._campaignName = messageDto.campaign_name;
15608
16312
  this._frequencyLimit = messageDto.frequency_limit;
15609
16313
  this._displayFrom = (_c = messageDto.display_from) !== null && _c !== void 0 ? _c : null;
@@ -15667,6 +16371,7 @@ let IamMessage = (() => {
15667
16371
  _IamMessage__appearanceOptions_accessor_storage = new WeakMap(),
15668
16372
  _IamMessage__needPlaceholders_accessor_storage = new WeakMap(),
15669
16373
  _IamMessage__hasLimit_accessor_storage = new WeakMap(),
16374
+ _IamMessage__disableClose_accessor_storage = new WeakMap(),
15670
16375
  _IamMessage__isOnceOpened_accessor_storage = new WeakMap(),
15671
16376
  _IamMessage__context_accessor_storage = new WeakMap(),
15672
16377
  (() => {
@@ -15678,6 +16383,7 @@ let IamMessage = (() => {
15678
16383
  __appearanceOptions_decorators = [external_mobx_namespaceObject.observable];
15679
16384
  __needPlaceholders_decorators = [external_mobx_namespaceObject.observable];
15680
16385
  __hasLimit_decorators = [external_mobx_namespaceObject.observable];
16386
+ __disableClose_decorators = [external_mobx_namespaceObject.observable];
15681
16387
  __isOnceOpened_decorators = [external_mobx_namespaceObject.observable];
15682
16388
  __context_decorators = [external_mobx_namespaceObject.observable];
15683
16389
  _updateByDto_decorators = [external_mobx_namespaceObject.action];
@@ -15688,6 +16394,7 @@ let IamMessage = (() => {
15688
16394
  iamMessage_esDecorate(_a, null, __appearanceOptions_decorators, { kind: "accessor", name: "_appearanceOptions", static: false, private: false, access: { has: obj => "_appearanceOptions" in obj, get: obj => obj._appearanceOptions, set: (obj, value) => { obj._appearanceOptions = value; } }, metadata: _metadata }, __appearanceOptions_initializers, __appearanceOptions_extraInitializers);
15689
16395
  iamMessage_esDecorate(_a, null, __needPlaceholders_decorators, { kind: "accessor", name: "_needPlaceholders", static: false, private: false, access: { has: obj => "_needPlaceholders" in obj, get: obj => obj._needPlaceholders, set: (obj, value) => { obj._needPlaceholders = value; } }, metadata: _metadata }, __needPlaceholders_initializers, __needPlaceholders_extraInitializers);
15690
16396
  iamMessage_esDecorate(_a, null, __hasLimit_decorators, { kind: "accessor", name: "_hasLimit", static: false, private: false, access: { has: obj => "_hasLimit" in obj, get: obj => obj._hasLimit, set: (obj, value) => { obj._hasLimit = value; } }, metadata: _metadata }, __hasLimit_initializers, __hasLimit_extraInitializers);
16397
+ iamMessage_esDecorate(_a, null, __disableClose_decorators, { kind: "accessor", name: "_disableClose", static: false, private: false, access: { has: obj => "_disableClose" in obj, get: obj => obj._disableClose, set: (obj, value) => { obj._disableClose = value; } }, metadata: _metadata }, __disableClose_initializers, __disableClose_extraInitializers);
15691
16398
  iamMessage_esDecorate(_a, null, __isOnceOpened_decorators, { kind: "accessor", name: "_isOnceOpened", static: false, private: false, access: { has: obj => "_isOnceOpened" in obj, get: obj => obj._isOnceOpened, set: (obj, value) => { obj._isOnceOpened = value; } }, metadata: _metadata }, __isOnceOpened_initializers, __isOnceOpened_extraInitializers);
15692
16399
  iamMessage_esDecorate(_a, null, __context_decorators, { kind: "accessor", name: "_context", static: false, private: false, access: { has: obj => "_context" in obj, get: obj => obj._context, set: (obj, value) => { obj._context = value; } }, metadata: _metadata }, __context_initializers, __context_extraInitializers);
15693
16400
  iamMessage_esDecorate(_a, null, _updateByDto_decorators, { kind: "method", name: "updateByDto", static: false, private: false, access: { has: obj => "updateByDto" in obj, get: obj => obj.updateByDto }, metadata: _metadata }, null, _instanceExtraInitializers);
@@ -16700,7 +17407,16 @@ let IamMessageSlideViewModel = (() => {
16700
17407
  const { canClickNext } = this.slideApi.slideClickHandler(event.target, direction);
16701
17408
  this._disabledNextClick = !canClickNext;
16702
17409
  }
16703
- destroy() { }
17410
+ async destroy() {
17411
+ try {
17412
+ this.message.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
17413
+ document.removeEventListener("visibilitychange", this.handleDocumentVisibilityChange);
17414
+ await this.slideApi.destroy();
17415
+ }
17416
+ catch (error) {
17417
+ console.error(error);
17418
+ }
17419
+ }
16704
17420
  getNavigationDirection(event, currentTarget) {
16705
17421
  const xPercent = this.getClickPosition(event, currentTarget);
16706
17422
  const k = this.slideApi.layoutDirection === "ltr" ? 1 : -1;
@@ -16756,6 +17472,7 @@ let IamMessageSlideViewModel = (() => {
16756
17472
 
16757
17473
 
16758
17474
 
17475
+
16759
17476
  ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/actions/openGameAction.ts
16760
17477
 
16761
17478
  class openGameAction_OpenGameAction {
@@ -16774,13 +17491,11 @@ class openGameAction_OpenGameAction {
16774
17491
  });
16775
17492
  }
16776
17493
  async handle(payload) {
16777
- var _a;
16778
17494
  try {
16779
17495
  await this.storyManager.openGame(payload.gameInstanceId);
16780
- (_a = this.iamMessage.activeSlide) === null || _a === void 0 ? void 0 : _a.pauseAndLock();
17496
+ this.iamMessage.pauseAndLock();
16781
17497
  this.storyManager.gameReader.once(GameReaderEvent.Close, () => {
16782
- var _a;
16783
- (_a = this.iamMessage.activeSlide) === null || _a === void 0 ? void 0 : _a.resumeAndUnlock();
17498
+ this.iamMessage.resumeAndUnlock();
16784
17499
  });
16785
17500
  }
16786
17501
  catch (error) {
@@ -17018,21 +17733,27 @@ let IamReaderViewModel = (() => {
17018
17733
  await this.open(message);
17019
17734
  return message;
17020
17735
  }
17021
- async close() {
17736
+ async forceClose() {
17022
17737
  if (!this._activeMessage)
17023
17738
  return;
17024
17739
  this.emitCloseEvent(this._activeMessage);
17025
17740
  this.clearActiveMessage();
17026
17741
  this.visibilityObserver.unsubscribe();
17027
17742
  this.touchController.destroy();
17028
- this.scrollbarHelper.enable();
17743
+ this.scrollbarHelper.disable();
17744
+ }
17745
+ async close() {
17746
+ var _b;
17747
+ if ((_b = this._activeMessage) === null || _b === void 0 ? void 0 : _b.disableClose)
17748
+ return;
17749
+ this.forceClose();
17029
17750
  }
17030
17751
  async open(message) {
17031
17752
  message.updatePlaceholders(this.storyManager.rootStore.placeholderStore.placeholders);
17032
17753
  this.touchController.init(document.body);
17033
17754
  this.setActiveMessage(message);
17034
17755
  this.visibilityObserver.subscribe();
17035
- this.scrollbarHelper.disable();
17756
+ this.scrollbarHelper.enable();
17036
17757
  }
17037
17758
  destroy() { }
17038
17759
  emitWidgetEvent(widgetEvent) {
@@ -17078,7 +17799,12 @@ let IamReaderViewModel = (() => {
17078
17799
  });
17079
17800
  }
17080
17801
  createIamMessageViewModel(message) {
17081
- return new IamMessageViewModel(this, this.storyManager, message, this.iamStatisticsService);
17802
+ if (message.slides.length > 1) {
17803
+ return new IamMultiSlideMessageViewModel(this, this.storyManager, message, this.iamStatisticsService);
17804
+ }
17805
+ else {
17806
+ return new IamMessageViewModel(this, this.storyManager, message, this.iamStatisticsService);
17807
+ }
17082
17808
  }
17083
17809
  checkMessageNotOpened() {
17084
17810
  if (this.activeMessage)
@@ -17179,13 +17905,11 @@ class showStoryAction_ShowStoryAction {
17179
17905
  });
17180
17906
  }
17181
17907
  async handle(payload) {
17182
- var _a;
17183
17908
  try {
17184
17909
  await this.storyManager.showStory(payload.storyId);
17185
- (_a = this.message.activeSlide) === null || _a === void 0 ? void 0 : _a.pauseAndLock();
17910
+ this.message.pauseAndLock();
17186
17911
  this.storyManager.storyReader.once(StoryReaderEvent.Close, () => {
17187
- var _a;
17188
- (_a = this.message.activeSlide) === null || _a === void 0 ? void 0 : _a.resumeAndUnlock();
17912
+ this.message.resumeAndUnlock();
17189
17913
  });
17190
17914
  }
17191
17915
  catch (error) {
@@ -17225,6 +17949,7 @@ class narrativeDataCache_NarrativeDataCache {
17225
17949
 
17226
17950
 
17227
17951
 
17952
+
17228
17953
  class IamSlideApiHandlers {
17229
17954
  constructor(storyManager, iamReader, iamMessage, iamStatisticsService) {
17230
17955
  Object.defineProperty(this, "storyManager", {
@@ -17264,6 +17989,29 @@ class IamSlideApiHandlers {
17264
17989
  value: new narrativeDataCache_NarrativeDataCache()
17265
17990
  });
17266
17991
  }
17992
+ onEvent(name, event) {
17993
+ switch (name) {
17994
+ case "showSlide":
17995
+ if (this.iamMessage instanceof IamMultiSlideMessageViewModel) {
17996
+ this.iamMessage.onShowSlide(event.index);
17997
+ }
17998
+ break;
17999
+ }
18000
+ }
18001
+ onCardLoadingStateChange(state) {
18002
+ switch (state) {
18003
+ case 0 /* CARD_LOADING_STATE.LOADING */:
18004
+ this.iamMessage.showLoaderScreen();
18005
+ break;
18006
+ case 1 /* CARD_LOADING_STATE.LOADED */:
18007
+ this.iamMessage.hideErrorScreen();
18008
+ this.iamMessage.hideLoaderScreen();
18009
+ break;
18010
+ case 2 /* CARD_LOADING_STATE.LOADING_ERROR */:
18011
+ this.iamMessage.showErrorScreen();
18012
+ break;
18013
+ }
18014
+ }
17267
18015
  clearActiveNarrativeDataCache() {
17268
18016
  this.activeMessageNarrativeDataCache.clear();
17269
18017
  }
@@ -17282,7 +18030,7 @@ class IamSlideApiHandlers {
17282
18030
  });
17283
18031
  }
17284
18032
  closeCard(reason) {
17285
- this.iamReader.close();
18033
+ this.iamReader.forceClose();
17286
18034
  }
17287
18035
  openStory(id, index) {
17288
18036
  new showStoryAction_ShowStoryAction(this.storyManager, this.iamMessage).handle({
@@ -17373,8 +18121,7 @@ class IamSlideApiHandlers {
17373
18121
  share(id, config) { }
17374
18122
  shareSlideScreenshot(shareId, hideElementsSelector, shareText) { }
17375
18123
  showLayer(index) {
17376
- var _a;
17377
- (_a = this.iamMessage.activeSlide) === null || _a === void 0 ? void 0 : _a.showLayerByIndex(index);
18124
+ this.iamMessage.showLayerByIndex(index);
17378
18125
  }
17379
18126
  showCardSlide(slideIndex) { }
17380
18127
  cardShowNext() { }
@@ -17410,20 +18157,357 @@ class IamSlideApiHandlers {
17410
18157
  this.iamMessage.hideErrorScreen();
17411
18158
  }
17412
18159
  showToast(text) {
17413
- var _a;
17414
- (_a = this.iamMessage.activeSlide) === null || _a === void 0 ? void 0 : _a.showToast({ content: text });
18160
+ this.iamMessage.showToast({ content: text });
18161
+ }
18162
+ }
18163
+
18164
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/nullIamMessageSlideViewModel.ts
18165
+ class NullIamMessageSlideViewModel {
18166
+ get isLoading() {
18167
+ return true;
18168
+ }
18169
+ get html() {
18170
+ return "";
17415
18171
  }
18172
+ get navigationDisabled() {
18173
+ return false;
18174
+ }
18175
+ async reload() {
18176
+ return {
18177
+ currentTime: Date.now()
18178
+ };
18179
+ }
18180
+ mute() { }
18181
+ unmute() { }
18182
+ notifyTimerEnd() { }
18183
+ pauseAndLock() { }
18184
+ resumeAndUnlock() { }
18185
+ async showLayerByIndex(index) { }
18186
+ setUserData(id, text) { }
18187
+ setShareComplete(id, isSuccess) { }
18188
+ notifySwipeUp(target) { }
18189
+ showToast(options) { }
18190
+ async init() { }
18191
+ async start() { }
18192
+ async restart() { }
18193
+ async resumeByApp() { }
18194
+ async pauseByApp() { }
18195
+ async resumeByUser() { }
18196
+ async pauseByUser() { }
18197
+ async stop() { }
18198
+ onClick(event, currentTarget) { }
18199
+ async destroy() { }
17416
18200
  }
17417
18201
 
17418
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/iamMessageViewModel.ts
17419
- var iamMessageViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
18202
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/iamMessageViewModel.ts
18203
+ var iamMessageViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
18204
+ var useValue = arguments.length > 2;
18205
+ for (var i = 0; i < initializers.length; i++) {
18206
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
18207
+ }
18208
+ return useValue ? value : void 0;
18209
+ };
18210
+ var iamMessageViewModel_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
18211
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
18212
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
18213
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
18214
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
18215
+ var _, done = false;
18216
+ for (var i = decorators.length - 1; i >= 0; i--) {
18217
+ var context = {};
18218
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
18219
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
18220
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
18221
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
18222
+ if (kind === "accessor") {
18223
+ if (result === void 0) continue;
18224
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
18225
+ if (_ = accept(result.get)) descriptor.get = _;
18226
+ if (_ = accept(result.set)) descriptor.set = _;
18227
+ if (_ = accept(result.init)) initializers.unshift(_);
18228
+ }
18229
+ else if (_ = accept(result)) {
18230
+ if (kind === "field") initializers.unshift(_);
18231
+ else descriptor[key] = _;
18232
+ }
18233
+ }
18234
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
18235
+ done = true;
18236
+ };
18237
+ var iamMessageViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18238
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
18239
+ 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");
18240
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
18241
+ };
18242
+ var iamMessageViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
18243
+ if (kind === "m") throw new TypeError("Private method is not writable");
18244
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
18245
+ 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");
18246
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
18247
+ };
18248
+
18249
+
18250
+
18251
+
18252
+
18253
+
18254
+
18255
+
18256
+ let IamMessageViewModel = (() => {
18257
+ var _a, _IamMessageViewModel__isOnceOpened_accessor_storage, _IamMessageViewModel__$root_accessor_storage, _IamMessageViewModel__needShowErrorScreen_accessor_storage, _IamMessageViewModel__needShowLoaderScreen_accessor_storage;
18258
+ let _classSuper = events.EventEmitter;
18259
+ let _instanceExtraInitializers = [];
18260
+ let __isOnceOpened_decorators;
18261
+ let __isOnceOpened_initializers = [];
18262
+ let __isOnceOpened_extraInitializers = [];
18263
+ let __$root_decorators;
18264
+ let __$root_initializers = [];
18265
+ let __$root_extraInitializers = [];
18266
+ let __needShowErrorScreen_decorators;
18267
+ let __needShowErrorScreen_initializers = [];
18268
+ let __needShowErrorScreen_extraInitializers = [];
18269
+ let __needShowLoaderScreen_decorators;
18270
+ let __needShowLoaderScreen_initializers = [];
18271
+ let __needShowLoaderScreen_extraInitializers = [];
18272
+ let _showErrorScreen_decorators;
18273
+ let _showLoaderScreen_decorators;
18274
+ let _hideLoaderScreen_decorators;
18275
+ let _hideErrorScreen_decorators;
18276
+ return _a = class IamMessageViewModel extends _classSuper {
18277
+ get _isOnceOpened() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__isOnceOpened_accessor_storage, "f"); }
18278
+ set _isOnceOpened(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__isOnceOpened_accessor_storage, value, "f"); }
18279
+ get _$root() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__$root_accessor_storage, "f"); }
18280
+ set _$root(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__$root_accessor_storage, value, "f"); }
18281
+ get _needShowErrorScreen() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__needShowErrorScreen_accessor_storage, "f"); }
18282
+ set _needShowErrorScreen(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__needShowErrorScreen_accessor_storage, value, "f"); }
18283
+ get _needShowLoaderScreen() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__needShowLoaderScreen_accessor_storage, "f"); }
18284
+ set _needShowLoaderScreen(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__needShowLoaderScreen_accessor_storage, value, "f"); }
18285
+ constructor(iamReader, storyManager, iamMessage, iamStatisticsService) {
18286
+ super();
18287
+ Object.defineProperty(this, "iamReader", {
18288
+ enumerable: true,
18289
+ configurable: true,
18290
+ writable: true,
18291
+ value: (iamMessageViewModel_runInitializers(this, _instanceExtraInitializers), iamReader)
18292
+ });
18293
+ Object.defineProperty(this, "storyManager", {
18294
+ enumerable: true,
18295
+ configurable: true,
18296
+ writable: true,
18297
+ value: storyManager
18298
+ });
18299
+ Object.defineProperty(this, "iamMessage", {
18300
+ enumerable: true,
18301
+ configurable: true,
18302
+ writable: true,
18303
+ value: iamMessage
18304
+ });
18305
+ Object.defineProperty(this, "iamStatisticsService", {
18306
+ enumerable: true,
18307
+ configurable: true,
18308
+ writable: true,
18309
+ value: iamStatisticsService
18310
+ });
18311
+ Object.defineProperty(this, "_slides", {
18312
+ enumerable: true,
18313
+ configurable: true,
18314
+ writable: true,
18315
+ value: []
18316
+ });
18317
+ Object.defineProperty(this, "slideApiHandlers", {
18318
+ enumerable: true,
18319
+ configurable: true,
18320
+ writable: true,
18321
+ value: void 0
18322
+ });
18323
+ _IamMessageViewModel__isOnceOpened_accessor_storage.set(this, iamMessageViewModel_runInitializers(this, __isOnceOpened_initializers, false));
18324
+ _IamMessageViewModel__$root_accessor_storage.set(this, (iamMessageViewModel_runInitializers(this, __isOnceOpened_extraInitializers), iamMessageViewModel_runInitializers(this, __$root_initializers, null)));
18325
+ _IamMessageViewModel__needShowErrorScreen_accessor_storage.set(this, (iamMessageViewModel_runInitializers(this, __$root_extraInitializers), iamMessageViewModel_runInitializers(this, __needShowErrorScreen_initializers, false)));
18326
+ _IamMessageViewModel__needShowLoaderScreen_accessor_storage.set(this, (iamMessageViewModel_runInitializers(this, __needShowErrorScreen_extraInitializers), iamMessageViewModel_runInitializers(this, __needShowLoaderScreen_initializers, false)));
18327
+ Object.defineProperty(this, "touchController", {
18328
+ enumerable: true,
18329
+ configurable: true,
18330
+ writable: true,
18331
+ value: iamMessageViewModel_runInitializers(this, __needShowLoaderScreen_extraInitializers)
18332
+ });
18333
+ Object.defineProperty(this, "slideApi", {
18334
+ enumerable: true,
18335
+ configurable: true,
18336
+ writable: true,
18337
+ value: void 0
18338
+ });
18339
+ Object.defineProperty(this, "attachRoot", {
18340
+ enumerable: true,
18341
+ configurable: true,
18342
+ writable: true,
18343
+ value: (el) => {
18344
+ this._$root = el;
18345
+ this.createSlidesViewModels();
18346
+ }
18347
+ });
18348
+ this.touchController = iamReader.touchController;
18349
+ this.slideApiHandlers = new IamSlideApiHandlers(this.storyManager, this.iamReader, this, this.iamStatisticsService);
18350
+ }
18351
+ get id() {
18352
+ return this.iamMessage.id;
18353
+ }
18354
+ get $root() {
18355
+ return this._$root;
18356
+ }
18357
+ get activeSlideIndex() {
18358
+ return 0;
18359
+ }
18360
+ get activeSlide() {
18361
+ var _b;
18362
+ return (_b = this._slides[this.activeSlideIndex]) !== null && _b !== void 0 ? _b : new NullIamMessageSlideViewModel();
18363
+ }
18364
+ get slides() {
18365
+ return this._slides;
18366
+ }
18367
+ get context() {
18368
+ return this.iamMessage.context;
18369
+ }
18370
+ get appearanceOptions() {
18371
+ return this.iamMessage.appearanceOptions;
18372
+ }
18373
+ get iterationId() {
18374
+ return this.iamMessage.iterationId;
18375
+ }
18376
+ get type() {
18377
+ return this.iamMessage.type;
18378
+ }
18379
+ get needShowErrorScreen() {
18380
+ return this._needShowErrorScreen;
18381
+ }
18382
+ get needShowLoaderScreen() {
18383
+ return this._needShowLoaderScreen;
18384
+ }
18385
+ get timeSinceLastShow() {
18386
+ return this.iamMessage.timeSinceLastShow;
18387
+ }
18388
+ get disableClose() {
18389
+ return this.iamMessage.disableClose;
18390
+ }
18391
+ open() {
18392
+ this._isOnceOpened = true;
18393
+ const iterationId = this.iamMessage.trackOpen();
18394
+ return {
18395
+ iterationId
18396
+ };
18397
+ }
18398
+ async updateUserData(data) {
18399
+ return this.storyManager.rootStore.iamStore.updateMessageUserData(this.id, data);
18400
+ }
18401
+ async init() {
18402
+ await this.activeSlide.init();
18403
+ }
18404
+ async start() {
18405
+ await this.activeSlide.start();
18406
+ }
18407
+ async stop() {
18408
+ this.slideApiHandlers.clearActiveNarrativeDataCache();
18409
+ await this.activeSlide.stop();
18410
+ }
18411
+ onClick(event, currentTarget) {
18412
+ this.activeSlide.onClick(event, currentTarget);
18413
+ }
18414
+ toPublicDto() {
18415
+ return this.iamMessage.toPublicDto();
18416
+ }
18417
+ showErrorScreen() {
18418
+ this._needShowErrorScreen = true;
18419
+ }
18420
+ showLoaderScreen() {
18421
+ this._needShowLoaderScreen = true;
18422
+ }
18423
+ hideLoaderScreen() {
18424
+ this._needShowLoaderScreen = false;
18425
+ }
18426
+ hideErrorScreen() {
18427
+ this._needShowErrorScreen = false;
18428
+ }
18429
+ async destroy() {
18430
+ var _b;
18431
+ return (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
18432
+ }
18433
+ resumeAndUnlock() {
18434
+ this.activeSlide.resumeAndUnlock();
18435
+ }
18436
+ pauseAndLock() {
18437
+ this.activeSlide.resumeAndUnlock();
18438
+ }
18439
+ showLayerByIndex(index) {
18440
+ this.activeSlide.showLayerByIndex(index);
18441
+ }
18442
+ showToast(options) {
18443
+ this.activeSlide.showToast(options);
18444
+ }
18445
+ restart() {
18446
+ var _b;
18447
+ return (_b = this.activeSlide) === null || _b === void 0 ? void 0 : _b.restart();
18448
+ }
18449
+ createSlidesViewModels() {
18450
+ if (this._slides.length > 0)
18451
+ return;
18452
+ const isFullscreen = this.type === IamMessageType.Fullscreen;
18453
+ const slideApi = new slide_api_namespaceObject.SlideApi(this.slideApiHandlers, {
18454
+ root: this._$root,
18455
+ slideRatio: this.getContentRatio(),
18456
+ isFullscreen,
18457
+ nonce: getNonce(),
18458
+ viewport: window,
18459
+ userResizeHandler: undefined,
18460
+ VODPlayer: this.storyManager.globalProperties.$videoOnDemand,
18461
+ useSdkCacheForMultislideMode: false
18462
+ });
18463
+ this._slides = this.iamMessage.slides.map(slide => new IamMessageSlideViewModel(this, slide, slideApi));
18464
+ this.slideApi = slideApi;
18465
+ }
18466
+ getContentRatio() {
18467
+ if (this.appearanceOptions instanceof IamBottomSheetAppearanceOptions ||
18468
+ this.appearanceOptions instanceof IamModalAppearanceOptions)
18469
+ return this.appearanceOptions.contentRatio;
18470
+ return 9 / 16;
18471
+ }
18472
+ },
18473
+ _IamMessageViewModel__isOnceOpened_accessor_storage = new WeakMap(),
18474
+ _IamMessageViewModel__$root_accessor_storage = new WeakMap(),
18475
+ _IamMessageViewModel__needShowErrorScreen_accessor_storage = new WeakMap(),
18476
+ _IamMessageViewModel__needShowLoaderScreen_accessor_storage = new WeakMap(),
18477
+ (() => {
18478
+ var _b;
18479
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
18480
+ __isOnceOpened_decorators = [external_mobx_namespaceObject.observable];
18481
+ __$root_decorators = [external_mobx_namespaceObject.observable];
18482
+ __needShowErrorScreen_decorators = [external_mobx_namespaceObject.observable];
18483
+ __needShowLoaderScreen_decorators = [external_mobx_namespaceObject.observable];
18484
+ _showErrorScreen_decorators = [external_mobx_namespaceObject.action];
18485
+ _showLoaderScreen_decorators = [external_mobx_namespaceObject.action];
18486
+ _hideLoaderScreen_decorators = [external_mobx_namespaceObject.action];
18487
+ _hideErrorScreen_decorators = [external_mobx_namespaceObject.action];
18488
+ iamMessageViewModel_esDecorate(_a, null, __isOnceOpened_decorators, { kind: "accessor", name: "_isOnceOpened", static: false, private: false, access: { has: obj => "_isOnceOpened" in obj, get: obj => obj._isOnceOpened, set: (obj, value) => { obj._isOnceOpened = value; } }, metadata: _metadata }, __isOnceOpened_initializers, __isOnceOpened_extraInitializers);
18489
+ iamMessageViewModel_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);
18490
+ iamMessageViewModel_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);
18491
+ iamMessageViewModel_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);
18492
+ iamMessageViewModel_esDecorate(_a, null, _showErrorScreen_decorators, { kind: "method", name: "showErrorScreen", static: false, private: false, access: { has: obj => "showErrorScreen" in obj, get: obj => obj.showErrorScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
18493
+ iamMessageViewModel_esDecorate(_a, null, _showLoaderScreen_decorators, { kind: "method", name: "showLoaderScreen", static: false, private: false, access: { has: obj => "showLoaderScreen" in obj, get: obj => obj.showLoaderScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
18494
+ iamMessageViewModel_esDecorate(_a, null, _hideLoaderScreen_decorators, { kind: "method", name: "hideLoaderScreen", static: false, private: false, access: { has: obj => "hideLoaderScreen" in obj, get: obj => obj.hideLoaderScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
18495
+ iamMessageViewModel_esDecorate(_a, null, _hideErrorScreen_decorators, { kind: "method", name: "hideErrorScreen", static: false, private: false, access: { has: obj => "hideErrorScreen" in obj, get: obj => obj.hideErrorScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
18496
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
18497
+ })(),
18498
+ _a;
18499
+ })();
18500
+
18501
+
18502
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/iamMultiSlideMessageViewModel.ts
18503
+ var iamMultiSlideMessageViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
17420
18504
  var useValue = arguments.length > 2;
17421
18505
  for (var i = 0; i < initializers.length; i++) {
17422
18506
  value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
17423
18507
  }
17424
18508
  return useValue ? value : void 0;
17425
18509
  };
17426
- var iamMessageViewModel_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
18510
+ var iamMultiSlideMessageViewModel_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
17427
18511
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
17428
18512
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
17429
18513
  var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
@@ -17450,12 +18534,12 @@ var iamMessageViewModel_esDecorate = (undefined && undefined.__esDecorate) || fu
17450
18534
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
17451
18535
  done = true;
17452
18536
  };
17453
- var iamMessageViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18537
+ var iamMultiSlideMessageViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
17454
18538
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
17455
18539
  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");
17456
18540
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17457
18541
  };
17458
- var iamMessageViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
18542
+ var iamMultiSlideMessageViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
17459
18543
  if (kind === "m") throw new TypeError("Private method is not writable");
17460
18544
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
17461
18545
  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");
@@ -17468,9 +18552,11 @@ var iamMessageViewModel_classPrivateFieldSet = (undefined && undefined.__classPr
17468
18552
 
17469
18553
 
17470
18554
 
17471
- let IamMessageViewModel = (() => {
17472
- var _a, _IamMessageViewModel__isOnceOpened_accessor_storage, _IamMessageViewModel__$root_accessor_storage, _IamMessageViewModel__needShowErrorScreen_accessor_storage, _IamMessageViewModel__needShowLoaderScreen_accessor_storage;
17473
- let _classSuper = ViewModel;
18555
+ const iamMultiSlideMessageViewModel_SWIPE_UP_THRESHOLD = 10;
18556
+ const iamMultiSlideMessageViewModel_SLIDE_CLICK_THRESHOLD = 0.3;
18557
+ let IamMultiSlideMessageViewModel = (() => {
18558
+ var _a, _IamMultiSlideMessageViewModel__isOnceOpened_accessor_storage, _IamMultiSlideMessageViewModel__$root_accessor_storage, _IamMultiSlideMessageViewModel__needShowErrorScreen_accessor_storage, _IamMultiSlideMessageViewModel__needShowLoaderScreen_accessor_storage, _IamMultiSlideMessageViewModel__disabledNextClick_accessor_storage;
18559
+ let _classSuper = events.EventEmitter;
17474
18560
  let _instanceExtraInitializers = [];
17475
18561
  let __isOnceOpened_decorators;
17476
18562
  let __isOnceOpened_initializers = [];
@@ -17484,26 +18570,31 @@ let IamMessageViewModel = (() => {
17484
18570
  let __needShowLoaderScreen_decorators;
17485
18571
  let __needShowLoaderScreen_initializers = [];
17486
18572
  let __needShowLoaderScreen_extraInitializers = [];
18573
+ let __disabledNextClick_decorators;
18574
+ let __disabledNextClick_initializers = [];
18575
+ let __disabledNextClick_extraInitializers = [];
17487
18576
  let _showErrorScreen_decorators;
17488
18577
  let _showLoaderScreen_decorators;
17489
18578
  let _hideLoaderScreen_decorators;
17490
18579
  let _hideErrorScreen_decorators;
17491
- return _a = class IamMessageViewModel extends _classSuper {
17492
- get _isOnceOpened() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__isOnceOpened_accessor_storage, "f"); }
17493
- set _isOnceOpened(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__isOnceOpened_accessor_storage, value, "f"); }
17494
- get _$root() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__$root_accessor_storage, "f"); }
17495
- set _$root(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__$root_accessor_storage, value, "f"); }
17496
- get _needShowErrorScreen() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__needShowErrorScreen_accessor_storage, "f"); }
17497
- set _needShowErrorScreen(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__needShowErrorScreen_accessor_storage, value, "f"); }
17498
- get _needShowLoaderScreen() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__needShowLoaderScreen_accessor_storage, "f"); }
17499
- set _needShowLoaderScreen(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__needShowLoaderScreen_accessor_storage, value, "f"); }
18580
+ return _a = class IamMultiSlideMessageViewModel extends _classSuper {
18581
+ get _isOnceOpened() { return iamMultiSlideMessageViewModel_classPrivateFieldGet(this, _IamMultiSlideMessageViewModel__isOnceOpened_accessor_storage, "f"); }
18582
+ set _isOnceOpened(value) { iamMultiSlideMessageViewModel_classPrivateFieldSet(this, _IamMultiSlideMessageViewModel__isOnceOpened_accessor_storage, value, "f"); }
18583
+ get _$root() { return iamMultiSlideMessageViewModel_classPrivateFieldGet(this, _IamMultiSlideMessageViewModel__$root_accessor_storage, "f"); }
18584
+ set _$root(value) { iamMultiSlideMessageViewModel_classPrivateFieldSet(this, _IamMultiSlideMessageViewModel__$root_accessor_storage, value, "f"); }
18585
+ get _needShowErrorScreen() { return iamMultiSlideMessageViewModel_classPrivateFieldGet(this, _IamMultiSlideMessageViewModel__needShowErrorScreen_accessor_storage, "f"); }
18586
+ set _needShowErrorScreen(value) { iamMultiSlideMessageViewModel_classPrivateFieldSet(this, _IamMultiSlideMessageViewModel__needShowErrorScreen_accessor_storage, value, "f"); }
18587
+ get _needShowLoaderScreen() { return iamMultiSlideMessageViewModel_classPrivateFieldGet(this, _IamMultiSlideMessageViewModel__needShowLoaderScreen_accessor_storage, "f"); }
18588
+ set _needShowLoaderScreen(value) { iamMultiSlideMessageViewModel_classPrivateFieldSet(this, _IamMultiSlideMessageViewModel__needShowLoaderScreen_accessor_storage, value, "f"); }
18589
+ get _disabledNextClick() { return iamMultiSlideMessageViewModel_classPrivateFieldGet(this, _IamMultiSlideMessageViewModel__disabledNextClick_accessor_storage, "f"); }
18590
+ set _disabledNextClick(value) { iamMultiSlideMessageViewModel_classPrivateFieldSet(this, _IamMultiSlideMessageViewModel__disabledNextClick_accessor_storage, value, "f"); }
17500
18591
  constructor(iamReader, storyManager, iamMessage, iamStatisticsService) {
17501
18592
  super();
17502
18593
  Object.defineProperty(this, "iamReader", {
17503
18594
  enumerable: true,
17504
18595
  configurable: true,
17505
18596
  writable: true,
17506
- value: (iamMessageViewModel_runInitializers(this, _instanceExtraInitializers), iamReader)
18597
+ value: (iamMultiSlideMessageViewModel_runInitializers(this, _instanceExtraInitializers), iamReader)
17507
18598
  });
17508
18599
  Object.defineProperty(this, "storyManager", {
17509
18600
  enumerable: true,
@@ -17523,11 +18614,11 @@ let IamMessageViewModel = (() => {
17523
18614
  writable: true,
17524
18615
  value: iamStatisticsService
17525
18616
  });
17526
- Object.defineProperty(this, "_slides", {
18617
+ Object.defineProperty(this, "toast", {
17527
18618
  enumerable: true,
17528
18619
  configurable: true,
17529
18620
  writable: true,
17530
- value: []
18621
+ value: null
17531
18622
  });
17532
18623
  Object.defineProperty(this, "slideApiHandlers", {
17533
18624
  enumerable: true,
@@ -17535,15 +18626,28 @@ let IamMessageViewModel = (() => {
17535
18626
  writable: true,
17536
18627
  value: void 0
17537
18628
  });
17538
- _IamMessageViewModel__isOnceOpened_accessor_storage.set(this, iamMessageViewModel_runInitializers(this, __isOnceOpened_initializers, false));
17539
- _IamMessageViewModel__$root_accessor_storage.set(this, (iamMessageViewModel_runInitializers(this, __isOnceOpened_extraInitializers), iamMessageViewModel_runInitializers(this, __$root_initializers, null)));
17540
- _IamMessageViewModel__needShowErrorScreen_accessor_storage.set(this, (iamMessageViewModel_runInitializers(this, __$root_extraInitializers), iamMessageViewModel_runInitializers(this, __needShowErrorScreen_initializers, false)));
17541
- _IamMessageViewModel__needShowLoaderScreen_accessor_storage.set(this, (iamMessageViewModel_runInitializers(this, __needShowErrorScreen_extraInitializers), iamMessageViewModel_runInitializers(this, __needShowLoaderScreen_initializers, false)));
18629
+ _IamMultiSlideMessageViewModel__isOnceOpened_accessor_storage.set(this, iamMultiSlideMessageViewModel_runInitializers(this, __isOnceOpened_initializers, false));
18630
+ _IamMultiSlideMessageViewModel__$root_accessor_storage.set(this, (iamMultiSlideMessageViewModel_runInitializers(this, __isOnceOpened_extraInitializers), iamMultiSlideMessageViewModel_runInitializers(this, __$root_initializers, null)));
18631
+ _IamMultiSlideMessageViewModel__needShowErrorScreen_accessor_storage.set(this, (iamMultiSlideMessageViewModel_runInitializers(this, __$root_extraInitializers), iamMultiSlideMessageViewModel_runInitializers(this, __needShowErrorScreen_initializers, false)));
18632
+ _IamMultiSlideMessageViewModel__needShowLoaderScreen_accessor_storage.set(this, (iamMultiSlideMessageViewModel_runInitializers(this, __needShowErrorScreen_extraInitializers), iamMultiSlideMessageViewModel_runInitializers(this, __needShowLoaderScreen_initializers, false)));
18633
+ _IamMultiSlideMessageViewModel__disabledNextClick_accessor_storage.set(this, (iamMultiSlideMessageViewModel_runInitializers(this, __needShowLoaderScreen_extraInitializers), iamMultiSlideMessageViewModel_runInitializers(this, __disabledNextClick_initializers, false)));
18634
+ Object.defineProperty(this, "_activeSlideIndex", {
18635
+ enumerable: true,
18636
+ configurable: true,
18637
+ writable: true,
18638
+ value: (iamMultiSlideMessageViewModel_runInitializers(this, __disabledNextClick_extraInitializers), 0)
18639
+ });
18640
+ Object.defineProperty(this, "locked", {
18641
+ enumerable: true,
18642
+ configurable: true,
18643
+ writable: true,
18644
+ value: false
18645
+ });
17542
18646
  Object.defineProperty(this, "touchController", {
17543
18647
  enumerable: true,
17544
18648
  configurable: true,
17545
18649
  writable: true,
17546
- value: iamMessageViewModel_runInitializers(this, __needShowLoaderScreen_extraInitializers)
18650
+ value: void 0
17547
18651
  });
17548
18652
  Object.defineProperty(this, "slideApi", {
17549
18653
  enumerable: true,
@@ -17557,11 +18661,23 @@ let IamMessageViewModel = (() => {
17557
18661
  writable: true,
17558
18662
  value: (el) => {
17559
18663
  this._$root = el;
17560
- this.createSlidesViewModels();
18664
+ this.slideApi = this.createSlideApi();
18665
+ }
18666
+ });
18667
+ Object.defineProperty(this, "handleTouchEnd", {
18668
+ enumerable: true,
18669
+ configurable: true,
18670
+ writable: true,
18671
+ value: ({ dy }) => {
18672
+ if (!this.touchController)
18673
+ return;
18674
+ if (dy < iamMultiSlideMessageViewModel_SWIPE_UP_THRESHOLD && this.touchController.verticalSwipeGesture)
18675
+ this.slideApi.slideSwipeUpHandler();
17561
18676
  }
17562
18677
  });
17563
18678
  this.touchController = iamReader.touchController;
17564
18679
  this.slideApiHandlers = new IamSlideApiHandlers(this.storyManager, this.iamReader, this, this.iamStatisticsService);
18680
+ this.handleDocumentVisibilityChange = this.handleDocumentVisibilityChange.bind(this);
17565
18681
  }
17566
18682
  get id() {
17567
18683
  return this.iamMessage.id;
@@ -17570,13 +18686,10 @@ let IamMessageViewModel = (() => {
17570
18686
  return this._$root;
17571
18687
  }
17572
18688
  get activeSlideIndex() {
17573
- return 0;
17574
- }
17575
- get activeSlide() {
17576
- return this._slides[this.activeSlideIndex];
18689
+ return this._activeSlideIndex;
17577
18690
  }
17578
18691
  get slides() {
17579
- return this._slides;
18692
+ return [];
17580
18693
  }
17581
18694
  get context() {
17582
18695
  return this.iamMessage.context;
@@ -17587,11 +18700,6 @@ let IamMessageViewModel = (() => {
17587
18700
  get iterationId() {
17588
18701
  return this.iamMessage.iterationId;
17589
18702
  }
17590
- /**
17591
- 1 - Bottom sheet
17592
- 2 - Modal
17593
- 3 - Fullscreen
17594
- */
17595
18703
  get type() {
17596
18704
  return this.iamMessage.type;
17597
18705
  }
@@ -17604,6 +18712,9 @@ let IamMessageViewModel = (() => {
17604
18712
  get timeSinceLastShow() {
17605
18713
  return this.iamMessage.timeSinceLastShow;
17606
18714
  }
18715
+ get disableClose() {
18716
+ return this.iamMessage.disableClose;
18717
+ }
17607
18718
  open() {
17608
18719
  this._isOnceOpened = true;
17609
18720
  const iterationId = this.iamMessage.trackOpen();
@@ -17615,17 +18726,24 @@ let IamMessageViewModel = (() => {
17615
18726
  return this.storyManager.rootStore.iamStore.updateMessageUserData(this.id, data);
17616
18727
  }
17617
18728
  async init() {
17618
- var _b;
17619
- await ((_b = this.activeSlide) === null || _b === void 0 ? void 0 : _b.init());
18729
+ await this.slideApi.showSlides(this.iamMessage.slides.map(slide => slide.html), this.appearanceOptions.cardAppearance);
17620
18730
  }
17621
18731
  async start() {
17622
- var _b;
17623
- await ((_b = this.activeSlide) === null || _b === void 0 ? void 0 : _b.start());
18732
+ document.addEventListener("visibilitychange", this.handleDocumentVisibilityChange);
18733
+ this.touchController.on(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
17624
18734
  }
17625
18735
  async stop() {
17626
- var _b;
17627
- this.slideApiHandlers.clearActiveNarrativeDataCache();
17628
- await ((_b = this.activeSlide) === null || _b === void 0 ? void 0 : _b.stop());
18736
+ document.removeEventListener("visibilitychange", this.handleDocumentVisibilityChange);
18737
+ this.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
18738
+ }
18739
+ onClick(event, currentTarget) {
18740
+ if (!event.target || !this.slideApi)
18741
+ return;
18742
+ event.preventDefault();
18743
+ event.stopPropagation();
18744
+ const direction = this.getNavigationDirection(event, currentTarget);
18745
+ const { canClickNext } = this.slideApi.slideClickHandler(event.target, direction);
18746
+ this._disabledNextClick = !canClickNext;
17629
18747
  }
17630
18748
  toPublicDto() {
17631
18749
  return this.iamMessage.toPublicDto();
@@ -17642,25 +18760,58 @@ let IamMessageViewModel = (() => {
17642
18760
  hideErrorScreen() {
17643
18761
  this._needShowErrorScreen = false;
17644
18762
  }
17645
- destroy() {
18763
+ async destroy() {
17646
18764
  var _b;
17647
- (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
18765
+ document.removeEventListener("visibilitychange", this.handleDocumentVisibilityChange);
18766
+ this.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
18767
+ return (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
17648
18768
  }
17649
- createSlidesViewModels() {
17650
- if (this._slides.length > 0)
17651
- return;
18769
+ async resumeAndUnlock() {
18770
+ var _b;
18771
+ try {
18772
+ this.locked = false;
18773
+ await ((_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.slideAppResume());
18774
+ }
18775
+ catch (error) {
18776
+ this.handleSlideError(error);
18777
+ }
18778
+ }
18779
+ async pauseAndLock() {
18780
+ var _b;
18781
+ try {
18782
+ this.locked = true;
18783
+ await ((_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.slideAppPause());
18784
+ }
18785
+ catch (error) {
18786
+ this.handleSlideError(error);
18787
+ }
18788
+ }
18789
+ showLayerByIndex(index) {
18790
+ var _b;
18791
+ (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.showLayer(index);
18792
+ }
18793
+ showToast(options) {
18794
+ this.toast = new Toast(Object.assign(Object.assign({}, options), { mountPoint: this.$root }));
18795
+ this.toast.show(options.content);
18796
+ }
18797
+ onShowSlide(index) {
18798
+ this._activeSlideIndex = index;
18799
+ }
18800
+ async restart() {
18801
+ await this.init();
18802
+ }
18803
+ createSlideApi() {
17652
18804
  const isFullscreen = this.type === IamMessageType.Fullscreen;
17653
- const slideApi = new slide_api_namespaceObject.SlideApi(this.slideApiHandlers, {
18805
+ return new slide_api_namespaceObject.SlideApi(this.slideApiHandlers, {
17654
18806
  root: this._$root,
17655
18807
  slideRatio: this.getContentRatio(),
17656
18808
  isFullscreen,
17657
18809
  nonce: getNonce(),
17658
18810
  viewport: window,
17659
18811
  userResizeHandler: undefined,
17660
- VODPlayer: this.storyManager.globalProperties.$videoOnDemand
18812
+ VODPlayer: this.storyManager.globalProperties.$videoOnDemand,
18813
+ useSdkCacheForMultislideMode: false
17661
18814
  });
17662
- this._slides = this.iamMessage.slides.map(slide => new IamMessageSlideViewModel(this, slide, slideApi));
17663
- this.slideApi = slideApi;
17664
18815
  }
17665
18816
  getContentRatio() {
17666
18817
  if (this.appearanceOptions instanceof IamBottomSheetAppearanceOptions ||
@@ -17668,11 +18819,66 @@ let IamMessageViewModel = (() => {
17668
18819
  return this.appearanceOptions.contentRatio;
17669
18820
  return 9 / 16;
17670
18821
  }
18822
+ handleSlideError(error) {
18823
+ console.error(error);
18824
+ this.showErrorScreen();
18825
+ this.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
18826
+ }
18827
+ getNavigationDirection(event, currentTarget) {
18828
+ const xPercent = this.getClickPosition(event, currentTarget);
18829
+ const k = this.slideApi.layoutDirection === "ltr" ? 1 : -1;
18830
+ const direction = xPercent >= iamMultiSlideMessageViewModel_SLIDE_CLICK_THRESHOLD ? k : -k;
18831
+ return direction > 0 ? "forward" : "backward";
18832
+ }
18833
+ getClickPosition(event, currentTarget) {
18834
+ const rect = currentTarget.getBoundingClientRect();
18835
+ const width = rect.width;
18836
+ if (width <= 0)
18837
+ return 0;
18838
+ let x;
18839
+ if (event instanceof MouseEvent) {
18840
+ x = event.pageX - rect.left;
18841
+ }
18842
+ else if (event.touches && event.touches.length > 0) {
18843
+ x = event.touches[0].pageX - rect.left;
18844
+ }
18845
+ else {
18846
+ return 0;
18847
+ }
18848
+ return Math.max(0, Math.min(1, x / width));
18849
+ }
18850
+ handleDocumentVisibilityChange() {
18851
+ if (this.locked)
18852
+ return;
18853
+ if (document.visibilityState === "hidden")
18854
+ this.pauseByApp();
18855
+ if (document.visibilityState === "visible")
18856
+ this.resumeByApp();
18857
+ }
18858
+ async resumeByApp() {
18859
+ var _b;
18860
+ try {
18861
+ await ((_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.slideAppResume());
18862
+ }
18863
+ catch (error) {
18864
+ this.handleSlideError(error);
18865
+ }
18866
+ }
18867
+ async pauseByApp() {
18868
+ var _b;
18869
+ try {
18870
+ await ((_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.slideAppPause());
18871
+ }
18872
+ catch (error) {
18873
+ this.handleSlideError(error);
18874
+ }
18875
+ }
17671
18876
  },
17672
- _IamMessageViewModel__isOnceOpened_accessor_storage = new WeakMap(),
17673
- _IamMessageViewModel__$root_accessor_storage = new WeakMap(),
17674
- _IamMessageViewModel__needShowErrorScreen_accessor_storage = new WeakMap(),
17675
- _IamMessageViewModel__needShowLoaderScreen_accessor_storage = new WeakMap(),
18877
+ _IamMultiSlideMessageViewModel__isOnceOpened_accessor_storage = new WeakMap(),
18878
+ _IamMultiSlideMessageViewModel__$root_accessor_storage = new WeakMap(),
18879
+ _IamMultiSlideMessageViewModel__needShowErrorScreen_accessor_storage = new WeakMap(),
18880
+ _IamMultiSlideMessageViewModel__needShowLoaderScreen_accessor_storage = new WeakMap(),
18881
+ _IamMultiSlideMessageViewModel__disabledNextClick_accessor_storage = new WeakMap(),
17676
18882
  (() => {
17677
18883
  var _b;
17678
18884
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
@@ -17680,18 +18886,20 @@ let IamMessageViewModel = (() => {
17680
18886
  __$root_decorators = [external_mobx_namespaceObject.observable];
17681
18887
  __needShowErrorScreen_decorators = [external_mobx_namespaceObject.observable];
17682
18888
  __needShowLoaderScreen_decorators = [external_mobx_namespaceObject.observable];
18889
+ __disabledNextClick_decorators = [external_mobx_namespaceObject.observable];
17683
18890
  _showErrorScreen_decorators = [external_mobx_namespaceObject.action];
17684
18891
  _showLoaderScreen_decorators = [external_mobx_namespaceObject.action];
17685
18892
  _hideLoaderScreen_decorators = [external_mobx_namespaceObject.action];
17686
18893
  _hideErrorScreen_decorators = [external_mobx_namespaceObject.action];
17687
- iamMessageViewModel_esDecorate(_a, null, __isOnceOpened_decorators, { kind: "accessor", name: "_isOnceOpened", static: false, private: false, access: { has: obj => "_isOnceOpened" in obj, get: obj => obj._isOnceOpened, set: (obj, value) => { obj._isOnceOpened = value; } }, metadata: _metadata }, __isOnceOpened_initializers, __isOnceOpened_extraInitializers);
17688
- iamMessageViewModel_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);
17689
- iamMessageViewModel_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);
17690
- iamMessageViewModel_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);
17691
- iamMessageViewModel_esDecorate(_a, null, _showErrorScreen_decorators, { kind: "method", name: "showErrorScreen", static: false, private: false, access: { has: obj => "showErrorScreen" in obj, get: obj => obj.showErrorScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
17692
- iamMessageViewModel_esDecorate(_a, null, _showLoaderScreen_decorators, { kind: "method", name: "showLoaderScreen", static: false, private: false, access: { has: obj => "showLoaderScreen" in obj, get: obj => obj.showLoaderScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
17693
- iamMessageViewModel_esDecorate(_a, null, _hideLoaderScreen_decorators, { kind: "method", name: "hideLoaderScreen", static: false, private: false, access: { has: obj => "hideLoaderScreen" in obj, get: obj => obj.hideLoaderScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
17694
- iamMessageViewModel_esDecorate(_a, null, _hideErrorScreen_decorators, { kind: "method", name: "hideErrorScreen", static: false, private: false, access: { has: obj => "hideErrorScreen" in obj, get: obj => obj.hideErrorScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
18894
+ iamMultiSlideMessageViewModel_esDecorate(_a, null, __isOnceOpened_decorators, { kind: "accessor", name: "_isOnceOpened", static: false, private: false, access: { has: obj => "_isOnceOpened" in obj, get: obj => obj._isOnceOpened, set: (obj, value) => { obj._isOnceOpened = value; } }, metadata: _metadata }, __isOnceOpened_initializers, __isOnceOpened_extraInitializers);
18895
+ iamMultiSlideMessageViewModel_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);
18896
+ iamMultiSlideMessageViewModel_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);
18897
+ iamMultiSlideMessageViewModel_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);
18898
+ iamMultiSlideMessageViewModel_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);
18899
+ iamMultiSlideMessageViewModel_esDecorate(_a, null, _showErrorScreen_decorators, { kind: "method", name: "showErrorScreen", static: false, private: false, access: { has: obj => "showErrorScreen" in obj, get: obj => obj.showErrorScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
18900
+ iamMultiSlideMessageViewModel_esDecorate(_a, null, _showLoaderScreen_decorators, { kind: "method", name: "showLoaderScreen", static: false, private: false, access: { has: obj => "showLoaderScreen" in obj, get: obj => obj.showLoaderScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
18901
+ iamMultiSlideMessageViewModel_esDecorate(_a, null, _hideLoaderScreen_decorators, { kind: "method", name: "hideLoaderScreen", static: false, private: false, access: { has: obj => "hideLoaderScreen" in obj, get: obj => obj.hideLoaderScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
18902
+ iamMultiSlideMessageViewModel_esDecorate(_a, null, _hideErrorScreen_decorators, { kind: "method", name: "hideErrorScreen", static: false, private: false, access: { has: obj => "hideErrorScreen" in obj, get: obj => obj.hideErrorScreen }, metadata: _metadata }, null, _instanceExtraInitializers);
17695
18903
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
17696
18904
  })(),
17697
18905
  _a;
@@ -17703,6 +18911,8 @@ let IamMessageViewModel = (() => {
17703
18911
 
17704
18912
 
17705
18913
 
18914
+
18915
+
17706
18916
  ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/index.ts
17707
18917
 
17708
18918
 
@@ -19517,8 +20727,9 @@ let IamStore = (() => {
19517
20727
  async fetchAll(params) {
19518
20728
  await this.rootStore.sessionStore.open();
19519
20729
  await this.fetchMessageContext();
19520
- const tags = params.tags ? params.tags : this.rootStore.storyManagerConfigStore.config.tags;
19521
- const messageDtos = await this.iamApi.fetchAll({ tags: filterTags(tags) });
20730
+ const config = this.rootStore.storyManagerConfigStore.config;
20731
+ const tags = params.tags ? params.tags : config.tags;
20732
+ const messageDtos = await this.iamApi.fetchAll({ tags: filterTags(tags), options: config.options });
19522
20733
  return this.createMessagesByDtos(messageDtos);
19523
20734
  }
19524
20735
  async fetchMessageContext() {
@@ -20053,8 +21264,15 @@ let StoryFeedStore = (() => {
20053
21264
  }
20054
21265
  async fetchDefaultFeed({ feedSlug, testKey }) {
20055
21266
  const session = await this.rootStore.sessionStore.open();
20056
- const tags = this.rootStore.storyManagerConfigStore.config.tags;
20057
- const storyFeedDto = await this.storyFeedsApi.fetchDefaultFeed({ feedSlug, tags, testKey });
21267
+ const config = this.rootStore.storyManagerConfigStore.config;
21268
+ const storyFeedDto = await this.storyFeedsApi.fetchDefaultFeed({
21269
+ feedSlug,
21270
+ tags: config.tags,
21271
+ testKey,
21272
+ options: {
21273
+ pos: config.options.pos
21274
+ }
21275
+ });
20058
21276
  const stories = this.rootStore.storyStore.addStoriesByDtos(storyFeedDto.stories);
20059
21277
  const storyFeed = new StoryFeed(storyFeedDto, stories, { testKey });
20060
21278
  this.addStoryFeed(session.userKey, storyFeed);
@@ -20071,10 +21289,19 @@ let StoryFeedStore = (() => {
20071
21289
  }
20072
21290
  async fetchUgcFeed({ filter, testKey }) {
20073
21291
  const session = await this.rootStore.sessionStore.open();
20074
- const tags = this.rootStore.storyManagerConfigStore.config.tags;
20075
- const storyDtos = await this.storyFeedsApi.fetchUgcFeed({ filter, tags, testKey });
21292
+ const config = this.rootStore.storyManagerConfigStore.config;
21293
+ const storyDtos = await this.storyFeedsApi.fetchUgcFeed({
21294
+ filter,
21295
+ tags: config.tags,
21296
+ testKey,
21297
+ options: {
21298
+ pos: config.options.pos
21299
+ }
21300
+ });
20076
21301
  const stories = this.rootStore.storyStore.addStoriesByDtos(storyDtos);
20077
- const ugcFeed = UgcStoryFeed.createByStories(stories, { filter });
21302
+ const ugcFeed = UgcStoryFeed.createByStories(stories, {
21303
+ filter
21304
+ });
20078
21305
  this.addStoryFeed(session.userKey, ugcFeed);
20079
21306
  return ugcFeed;
20080
21307
  }
@@ -20184,7 +21411,7 @@ let OnboardingFeedStore = (() => {
20184
21411
  const config = this.rootStore.storyManagerConfigStore.config;
20185
21412
  if (!config)
20186
21413
  return null;
20187
- return [config.lang, config.apiKey];
21414
+ return [config.lang, config.apiKey, config.options];
20188
21415
  }, () => {
20189
21416
  this.invalidateCacheData();
20190
21417
  });
@@ -20211,7 +21438,10 @@ let OnboardingFeedStore = (() => {
20211
21438
  if (onboardingStoryFeed && !this.cacheDataInvalidated && onboardingStoryFeed.isEqualParams(onboardingParams))
20212
21439
  return onboardingStoryFeed;
20213
21440
  const session = await this.rootStore.sessionStore.open();
20214
- const onboardingFeedDto = await this.storyFeedsApi.fetchOnboardingFeed(Object.assign(Object.assign({}, onboardingParams), { feedSlug }));
21441
+ const config = this.rootStore.storyManagerConfigStore.config;
21442
+ const onboardingFeedDto = await this.storyFeedsApi.fetchOnboardingFeed(Object.assign(Object.assign({}, onboardingParams), { feedSlug, options: {
21443
+ pos: config.options.pos
21444
+ } }));
20215
21445
  const stories = this.rootStore.storyStore.addStoriesByDtos(onboardingFeedDto.stories);
20216
21446
  onboardingStoryFeed = new OnboardingStoryFeed(onboardingFeedDto, stories, onboardingParams);
20217
21447
  this.addOnboardingFeed(session.userKey, onboardingStoryFeed);
@@ -20284,7 +21514,7 @@ class UgcEditorStore {
20284
21514
  const session = await this.storyManager.rootStore.sessionStore.open();
20285
21515
  const ugcEditorConfigDto = await this.ugcEditorApi.fetchUgcEditorConfig();
20286
21516
  const storyManagerConfig = this.storyManager.config;
20287
- const sdkVersion = "1.8.0-rc.8";
21517
+ const sdkVersion = "1.8.0";
20288
21518
  this._config = {
20289
21519
  sessionId: session.id,
20290
21520
  apiKey: storyManagerConfig.apiKey,
@@ -20317,7 +21547,6 @@ class UgcEditorApi {
20317
21547
  const requestConfig = {
20318
21548
  method: "GET",
20319
21549
  url: "ugc/editor-config",
20320
- params: {}
20321
21550
  };
20322
21551
  const response = await api.request(requestConfig);
20323
21552
  return response.data;
@@ -20716,7 +21945,7 @@ class StoryManager extends TypedEventEmitter {
20716
21945
  return this._userAgent;
20717
21946
  }
20718
21947
  get sdkVersionName() {
20719
- const sdkVersionName = "1.8.0-rc.8";
21948
+ const sdkVersionName = "1.8.0";
20720
21949
  return sdkVersionName || "0.0.0";
20721
21950
  }
20722
21951
  get sdkVersionCode() {
@@ -20840,7 +22069,7 @@ class StoryManager extends TypedEventEmitter {
20840
22069
  clearConfig() {
20841
22070
  this.storyReader.close(CloseStoryReaderAction.AppClose, true);
20842
22071
  this.gameReader.closeGame();
20843
- this.inAppMessaging.close();
22072
+ this.inAppMessaging.forceClose();
20844
22073
  this.rootStore.storyManagerConfigStore.clear();
20845
22074
  }
20846
22075
  static isSingletonInstanceExists() {
@@ -22717,7 +23946,8 @@ const StoryReaderRoot = (0,external_mobx_react_lite_namespaceObject.observer)((p
22717
23946
  filter: ((_c = options.slideBackdrop) === null || _c === void 0 ? void 0 : _c.blur) ? `blur(${options.slideBackdrop.blur}px)` : "none"
22718
23947
  };
22719
23948
  };
22720
- return ((0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, { children: [(0,jsx_runtime_namespaceObject.jsxs)("div", { ref: storiesViewerRef, className: (0,external_classnames_namespaceObject["default"])("stories-viewer", Root_storyReaderRoot_module["stories-viewer"]), style: Object.assign(Object.assign({}, getRootVars()), getWrapperBackdropStyle()), children: [isDesktopMode_isDesktopMode && ((0,jsx_runtime_namespaceObject.jsx)("div", { className: Root_storyReaderRoot_module["stories-viewer-background"], style: getSlideBackdropStyle() })), props.children, props.isDesktopGeometry && props.storyReader.activeStory && ((0,jsx_runtime_namespaceObject.jsx)(CloseButton_CloseButton, { dir: props.storyReader.dir, className: Root_storyReaderRoot_module["stories-viewer__close-btn"], hidden: Boolean(props.storyReader.activeStory.pauseState.isUIPaused), onClose: () => {
23949
+ const activeStory = props.storyReader.activeStory;
23950
+ return ((0,jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, { children: [(0,jsx_runtime_namespaceObject.jsxs)("div", { ref: storiesViewerRef, className: (0,external_classnames_namespaceObject["default"])("stories-viewer", Root_storyReaderRoot_module["stories-viewer"]), style: Object.assign(Object.assign({}, getRootVars()), getWrapperBackdropStyle()), children: [isDesktopMode_isDesktopMode && ((0,jsx_runtime_namespaceObject.jsx)("div", { className: Root_storyReaderRoot_module["stories-viewer-background"], style: getSlideBackdropStyle() })), props.children, props.isDesktopGeometry && activeStory && !activeStory.disableClose && ((0,jsx_runtime_namespaceObject.jsx)(CloseButton_CloseButton, { dir: props.storyReader.dir, className: Root_storyReaderRoot_module["stories-viewer__close-btn"], hidden: Boolean(activeStory.pauseState.isUIPaused), onClose: () => {
22721
23951
  props.storyReader.close();
22722
23952
  } }))] }), (0,jsx_runtime_namespaceObject.jsx)("div", { ref: backdropRef, className: (0,external_classnames_namespaceObject["default"])(Root_storyReaderRoot_module["stories-viewer-backdrop"], {
22723
23953
  [Root_storyReaderRoot_module["_desktopMode"]]: isDesktopMode_isDesktopMode
@@ -23097,10 +24327,7 @@ const Loader = (0,external_mobx_react_lite_namespaceObject.observer)((props) =>
23097
24327
  const isLoading = props.needShowLoaderScreen;
23098
24328
  if (!isLoading && !needShowReloadBtn)
23099
24329
  return null;
23100
- return ((0,jsx_runtime_namespaceObject.jsx)("div", { className: (0,external_classnames_namespaceObject["default"])(Loader_loader_module["loader"]), style: {
23101
- "--loader-background": props.background,
23102
- "--loaderBackgroundColor": props.color
23103
- }, onClick: e => {
24330
+ return ((0,jsx_runtime_namespaceObject.jsx)("div", { className: (0,external_classnames_namespaceObject["default"])(Loader_loader_module["loader"]), style: Object.assign({ "--loader-background": props.background, "--loaderBackgroundColor": props.color }, props.style), onClick: e => {
23104
24331
  e.preventDefault();
23105
24332
  }, children: needShowReloadBtn ? ((0,jsx_runtime_namespaceObject.jsx)(RefreshIcon, { className: Loader_loader_module["loader__refresh-btn"], onClick: e => {
23106
24333
  e.stopPropagation();
@@ -24896,8 +26123,7 @@ const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) =
24896
26123
  const shouldHideHeader = isDesktopGeometry && useModernLayout
24897
26124
  ? !isActiveStory || story.pauseState.isUIPaused
24898
26125
  : story.pauseState.isUIPaused;
24899
- const shouldHideActionPanel = isDesktopGeometry &&
24900
- ((useModernLayout && !isActiveStory) || story.textInput.isOpened);
26126
+ const shouldHideActionPanel = isDesktopGeometry && ((useModernLayout && !isActiveStory) || story.textInput.isOpened);
24901
26127
  (0,external_react_namespaceObject.useLayoutEffect)(() => {
24902
26128
  const bottomOffset = parseFloat(String(storyReaderOptions.actionPanelBottomOffset));
24903
26129
  story.actionPanel.setOptions(commonOptions);
@@ -24921,7 +26147,7 @@ const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) =
24921
26147
  story.sharePanel.completeNativeSharing({ result: false });
24922
26148
  }, onTouchStart: () => {
24923
26149
  story.sharePanel.completeNativeSharing({ result: false });
24924
- }, "data-testid": "story", children: [isDesktopGeometry && useModernLayout && ((0,jsx_runtime_namespaceObject.jsx)(StoryBackdrop, { hidden: isActiveStory })), story.canBeShown && ((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 && ((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 })] }));
26150
+ }, "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 })] }));
24925
26151
  });
24926
26152
 
24927
26153
  ;// CONCATENATED MODULE: ./src/StoryReader/Story/index.ts
@@ -25268,7 +26494,7 @@ const ModernStoryList = (0,external_mobx_react_lite_namespaceObject.observer)((p
25268
26494
  if (uiDisabled)
25269
26495
  return;
25270
26496
  props.storyReader.toStoryWithAnimationByIndex(index);
25271
- }, 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: () => {
26497
+ }, 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: () => {
25272
26498
  props.storyReader.goNext();
25273
26499
  }, onPrev: () => {
25274
26500
  props.storyReader.goPrev();
@@ -26159,7 +27385,7 @@ var decorators_js_x = (y) => {
26159
27385
  var x = {}; __webpack_require__.d(x, y); return x
26160
27386
  }
26161
27387
  var decorators_js_y = (x) => (() => (x))
26162
- const decorators_js_namespaceObject = decorators_js_x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property), ["query"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.query), ["state"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.state) });
27388
+ const decorators_js_namespaceObject = decorators_js_x({ ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property), ["query"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.query), ["state"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.state) });
26163
27389
  ;// CONCATENATED MODULE: ./src/InAppMessaging/controllers/viewportController.ts
26164
27390
  class ViewportController {
26165
27391
  constructor(host) {
@@ -26221,7 +27447,7 @@ const messageViewsByType = {
26221
27447
 
26222
27448
  ;// CONCATENATED MODULE: ./src/InAppMessaging/components/BottomSheet/BottomSheet.styles.ts
26223
27449
 
26224
- const bottomSheetStyles = (0,external_lit_namespaceObject.css) `.bottom-sheet{position:fixed;inset:0;left:0;bottom:0;right:0;z-index:999}.bottom-sheet__backdrop{position:fixed;inset:0;left:0;bottom:0;right:0;z-index:-1;background-color:rgba(0,0,0,var(--backdrop-opacity,.5));opacity:0;transition:opacity 225ms cubic-bezier(.4,0,.2,1);pointer-events:none}.bottom-sheet__backdrop--visible{animation:fade-in .3s forwards}.bottom-sheet__backdrop--hidden{animation:fade-out .3s forwards}.bottom-sheet__box{position:absolute;left:0;right:0;bottom:0;will-change:transform;border-top-left-radius:var(--slide-border-top-left-radius,0);border-top-right-radius:var(--slide-border-top-right-radius,0);background-color:transparent;transition:opacity .3s ease,transform .3s ease;transform:translate3d(0,120%,0);pointer-events:all}.bottom-sheet__box-wrapper{position:absolute;inset:0;pointer-events:none}.bottom-sheet__box-wrapper.bottom-sheet__box-wrapper--desktop-mode{position:absolute;bottom:0;left:50%;transform:translate3d(-50%,0,0)}.bottom-sheet__box.bottom-sheet__box--open{opacity:1;transform:translate3d(0,0,0)}.bottom-sheet__backdrop.bottom-sheet__backdrop--open{opacity:1;pointer-events:all}.bottom-sheet__header .close-strip-btn{margin-top:8px;width:32px;height:4px;background-color:#00000080;border-radius:var(--close-strip-btn-border-radius);position:absolute;z-index:10000;left:50%;transform:translate3d(-50%,0,0)}`;
27450
+ const bottomSheetStyles = (0,external_lit_namespaceObject.css) `.bottom-sheet{position:fixed;inset:0;left:0;bottom:0;right:0;z-index:999}.bottom-sheet__backdrop{position:fixed;inset:0;left:0;bottom:0;right:0;z-index:-1;background-color:rgba(0,0,0,var(--backdrop-opacity,.5));opacity:0;transition:opacity 225ms cubic-bezier(.4,0,.2,1);pointer-events:none}.bottom-sheet__backdrop--visible{animation:fade-in .3s forwards}.bottom-sheet__backdrop--hidden{animation:fade-out .3s forwards}.bottom-sheet__box{position:absolute;left:0;right:0;bottom:0;will-change:transform;border-top-left-radius:var(--slide-border-top-left-radius,0);border-top-right-radius:var(--slide-border-top-right-radius,0);background-color:transparent;transition:opacity .3s ease,transform .3s ease;transform:translate3d(0,120%,0);pointer-events:all;overflow:hidden}.bottom-sheet__box-wrapper{position:absolute;inset:0;pointer-events:none}.bottom-sheet__box-wrapper.bottom-sheet__box-wrapper--desktop-mode{position:absolute;bottom:0;left:50%;transform:translate3d(-50%,0,0)}.bottom-sheet__box.bottom-sheet__box--open{opacity:1;transform:translate3d(0,0,0)}.bottom-sheet__backdrop.bottom-sheet__backdrop--open{opacity:1;pointer-events:all}.bottom-sheet__header .close-strip-btn{margin-top:8px;width:32px;height:4px;background-color:#00000080;border-radius:var(--close-strip-btn-border-radius);position:absolute;z-index:10000;left:50%;transform:translate3d(-50%,0,0)}`;
26225
27451
 
26226
27452
  ;// CONCATENATED MODULE: external "lit/directives/style-map.js"
26227
27453
  var style_map_js_x = (y) => {
@@ -26368,8 +27594,8 @@ var BottomSheet_classPrivateFieldSet = (undefined && undefined.__classPrivateFie
26368
27594
 
26369
27595
 
26370
27596
  let BottomSheet = (() => {
26371
- var _BottomSheet_open_accessor_storage, _BottomSheet_geometry_accessor_storage, _BottomSheet_appearanceOptions_accessor_storage, _BottomSheet_touchController_accessor_storage, _BottomSheet_desktopMode_accessor_storage, _BottomSheet_isVisible_accessor_storage, _BottomSheet_isClosed_accessor_storage, _BottomSheet_backdropRef_accessor_storage, _BottomSheet_bottomSheetBoxRef_accessor_storage, _BottomSheet_bottomSheetRef_accessor_storage;
26372
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-bottom-sheet")];
27597
+ var _BottomSheet_open_accessor_storage, _BottomSheet_disableClose_accessor_storage, _BottomSheet_geometry_accessor_storage, _BottomSheet_appearanceOptions_accessor_storage, _BottomSheet_touchController_accessor_storage, _BottomSheet_desktopMode_accessor_storage, _BottomSheet_isVisible_accessor_storage, _BottomSheet_isClosed_accessor_storage, _BottomSheet_backdropRef_accessor_storage, _BottomSheet_bottomSheetBoxRef_accessor_storage, _BottomSheet_bottomSheetRef_accessor_storage;
27598
+ let _classDecorators = [safeCustomElement("iam-bottom-sheet")];
26373
27599
  let _classDescriptor;
26374
27600
  let _classExtraInitializers = [];
26375
27601
  let _classThis;
@@ -26377,6 +27603,9 @@ let BottomSheet = (() => {
26377
27603
  let _open_decorators;
26378
27604
  let _open_initializers = [];
26379
27605
  let _open_extraInitializers = [];
27606
+ let _disableClose_decorators;
27607
+ let _disableClose_initializers = [];
27608
+ let _disableClose_extraInitializers = [];
26380
27609
  let _geometry_decorators;
26381
27610
  let _geometry_initializers = [];
26382
27611
  let _geometry_extraInitializers = [];
@@ -26407,6 +27636,8 @@ let BottomSheet = (() => {
26407
27636
  var BottomSheet = _classThis = class extends _classSuper {
26408
27637
  get open() { return BottomSheet_classPrivateFieldGet(this, _BottomSheet_open_accessor_storage, "f"); }
26409
27638
  set open(value) { BottomSheet_classPrivateFieldSet(this, _BottomSheet_open_accessor_storage, value, "f"); }
27639
+ get disableClose() { return BottomSheet_classPrivateFieldGet(this, _BottomSheet_disableClose_accessor_storage, "f"); }
27640
+ set disableClose(value) { BottomSheet_classPrivateFieldSet(this, _BottomSheet_disableClose_accessor_storage, value, "f"); }
26410
27641
  get geometry() { return BottomSheet_classPrivateFieldGet(this, _BottomSheet_geometry_accessor_storage, "f"); }
26411
27642
  set geometry(value) { BottomSheet_classPrivateFieldSet(this, _BottomSheet_geometry_accessor_storage, value, "f"); }
26412
27643
  get appearanceOptions() { return BottomSheet_classPrivateFieldGet(this, _BottomSheet_appearanceOptions_accessor_storage, "f"); }
@@ -26428,7 +27659,8 @@ let BottomSheet = (() => {
26428
27659
  constructor() {
26429
27660
  super();
26430
27661
  _BottomSheet_open_accessor_storage.set(this, BottomSheet_runInitializers(this, _open_initializers, false));
26431
- _BottomSheet_geometry_accessor_storage.set(this, (BottomSheet_runInitializers(this, _open_extraInitializers), BottomSheet_runInitializers(this, _geometry_initializers, void 0)));
27662
+ _BottomSheet_disableClose_accessor_storage.set(this, (BottomSheet_runInitializers(this, _open_extraInitializers), BottomSheet_runInitializers(this, _disableClose_initializers, false)));
27663
+ _BottomSheet_geometry_accessor_storage.set(this, (BottomSheet_runInitializers(this, _disableClose_extraInitializers), BottomSheet_runInitializers(this, _geometry_initializers, void 0)));
26432
27664
  _BottomSheet_appearanceOptions_accessor_storage.set(this, (BottomSheet_runInitializers(this, _geometry_extraInitializers), BottomSheet_runInitializers(this, _appearanceOptions_initializers, void 0)));
26433
27665
  _BottomSheet_touchController_accessor_storage.set(this, (BottomSheet_runInitializers(this, _appearanceOptions_extraInitializers), BottomSheet_runInitializers(this, _touchController_initializers, void 0)));
26434
27666
  _BottomSheet_desktopMode_accessor_storage.set(this, (BottomSheet_runInitializers(this, _touchController_extraInitializers), BottomSheet_runInitializers(this, _desktopMode_initializers, void 0)));
@@ -26471,6 +27703,8 @@ let BottomSheet = (() => {
26471
27703
  super.disconnectedCallback();
26472
27704
  }
26473
27705
  close() {
27706
+ if (this.disableClose)
27707
+ return;
26474
27708
  this.backdropRef.addEventListener("transitionend", this.handleTransitionEnd);
26475
27709
  this.isVisible = false;
26476
27710
  }
@@ -26509,10 +27743,11 @@ let BottomSheet = (() => {
26509
27743
  "bottom-sheet__box-wrapper--desktop-mode": this.desktopMode
26510
27744
  })}" style="${(0,style_map_js_namespaceObject.styleMap)(bottomSheetBoxWrapperStyle)}"><div style="${(0,style_map_js_namespaceObject.styleMap)(bottomSheetBoxStyle)}" id="bottom-sheet__box" class="bottom-sheet__box ${(0,class_map_js_namespaceObject.classMap)({
26511
27745
  "bottom-sheet__box--open": this.isVisible
26512
- })}"><div class="bottom-sheet__header"><div class="close-strip-btn" style="${(0,style_map_js_namespaceObject.styleMap)(closeStripButtonStyle)}"></div></div><slot></slot></div></div></div>`;
27746
+ })}"><div class="bottom-sheet__header">${this.disableClose ? external_lit_namespaceObject.nothing : (0,external_lit_namespaceObject.html) `<div class="close-strip-btn" style="${(0,style_map_js_namespaceObject.styleMap)(closeStripButtonStyle)}"></div>`}</div><slot></slot></div></div></div>`;
26513
27747
  }
26514
27748
  };
26515
27749
  _BottomSheet_open_accessor_storage = new WeakMap();
27750
+ _BottomSheet_disableClose_accessor_storage = new WeakMap();
26516
27751
  _BottomSheet_geometry_accessor_storage = new WeakMap();
26517
27752
  _BottomSheet_appearanceOptions_accessor_storage = new WeakMap();
26518
27753
  _BottomSheet_touchController_accessor_storage = new WeakMap();
@@ -26527,6 +27762,7 @@ let BottomSheet = (() => {
26527
27762
  var _a;
26528
27763
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_a = _classSuper[Symbol.metadata]) !== null && _a !== void 0 ? _a : null) : void 0;
26529
27764
  _open_decorators = [(0,decorators_js_namespaceObject.property)({ type: Boolean })];
27765
+ _disableClose_decorators = [(0,decorators_js_namespaceObject.property)({ type: Boolean })];
26530
27766
  _geometry_decorators = [(0,decorators_js_namespaceObject.property)({ type: Object })];
26531
27767
  _appearanceOptions_decorators = [(0,decorators_js_namespaceObject.property)({ type: Object })];
26532
27768
  _touchController_decorators = [(0,decorators_js_namespaceObject.property)({ type: Object })];
@@ -26537,6 +27773,7 @@ let BottomSheet = (() => {
26537
27773
  _bottomSheetBoxRef_decorators = [(0,decorators_js_namespaceObject.query)("#bottom-sheet__box")];
26538
27774
  _bottomSheetRef_decorators = [(0,decorators_js_namespaceObject.query)("#bottom-sheet")];
26539
27775
  BottomSheet_esDecorate(_classThis, null, _open_decorators, { kind: "accessor", name: "open", static: false, private: false, access: { has: obj => "open" in obj, get: obj => obj.open, set: (obj, value) => { obj.open = value; } }, metadata: _metadata }, _open_initializers, _open_extraInitializers);
27776
+ BottomSheet_esDecorate(_classThis, null, _disableClose_decorators, { kind: "accessor", name: "disableClose", static: false, private: false, access: { has: obj => "disableClose" in obj, get: obj => obj.disableClose, set: (obj, value) => { obj.disableClose = value; } }, metadata: _metadata }, _disableClose_initializers, _disableClose_extraInitializers);
26540
27777
  BottomSheet_esDecorate(_classThis, null, _geometry_decorators, { kind: "accessor", name: "geometry", static: false, private: false, access: { has: obj => "geometry" in obj, get: obj => obj.geometry, set: (obj, value) => { obj.geometry = value; } }, metadata: _metadata }, _geometry_initializers, _geometry_extraInitializers);
26541
27778
  BottomSheet_esDecorate(_classThis, null, _appearanceOptions_decorators, { kind: "accessor", name: "appearanceOptions", static: false, private: false, access: { has: obj => "appearanceOptions" in obj, get: obj => obj.appearanceOptions, set: (obj, value) => { obj.appearanceOptions = value; } }, metadata: _metadata }, _appearanceOptions_initializers, _appearanceOptions_extraInitializers);
26542
27779
  BottomSheet_esDecorate(_classThis, null, _touchController_decorators, { kind: "accessor", name: "touchController", static: false, private: false, access: { has: obj => "touchController" in obj, get: obj => obj.touchController, set: (obj, value) => { obj.touchController = value; } }, metadata: _metadata }, _touchController_initializers, _touchController_extraInitializers);
@@ -26637,9 +27874,10 @@ var ModalCloseButton_classPrivateFieldSet = (undefined && undefined.__classPriva
26637
27874
 
26638
27875
 
26639
27876
 
27877
+
26640
27878
  let Modal = (() => {
26641
27879
  var _Modal_closeBtnPosition_accessor_storage, _Modal_dir_accessor_storage;
26642
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-modal-close-btn")];
27880
+ let _classDecorators = [safeCustomElement("iam-modal-close-btn")];
26643
27881
  let _classDescriptor;
26644
27882
  let _classExtraInitializers = [];
26645
27883
  let _classThis;
@@ -26757,9 +27995,10 @@ var Modal_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet)
26757
27995
 
26758
27996
  const ANIMATION_DURATION = 350;
26759
27997
 
27998
+
26760
27999
  let Modal_Modal = (() => {
26761
- var _Modal_open_accessor_storage, _Modal_fullscreen_accessor_storage, _Modal_geometry_accessor_storage, _Modal_appearanceOptions_accessor_storage, _Modal_dir_accessor_storage, _Modal_isVisible_accessor_storage, _Modal_isClosed_accessor_storage, _Modal_backdropRef_accessor_storage;
26762
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-modal")];
28000
+ var _Modal_open_accessor_storage, _Modal_disableClose_accessor_storage, _Modal_fullscreen_accessor_storage, _Modal_geometry_accessor_storage, _Modal_appearanceOptions_accessor_storage, _Modal_dir_accessor_storage, _Modal_isVisible_accessor_storage, _Modal_isClosed_accessor_storage, _Modal_backdropRef_accessor_storage;
28001
+ let _classDecorators = [safeCustomElement("iam-modal")];
26763
28002
  let _classDescriptor;
26764
28003
  let _classExtraInitializers = [];
26765
28004
  let _classThis;
@@ -26767,6 +28006,9 @@ let Modal_Modal = (() => {
26767
28006
  let _open_decorators;
26768
28007
  let _open_initializers = [];
26769
28008
  let _open_extraInitializers = [];
28009
+ let _disableClose_decorators;
28010
+ let _disableClose_initializers = [];
28011
+ let _disableClose_extraInitializers = [];
26770
28012
  let _fullscreen_decorators;
26771
28013
  let _fullscreen_initializers = [];
26772
28014
  let _fullscreen_extraInitializers = [];
@@ -26791,6 +28033,8 @@ let Modal_Modal = (() => {
26791
28033
  var Modal = _classThis = class extends _classSuper {
26792
28034
  get open() { return Modal_classPrivateFieldGet(this, _Modal_open_accessor_storage, "f"); }
26793
28035
  set open(value) { Modal_classPrivateFieldSet(this, _Modal_open_accessor_storage, value, "f"); }
28036
+ get disableClose() { return Modal_classPrivateFieldGet(this, _Modal_disableClose_accessor_storage, "f"); }
28037
+ set disableClose(value) { Modal_classPrivateFieldSet(this, _Modal_disableClose_accessor_storage, value, "f"); }
26794
28038
  get fullscreen() { return Modal_classPrivateFieldGet(this, _Modal_fullscreen_accessor_storage, "f"); }
26795
28039
  set fullscreen(value) { Modal_classPrivateFieldSet(this, _Modal_fullscreen_accessor_storage, value, "f"); }
26796
28040
  get geometry() { return Modal_classPrivateFieldGet(this, _Modal_geometry_accessor_storage, "f"); }
@@ -26808,7 +28052,8 @@ let Modal_Modal = (() => {
26808
28052
  constructor() {
26809
28053
  super();
26810
28054
  _Modal_open_accessor_storage.set(this, Modal_runInitializers(this, _open_initializers, false));
26811
- _Modal_fullscreen_accessor_storage.set(this, (Modal_runInitializers(this, _open_extraInitializers), Modal_runInitializers(this, _fullscreen_initializers, false)));
28055
+ _Modal_disableClose_accessor_storage.set(this, (Modal_runInitializers(this, _open_extraInitializers), Modal_runInitializers(this, _disableClose_initializers, false)));
28056
+ _Modal_fullscreen_accessor_storage.set(this, (Modal_runInitializers(this, _disableClose_extraInitializers), Modal_runInitializers(this, _fullscreen_initializers, false)));
26812
28057
  _Modal_geometry_accessor_storage.set(this, (Modal_runInitializers(this, _fullscreen_extraInitializers), Modal_runInitializers(this, _geometry_initializers, void 0)));
26813
28058
  _Modal_appearanceOptions_accessor_storage.set(this, (Modal_runInitializers(this, _geometry_extraInitializers), Modal_runInitializers(this, _appearanceOptions_initializers, void 0)));
26814
28059
  _Modal_dir_accessor_storage.set(this, (Modal_runInitializers(this, _appearanceOptions_extraInitializers), Modal_runInitializers(this, _dir_initializers, void 0)));
@@ -26818,6 +28063,8 @@ let Modal_Modal = (() => {
26818
28063
  Modal_runInitializers(this, _backdropRef_extraInitializers);
26819
28064
  }
26820
28065
  close() {
28066
+ if (this.disableClose)
28067
+ return;
26821
28068
  const duration = this.appearanceOptions.animationType === IamModalAnimationType.None ? 0 : ANIMATION_DURATION;
26822
28069
  setTimeout(() => {
26823
28070
  this.isClosed = true;
@@ -26894,10 +28141,11 @@ let Modal_Modal = (() => {
26894
28141
  ? external_lit_namespaceObject.nothing
26895
28142
  : (0,external_lit_namespaceObject.html) `<div class="modal__header"><iam-modal-close-btn @click="${this.close}" .dir="${this.dir}" .closeBtnPosition="${this.appearanceOptions.closeBtnPosition}"></iam-modal-close-btn></div>`}<div style="${(0,style_map_js_namespaceObject.styleMap)(modalBoxContentStyle)}" class="modal__box-content ${(0,class_map_js_namespaceObject.classMap)({ "modal__box-content--fullscreen": this.fullscreen })}">${this.fullscreen
26896
28143
  ? external_lit_namespaceObject.nothing
26897
- : (0,external_lit_namespaceObject.html) `<div class="modal__header"><iam-modal-close-btn @click="${this.close}" .dir="${this.dir}" .closeBtnPosition="${this.appearanceOptions.closeBtnPosition}"></iam-modal-close-btn></div>`}<slot></slot></div></div></div>`;
28144
+ : (0,external_lit_namespaceObject.html) `<div class="modal__header">${this.disableClose ? external_lit_namespaceObject.nothing : (0,external_lit_namespaceObject.html) `<iam-modal-close-btn @click="${this.close}" .dir="${this.dir}" .closeBtnPosition="${this.appearanceOptions.closeBtnPosition}"></iam-modal-close-btn>`}</div>`}<slot></slot></div></div></div>`;
26898
28145
  }
26899
28146
  };
26900
28147
  _Modal_open_accessor_storage = new WeakMap();
28148
+ _Modal_disableClose_accessor_storage = new WeakMap();
26901
28149
  _Modal_fullscreen_accessor_storage = new WeakMap();
26902
28150
  _Modal_geometry_accessor_storage = new WeakMap();
26903
28151
  _Modal_appearanceOptions_accessor_storage = new WeakMap();
@@ -26910,6 +28158,7 @@ let Modal_Modal = (() => {
26910
28158
  var _a;
26911
28159
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_a = _classSuper[Symbol.metadata]) !== null && _a !== void 0 ? _a : null) : void 0;
26912
28160
  _open_decorators = [(0,decorators_js_namespaceObject.property)({ type: Boolean })];
28161
+ _disableClose_decorators = [(0,decorators_js_namespaceObject.property)({ type: Boolean })];
26913
28162
  _fullscreen_decorators = [(0,decorators_js_namespaceObject.property)({ type: Boolean })];
26914
28163
  _geometry_decorators = [(0,decorators_js_namespaceObject.property)({ type: Object })];
26915
28164
  _appearanceOptions_decorators = [(0,decorators_js_namespaceObject.property)({ type: Object })];
@@ -26918,6 +28167,7 @@ let Modal_Modal = (() => {
26918
28167
  _isClosed_decorators = [(0,decorators_js_namespaceObject.state)()];
26919
28168
  _backdropRef_decorators = [(0,decorators_js_namespaceObject.query)("#modal__backdrop")];
26920
28169
  Modal_esDecorate(_classThis, null, _open_decorators, { kind: "accessor", name: "open", static: false, private: false, access: { has: obj => "open" in obj, get: obj => obj.open, set: (obj, value) => { obj.open = value; } }, metadata: _metadata }, _open_initializers, _open_extraInitializers);
28170
+ Modal_esDecorate(_classThis, null, _disableClose_decorators, { kind: "accessor", name: "disableClose", static: false, private: false, access: { has: obj => "disableClose" in obj, get: obj => obj.disableClose, set: (obj, value) => { obj.disableClose = value; } }, metadata: _metadata }, _disableClose_initializers, _disableClose_extraInitializers);
26921
28171
  Modal_esDecorate(_classThis, null, _fullscreen_decorators, { kind: "accessor", name: "fullscreen", static: false, private: false, access: { has: obj => "fullscreen" in obj, get: obj => obj.fullscreen, set: (obj, value) => { obj.fullscreen = value; } }, metadata: _metadata }, _fullscreen_initializers, _fullscreen_extraInitializers);
26922
28172
  Modal_esDecorate(_classThis, null, _geometry_decorators, { kind: "accessor", name: "geometry", static: false, private: false, access: { has: obj => "geometry" in obj, get: obj => obj.geometry, set: (obj, value) => { obj.geometry = value; } }, metadata: _metadata }, _geometry_initializers, _geometry_extraInitializers);
26923
28173
  Modal_esDecorate(_classThis, null, _appearanceOptions_decorators, { kind: "accessor", name: "appearanceOptions", static: false, private: false, access: { has: obj => "appearanceOptions" in obj, get: obj => obj.appearanceOptions, set: (obj, value) => { obj.appearanceOptions = value; } }, metadata: _metadata }, _appearanceOptions_initializers, _appearanceOptions_extraInitializers);
@@ -26998,9 +28248,10 @@ var FullscreenModal_classPrivateFieldSet = (undefined && undefined.__classPrivat
26998
28248
 
26999
28249
 
27000
28250
 
28251
+
27001
28252
  let FullscreenModal = (() => {
27002
28253
  var _FullscreenModal_open_accessor_storage, _FullscreenModal_geometry_accessor_storage, _FullscreenModal_appearanceOptions_accessor_storage;
27003
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-fullscreen-modal")];
28254
+ let _classDecorators = [safeCustomElement("iam-fullscreen-modal")];
27004
28255
  let _classDescriptor;
27005
28256
  let _classExtraInitializers = [];
27006
28257
  let _classThis;
@@ -27117,9 +28368,10 @@ var MessageViewFactory_classPrivateFieldSet = (undefined && undefined.__classPri
27117
28368
 
27118
28369
 
27119
28370
 
28371
+
27120
28372
  let MessageViewFactory = (() => {
27121
- var _MessageViewFactory_appearanceOptions_accessor_storage, _MessageViewFactory_type_accessor_storage, _MessageViewFactory_open_accessor_storage, _MessageViewFactory_geometry_accessor_storage, _MessageViewFactory_touchController_accessor_storage, _MessageViewFactory_desktopMode_accessor_storage, _MessageViewFactory_dir_accessor_storage;
27122
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("message-view-factory")];
28373
+ var _MessageViewFactory_appearanceOptions_accessor_storage, _MessageViewFactory_type_accessor_storage, _MessageViewFactory_open_accessor_storage, _MessageViewFactory_disableClose_accessor_storage, _MessageViewFactory_geometry_accessor_storage, _MessageViewFactory_touchController_accessor_storage, _MessageViewFactory_desktopMode_accessor_storage, _MessageViewFactory_dir_accessor_storage;
28374
+ let _classDecorators = [safeCustomElement("message-view-factory")];
27123
28375
  let _classDescriptor;
27124
28376
  let _classExtraInitializers = [];
27125
28377
  let _classThis;
@@ -27133,6 +28385,9 @@ let MessageViewFactory = (() => {
27133
28385
  let _open_decorators;
27134
28386
  let _open_initializers = [];
27135
28387
  let _open_extraInitializers = [];
28388
+ let _disableClose_decorators;
28389
+ let _disableClose_initializers = [];
28390
+ let _disableClose_extraInitializers = [];
27136
28391
  let _geometry_decorators;
27137
28392
  let _geometry_initializers = [];
27138
28393
  let _geometry_extraInitializers = [];
@@ -27152,6 +28407,8 @@ let MessageViewFactory = (() => {
27152
28407
  set type(value) { MessageViewFactory_classPrivateFieldSet(this, _MessageViewFactory_type_accessor_storage, value, "f"); }
27153
28408
  get open() { return MessageViewFactory_classPrivateFieldGet(this, _MessageViewFactory_open_accessor_storage, "f"); }
27154
28409
  set open(value) { MessageViewFactory_classPrivateFieldSet(this, _MessageViewFactory_open_accessor_storage, value, "f"); }
28410
+ get disableClose() { return MessageViewFactory_classPrivateFieldGet(this, _MessageViewFactory_disableClose_accessor_storage, "f"); }
28411
+ set disableClose(value) { MessageViewFactory_classPrivateFieldSet(this, _MessageViewFactory_disableClose_accessor_storage, value, "f"); }
27155
28412
  get geometry() { return MessageViewFactory_classPrivateFieldGet(this, _MessageViewFactory_geometry_accessor_storage, "f"); }
27156
28413
  set geometry(value) { MessageViewFactory_classPrivateFieldSet(this, _MessageViewFactory_geometry_accessor_storage, value, "f"); }
27157
28414
  get touchController() { return MessageViewFactory_classPrivateFieldGet(this, _MessageViewFactory_touchController_accessor_storage, "f"); }
@@ -27166,7 +28423,8 @@ let MessageViewFactory = (() => {
27166
28423
  return null;
27167
28424
  return (0,static_html_js_namespaceObject.html) `
27168
28425
  <${MessageView}
27169
- .open=${this.open}
28426
+ .open=${this.open}
28427
+ .disableClose=${this.disableClose}
27170
28428
  .geometry=${this.geometry}
27171
28429
  .appearanceOptions=${this.appearanceOptions}
27172
28430
  .touchController=${this.touchController}
@@ -27181,7 +28439,8 @@ let MessageViewFactory = (() => {
27181
28439
  _MessageViewFactory_appearanceOptions_accessor_storage.set(this, MessageViewFactory_runInitializers(this, _appearanceOptions_initializers, void 0));
27182
28440
  _MessageViewFactory_type_accessor_storage.set(this, (MessageViewFactory_runInitializers(this, _appearanceOptions_extraInitializers), MessageViewFactory_runInitializers(this, _type_initializers, void 0)));
27183
28441
  _MessageViewFactory_open_accessor_storage.set(this, (MessageViewFactory_runInitializers(this, _type_extraInitializers), MessageViewFactory_runInitializers(this, _open_initializers, false)));
27184
- _MessageViewFactory_geometry_accessor_storage.set(this, (MessageViewFactory_runInitializers(this, _open_extraInitializers), MessageViewFactory_runInitializers(this, _geometry_initializers, void 0)));
28442
+ _MessageViewFactory_disableClose_accessor_storage.set(this, (MessageViewFactory_runInitializers(this, _open_extraInitializers), MessageViewFactory_runInitializers(this, _disableClose_initializers, false)));
28443
+ _MessageViewFactory_geometry_accessor_storage.set(this, (MessageViewFactory_runInitializers(this, _disableClose_extraInitializers), MessageViewFactory_runInitializers(this, _geometry_initializers, void 0)));
27185
28444
  _MessageViewFactory_touchController_accessor_storage.set(this, (MessageViewFactory_runInitializers(this, _geometry_extraInitializers), MessageViewFactory_runInitializers(this, _touchController_initializers, void 0)));
27186
28445
  _MessageViewFactory_desktopMode_accessor_storage.set(this, (MessageViewFactory_runInitializers(this, _touchController_extraInitializers), MessageViewFactory_runInitializers(this, _desktopMode_initializers, void 0)));
27187
28446
  _MessageViewFactory_dir_accessor_storage.set(this, (MessageViewFactory_runInitializers(this, _desktopMode_extraInitializers), MessageViewFactory_runInitializers(this, _dir_initializers, void 0)));
@@ -27191,6 +28450,7 @@ let MessageViewFactory = (() => {
27191
28450
  _MessageViewFactory_appearanceOptions_accessor_storage = new WeakMap();
27192
28451
  _MessageViewFactory_type_accessor_storage = new WeakMap();
27193
28452
  _MessageViewFactory_open_accessor_storage = new WeakMap();
28453
+ _MessageViewFactory_disableClose_accessor_storage = new WeakMap();
27194
28454
  _MessageViewFactory_geometry_accessor_storage = new WeakMap();
27195
28455
  _MessageViewFactory_touchController_accessor_storage = new WeakMap();
27196
28456
  _MessageViewFactory_desktopMode_accessor_storage = new WeakMap();
@@ -27202,6 +28462,7 @@ let MessageViewFactory = (() => {
27202
28462
  _appearanceOptions_decorators = [(0,decorators_js_namespaceObject.property)({ type: Object })];
27203
28463
  _type_decorators = [(0,decorators_js_namespaceObject.property)({ type: Number })];
27204
28464
  _open_decorators = [(0,decorators_js_namespaceObject.property)({ type: Boolean })];
28465
+ _disableClose_decorators = [(0,decorators_js_namespaceObject.property)({ type: Boolean })];
27205
28466
  _geometry_decorators = [(0,decorators_js_namespaceObject.property)({ type: Object })];
27206
28467
  _touchController_decorators = [(0,decorators_js_namespaceObject.property)({ type: Object })];
27207
28468
  _desktopMode_decorators = [(0,decorators_js_namespaceObject.property)({ type: Boolean })];
@@ -27209,6 +28470,7 @@ let MessageViewFactory = (() => {
27209
28470
  MessageViewFactory_esDecorate(_classThis, null, _appearanceOptions_decorators, { kind: "accessor", name: "appearanceOptions", static: false, private: false, access: { has: obj => "appearanceOptions" in obj, get: obj => obj.appearanceOptions, set: (obj, value) => { obj.appearanceOptions = value; } }, metadata: _metadata }, _appearanceOptions_initializers, _appearanceOptions_extraInitializers);
27210
28471
  MessageViewFactory_esDecorate(_classThis, null, _type_decorators, { kind: "accessor", name: "type", static: false, private: false, access: { has: obj => "type" in obj, get: obj => obj.type, set: (obj, value) => { obj.type = value; } }, metadata: _metadata }, _type_initializers, _type_extraInitializers);
27211
28472
  MessageViewFactory_esDecorate(_classThis, null, _open_decorators, { kind: "accessor", name: "open", static: false, private: false, access: { has: obj => "open" in obj, get: obj => obj.open, set: (obj, value) => { obj.open = value; } }, metadata: _metadata }, _open_initializers, _open_extraInitializers);
28473
+ MessageViewFactory_esDecorate(_classThis, null, _disableClose_decorators, { kind: "accessor", name: "disableClose", static: false, private: false, access: { has: obj => "disableClose" in obj, get: obj => obj.disableClose, set: (obj, value) => { obj.disableClose = value; } }, metadata: _metadata }, _disableClose_initializers, _disableClose_extraInitializers);
27212
28474
  MessageViewFactory_esDecorate(_classThis, null, _geometry_decorators, { kind: "accessor", name: "geometry", static: false, private: false, access: { has: obj => "geometry" in obj, get: obj => obj.geometry, set: (obj, value) => { obj.geometry = value; } }, metadata: _metadata }, _geometry_initializers, _geometry_extraInitializers);
27213
28475
  MessageViewFactory_esDecorate(_classThis, null, _touchController_decorators, { kind: "accessor", name: "touchController", static: false, private: false, access: { has: obj => "touchController" in obj, get: obj => obj.touchController, set: (obj, value) => { obj.touchController = value; } }, metadata: _metadata }, _touchController_initializers, _touchController_extraInitializers);
27214
28476
  MessageViewFactory_esDecorate(_classThis, null, _desktopMode_decorators, { kind: "accessor", name: "desktopMode", static: false, private: false, access: { has: obj => "desktopMode" in obj, get: obj => obj.desktopMode, set: (obj, value) => { obj.desktopMode = value; } }, metadata: _metadata }, _desktopMode_initializers, _desktopMode_extraInitializers);
@@ -27230,9 +28492,9 @@ let MessageViewFactory = (() => {
27230
28492
  })();
27231
28493
 
27232
28494
 
27233
- ;// CONCATENATED MODULE: ./src/InAppMessaging/components/MessageSlide/MessageSide.styles.ts
28495
+ ;// CONCATENATED MODULE: ./src/InAppMessaging/components/MessageSlide/MessageSlide.styles.ts
27234
28496
 
27235
- const messageSlideStyles = (0,external_lit_namespaceObject.css) `.slides-container{height:100%;width:100%;position:absolute;top:0;left:0;bottom:0;right:0}`;
28497
+ const messageSlideStyles = (0,external_lit_namespaceObject.css) `.slides-container{height:100%;width:100%;position:absolute;top:0;left:0;bottom:0;right:0}.slides-container .cards-slider{overflow:hidden}`;
27236
28498
 
27237
28499
  ;// CONCATENATED MODULE: ./src/InAppMessaging/components/MessageSlide/MessageSlide.ts
27238
28500
  var MessageSlide_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
@@ -27290,7 +28552,7 @@ var MessageSlide_classPrivateFieldSet = (undefined && undefined.__classPrivateFi
27290
28552
 
27291
28553
  let MessageSlide = (() => {
27292
28554
  var _MessageSlide_message_accessor_storage, _MessageSlide_styleContext_accessor_storage, _MessageSlide_geometry_accessor_storage, _MessageSlide_slidesContainer_accessor_storage;
27293
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("message-slide")];
28555
+ let _classDecorators = [safeCustomElement("message-slide")];
27294
28556
  let _classDescriptor;
27295
28557
  let _classExtraInitializers = [];
27296
28558
  let _classThis;
@@ -27338,12 +28600,11 @@ let MessageSlide = (() => {
27338
28600
  this.message.stop();
27339
28601
  }
27340
28602
  handleSlideClick(event) {
27341
- var _a;
27342
28603
  if (!event.currentTarget)
27343
28604
  return;
27344
28605
  event.preventDefault();
27345
28606
  event.stopPropagation();
27346
- (_a = this.message.activeSlide) === null || _a === void 0 ? void 0 : _a.onClick(event, event.currentTarget);
28607
+ this.message.onClick(event, event.currentTarget);
27347
28608
  }
27348
28609
  async initAndStartSlide() {
27349
28610
  const slidesContainer = this.slidesContainer;
@@ -27446,9 +28707,10 @@ var RefreshIcon_classPrivateFieldSet = (undefined && undefined.__classPrivateFie
27446
28707
  };
27447
28708
 
27448
28709
 
28710
+
27449
28711
  let RefreshIcon_RefreshIcon = (() => {
27450
28712
  var _RefreshIcon_className_accessor_storage;
27451
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-refresh-icon")];
28713
+ let _classDecorators = [safeCustomElement("iam-refresh-icon")];
27452
28714
  let _classDescriptor;
27453
28715
  let _classExtraInitializers = [];
27454
28716
  let _classThis;
@@ -27548,9 +28810,10 @@ var Loader_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet
27548
28810
 
27549
28811
 
27550
28812
 
28813
+
27551
28814
  let Loader_Loader = (() => {
27552
28815
  var _Loader_background_accessor_storage, _Loader_color_accessor_storage, _Loader_needShowErrorScreen_accessor_storage, _Loader_needShowLoaderScreen_accessor_storage;
27553
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-loader")];
28816
+ let _classDecorators = [safeCustomElement("iam-loader")];
27554
28817
  let _classDescriptor;
27555
28818
  let _classExtraInitializers = [];
27556
28819
  let _classThis;
@@ -27699,7 +28962,7 @@ var InAppMessagingReader_classPrivateFieldSet = (undefined && undefined.__classP
27699
28962
 
27700
28963
  let InAppMessagingReader = (() => {
27701
28964
  var _InAppMessagingReader_options_accessor_storage, _InAppMessagingReader_desktopMode_accessor_storage, _InAppMessagingReader_dir_accessor_storage, _InAppMessagingReader_viewModel_accessor_storage, _InAppMessagingReader_open_accessor_storage;
27702
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-reader"), mobxObserver];
28965
+ let _classDecorators = [safeCustomElement("iam-reader"), mobxObserver];
27703
28966
  let _classDescriptor;
27704
28967
  let _classExtraInitializers = [];
27705
28968
  let _classThis;
@@ -27798,9 +29061,9 @@ let InAppMessagingReader = (() => {
27798
29061
  });
27799
29062
  }
27800
29063
  async handleReloadMessage() {
27801
- var _a, _b, _c;
29064
+ var _a, _b;
27802
29065
  try {
27803
- await ((_c = (_b = (_a = this.viewModel) === null || _a === void 0 ? void 0 : _a.activeMessage) === null || _b === void 0 ? void 0 : _b.activeSlide) === null || _c === void 0 ? void 0 : _c.restart());
29066
+ await ((_b = (_a = this.viewModel) === null || _a === void 0 ? void 0 : _a.activeMessage) === null || _b === void 0 ? void 0 : _b.restart());
27804
29067
  }
27805
29068
  catch (error) {
27806
29069
  console.error(error);
@@ -27815,7 +29078,7 @@ let InAppMessagingReader = (() => {
27815
29078
  const type = message.type;
27816
29079
  const messageGeometry = this.createMessageGeometry(type, message.appearanceOptions);
27817
29080
  const slideGeometry = this.createSlideGeometry(messageGeometry);
27818
- return (0,external_lit_namespaceObject.html) `<message-view-factory type="${type}" @closed="${this.handleClosed}" .appearanceOptions="${message.appearanceOptions}" .geometry="${messageGeometry}" .open="${this.open}" .dir="${this.dir}" .desktopMode="${this.desktopMode}" .touchController="${touchController}"><message-slide .message="${message}" .styleContext="${message.context.style}" .geometry="${slideGeometry}"></message-slide><iam-loader .needShowErrorScreen="${message.needShowErrorScreen}" .needShowLoaderScreen="${message.needShowLoaderScreen}" @reload="${this.handleReloadMessage}"></iam-loader></message-view-factory>`;
29081
+ return (0,external_lit_namespaceObject.html) `<message-view-factory type="${type}" @closed="${this.handleClosed}" .disableClose="${message.disableClose}" .appearanceOptions="${message.appearanceOptions}" .geometry="${messageGeometry}" .open="${this.open}" .dir="${this.dir}" .desktopMode="${this.desktopMode}" .touchController="${touchController}"><message-slide .message="${message}" .styleContext="${message.context.style}" .geometry="${slideGeometry}"></message-slide><iam-loader .needShowErrorScreen="${message.needShowErrorScreen}" .needShowLoaderScreen="${message.needShowLoaderScreen}" @reload="${this.handleReloadMessage}"></iam-loader></message-view-factory>`;
27819
29082
  }
27820
29083
  };
27821
29084
  _InAppMessagingReader_options_accessor_storage = new WeakMap();
@@ -27905,7 +29168,7 @@ const IASContainer = (0,external_mobx_react_lite_namespaceObject.observer)((prop
27905
29168
  const gameReader = useGameReaderViewModel({ storyManager: storyManager });
27906
29169
  (0,external_react_namespaceObject.useEffect)(() => {
27907
29170
  if (iasContainerMounted)
27908
- throw new Error("There can only be one instance of <IASContainer /> per application");
29171
+ throw new Error("[IAS]: There can only be one instance of <IASContainer /> per application");
27909
29172
  iasContainerMounted = true;
27910
29173
  return () => {
27911
29174
  iasContainerMounted = false;