@inappstory/react-sdk 1.8.0-rc.9 → 1.8.1

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,54 +3185,101 @@ 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
+ }
3214
+ async request(config) {
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
+ }
3183
3279
  buildQuery(obj, prefix) {
3184
3280
  const pairs = [];
3185
3281
  for (const [key, value] of Object.entries(obj)) {
3186
- if (value == null || value === "")
3282
+ if (value == null || value === "" || Number.isNaN(value))
3187
3283
  continue;
3188
3284
  const fullKey = prefix ? `${prefix}[${key}]` : key;
3189
3285
  if (typeof value === "object" && !Array.isArray(value)) {
@@ -3213,79 +3309,6 @@ class API {
3213
3309
  }
3214
3310
  return result;
3215
3311
  }
3216
- async request(config) {
3217
- return new Promise((resolve, reject) => {
3218
- const cb = async () => {
3219
- try {
3220
- if (!(0,isObject_js_namespaceObject["default"])(config.headers) || config.headers == null) {
3221
- config.headers = {};
3222
- }
3223
- config.headers = mergeObjects(this._baseHeaders, config.headers);
3224
- if (this.requestInterceptors.length) {
3225
- for (const interceptor of this.requestInterceptors) {
3226
- interceptor(config);
3227
- }
3228
- }
3229
- let search = "";
3230
- if (!(0,isNil_js_namespaceObject["default"])(config.params) && (0,isObject_js_namespaceObject["default"])(config.params)) {
3231
- search = new URLSearchParams(this.buildQuery(config.params)).toString();
3232
- }
3233
- let url = new URL(`${trimStartSlash(config.url)}${search ? "?" + search : ""}`, this._baseURL);
3234
- let method = "GET";
3235
- if (!(0,isNil_js_namespaceObject["default"])(config.method)) {
3236
- method = config.method.toUpperCase();
3237
- }
3238
- let headers = {};
3239
- if (!(0,isNil_js_namespaceObject["default"])(config.headers) && (0,isObject_js_namespaceObject["default"])(config.headers)) {
3240
- headers = config.headers;
3241
- }
3242
- let body = null;
3243
- if (!(0,isNil_js_namespaceObject["default"])(config.data) && (0,isObject_js_namespaceObject["default"])(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
- });
3253
- let json = {};
3254
- if (response.status !== 204)
3255
- json = await response.json();
3256
- const apiResponse = {
3257
- data: json,
3258
- headersRaw: response.headers,
3259
- // @ts-ignore
3260
- headers: Object.fromEntries([...response.headers]),
3261
- status: response.status,
3262
- statusText: response.statusText,
3263
- ok: response.ok
3264
- };
3265
- if (!response.ok) {
3266
- reject(ApiRequestError.createByRequestError(apiResponse));
3267
- return;
3268
- }
3269
- resolve(apiResponse);
3270
- }
3271
- catch (error) {
3272
- reject(ApiRequestError.createByFetchError(error));
3273
- }
3274
- };
3275
- if (this._deviceInfoPromise) {
3276
- this._deviceInfoPromise.finally(cb);
3277
- }
3278
- else {
3279
- cb();
3280
- }
3281
- });
3282
- }
3283
- async post(path, data, params = {}) {
3284
- return this.request({ method: "post", url: path, data, params });
3285
- }
3286
- async get(path, params = {}) {
3287
- return this.request({ method: "get", url: path, params });
3288
- }
3289
3312
  }
3290
3313
  const APIInstance = new API();
3291
3314
  APIInstance.interceptors.request.use(config => {
@@ -3293,14 +3316,13 @@ APIInstance.interceptors.request.use(config => {
3293
3316
  const storyManagerConfig = storyManager.config;
3294
3317
  const session = storyManager.rootStore.sessionStore.session;
3295
3318
  const sessionId = session === null || session === void 0 ? void 0 : session.id;
3296
- config.headers = mergeObjects((_a = config.headers) !== null && _a !== void 0 ? _a : {}, {
3297
- Authorization: `Bearer ${storyManagerConfig.apiKey}`,
3298
- "Accept-Language": storyManagerConfig.lang.toString(),
3299
- "X-Request-Id": (0,external_uuid_namespaceObject.v4)(),
3300
- "X-User-Agent": storyManager.userAgent
3301
- });
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 });
3302
3324
  if (storyManagerConfig.userId && !storyManagerConfig.anonymous) {
3303
- config.headers["X-User-Id"] = storyManagerConfig.userId;
3325
+ config.headers["X-User-Id"] = storyManagerConfig.userId.toString();
3304
3326
  }
3305
3327
  if (sessionId) {
3306
3328
  config.headers["Auth-Session-Id"] = sessionId;
@@ -3508,20 +3530,24 @@ let IamApi = (() => {
3508
3530
  tags: tags.join(","),
3509
3531
  options
3510
3532
  }, {
3511
- fields: messageFieldsWithPrefix
3533
+ params: {
3534
+ fields: messageFieldsWithPrefix
3535
+ }
3512
3536
  });
3513
3537
  return response.data.messages;
3514
3538
  }
3515
3539
  async fetchContext() {
3516
3540
  const response = await api.get("inappmessaging/message-context", {
3517
- fields: "style,widgetsData"
3541
+ params: { fields: "style,widgetsData" }
3518
3542
  });
3519
3543
  return response.data;
3520
3544
  }
3521
3545
  async fetchById(messageId) {
3522
3546
  const response = await api.get(`inappmessaging/message/${messageId}`, {
3523
- expand: "slides_html",
3524
- fields: messageFields
3547
+ params: {
3548
+ expand: "slides_html",
3549
+ fields: messageFields
3550
+ }
3525
3551
  });
3526
3552
  const messageDto = response.data;
3527
3553
  if (!messageDto)
@@ -3538,7 +3564,9 @@ let IamApi = (() => {
3538
3564
  });
3539
3565
  return;
3540
3566
  }
3541
- 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
+ });
3542
3570
  }
3543
3571
  catch (error) {
3544
3572
  console.error(error);
@@ -3607,13 +3635,21 @@ let IamApi = (() => {
3607
3635
  ;// CONCATENATED MODULE: ../core/src/domain/inAppMessaging/models/appearanceOptions/iamCommonAppearanceOptions.ts
3608
3636
  class IamAppearanceCommonOptions {
3609
3637
  constructor(optionsDto) {
3638
+ var _a;
3610
3639
  Object.defineProperty(this, "background", {
3611
3640
  enumerable: true,
3612
3641
  configurable: true,
3613
3642
  writable: true,
3614
3643
  value: void 0
3615
3644
  });
3645
+ Object.defineProperty(this, "cardAppearance", {
3646
+ enumerable: true,
3647
+ configurable: true,
3648
+ writable: true,
3649
+ value: {}
3650
+ });
3616
3651
  this.background = this.mapBackgroundDtoToModel(optionsDto.background);
3652
+ this.cardAppearance = (_a = optionsDto.card_appearance) !== null && _a !== void 0 ? _a : {};
3617
3653
  }
3618
3654
  mapBackgroundDtoToModel(backgroundDto) {
3619
3655
  if (!backgroundDto || backgroundDto.alpha === 0)
@@ -3919,8 +3955,13 @@ class SessionApi {
3919
3955
  async open(payload) {
3920
3956
  const data = await this.getOpenSessionPayload(payload);
3921
3957
  const response = await api.post("session/open", data, {
3922
- expand: "cache",
3923
- fields: openFields
3958
+ params: {
3959
+ expand: "cache",
3960
+ fields: openFields
3961
+ },
3962
+ meta: {
3963
+ public: true
3964
+ }
3924
3965
  });
3925
3966
  return response.data;
3926
3967
  }
@@ -4493,25 +4534,25 @@ class StoriesApi {
4493
4534
  }
4494
4535
  async fetchStorySlides({ id, feedSlug }) {
4495
4536
  const { url, params } = this.getStoryRequestConfig(id, feedSlug);
4496
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4537
+ const response = await api.get(url, { params });
4497
4538
  return response.data;
4498
4539
  }
4499
4540
  async fetchStory({ id, feedSlug, fetchShareUrl, once }) {
4500
4541
  const { url, params } = this.getStoryRequestConfig(id, feedSlug, true, fetchShareUrl, once);
4501
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4542
+ const response = await api.get(url, { params });
4502
4543
  if (response.status === 204 && once)
4503
4544
  throw new IasStoryAlreadyShownError(id.toString());
4504
4545
  return response.data;
4505
4546
  }
4506
4547
  async fetchStoryContext({ ids }) {
4507
4548
  const { url, params } = this.getStoryContextRequestConfig(ids);
4508
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4549
+ const response = await api.get(url, { params });
4509
4550
  return response.data;
4510
4551
  }
4511
4552
  async fetchStoryCSS() {
4512
4553
  var _a;
4513
4554
  const { url, params } = this.getStoryCSSRequestConfig();
4514
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4555
+ const response = await api.get(url, { params });
4515
4556
  return (_a = response.data.style) !== null && _a !== void 0 ? _a : "";
4516
4557
  }
4517
4558
  async setStoryLike(storyId, like) {
@@ -4543,7 +4584,7 @@ class StoriesApi {
4543
4584
  localStorageSet(key, data);
4544
4585
  }
4545
4586
  async fetchStorySharePath(storyId) {
4546
- const response = await api.get(`story-share/${storyId}`, {});
4587
+ const response = await api.get(`story-share/${storyId}`);
4547
4588
  if (!response.data.url)
4548
4589
  throw new IasShareUrlUndefinedError(storyId);
4549
4590
  return response.data.url;
@@ -4565,7 +4606,7 @@ class StoriesApi {
4565
4606
  const config = {
4566
4607
  url: `${feedSlug === UGCFeedSlug ? "ugc/" : ""}story/${id}`,
4567
4608
  method: "GET",
4568
- params: { expand: expandFields.join(",") }
4609
+ params: { expand: expandFields.join(",") /* , src_list: "true" */ }
4569
4610
  };
4570
4611
  config.params.once = Number(Boolean(once));
4571
4612
  if (!allFields) {
@@ -4617,7 +4658,7 @@ class StoryFeedsApi {
4617
4658
  f: filter && JSON.stringify(filter),
4618
4659
  options
4619
4660
  };
4620
- const response = await api.get(url, params !== null && params !== void 0 ? params : {});
4661
+ const response = await api.get(url, { params });
4621
4662
  return response.data;
4622
4663
  }
4623
4664
  async fetchDefaultFeed({ feedSlug, tags, testKey, options }) {
@@ -4626,7 +4667,9 @@ class StoryFeedsApi {
4626
4667
  tags: tags.join(","),
4627
4668
  options
4628
4669
  }, {
4629
- test: testKey
4670
+ params: {
4671
+ test: testKey
4672
+ }
4630
4673
  });
4631
4674
  response.data.feedSlug = feedSlug;
4632
4675
  return response.data;
@@ -4634,8 +4677,10 @@ class StoryFeedsApi {
4634
4677
  async fetchFavoriteFeed({ tags }) {
4635
4678
  const url = "story";
4636
4679
  const response = await api.get(url, {
4637
- tags: tags.join(","),
4638
- favorite: 1
4680
+ params: {
4681
+ tags: tags.join(","),
4682
+ favorite: 1
4683
+ }
4639
4684
  });
4640
4685
  return response.data;
4641
4686
  }
@@ -4645,7 +4690,9 @@ class StoryFeedsApi {
4645
4690
  tags: payload.tags.join(","),
4646
4691
  options: payload.options
4647
4692
  }, {
4648
- limit: payload.limit
4693
+ params: {
4694
+ limit: payload.limit
4695
+ }
4649
4696
  });
4650
4697
  response.data.feedSlug = payload.feedSlug;
4651
4698
  return response.data;
@@ -4712,7 +4759,7 @@ class StatisticV2Api {
4712
4759
  }
4713
4760
  async sendFallbackFetch(path, params) {
4714
4761
  const api = new API({ baseURL: domains.apiUrl });
4715
- await api.get(path, params);
4762
+ await api.get(path, { params });
4716
4763
  }
4717
4764
  }
4718
4765
 
@@ -5114,6 +5161,7 @@ let StorySlide = (() => {
5114
5161
  return this._html;
5115
5162
  }
5116
5163
  constructor(storySlideDto) {
5164
+ var _b, _c;
5117
5165
  _StorySlide__html_accessor_storage.set(this, (storySlide_runInitializers(this, _instanceExtraInitializers), storySlide_runInitializers(this, __html_initializers, "")));
5118
5166
  Object.defineProperty(this, "index", {
5119
5167
  enumerable: true,
@@ -5145,6 +5193,18 @@ let StorySlide = (() => {
5145
5193
  writable: true,
5146
5194
  value: void 0
5147
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
+ });
5148
5208
  this.index = storySlideDto.index;
5149
5209
  this.timeline = {
5150
5210
  foreground: storySlideDto.timeline.foreground,
@@ -5153,6 +5213,17 @@ let StorySlide = (() => {
5153
5213
  this.duration = storySlideDto.duration;
5154
5214
  this.screenshotShare = storySlideDto.screenshot_share;
5155
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 : [];
5156
5227
  this._html = this.replaceSlideNonce(storySlideDto.html);
5157
5228
  }
5158
5229
  static createEmpty() {
@@ -5167,16 +5238,39 @@ let StorySlide = (() => {
5167
5238
  html: ""
5168
5239
  });
5169
5240
  }
5170
- replaceSlideNonce(slideHtml) {
5171
- var _b;
5172
- return replaceAll(slideHtml, `{{nonce}}`, (_b = getNonce()) !== null && _b !== void 0 ? _b : "");
5173
- }
5174
5241
  updatePlaceholders(placeholders) {
5175
5242
  let slideHtml = this._html;
5176
5243
  for (const placeholder of placeholders)
5177
5244
  slideHtml = replaceAll(slideHtml, `%${placeholder.key}%`, placeholder.value);
5178
5245
  this._html = slideHtml;
5179
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
+ }
5180
5274
  },
5181
5275
  _StorySlide__html_accessor_storage = new WeakMap(),
5182
5276
  (() => {
@@ -7777,7 +7871,7 @@ var external_async_mutex_x = (y) => {
7777
7871
  var x = {}; __webpack_require__.d(x, y); return x
7778
7872
  }
7779
7873
  var external_async_mutex_y = (x) => (() => (x))
7780
- const external_async_mutex_namespaceObject = external_async_mutex_x({ ["Mutex"]: () => (__WEBPACK_EXTERNAL_MODULE_async_mutex_052338b1__.Mutex) });
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) });
7781
7875
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storySlideViewModel/storySlideViewModel.ts
7782
7876
  var storySlideViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
7783
7877
  var useValue = arguments.length > 2;
@@ -7842,7 +7936,7 @@ let StorySlideViewModel = (() => {
7842
7936
  return _a = class StorySlideViewModel {
7843
7937
  get _disabledNextClick() { return storySlideViewModel_classPrivateFieldGet(this, _StorySlideViewModel__disabledNextClick_accessor_storage, "f"); }
7844
7938
  set _disabledNextClick(value) { storySlideViewModel_classPrivateFieldSet(this, _StorySlideViewModel__disabledNextClick_accessor_storage, value, "f"); }
7845
- constructor(_story, _index, slideApi, slide) {
7939
+ constructor(_story, _index, slideApi, slide, cacheManager) {
7846
7940
  Object.defineProperty(this, "_story", {
7847
7941
  enumerable: true,
7848
7942
  configurable: true,
@@ -7867,6 +7961,12 @@ let StorySlideViewModel = (() => {
7867
7961
  writable: true,
7868
7962
  value: slide
7869
7963
  });
7964
+ Object.defineProperty(this, "cacheManager", {
7965
+ enumerable: true,
7966
+ configurable: true,
7967
+ writable: true,
7968
+ value: cacheManager
7969
+ });
7870
7970
  _StorySlideViewModel__disabledNextClick_accessor_storage.set(this, storySlideViewModel_runInitializers(this, __disabledNextClick_initializers, false));
7871
7971
  Object.defineProperty(this, "mutex", {
7872
7972
  enumerable: true,
@@ -7886,6 +7986,18 @@ let StorySlideViewModel = (() => {
7886
7986
  writable: true,
7887
7987
  value: false
7888
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
+ });
7889
8001
  Object.defineProperty(this, "handleTouchEnd", {
7890
8002
  enumerable: true,
7891
8003
  configurable: true,
@@ -7898,9 +8010,6 @@ let StorySlideViewModel = (() => {
7898
8010
  }
7899
8011
  });
7900
8012
  }
7901
- get state() {
7902
- return this.slideApi.state;
7903
- }
7904
8013
  get index() {
7905
8014
  return this._index;
7906
8015
  }
@@ -8097,6 +8206,23 @@ let StorySlideViewModel = (() => {
8097
8206
  const { canClickNext } = this.slideApi.slideClickHandler(null, "backward");
8098
8207
  return canClickNext;
8099
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
+ }
8100
8226
  onClick({ event, currentTarget, preventNavigation = false }) {
8101
8227
  if (!event.target)
8102
8228
  return;
@@ -8113,15 +8239,20 @@ let StorySlideViewModel = (() => {
8113
8239
  }
8114
8240
  }
8115
8241
  async destroy() {
8242
+ const release = await this.mutex.acquire();
8116
8243
  try {
8117
8244
  this.isStarted = false;
8118
8245
  this.isInited = false;
8119
8246
  this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8120
- await this.slideApi.destroy();
8247
+ if (this.cacheManager)
8248
+ this.slide.restoreOriginalResourceUrls();
8121
8249
  }
8122
8250
  catch (error) {
8123
8251
  console.error(error);
8124
8252
  }
8253
+ finally {
8254
+ release();
8255
+ }
8125
8256
  }
8126
8257
  getNavigationDirection(event, currentTarget) {
8127
8258
  const xPercent = this.getClickPosition(event, currentTarget);
@@ -9475,8 +9606,9 @@ var StoryEvent;
9475
9606
  (function (StoryEvent) {
9476
9607
  StoryEvent["ShowToast"] = "showToast";
9477
9608
  })(StoryEvent || (StoryEvent = {}));
9609
+ const ACTIVE_SLIDE_PRELOAD_PRIORITY = 1000;
9478
9610
  let StoryViewModel = (() => {
9479
- var _a, _StoryViewModel__activeSlideIndex_accessor_storage, _StoryViewModel__slides_accessor_storage, _StoryViewModel__needShowErrorScreen_accessor_storage, _StoryViewModel__needShowLoaderScreen_accessor_storage, _StoryViewModel__$root_accessor_storage;
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;
9480
9612
  var _b;
9481
9613
  let _classSuper = ViewModel;
9482
9614
  let _instanceExtraInitializers = [];
@@ -9495,6 +9627,9 @@ let StoryViewModel = (() => {
9495
9627
  let __$root_decorators;
9496
9628
  let __$root_initializers = [];
9497
9629
  let __$root_extraInitializers = [];
9630
+ let _isInited_decorators;
9631
+ let _isInited_initializers = [];
9632
+ let _isInited_extraInitializers = [];
9498
9633
  let _get_needShowErrorScreen_decorators;
9499
9634
  let _get_needShowLoaderScreen_decorators;
9500
9635
  let _get_activeSlide_decorators;
@@ -9522,7 +9657,9 @@ let StoryViewModel = (() => {
9522
9657
  set _needShowLoaderScreen(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__needShowLoaderScreen_accessor_storage, value, "f"); }
9523
9658
  get _$root() { return storyViewModel_classPrivateFieldGet(this, _StoryViewModel__$root_accessor_storage, "f"); }
9524
9659
  set _$root(value) { storyViewModel_classPrivateFieldSet(this, _StoryViewModel__$root_accessor_storage, value, "f"); }
9525
- 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) {
9526
9663
  super();
9527
9664
  Object.defineProperty(this, "storyManager", {
9528
9665
  enumerable: true,
@@ -9560,22 +9697,23 @@ let StoryViewModel = (() => {
9560
9697
  writable: true,
9561
9698
  value: storyReaderStatisticV2Service
9562
9699
  });
9700
+ Object.defineProperty(this, "cacheManager", {
9701
+ enumerable: true,
9702
+ configurable: true,
9703
+ writable: true,
9704
+ value: cacheManager
9705
+ });
9563
9706
  _StoryViewModel__activeSlideIndex_accessor_storage.set(this, storyViewModel_runInitializers(this, __activeSlideIndex_initializers, 0));
9564
9707
  _StoryViewModel__slides_accessor_storage.set(this, (storyViewModel_runInitializers(this, __activeSlideIndex_extraInitializers), storyViewModel_runInitializers(this, __slides_initializers, [])));
9565
9708
  _StoryViewModel__needShowErrorScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __slides_extraInitializers), storyViewModel_runInitializers(this, __needShowErrorScreen_initializers, false)));
9566
9709
  _StoryViewModel__needShowLoaderScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowErrorScreen_extraInitializers), storyViewModel_runInitializers(this, __needShowLoaderScreen_initializers, false)));
9567
9710
  _StoryViewModel__$root_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowLoaderScreen_extraInitializers), storyViewModel_runInitializers(this, __$root_initializers, null)));
9568
- Object.defineProperty(this, "isInited", {
9569
- enumerable: true,
9570
- configurable: true,
9571
- writable: true,
9572
- value: (storyViewModel_runInitializers(this, __$root_extraInitializers), false)
9573
- });
9711
+ _StoryViewModel_isInited_accessor_storage.set(this, (storyViewModel_runInitializers(this, __$root_extraInitializers), storyViewModel_runInitializers(this, _isInited_initializers, false)));
9574
9712
  Object.defineProperty(this, "isStarted", {
9575
9713
  enumerable: true,
9576
9714
  configurable: true,
9577
9715
  writable: true,
9578
- value: false
9716
+ value: (storyViewModel_runInitializers(this, _isInited_extraInitializers), false)
9579
9717
  });
9580
9718
  Object.defineProperty(this, "_activeSlideStartTime", {
9581
9719
  enumerable: true,
@@ -9651,12 +9789,6 @@ let StoryViewModel = (() => {
9651
9789
  writable: true,
9652
9790
  value: void 0
9653
9791
  });
9654
- Object.defineProperty(this, "initOnce", {
9655
- enumerable: true,
9656
- configurable: true,
9657
- writable: true,
9658
- value: false
9659
- });
9660
9792
  Object.defineProperty(this, "toast", {
9661
9793
  enumerable: true,
9662
9794
  configurable: true,
@@ -9733,7 +9865,7 @@ let StoryViewModel = (() => {
9733
9865
  return this.storyReader.displayStrategy;
9734
9866
  }
9735
9867
  get canBeShown() {
9736
- return this.story.canBeShown && this.slides.length > 0;
9868
+ return this.story.canBeShown && this.slides.length > 0 && Boolean(this._$root);
9737
9869
  }
9738
9870
  get context() {
9739
9871
  return this.story.context;
@@ -9790,6 +9922,9 @@ let StoryViewModel = (() => {
9790
9922
  get dir() {
9791
9923
  return this.storyReader.dir;
9792
9924
  }
9925
+ get isSlideRendered() {
9926
+ return this.isInited;
9927
+ }
9793
9928
  get isNextDisabled() {
9794
9929
  return ((this.storyReader.reachEnd && this.reachEnd) ||
9795
9930
  this.activeSlide.disabledNextClick ||
@@ -9921,15 +10056,24 @@ let StoryViewModel = (() => {
9921
10056
  this.isInited = isInited;
9922
10057
  this.isStarted = isStarted;
9923
10058
  }
10059
+ async preloadSlides(start, end, priority) {
10060
+ if (!this.story.canBeShown)
10061
+ this.showLoaderScreen();
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
+ }
9924
10070
  async init() {
9925
10071
  await this.mutex.runExclusive(async () => {
9926
10072
  if (this.isInited)
9927
10073
  return;
9928
- if (!this.initOnce && !this.story.canBeShown) {
10074
+ if (!this.story.canBeShown)
9929
10075
  this.showLoaderScreen();
9930
- this.initOnce = true;
9931
- }
9932
- await (0,external_mobx_namespaceObject.when)(() => this.canBeShown && Boolean(this._$root));
10076
+ await (0,external_mobx_namespaceObject.when)(() => this.canBeShown);
9933
10077
  await this.activeSlide.init();
9934
10078
  this.isInited = true;
9935
10079
  });
@@ -10037,13 +10181,14 @@ let StoryViewModel = (() => {
10037
10181
  viewport: window,
10038
10182
  userResizeHandler: undefined,
10039
10183
  VODPlayer: this.storyManager.globalProperties.$videoOnDemand,
10040
- overlappingActionBarHeight: this.actionPanel.height
10184
+ overlappingActionBarHeight: this.actionPanel.height,
10185
+ useSdkCacheForMultislideMode: false
10041
10186
  });
10042
10187
  slideApi.setSdkClientVariables(this.storyManager.config.options);
10043
10188
  return slideApi;
10044
10189
  }
10045
10190
  async createSlidesViewModels(slides, slideApi) {
10046
- this._slides = slides.map((slide, index) => new StorySlideViewModel(this, index, slideApi, slide));
10191
+ this._slides = slides.map((slide, index) => new StorySlideViewModel(this, index, slideApi, slide, this.cacheManager));
10047
10192
  }
10048
10193
  handleSpaceKeydown(e) {
10049
10194
  if (e.code !== "Space")
@@ -10062,14 +10207,15 @@ let StoryViewModel = (() => {
10062
10207
  this.mute();
10063
10208
  }
10064
10209
  async onSlideChange(index) {
10210
+ var _b;
10065
10211
  try {
10066
- if (!this.isInited || !this.isStarted)
10067
- return;
10068
10212
  const lastSlide = this.getSlideByIndex(this._activeSlideIndex);
10069
10213
  const activeSlide = this.getSlideByIndex(index);
10070
10214
  this._activeSlideIndex = index;
10071
10215
  this.hideErrorScreen();
10072
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);
10073
10219
  await activeSlide.init();
10074
10220
  await (lastSlide === null || lastSlide === void 0 ? void 0 : lastSlide.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ }));
10075
10221
  await activeSlide.start();
@@ -10097,6 +10243,7 @@ let StoryViewModel = (() => {
10097
10243
  _StoryViewModel__needShowErrorScreen_accessor_storage = new WeakMap(),
10098
10244
  _StoryViewModel__needShowLoaderScreen_accessor_storage = new WeakMap(),
10099
10245
  _StoryViewModel__$root_accessor_storage = new WeakMap(),
10246
+ _StoryViewModel_isInited_accessor_storage = new WeakMap(),
10100
10247
  (() => {
10101
10248
  var _b;
10102
10249
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
@@ -10105,6 +10252,7 @@ let StoryViewModel = (() => {
10105
10252
  __needShowErrorScreen_decorators = [external_mobx_namespaceObject.observable];
10106
10253
  __needShowLoaderScreen_decorators = [external_mobx_namespaceObject.observable];
10107
10254
  __$root_decorators = [external_mobx_namespaceObject.observable];
10255
+ _isInited_decorators = [external_mobx_namespaceObject.observable];
10108
10256
  _get_needShowErrorScreen_decorators = [external_mobx_namespaceObject.computed];
10109
10257
  _get_needShowLoaderScreen_decorators = [external_mobx_namespaceObject.computed];
10110
10258
  _get_activeSlide_decorators = [external_mobx_namespaceObject.computed];
@@ -10126,6 +10274,7 @@ let StoryViewModel = (() => {
10126
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);
10127
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);
10128
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);
10129
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);
10130
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);
10131
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);
@@ -10154,6 +10303,12 @@ var isEmpty_js_x = (y) => {
10154
10303
  }
10155
10304
  var isEmpty_js_y = (x) => (() => (x))
10156
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"]) });
10157
10312
  ;// CONCATENATED MODULE: ../core/src/readers/gameReader/gameSessionHandlers/gameInstanceLocalDataHandlers/gameInstanceStorage.ts
10158
10313
 
10159
10314
 
@@ -10496,7 +10651,7 @@ class GameCenterApi {
10496
10651
  const body = {};
10497
10652
  if (gameOptions && (0,isObject_js_namespaceObject["default"])(gameOptions) && gameOptions.demoMode != null)
10498
10653
  body.demoMode = Boolean(gameOptions.demoMode);
10499
- const response = await api.post(`game/${gameInstanceId}/launch`, body, params);
10654
+ const response = await api.post(`game/${gameInstanceId}/launch`, body, { params });
10500
10655
  return response.data;
10501
10656
  }
10502
10657
  }
@@ -10589,7 +10744,7 @@ class GameClientConfig {
10589
10744
  value: void 0
10590
10745
  });
10591
10746
  const storyManagerConfig = this.storyManager.config;
10592
- const sdkVersion = "1.8.0-rc.9";
10747
+ const sdkVersion = "1.8.1";
10593
10748
  const placeholders = this.storyManager.rootStore.placeholderStore.placeholders;
10594
10749
  const session = this.storyManager.rootStore.sessionStore.session;
10595
10750
  this.sessionId = session.id;
@@ -12058,6 +12213,9 @@ class StorySlideApiHandlers {
12058
12213
  value: new NarrativeDataCache()
12059
12214
  });
12060
12215
  }
12216
+ onEvent(name, event) { }
12217
+ onCardLoadingStateChange(state) { }
12218
+ ;
12061
12219
  clearNarrativeSessionDataCache() {
12062
12220
  this.sessionNarrativeDataCache.clear();
12063
12221
  }
@@ -12805,6 +12963,8 @@ var storyReaderNavigationController_classPrivateFieldSet = (undefined && undefin
12805
12963
 
12806
12964
 
12807
12965
  const STORY_INIT_RANGE = 1;
12966
+ const ACTIVE_STORY_PRELOAD_PRIORITY = 1000;
12967
+ const NON_ACTIVE_STORY_PRELOAD_PRIORITY = 0;
12808
12968
  let StoryReaderNavigationController = (() => {
12809
12969
  var _a, _StoryReaderNavigationController__activeStory_accessor_storage, _StoryReaderNavigationController__currentIndex_accessor_storage, _StoryReaderNavigationController__targetTransitionIndex_accessor_storage;
12810
12970
  let _instanceExtraInitializers = [];
@@ -12942,7 +13102,6 @@ let StoryReaderNavigationController = (() => {
12942
13102
  this.currentStoryDisplayStrategy.handleNextStoryByIndex(index);
12943
13103
  this.initStoriesWithinRange(index);
12944
13104
  await this.animatedNavigationController.transitionByIndex(index, this.currentIndex);
12945
- //await Promise.all([p1, p2]);
12946
13105
  await this.handleTransitionEnd(index, action);
12947
13106
  }
12948
13107
  handleStoryReaderReachEnd(action) {
@@ -12986,6 +13145,7 @@ let StoryReaderNavigationController = (() => {
12986
13145
  async runNextStory(prevStory, story) {
12987
13146
  try {
12988
13147
  await (prevStory === null || prevStory === void 0 ? void 0 : prevStory.stop());
13148
+ await this.preloadActiveStory(story);
12989
13149
  await story.init();
12990
13150
  await story.start();
12991
13151
  }
@@ -12994,11 +13154,16 @@ let StoryReaderNavigationController = (() => {
12994
13154
  }
12995
13155
  }
12996
13156
  async initStoriesWithinRange(currentIndex) {
12997
- let stories = this.storyReader.stories;
13157
+ const stories = this.storyReader.stories;
12998
13158
  const start = Math.max(currentIndex - STORY_INIT_RANGE, 0);
12999
13159
  const end = Math.min(currentIndex + STORY_INIT_RANGE, stories.length - 1);
13000
- stories = stories.slice(start, end + 1);
13001
- return Promise.allSettled(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()));
13002
13167
  }
13003
13168
  handleActiveStoryError(story) {
13004
13169
  if (!(story === null || story === void 0 ? void 0 : story.error))
@@ -13014,6 +13179,28 @@ let StoryReaderNavigationController = (() => {
13014
13179
  limitIndex(index) {
13015
13180
  return Math.max(0, Math.min(this.storyReader.stories.length - 1, index));
13016
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
+ }
13017
13204
  },
13018
13205
  _StoryReaderNavigationController__activeStory_accessor_storage = new WeakMap(),
13019
13206
  _StoryReaderNavigationController__currentIndex_accessor_storage = new WeakMap(),
@@ -13051,129 +13238,81 @@ let StoryReaderNavigationController = (() => {
13051
13238
 
13052
13239
 
13053
13240
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showOnboardingStoriesStrategy.ts
13054
- var showOnboardingStoriesStrategy_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
13055
- var useValue = arguments.length > 2;
13056
- for (var i = 0; i < initializers.length; i++) {
13057
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
13058
- }
13059
- return useValue ? value : void 0;
13060
- };
13061
- var showOnboardingStoriesStrategy_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
13062
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
13063
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
13064
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13065
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13066
- var _, done = false;
13067
- for (var i = decorators.length - 1; i >= 0; i--) {
13068
- var context = {};
13069
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
13070
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
13071
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13072
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13073
- if (kind === "accessor") {
13074
- if (result === void 0) continue;
13075
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
13076
- if (_ = accept(result.get)) descriptor.get = _;
13077
- if (_ = accept(result.set)) descriptor.set = _;
13078
- if (_ = accept(result.init)) initializers.unshift(_);
13079
- }
13080
- else if (_ = accept(result)) {
13081
- if (kind === "field") initializers.unshift(_);
13082
- else descriptor[key] = _;
13083
- }
13084
- }
13085
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
13086
- done = true;
13087
- };
13088
13241
 
13089
-
13090
- let ShowOnboardingStoriesStrategy = (() => {
13091
- var _a;
13092
- let _instanceExtraInitializers = [];
13093
- let _show_decorators;
13094
- return _a = class ShowOnboardingStoriesStrategy {
13095
- constructor(showMultipleStoriesStrategy, storyManager) {
13096
- Object.defineProperty(this, "showMultipleStoriesStrategy", {
13097
- enumerable: true,
13098
- configurable: true,
13099
- writable: true,
13100
- value: (showOnboardingStoriesStrategy_runInitializers(this, _instanceExtraInitializers), showMultipleStoriesStrategy)
13101
- });
13102
- Object.defineProperty(this, "storyManager", {
13103
- enumerable: true,
13104
- configurable: true,
13105
- writable: true,
13106
- value: storyManager
13107
- });
13108
- Object.defineProperty(this, "_feed", {
13109
- enumerable: true,
13110
- configurable: true,
13111
- writable: true,
13112
- value: null
13113
- });
13114
- }
13115
- get feed() {
13116
- return this._feed;
13117
- }
13118
- async show(payload) {
13119
- var _b, _c;
13120
- const storyFeedStore = this.storyManager.rootStore.onboardingFeedStore;
13121
- const onboardingFeed = await storyFeedStore.fetchOnboardingFeed({
13122
- feedSlug: payload.feedSlug,
13123
- tags: (_b = payload.customTags) !== null && _b !== void 0 ? _b : [],
13124
- limit: (_c = payload.limit) !== null && _c !== void 0 ? _c : undefined
13125
- });
13126
- this._feed = onboardingFeed;
13127
- const feedLoadEvent = this.getFeedLoadEvent(onboardingFeed.slug, onboardingFeed.stories);
13128
- this.emitFeedLoad(feedLoadEvent);
13129
- if (!onboardingFeed.stories.length)
13130
- return feedLoadEvent;
13131
- await this.showMultipleStoriesStrategy.show({
13132
- windowReferer: STORY_READER_WINDOW_REFERER.default,
13133
- storyFeed: onboardingFeed,
13134
- storyId: onboardingFeed.stories[0].id
13135
- });
13136
- return feedLoadEvent;
13137
- }
13138
- async handleNextStoryByIndex(nextStoryIndex) {
13139
- this.showMultipleStoriesStrategy.handleNextStoryByIndex(nextStoryIndex);
13140
- }
13141
- emitFeedLoad(event) {
13142
- this.storyManager.emit("feedLoad", event);
13143
- }
13144
- getFeedLoadEvent(feed, onboardingStories) {
13145
- const stories = onboardingStories.map(story => {
13146
- const additionalPayload = {
13147
- title: null,
13148
- slidesCount: null
13149
- };
13150
- if (story) {
13151
- additionalPayload.title = story.statTitle;
13152
- additionalPayload.slidesCount = story.slidesCount;
13153
- }
13154
- return Object.assign({ id: story.id }, additionalPayload);
13155
- });
13156
- const eventData = {
13157
- stories,
13158
- feed: null,
13159
- filter: null
13160
- };
13161
- eventData.feed = feed;
13162
- return eventData;
13163
- }
13164
- async reload(payload) {
13165
- this.showMultipleStoriesStrategy.reload(payload);
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
+ });
13262
+ }
13263
+ get feed() {
13264
+ return this._feed;
13265
+ }
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;
13166
13301
  }
13167
- },
13168
- (() => {
13169
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
13170
- _show_decorators = [noConcurrent];
13171
- 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);
13172
- if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
13173
- })(),
13174
- _a;
13175
- })();
13176
-
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
+ }
13177
13316
 
13178
13317
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showMultipleStoriesStrategy.ts
13179
13318
  const NUMBER_OF_LAZY_LOADED_STORIES = 2;
@@ -13284,195 +13423,59 @@ class ShowStoryFromSharePageStrategy {
13284
13423
  }
13285
13424
 
13286
13425
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showStoryOnceStrategy.ts
13287
- var showStoryOnceStrategy_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
13288
- var useValue = arguments.length > 2;
13289
- for (var i = 0; i < initializers.length; i++) {
13290
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
13291
- }
13292
- return useValue ? value : void 0;
13293
- };
13294
- var showStoryOnceStrategy_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
13295
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
13296
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
13297
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13298
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13299
- var _, done = false;
13300
- for (var i = decorators.length - 1; i >= 0; i--) {
13301
- var context = {};
13302
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
13303
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
13304
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13305
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13306
- if (kind === "accessor") {
13307
- if (result === void 0) continue;
13308
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
13309
- if (_ = accept(result.get)) descriptor.get = _;
13310
- if (_ = accept(result.set)) descriptor.set = _;
13311
- if (_ = accept(result.init)) initializers.unshift(_);
13312
- }
13313
- else if (_ = accept(result)) {
13314
- if (kind === "field") initializers.unshift(_);
13315
- else descriptor[key] = _;
13316
- }
13317
- }
13318
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
13319
- done = true;
13320
- };
13321
-
13322
-
13323
-
13324
- let ShowStoryOnceStrategy = (() => {
13325
- var _a;
13326
- let _instanceExtraInitializers = [];
13327
- let _show_decorators;
13328
- return _a = class ShowStoryOnceStrategy {
13329
- constructor(storyManager, storyReaderViewModel) {
13330
- Object.defineProperty(this, "storyManager", {
13331
- enumerable: true,
13332
- configurable: true,
13333
- writable: true,
13334
- value: (showStoryOnceStrategy_runInitializers(this, _instanceExtraInitializers), storyManager)
13335
- });
13336
- Object.defineProperty(this, "storyReaderViewModel", {
13337
- enumerable: true,
13338
- configurable: true,
13339
- writable: true,
13340
- value: storyReaderViewModel
13341
- });
13342
- }
13343
- get feed() {
13344
- return null;
13345
- }
13346
- async show(payload) {
13347
- try {
13348
- const storyStore = this.storyManager.rootStore.storyStore;
13349
- const story = await storyStore.fetchStoryById({
13350
- storyId: payload.storyId,
13351
- feedSlug: "",
13352
- once: true
13353
- });
13354
- if (story.error)
13355
- throw story.error;
13356
- if (story.isOpened)
13357
- throw new IasStoryAlreadyShownError(payload.storyId.toString());
13358
- this.openStoryReader(story);
13359
- }
13360
- catch (error) {
13361
- this.storyReaderViewModel.close();
13362
- throw error;
13363
- }
13364
- }
13365
- openStoryReader(story) {
13366
- this.storyReaderViewModel.open({
13367
- windowReferer: STORY_READER_WINDOW_REFERER.default,
13368
- id: story.id,
13369
- stories: [story]
13370
- });
13371
- }
13372
- async handleNextStoryByIndex(storyIndex) { }
13373
- async reload(payload) { }
13374
- },
13375
- (() => {
13376
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
13377
- _show_decorators = [noConcurrent];
13378
- showStoryOnceStrategy_esDecorate(_a, null, _show_decorators, { kind: "method", name: "show", static: false, private: false, access: { has: obj => "show" in obj, get: obj => obj.show }, metadata: _metadata }, null, _instanceExtraInitializers);
13379
- if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
13380
- })(),
13381
- _a;
13382
- })();
13383
13426
 
13384
13427
 
13385
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showStoryStrategy.ts
13386
- var showStoryStrategy_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
13387
- var useValue = arguments.length > 2;
13388
- for (var i = 0; i < initializers.length; i++) {
13389
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
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
+ });
13390
13442
  }
13391
- return useValue ? value : void 0;
13392
- };
13393
- var showStoryStrategy_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
13394
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
13395
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
13396
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13397
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13398
- var _, done = false;
13399
- for (var i = decorators.length - 1; i >= 0; i--) {
13400
- var context = {};
13401
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
13402
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
13403
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13404
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13405
- if (kind === "accessor") {
13406
- if (result === void 0) continue;
13407
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
13408
- if (_ = accept(result.get)) descriptor.get = _;
13409
- if (_ = accept(result.set)) descriptor.set = _;
13410
- if (_ = accept(result.init)) initializers.unshift(_);
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);
13411
13459
  }
13412
- else if (_ = accept(result)) {
13413
- if (kind === "field") initializers.unshift(_);
13414
- else descriptor[key] = _;
13460
+ catch (error) {
13461
+ this.storyReaderViewModel.close();
13462
+ throw error;
13415
13463
  }
13416
13464
  }
13417
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
13418
- done = true;
13419
- };
13420
-
13421
-
13422
- let ShowStoryStrategy = (() => {
13423
- var _a;
13424
- let _instanceExtraInitializers = [];
13425
- let _show_decorators;
13426
- return _a = class ShowStoryStrategy {
13427
- constructor(storyManager, storyReaderViewModel) {
13428
- Object.defineProperty(this, "storyManager", {
13429
- enumerable: true,
13430
- configurable: true,
13431
- writable: true,
13432
- value: (showStoryStrategy_runInitializers(this, _instanceExtraInitializers), storyManager)
13433
- });
13434
- Object.defineProperty(this, "storyReaderViewModel", {
13435
- enumerable: true,
13436
- configurable: true,
13437
- writable: true,
13438
- value: storyReaderViewModel
13439
- });
13440
- }
13441
- get feed() {
13442
- return null;
13443
- }
13444
- async show(payload) {
13445
- const storyStore = this.storyManager.rootStore.storyStore;
13446
- const story = await storyStore.fetchStoryById({
13447
- storyId: payload.storyId,
13448
- feedSlug: "",
13449
- fetchShareUrl: payload.fetchShareUrl
13450
- });
13451
- this.openStoryReader(story, payload);
13452
- }
13453
- openStoryReader(story, payload) {
13454
- this.storyReaderViewModel.open({
13455
- windowReferer: STORY_READER_WINDOW_REFERER.default,
13456
- id: story.id,
13457
- stories: [story]
13458
- });
13459
- }
13460
- async handleNextStoryByIndex(storyIndex) { }
13461
- async reload(payload) { }
13462
- },
13463
- (() => {
13464
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
13465
- _show_decorators = [noConcurrent];
13466
- showStoryStrategy_esDecorate(_a, null, _show_decorators, { kind: "method", name: "show", static: false, private: false, access: { has: obj => "show" in obj, get: obj => obj.show }, metadata: _metadata }, null, _instanceExtraInitializers);
13467
- if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
13468
- })(),
13469
- _a;
13470
- })();
13471
-
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
+ }
13472
13475
 
13473
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/storyDisplayStrategyFactory.ts
13476
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/showStoryStrategy.ts
13474
13477
 
13475
- class StoryDisplayStrategyFactory {
13478
+ class ShowStoryStrategy {
13476
13479
  constructor(storyManager, storyReaderViewModel) {
13477
13480
  Object.defineProperty(this, "storyManager", {
13478
13481
  enumerable: true,
@@ -13487,20 +13490,60 @@ class StoryDisplayStrategyFactory {
13487
13490
  value: storyReaderViewModel
13488
13491
  });
13489
13492
  }
13490
- createShowStory() {
13491
- return new ShowStoryStrategy(this.storyManager, this.storyReaderViewModel);
13492
- }
13493
- createShowStoryOnce() {
13494
- return new ShowStoryOnceStrategy(this.storyManager, this.storyReaderViewModel);
13495
- }
13496
- createShowStoryFromSharePage() {
13497
- return new ShowStoryFromSharePageStrategy(new ShowStoryStrategy(this.storyManager, this.storyReaderViewModel));
13493
+ get feed() {
13494
+ return null;
13498
13495
  }
13499
- createShowOnboardingStories() {
13500
- return new ShowOnboardingStoriesStrategy(new ShowMultipleStoriesStrategy(this.storyManager, this.storyReaderViewModel), this.storyManager);
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);
13501
13504
  }
13502
- createShowMultipleStories() {
13503
- return new ShowMultipleStoriesStrategy(this.storyManager, this.storyReaderViewModel);
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
+ }
13515
+
13516
+ ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyDisplayStrategies/storyDisplayStrategyFactory.ts
13517
+
13518
+ class StoryDisplayStrategyFactory {
13519
+ constructor(storyManager, storyReaderViewModel) {
13520
+ Object.defineProperty(this, "storyManager", {
13521
+ enumerable: true,
13522
+ configurable: true,
13523
+ writable: true,
13524
+ value: storyManager
13525
+ });
13526
+ Object.defineProperty(this, "storyReaderViewModel", {
13527
+ enumerable: true,
13528
+ configurable: true,
13529
+ writable: true,
13530
+ value: storyReaderViewModel
13531
+ });
13532
+ }
13533
+ createShowStory() {
13534
+ return new ShowStoryStrategy(this.storyManager, this.storyReaderViewModel);
13535
+ }
13536
+ createShowStoryOnce() {
13537
+ return new ShowStoryOnceStrategy(this.storyManager, this.storyReaderViewModel);
13538
+ }
13539
+ createShowStoryFromSharePage() {
13540
+ return new ShowStoryFromSharePageStrategy(new ShowStoryStrategy(this.storyManager, this.storyReaderViewModel));
13541
+ }
13542
+ createShowOnboardingStories() {
13543
+ return new ShowOnboardingStoriesStrategy(new ShowMultipleStoriesStrategy(this.storyManager, this.storyReaderViewModel), this.storyManager);
13544
+ }
13545
+ createShowMultipleStories() {
13546
+ return new ShowMultipleStoriesStrategy(this.storyManager, this.storyReaderViewModel);
13504
13547
  }
13505
13548
  }
13506
13549
 
@@ -13623,6 +13666,509 @@ class StoryReaderStatisticsController {
13623
13666
  }
13624
13667
  }
13625
13668
 
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
+ });
13696
+ }
13697
+ updateLastAccessed() {
13698
+ this.lastAccessed = Date.now();
13699
+ }
13700
+ getOrCreateBlobUrl() {
13701
+ if (!this.blobUrl) {
13702
+ this.blobUrl = URL.createObjectURL(this.blob);
13703
+ }
13704
+ return this.blobUrl;
13705
+ }
13706
+ unlinkBlob() {
13707
+ if (this.blobUrl)
13708
+ URL.revokeObjectURL(this.blobUrl);
13709
+ }
13710
+ destroy() {
13711
+ this.unlinkBlob();
13712
+ }
13713
+ }
13714
+
13715
+ ;// CONCATENATED MODULE: ../core/src/cache/cacheRepository.ts
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
+ }
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
+ }
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
+ }
13915
+
13916
+ ;// CONCATENATED MODULE: ../core/src/cache/lruCache.ts
13917
+
13918
+
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
+
13626
14172
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyReaderViewModel/storyReaderViewModel.ts
13627
14173
  var storyReaderViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
13628
14174
  var useValue = arguments.length > 2;
@@ -13679,6 +14225,8 @@ var storyReaderViewModel_classPrivateFieldSet = (undefined && undefined.__classP
13679
14225
 
13680
14226
 
13681
14227
 
14228
+
14229
+
13682
14230
  var StoryReaderEvent;
13683
14231
  (function (StoryReaderEvent) {
13684
14232
  StoryReaderEvent["Close"] = "closeStoryReader";
@@ -13711,6 +14259,11 @@ let StoryReaderViewModel = (() => {
13711
14259
  let _get_reachEnd_decorators;
13712
14260
  let _open_decorators;
13713
14261
  let _close_decorators;
14262
+ let _showStory_decorators;
14263
+ let _showStoryOnce_decorators;
14264
+ let _showStoryFromSharePage_decorators;
14265
+ let _showOnboardingStories_decorators;
14266
+ let _showMultipleStories_decorators;
13714
14267
  let _reloadStory_decorators;
13715
14268
  let _nextStory_decorators;
13716
14269
  let _prevStory_decorators;
@@ -13800,9 +14353,15 @@ let StoryReaderViewModel = (() => {
13800
14353
  writable: true,
13801
14354
  value: false
13802
14355
  });
13803
- this.handleWindowUnload = this.handleWindowUnload.bind(this);
13804
- this.handleKeydown = this.handleKeydown.bind(this);
13805
- window.addEventListener("beforeunload", this.handleWindowUnload);
14356
+ Object.defineProperty(this, "cacheManager", {
14357
+ enumerable: true,
14358
+ configurable: true,
14359
+ writable: true,
14360
+ value: null
14361
+ });
14362
+ this.handleWindowUnload = this.handleWindowUnload.bind(this);
14363
+ this.handleKeydown = this.handleKeydown.bind(this);
14364
+ window.addEventListener("beforeunload", this.handleWindowUnload);
13806
14365
  this.storyDisplayStrategyFactory = new StoryDisplayStrategyFactory(storyManager, this);
13807
14366
  this.navigationController = new StoryReaderNavigationController(this.storyManager, this, new StoryReaderStatisticsController(this, this.storyManager, this.storyReaderStatisticV1Service, this.storyFeedStatisticV1Service, this.storyReaderStatisticV2Service));
13808
14367
  }
@@ -13853,6 +14412,8 @@ let StoryReaderViewModel = (() => {
13853
14412
  var _b, _c;
13854
14413
  if (this.activeStory)
13855
14414
  this.resetReaderToDefaultState(this.activeStory);
14415
+ if (this.storyManager.config.cache)
14416
+ this.cacheManager = new CacheManager(this.storyManager.config.cache);
13856
14417
  this.windowReferer = payload.windowReferer;
13857
14418
  this.setStories(payload.stories);
13858
14419
  const activeStory = this.navigationController.setActiveStoryById(payload.id);
@@ -13890,6 +14451,7 @@ let StoryReaderViewModel = (() => {
13890
14451
  });
13891
14452
  }
13892
14453
  resetReaderToDefaultState(activeStory, closeAction) {
14454
+ var _b;
13893
14455
  const event = new CloseStoryEvent(activeStory, {
13894
14456
  action: closeAction
13895
14457
  });
@@ -13904,6 +14466,7 @@ let StoryReaderViewModel = (() => {
13904
14466
  this._touchController.destroy();
13905
14467
  document.removeEventListener("keydown", this.handleKeydown);
13906
14468
  this.navigationController.destroy();
14469
+ (_b = this.cacheManager) === null || _b === void 0 ? void 0 : _b.destroy();
13907
14470
  }
13908
14471
  canBeClosed() {
13909
14472
  return this.activeStory ? !this.activeStory.disableClose : false;
@@ -13973,12 +14536,14 @@ let StoryReaderViewModel = (() => {
13973
14536
  this.navigationController.navigateStoryWithAnimation(index, action);
13974
14537
  }
13975
14538
  destroy() {
14539
+ var _b;
13976
14540
  if (this.activeStory) {
13977
14541
  this.emitCloseEvents(this.activeStory, CloseStoryReaderAction.AppClose);
13978
14542
  this.resetReaderToDefaultState(this.activeStory);
13979
14543
  }
13980
14544
  this.removeAllListeners();
13981
14545
  window.removeEventListener("beforeunload", this.handleWindowUnload);
14546
+ (_b = this.cacheManager) === null || _b === void 0 ? void 0 : _b.destroy();
13982
14547
  }
13983
14548
  closeGoodsWidget() {
13984
14549
  var _b;
@@ -14049,7 +14614,7 @@ let StoryReaderViewModel = (() => {
14049
14614
  setStories(stories) {
14050
14615
  const slideApiHandlersFactory = new StorySlideApiHandlersFactory(this.storyManager, this, this.storyReaderStatisticV1Service, this.storyReaderStatisticV2Service);
14051
14616
  for (const story of stories) {
14052
- 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));
14053
14618
  }
14054
14619
  }
14055
14620
  handleKeydown(e) {
@@ -14104,6 +14669,11 @@ let StoryReaderViewModel = (() => {
14104
14669
  _get_reachEnd_decorators = [external_mobx_namespaceObject.computed];
14105
14670
  _open_decorators = [external_mobx_namespaceObject.action];
14106
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];
14107
14677
  _reloadStory_decorators = [external_mobx_namespaceObject.action];
14108
14678
  _nextStory_decorators = [external_mobx_namespaceObject.action];
14109
14679
  _prevStory_decorators = [external_mobx_namespaceObject.action];
@@ -14123,6 +14693,11 @@ let StoryReaderViewModel = (() => {
14123
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);
14124
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);
14125
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);
14126
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);
14127
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);
14128
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);
@@ -15140,8 +15715,12 @@ let StoryManagerConfig = (() => {
15140
15715
  });
15141
15716
  _StoryManagerConfig__anonymous_accessor_storage.set(this, storyManagerConfig_runInitializers(this, __anonymous_initializers, false));
15142
15717
  _StoryManagerConfig__options_accessor_storage.set(this, (storyManagerConfig_runInitializers(this, __anonymous_extraInitializers), storyManagerConfig_runInitializers(this, __options_initializers, {})));
15143
- storyManagerConfig_runInitializers(this, __options_extraInitializers);
15144
- 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
+ });
15145
15724
  this.update(configDto);
15146
15725
  this._isInited = true;
15147
15726
  }
@@ -15187,6 +15766,9 @@ let StoryManagerConfig = (() => {
15187
15766
  get options() {
15188
15767
  return this._options;
15189
15768
  }
15769
+ get cache() {
15770
+ return this._cache;
15771
+ }
15190
15772
  disableStatistic() {
15191
15773
  this._isStatisticsDisabled = true;
15192
15774
  }
@@ -15271,7 +15853,7 @@ let StoryManagerConfig = (() => {
15271
15853
  this._options = options;
15272
15854
  }
15273
15855
  update(configDto) {
15274
- var _b, _c, _d, _e, _f;
15856
+ var _b, _c, _d, _e, _f, _g;
15275
15857
  this._appPackageId = (_b = configDto.appPackageId) !== null && _b !== void 0 ? _b : "";
15276
15858
  this._disableDeviceId = Boolean(configDto.disableDeviceId);
15277
15859
  this.setOptions(configDto.options);
@@ -15283,6 +15865,7 @@ let StoryManagerConfig = (() => {
15283
15865
  this.setImagePlaceholders((_e = configDto.imagePlaceholders) !== null && _e !== void 0 ? _e : {});
15284
15866
  this.setTags((_f = configDto.tags) !== null && _f !== void 0 ? _f : []);
15285
15867
  this.setDir(configDto.dir);
15868
+ this._cache = configDto.cache ? Object.assign(Object.assign({}, configDto.cache), { prefetch: (_g = configDto.cache.prefetch) !== null && _g !== void 0 ? _g : true }) : null;
15286
15869
  }
15287
15870
  mapTextPlaceholders(textPlaceholderDtos) {
15288
15871
  const textPlaceholders = [];
@@ -15388,6 +15971,9 @@ class NullStoryManagerConfig {
15388
15971
  get options() {
15389
15972
  return {};
15390
15973
  }
15974
+ get cache() {
15975
+ return null;
15976
+ }
15391
15977
  disableStatistic() { }
15392
15978
  enableStatistic() { }
15393
15979
  async setApiKey(apiKey) { }
@@ -16821,7 +17407,16 @@ let IamMessageSlideViewModel = (() => {
16821
17407
  const { canClickNext } = this.slideApi.slideClickHandler(event.target, direction);
16822
17408
  this._disabledNextClick = !canClickNext;
16823
17409
  }
16824
- 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
+ }
16825
17420
  getNavigationDirection(event, currentTarget) {
16826
17421
  const xPercent = this.getClickPosition(event, currentTarget);
16827
17422
  const k = this.slideApi.layoutDirection === "ltr" ? 1 : -1;
@@ -16877,6 +17472,7 @@ let IamMessageSlideViewModel = (() => {
16877
17472
 
16878
17473
 
16879
17474
 
17475
+
16880
17476
  ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/actions/openGameAction.ts
16881
17477
 
16882
17478
  class openGameAction_OpenGameAction {
@@ -16895,13 +17491,11 @@ class openGameAction_OpenGameAction {
16895
17491
  });
16896
17492
  }
16897
17493
  async handle(payload) {
16898
- var _a;
16899
17494
  try {
16900
17495
  await this.storyManager.openGame(payload.gameInstanceId);
16901
- (_a = this.iamMessage.activeSlide) === null || _a === void 0 ? void 0 : _a.pauseAndLock();
17496
+ this.iamMessage.pauseAndLock();
16902
17497
  this.storyManager.gameReader.once(GameReaderEvent.Close, () => {
16903
- var _a;
16904
- (_a = this.iamMessage.activeSlide) === null || _a === void 0 ? void 0 : _a.resumeAndUnlock();
17498
+ this.iamMessage.resumeAndUnlock();
16905
17499
  });
16906
17500
  }
16907
17501
  catch (error) {
@@ -17146,7 +17740,7 @@ let IamReaderViewModel = (() => {
17146
17740
  this.clearActiveMessage();
17147
17741
  this.visibilityObserver.unsubscribe();
17148
17742
  this.touchController.destroy();
17149
- this.scrollbarHelper.enable();
17743
+ this.scrollbarHelper.disable();
17150
17744
  }
17151
17745
  async close() {
17152
17746
  var _b;
@@ -17159,7 +17753,7 @@ let IamReaderViewModel = (() => {
17159
17753
  this.touchController.init(document.body);
17160
17754
  this.setActiveMessage(message);
17161
17755
  this.visibilityObserver.subscribe();
17162
- this.scrollbarHelper.disable();
17756
+ this.scrollbarHelper.enable();
17163
17757
  }
17164
17758
  destroy() { }
17165
17759
  emitWidgetEvent(widgetEvent) {
@@ -17205,7 +17799,12 @@ let IamReaderViewModel = (() => {
17205
17799
  });
17206
17800
  }
17207
17801
  createIamMessageViewModel(message) {
17208
- 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
+ }
17209
17808
  }
17210
17809
  checkMessageNotOpened() {
17211
17810
  if (this.activeMessage)
@@ -17306,13 +17905,11 @@ class showStoryAction_ShowStoryAction {
17306
17905
  });
17307
17906
  }
17308
17907
  async handle(payload) {
17309
- var _a;
17310
17908
  try {
17311
17909
  await this.storyManager.showStory(payload.storyId);
17312
- (_a = this.message.activeSlide) === null || _a === void 0 ? void 0 : _a.pauseAndLock();
17910
+ this.message.pauseAndLock();
17313
17911
  this.storyManager.storyReader.once(StoryReaderEvent.Close, () => {
17314
- var _a;
17315
- (_a = this.message.activeSlide) === null || _a === void 0 ? void 0 : _a.resumeAndUnlock();
17912
+ this.message.resumeAndUnlock();
17316
17913
  });
17317
17914
  }
17318
17915
  catch (error) {
@@ -17352,6 +17949,7 @@ class narrativeDataCache_NarrativeDataCache {
17352
17949
 
17353
17950
 
17354
17951
 
17952
+
17355
17953
  class IamSlideApiHandlers {
17356
17954
  constructor(storyManager, iamReader, iamMessage, iamStatisticsService) {
17357
17955
  Object.defineProperty(this, "storyManager", {
@@ -17391,6 +17989,29 @@ class IamSlideApiHandlers {
17391
17989
  value: new narrativeDataCache_NarrativeDataCache()
17392
17990
  });
17393
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
+ }
17394
18015
  clearActiveNarrativeDataCache() {
17395
18016
  this.activeMessageNarrativeDataCache.clear();
17396
18017
  }
@@ -17495,62 +18116,398 @@ class IamSlideApiHandlers {
17495
18116
  data: (_c = error.response) === null || _c === void 0 ? void 0 : _c.data
17496
18117
  };
17497
18118
  }
17498
- }
17499
- }
17500
- share(id, config) { }
17501
- shareSlideScreenshot(shareId, hideElementsSelector, shareText) { }
17502
- showLayer(index) {
17503
- var _a;
17504
- (_a = this.iamMessage.activeSlide) === null || _a === void 0 ? void 0 : _a.showLayerByIndex(index);
17505
- }
17506
- showCardSlide(slideIndex) { }
17507
- cardShowNext() { }
17508
- showNextSlide() { }
17509
- sendStatisticEvent(eventName, data, devPayload, forceEnableStatisticV2) {
17510
- this.iamStatisticsService.sendWidgetEvent({
17511
- iterationId: this.iamMessage.iterationId,
17512
- messageId: this.iamMessage.id,
17513
- slideIndex: this.iamMessage.activeSlideIndex,
17514
- slideTotal: this.iamMessage.slides.length,
17515
- duration: this.iamMessage.timeSinceLastShow,
17516
- type: eventName,
17517
- widgetPayload: data
17518
- });
17519
- this.iamReader.emitWidgetEvent({
17520
- type: eventName,
17521
- widgetPayload: devPayload !== null && devPayload !== void 0 ? devPayload : {}
17522
- });
17523
- }
17524
- async resetCard(messageId) { }
17525
- getCardFonts() {
17526
- var _a, _b;
17527
- return (_b = (_a = this.storyManager.rootStore.sessionStore.session) === null || _a === void 0 ? void 0 : _a.fontsResources) !== null && _b !== void 0 ? _b : [];
17528
- }
17529
- updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError) {
17530
- if (showLoader)
17531
- this.iamMessage.showLoaderScreen();
17532
- else
17533
- this.iamMessage.hideLoaderScreen();
17534
- if (showError)
17535
- this.iamMessage.showErrorScreen();
17536
- else
17537
- this.iamMessage.hideErrorScreen();
17538
- }
17539
- showToast(text) {
17540
- var _a;
17541
- (_a = this.iamMessage.activeSlide) === null || _a === void 0 ? void 0 : _a.showToast({ content: text });
17542
- }
17543
- }
18119
+ }
18120
+ }
18121
+ share(id, config) { }
18122
+ shareSlideScreenshot(shareId, hideElementsSelector, shareText) { }
18123
+ showLayer(index) {
18124
+ this.iamMessage.showLayerByIndex(index);
18125
+ }
18126
+ showCardSlide(slideIndex) { }
18127
+ cardShowNext() { }
18128
+ showNextSlide() { }
18129
+ sendStatisticEvent(eventName, data, devPayload, forceEnableStatisticV2) {
18130
+ this.iamStatisticsService.sendWidgetEvent({
18131
+ iterationId: this.iamMessage.iterationId,
18132
+ messageId: this.iamMessage.id,
18133
+ slideIndex: this.iamMessage.activeSlideIndex,
18134
+ slideTotal: this.iamMessage.slides.length,
18135
+ duration: this.iamMessage.timeSinceLastShow,
18136
+ type: eventName,
18137
+ widgetPayload: data
18138
+ });
18139
+ this.iamReader.emitWidgetEvent({
18140
+ type: eventName,
18141
+ widgetPayload: devPayload !== null && devPayload !== void 0 ? devPayload : {}
18142
+ });
18143
+ }
18144
+ async resetCard(messageId) { }
18145
+ getCardFonts() {
18146
+ var _a, _b;
18147
+ return (_b = (_a = this.storyManager.rootStore.sessionStore.session) === null || _a === void 0 ? void 0 : _a.fontsResources) !== null && _b !== void 0 ? _b : [];
18148
+ }
18149
+ updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError) {
18150
+ if (showLoader)
18151
+ this.iamMessage.showLoaderScreen();
18152
+ else
18153
+ this.iamMessage.hideLoaderScreen();
18154
+ if (showError)
18155
+ this.iamMessage.showErrorScreen();
18156
+ else
18157
+ this.iamMessage.hideErrorScreen();
18158
+ }
18159
+ showToast(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 "";
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() { }
18200
+ }
18201
+
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
+ })();
17544
18500
 
17545
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/iamMessageViewModel.ts
17546
- var iamMessageViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
18501
+
18502
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/iamMultiSlideMessageViewModel.ts
18503
+ var iamMultiSlideMessageViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
17547
18504
  var useValue = arguments.length > 2;
17548
18505
  for (var i = 0; i < initializers.length; i++) {
17549
18506
  value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
17550
18507
  }
17551
18508
  return useValue ? value : void 0;
17552
18509
  };
17553
- 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) {
17554
18511
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
17555
18512
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
17556
18513
  var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
@@ -17577,12 +18534,12 @@ var iamMessageViewModel_esDecorate = (undefined && undefined.__esDecorate) || fu
17577
18534
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
17578
18535
  done = true;
17579
18536
  };
17580
- var iamMessageViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18537
+ var iamMultiSlideMessageViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
17581
18538
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
17582
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");
17583
18540
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17584
18541
  };
17585
- 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) {
17586
18543
  if (kind === "m") throw new TypeError("Private method is not writable");
17587
18544
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
17588
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");
@@ -17595,9 +18552,11 @@ var iamMessageViewModel_classPrivateFieldSet = (undefined && undefined.__classPr
17595
18552
 
17596
18553
 
17597
18554
 
17598
- let IamMessageViewModel = (() => {
17599
- var _a, _IamMessageViewModel__isOnceOpened_accessor_storage, _IamMessageViewModel__$root_accessor_storage, _IamMessageViewModel__needShowErrorScreen_accessor_storage, _IamMessageViewModel__needShowLoaderScreen_accessor_storage;
17600
- 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;
17601
18560
  let _instanceExtraInitializers = [];
17602
18561
  let __isOnceOpened_decorators;
17603
18562
  let __isOnceOpened_initializers = [];
@@ -17611,26 +18570,31 @@ let IamMessageViewModel = (() => {
17611
18570
  let __needShowLoaderScreen_decorators;
17612
18571
  let __needShowLoaderScreen_initializers = [];
17613
18572
  let __needShowLoaderScreen_extraInitializers = [];
18573
+ let __disabledNextClick_decorators;
18574
+ let __disabledNextClick_initializers = [];
18575
+ let __disabledNextClick_extraInitializers = [];
17614
18576
  let _showErrorScreen_decorators;
17615
18577
  let _showLoaderScreen_decorators;
17616
18578
  let _hideLoaderScreen_decorators;
17617
18579
  let _hideErrorScreen_decorators;
17618
- return _a = class IamMessageViewModel extends _classSuper {
17619
- get _isOnceOpened() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__isOnceOpened_accessor_storage, "f"); }
17620
- set _isOnceOpened(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__isOnceOpened_accessor_storage, value, "f"); }
17621
- get _$root() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__$root_accessor_storage, "f"); }
17622
- set _$root(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__$root_accessor_storage, value, "f"); }
17623
- get _needShowErrorScreen() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__needShowErrorScreen_accessor_storage, "f"); }
17624
- set _needShowErrorScreen(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__needShowErrorScreen_accessor_storage, value, "f"); }
17625
- get _needShowLoaderScreen() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__needShowLoaderScreen_accessor_storage, "f"); }
17626
- 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"); }
17627
18591
  constructor(iamReader, storyManager, iamMessage, iamStatisticsService) {
17628
18592
  super();
17629
18593
  Object.defineProperty(this, "iamReader", {
17630
18594
  enumerable: true,
17631
18595
  configurable: true,
17632
18596
  writable: true,
17633
- value: (iamMessageViewModel_runInitializers(this, _instanceExtraInitializers), iamReader)
18597
+ value: (iamMultiSlideMessageViewModel_runInitializers(this, _instanceExtraInitializers), iamReader)
17634
18598
  });
17635
18599
  Object.defineProperty(this, "storyManager", {
17636
18600
  enumerable: true,
@@ -17650,11 +18614,11 @@ let IamMessageViewModel = (() => {
17650
18614
  writable: true,
17651
18615
  value: iamStatisticsService
17652
18616
  });
17653
- Object.defineProperty(this, "_slides", {
18617
+ Object.defineProperty(this, "toast", {
17654
18618
  enumerable: true,
17655
18619
  configurable: true,
17656
18620
  writable: true,
17657
- value: []
18621
+ value: null
17658
18622
  });
17659
18623
  Object.defineProperty(this, "slideApiHandlers", {
17660
18624
  enumerable: true,
@@ -17662,15 +18626,28 @@ let IamMessageViewModel = (() => {
17662
18626
  writable: true,
17663
18627
  value: void 0
17664
18628
  });
17665
- _IamMessageViewModel__isOnceOpened_accessor_storage.set(this, iamMessageViewModel_runInitializers(this, __isOnceOpened_initializers, false));
17666
- _IamMessageViewModel__$root_accessor_storage.set(this, (iamMessageViewModel_runInitializers(this, __isOnceOpened_extraInitializers), iamMessageViewModel_runInitializers(this, __$root_initializers, null)));
17667
- _IamMessageViewModel__needShowErrorScreen_accessor_storage.set(this, (iamMessageViewModel_runInitializers(this, __$root_extraInitializers), iamMessageViewModel_runInitializers(this, __needShowErrorScreen_initializers, false)));
17668
- _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
+ });
17669
18646
  Object.defineProperty(this, "touchController", {
17670
18647
  enumerable: true,
17671
18648
  configurable: true,
17672
18649
  writable: true,
17673
- value: iamMessageViewModel_runInitializers(this, __needShowLoaderScreen_extraInitializers)
18650
+ value: void 0
17674
18651
  });
17675
18652
  Object.defineProperty(this, "slideApi", {
17676
18653
  enumerable: true,
@@ -17684,11 +18661,23 @@ let IamMessageViewModel = (() => {
17684
18661
  writable: true,
17685
18662
  value: (el) => {
17686
18663
  this._$root = el;
17687
- 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();
17688
18676
  }
17689
18677
  });
17690
18678
  this.touchController = iamReader.touchController;
17691
18679
  this.slideApiHandlers = new IamSlideApiHandlers(this.storyManager, this.iamReader, this, this.iamStatisticsService);
18680
+ this.handleDocumentVisibilityChange = this.handleDocumentVisibilityChange.bind(this);
17692
18681
  }
17693
18682
  get id() {
17694
18683
  return this.iamMessage.id;
@@ -17697,13 +18686,10 @@ let IamMessageViewModel = (() => {
17697
18686
  return this._$root;
17698
18687
  }
17699
18688
  get activeSlideIndex() {
17700
- return 0;
17701
- }
17702
- get activeSlide() {
17703
- return this._slides[this.activeSlideIndex];
18689
+ return this._activeSlideIndex;
17704
18690
  }
17705
18691
  get slides() {
17706
- return this._slides;
18692
+ return [];
17707
18693
  }
17708
18694
  get context() {
17709
18695
  return this.iamMessage.context;
@@ -17714,11 +18700,6 @@ let IamMessageViewModel = (() => {
17714
18700
  get iterationId() {
17715
18701
  return this.iamMessage.iterationId;
17716
18702
  }
17717
- /**
17718
- 1 - Bottom sheet
17719
- 2 - Modal
17720
- 3 - Fullscreen
17721
- */
17722
18703
  get type() {
17723
18704
  return this.iamMessage.type;
17724
18705
  }
@@ -17745,17 +18726,24 @@ let IamMessageViewModel = (() => {
17745
18726
  return this.storyManager.rootStore.iamStore.updateMessageUserData(this.id, data);
17746
18727
  }
17747
18728
  async init() {
17748
- var _b;
17749
- 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);
17750
18730
  }
17751
18731
  async start() {
17752
- var _b;
17753
- 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);
17754
18734
  }
17755
18735
  async stop() {
17756
- var _b;
17757
- this.slideApiHandlers.clearActiveNarrativeDataCache();
17758
- 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;
17759
18747
  }
17760
18748
  toPublicDto() {
17761
18749
  return this.iamMessage.toPublicDto();
@@ -17772,25 +18760,58 @@ let IamMessageViewModel = (() => {
17772
18760
  hideErrorScreen() {
17773
18761
  this._needShowErrorScreen = false;
17774
18762
  }
17775
- destroy() {
18763
+ async destroy() {
17776
18764
  var _b;
17777
- (_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();
17778
18768
  }
17779
- createSlidesViewModels() {
17780
- if (this._slides.length > 0)
17781
- 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() {
17782
18804
  const isFullscreen = this.type === IamMessageType.Fullscreen;
17783
- const slideApi = new slide_api_namespaceObject.SlideApi(this.slideApiHandlers, {
18805
+ return new slide_api_namespaceObject.SlideApi(this.slideApiHandlers, {
17784
18806
  root: this._$root,
17785
18807
  slideRatio: this.getContentRatio(),
17786
18808
  isFullscreen,
17787
18809
  nonce: getNonce(),
17788
18810
  viewport: window,
17789
18811
  userResizeHandler: undefined,
17790
- VODPlayer: this.storyManager.globalProperties.$videoOnDemand
18812
+ VODPlayer: this.storyManager.globalProperties.$videoOnDemand,
18813
+ useSdkCacheForMultislideMode: false
17791
18814
  });
17792
- this._slides = this.iamMessage.slides.map(slide => new IamMessageSlideViewModel(this, slide, slideApi));
17793
- this.slideApi = slideApi;
17794
18815
  }
17795
18816
  getContentRatio() {
17796
18817
  if (this.appearanceOptions instanceof IamBottomSheetAppearanceOptions ||
@@ -17798,11 +18819,66 @@ let IamMessageViewModel = (() => {
17798
18819
  return this.appearanceOptions.contentRatio;
17799
18820
  return 9 / 16;
17800
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
+ }
17801
18876
  },
17802
- _IamMessageViewModel__isOnceOpened_accessor_storage = new WeakMap(),
17803
- _IamMessageViewModel__$root_accessor_storage = new WeakMap(),
17804
- _IamMessageViewModel__needShowErrorScreen_accessor_storage = new WeakMap(),
17805
- _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(),
17806
18882
  (() => {
17807
18883
  var _b;
17808
18884
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
@@ -17810,18 +18886,20 @@ let IamMessageViewModel = (() => {
17810
18886
  __$root_decorators = [external_mobx_namespaceObject.observable];
17811
18887
  __needShowErrorScreen_decorators = [external_mobx_namespaceObject.observable];
17812
18888
  __needShowLoaderScreen_decorators = [external_mobx_namespaceObject.observable];
18889
+ __disabledNextClick_decorators = [external_mobx_namespaceObject.observable];
17813
18890
  _showErrorScreen_decorators = [external_mobx_namespaceObject.action];
17814
18891
  _showLoaderScreen_decorators = [external_mobx_namespaceObject.action];
17815
18892
  _hideLoaderScreen_decorators = [external_mobx_namespaceObject.action];
17816
18893
  _hideErrorScreen_decorators = [external_mobx_namespaceObject.action];
17817
- 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);
17818
- 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);
17819
- 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);
17820
- 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);
17821
- 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);
17822
- 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);
17823
- 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);
17824
- 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);
17825
18903
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
17826
18904
  })(),
17827
18905
  _a;
@@ -17833,6 +18911,8 @@ let IamMessageViewModel = (() => {
17833
18911
 
17834
18912
 
17835
18913
 
18914
+
18915
+
17836
18916
  ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/index.ts
17837
18917
 
17838
18918
 
@@ -20434,7 +21514,7 @@ class UgcEditorStore {
20434
21514
  const session = await this.storyManager.rootStore.sessionStore.open();
20435
21515
  const ugcEditorConfigDto = await this.ugcEditorApi.fetchUgcEditorConfig();
20436
21516
  const storyManagerConfig = this.storyManager.config;
20437
- const sdkVersion = "1.8.0-rc.9";
21517
+ const sdkVersion = "1.8.1";
20438
21518
  this._config = {
20439
21519
  sessionId: session.id,
20440
21520
  apiKey: storyManagerConfig.apiKey,
@@ -20467,7 +21547,6 @@ class UgcEditorApi {
20467
21547
  const requestConfig = {
20468
21548
  method: "GET",
20469
21549
  url: "ugc/editor-config",
20470
- params: {}
20471
21550
  };
20472
21551
  const response = await api.request(requestConfig);
20473
21552
  return response.data;
@@ -20866,11 +21945,11 @@ class StoryManager extends TypedEventEmitter {
20866
21945
  return this._userAgent;
20867
21946
  }
20868
21947
  get sdkVersionName() {
20869
- const sdkVersionName = "1.8.0-rc.9";
21948
+ const sdkVersionName = "1.8.1";
20870
21949
  return sdkVersionName || "0.0.0";
20871
21950
  }
20872
21951
  get sdkVersionCode() {
20873
- const sdkVersionCode = 10800;
21952
+ const sdkVersionCode = 10801;
20874
21953
  return sdkVersionCode ? parseInt(sdkVersionCode) : 0;
20875
21954
  }
20876
21955
  get lang() {
@@ -20927,7 +22006,7 @@ class StoryManager extends TypedEventEmitter {
20927
22006
  this.rootStore.storyManagerConfigStore.setConfig(configDto);
20928
22007
  }
20929
22008
  setUserAgent(userAgent) {
20930
- const sdkVersionCode = 10800;
22009
+ const sdkVersionCode = 10801;
20931
22010
  const buildVersion = sdkVersionCode ? parseInt(sdkVersionCode) : 0;
20932
22011
  // According to RFC5987, HTTP header values can legitimately be supplied using the ISO-8859-1 encoding.
20933
22012
  this._userAgent = `${userAgent} ${convertStrToLatin1(navigator.userAgent)}`;
@@ -23248,10 +24327,7 @@ const Loader = (0,external_mobx_react_lite_namespaceObject.observer)((props) =>
23248
24327
  const isLoading = props.needShowLoaderScreen;
23249
24328
  if (!isLoading && !needShowReloadBtn)
23250
24329
  return null;
23251
- return ((0,jsx_runtime_namespaceObject.jsx)("div", { className: (0,external_classnames_namespaceObject["default"])(Loader_loader_module["loader"]), style: {
23252
- "--loader-background": props.background,
23253
- "--loaderBackgroundColor": props.color
23254
- }, 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 => {
23255
24331
  e.preventDefault();
23256
24332
  }, children: needShowReloadBtn ? ((0,jsx_runtime_namespaceObject.jsx)(RefreshIcon, { className: Loader_loader_module["loader__refresh-btn"], onClick: e => {
23257
24333
  e.stopPropagation();
@@ -25047,8 +26123,7 @@ const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) =
25047
26123
  const shouldHideHeader = isDesktopGeometry && useModernLayout
25048
26124
  ? !isActiveStory || story.pauseState.isUIPaused
25049
26125
  : story.pauseState.isUIPaused;
25050
- const shouldHideActionPanel = isDesktopGeometry &&
25051
- ((useModernLayout && !isActiveStory) || story.textInput.isOpened);
26126
+ const shouldHideActionPanel = isDesktopGeometry && ((useModernLayout && !isActiveStory) || story.textInput.isOpened);
25052
26127
  (0,external_react_namespaceObject.useLayoutEffect)(() => {
25053
26128
  const bottomOffset = parseFloat(String(storyReaderOptions.actionPanelBottomOffset));
25054
26129
  story.actionPanel.setOptions(commonOptions);
@@ -25072,7 +26147,7 @@ const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) =
25072
26147
  story.sharePanel.completeNativeSharing({ result: false });
25073
26148
  }, onTouchStart: () => {
25074
26149
  story.sharePanel.completeNativeSharing({ result: false });
25075
- }, "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 })] }));
25076
26151
  });
25077
26152
 
25078
26153
  ;// CONCATENATED MODULE: ./src/StoryReader/Story/index.ts
@@ -25419,7 +26494,7 @@ const ModernStoryList = (0,external_mobx_react_lite_namespaceObject.observer)((p
25419
26494
  if (uiDisabled)
25420
26495
  return;
25421
26496
  props.storyReader.toStoryWithAnimationByIndex(index);
25422
- }, children: [(0,jsx_runtime_namespaceObject.jsx)(Story_Story, { index: index, story: story, slideClickDisabled: uiDisabled, activeStory: activeStory, geometry: props.storyGeometry, onClose: props.onCloseStory }), (props.storyReader.stories.length > 1 || story.slidesCount > 1) && ((0,jsx_runtime_namespaceObject.jsx)(ModernStoryListControls, { dir: props.storyReader.dir, display: isActiveStory && activeStory.canBeShown, disabled: uiDisabled, isNextDisabled: isNextDisabled, isPrevDisabled: isPrevDisabled, navigationOptions: storyReaderOptions.navigation, onNext: () => {
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: () => {
25423
26498
  props.storyReader.goNext();
25424
26499
  }, onPrev: () => {
25425
26500
  props.storyReader.goPrev();
@@ -26310,7 +27385,7 @@ var decorators_js_x = (y) => {
26310
27385
  var x = {}; __webpack_require__.d(x, y); return x
26311
27386
  }
26312
27387
  var decorators_js_y = (x) => (() => (x))
26313
- 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) });
26314
27389
  ;// CONCATENATED MODULE: ./src/InAppMessaging/controllers/viewportController.ts
26315
27390
  class ViewportController {
26316
27391
  constructor(host) {
@@ -26372,7 +27447,7 @@ const messageViewsByType = {
26372
27447
 
26373
27448
  ;// CONCATENATED MODULE: ./src/InAppMessaging/components/BottomSheet/BottomSheet.styles.ts
26374
27449
 
26375
- 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)}`;
26376
27451
 
26377
27452
  ;// CONCATENATED MODULE: external "lit/directives/style-map.js"
26378
27453
  var style_map_js_x = (y) => {
@@ -26520,7 +27595,7 @@ var BottomSheet_classPrivateFieldSet = (undefined && undefined.__classPrivateFie
26520
27595
 
26521
27596
  let BottomSheet = (() => {
26522
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;
26523
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-bottom-sheet")];
27598
+ let _classDecorators = [safeCustomElement("iam-bottom-sheet")];
26524
27599
  let _classDescriptor;
26525
27600
  let _classExtraInitializers = [];
26526
27601
  let _classThis;
@@ -26799,9 +27874,10 @@ var ModalCloseButton_classPrivateFieldSet = (undefined && undefined.__classPriva
26799
27874
 
26800
27875
 
26801
27876
 
27877
+
26802
27878
  let Modal = (() => {
26803
27879
  var _Modal_closeBtnPosition_accessor_storage, _Modal_dir_accessor_storage;
26804
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-modal-close-btn")];
27880
+ let _classDecorators = [safeCustomElement("iam-modal-close-btn")];
26805
27881
  let _classDescriptor;
26806
27882
  let _classExtraInitializers = [];
26807
27883
  let _classThis;
@@ -26919,9 +27995,10 @@ var Modal_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet)
26919
27995
 
26920
27996
  const ANIMATION_DURATION = 350;
26921
27997
 
27998
+
26922
27999
  let Modal_Modal = (() => {
26923
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;
26924
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-modal")];
28001
+ let _classDecorators = [safeCustomElement("iam-modal")];
26925
28002
  let _classDescriptor;
26926
28003
  let _classExtraInitializers = [];
26927
28004
  let _classThis;
@@ -27171,9 +28248,10 @@ var FullscreenModal_classPrivateFieldSet = (undefined && undefined.__classPrivat
27171
28248
 
27172
28249
 
27173
28250
 
28251
+
27174
28252
  let FullscreenModal = (() => {
27175
28253
  var _FullscreenModal_open_accessor_storage, _FullscreenModal_geometry_accessor_storage, _FullscreenModal_appearanceOptions_accessor_storage;
27176
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-fullscreen-modal")];
28254
+ let _classDecorators = [safeCustomElement("iam-fullscreen-modal")];
27177
28255
  let _classDescriptor;
27178
28256
  let _classExtraInitializers = [];
27179
28257
  let _classThis;
@@ -27290,9 +28368,10 @@ var MessageViewFactory_classPrivateFieldSet = (undefined && undefined.__classPri
27290
28368
 
27291
28369
 
27292
28370
 
28371
+
27293
28372
  let MessageViewFactory = (() => {
27294
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;
27295
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("message-view-factory")];
28374
+ let _classDecorators = [safeCustomElement("message-view-factory")];
27296
28375
  let _classDescriptor;
27297
28376
  let _classExtraInitializers = [];
27298
28377
  let _classThis;
@@ -27413,9 +28492,9 @@ let MessageViewFactory = (() => {
27413
28492
  })();
27414
28493
 
27415
28494
 
27416
- ;// CONCATENATED MODULE: ./src/InAppMessaging/components/MessageSlide/MessageSide.styles.ts
28495
+ ;// CONCATENATED MODULE: ./src/InAppMessaging/components/MessageSlide/MessageSlide.styles.ts
27417
28496
 
27418
- 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}`;
27419
28498
 
27420
28499
  ;// CONCATENATED MODULE: ./src/InAppMessaging/components/MessageSlide/MessageSlide.ts
27421
28500
  var MessageSlide_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
@@ -27473,7 +28552,7 @@ var MessageSlide_classPrivateFieldSet = (undefined && undefined.__classPrivateFi
27473
28552
 
27474
28553
  let MessageSlide = (() => {
27475
28554
  var _MessageSlide_message_accessor_storage, _MessageSlide_styleContext_accessor_storage, _MessageSlide_geometry_accessor_storage, _MessageSlide_slidesContainer_accessor_storage;
27476
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("message-slide")];
28555
+ let _classDecorators = [safeCustomElement("message-slide")];
27477
28556
  let _classDescriptor;
27478
28557
  let _classExtraInitializers = [];
27479
28558
  let _classThis;
@@ -27521,12 +28600,11 @@ let MessageSlide = (() => {
27521
28600
  this.message.stop();
27522
28601
  }
27523
28602
  handleSlideClick(event) {
27524
- var _a;
27525
28603
  if (!event.currentTarget)
27526
28604
  return;
27527
28605
  event.preventDefault();
27528
28606
  event.stopPropagation();
27529
- (_a = this.message.activeSlide) === null || _a === void 0 ? void 0 : _a.onClick(event, event.currentTarget);
28607
+ this.message.onClick(event, event.currentTarget);
27530
28608
  }
27531
28609
  async initAndStartSlide() {
27532
28610
  const slidesContainer = this.slidesContainer;
@@ -27629,9 +28707,10 @@ var RefreshIcon_classPrivateFieldSet = (undefined && undefined.__classPrivateFie
27629
28707
  };
27630
28708
 
27631
28709
 
28710
+
27632
28711
  let RefreshIcon_RefreshIcon = (() => {
27633
28712
  var _RefreshIcon_className_accessor_storage;
27634
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-refresh-icon")];
28713
+ let _classDecorators = [safeCustomElement("iam-refresh-icon")];
27635
28714
  let _classDescriptor;
27636
28715
  let _classExtraInitializers = [];
27637
28716
  let _classThis;
@@ -27731,9 +28810,10 @@ var Loader_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet
27731
28810
 
27732
28811
 
27733
28812
 
28813
+
27734
28814
  let Loader_Loader = (() => {
27735
28815
  var _Loader_background_accessor_storage, _Loader_color_accessor_storage, _Loader_needShowErrorScreen_accessor_storage, _Loader_needShowLoaderScreen_accessor_storage;
27736
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-loader")];
28816
+ let _classDecorators = [safeCustomElement("iam-loader")];
27737
28817
  let _classDescriptor;
27738
28818
  let _classExtraInitializers = [];
27739
28819
  let _classThis;
@@ -27882,7 +28962,7 @@ var InAppMessagingReader_classPrivateFieldSet = (undefined && undefined.__classP
27882
28962
 
27883
28963
  let InAppMessagingReader = (() => {
27884
28964
  var _InAppMessagingReader_options_accessor_storage, _InAppMessagingReader_desktopMode_accessor_storage, _InAppMessagingReader_dir_accessor_storage, _InAppMessagingReader_viewModel_accessor_storage, _InAppMessagingReader_open_accessor_storage;
27885
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-reader"), mobxObserver];
28965
+ let _classDecorators = [safeCustomElement("iam-reader"), mobxObserver];
27886
28966
  let _classDescriptor;
27887
28967
  let _classExtraInitializers = [];
27888
28968
  let _classThis;
@@ -27981,9 +29061,9 @@ let InAppMessagingReader = (() => {
27981
29061
  });
27982
29062
  }
27983
29063
  async handleReloadMessage() {
27984
- var _a, _b, _c;
29064
+ var _a, _b;
27985
29065
  try {
27986
- 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());
27987
29067
  }
27988
29068
  catch (error) {
27989
29069
  console.error(error);
@@ -28088,7 +29168,7 @@ const IASContainer = (0,external_mobx_react_lite_namespaceObject.observer)((prop
28088
29168
  const gameReader = useGameReaderViewModel({ storyManager: storyManager });
28089
29169
  (0,external_react_namespaceObject.useEffect)(() => {
28090
29170
  if (iasContainerMounted)
28091
- 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");
28092
29172
  iasContainerMounted = true;
28093
29173
  return () => {
28094
29174
  iasContainerMounted = false;