@inappstory/react-sdk 1.7.5 → 1.7.6

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.
@@ -2108,12 +2108,12 @@ __webpack_require__.d(__webpack_exports__, {
2108
2108
  Jj: () => (/* reexport */ StoriesListDirection),
2109
2109
  Wf: () => (/* reexport */ StoryFeedType),
2110
2110
  _5: () => (/* reexport */ StoryList),
2111
- Bq: () => (/* reexport */ StoryManagerProxy),
2111
+ Bq: () => (/* reexport */ StoryManager),
2112
2112
  qz: () => (/* reexport */ StoryReaderSwipeStyle),
2113
2113
  rT: () => (/* reexport */ UGCFeedSlug),
2114
2114
  rs: () => (/* reexport */ UGCStoryList),
2115
2115
  vy: () => (/* reexport */ __IAS_INTERNAL_API__),
2116
- jR: () => (/* reexport */ storyManagerProxy),
2116
+ jR: () => (/* reexport */ storyManager),
2117
2117
  ap: () => (/* reexport */ useIASContainer)
2118
2118
  });
2119
2119
 
@@ -3266,7 +3266,7 @@ APIInstance.interceptors.request.use(config => {
3266
3266
  "X-Request-Id": (0,external_uuid_namespaceObject.v4)(),
3267
3267
  "X-User-Agent": storyManager.userAgent
3268
3268
  });
3269
- if (storyManagerConfig.userId) {
3269
+ if (storyManagerConfig.userId && !storyManagerConfig.anonymous) {
3270
3270
  config.headers["X-User-Id"] = storyManagerConfig.userId;
3271
3271
  }
3272
3272
  if (sessionId) {
@@ -3275,7 +3275,7 @@ APIInstance.interceptors.request.use(config => {
3275
3275
  if (storyManagerConfig.appPackageId != null) {
3276
3276
  config.headers["X-App-Package-Id"] = storyManagerConfig.appPackageId;
3277
3277
  }
3278
- if (!storyManagerConfig.disableDeviceId) {
3278
+ if (!storyManagerConfig.disableDeviceId && !storyManagerConfig.anonymous) {
3279
3279
  config.headers["X-Device-Id"] = deviceDescriptor.deviceId;
3280
3280
  }
3281
3281
  return config;
@@ -3878,12 +3878,14 @@ let IamMessageSlide = (() => {
3878
3878
  ;// CONCATENATED MODULE: ../core/src/domain/session/api/sessionApi.ts
3879
3879
 
3880
3880
 
3881
+ const openFields = "session,server_timestamp,user_key,share,preview_aspect_ratio,placeholders,image_placeholders,is_allow_ugc,is_allow_statistic_v2";
3882
+ const openFeatures = "animation,data,deeplink,placeholder,resetTimers,gameReader,sendApi,swipeUpItems,imgPlaceholder,vod,closeStoryApi,slideTimerEndApi";
3881
3883
  class SessionApi {
3882
3884
  async open(payload) {
3883
3885
  const data = await this.getOpenSessionPayload(payload);
3884
3886
  const response = await api.post("session/open", data, {
3885
3887
  expand: "cache",
3886
- fields: "session,server_timestamp,user_key,share,preview_aspect_ratio,placeholders,image_placeholders,is_allow_ugc,is_allow_statistic_v2"
3888
+ fields: openFields
3887
3889
  });
3888
3890
  return response.data;
3889
3891
  }
@@ -3891,23 +3893,13 @@ class SessionApi {
3891
3893
  const hasWebP = await hasLossyWebP();
3892
3894
  const data = {
3893
3895
  platform: deviceDescriptor.platform,
3894
- device_id: deviceDescriptor.deviceId,
3895
- features: [
3896
- "animation",
3897
- "data",
3898
- "deeplink",
3899
- "placeholder",
3900
- "resetTimers",
3901
- "gameReader",
3902
- "sendApi",
3903
- "swipeUpItems",
3904
- "imgPlaceholder",
3905
- "vod",
3906
- "closeStoryApi",
3907
- "slideTimerEndApi"
3908
- ].join(",")
3896
+ features: openFeatures
3909
3897
  };
3910
- if (payload.userId) {
3898
+ if (payload.anonymous)
3899
+ data.anonymous = payload.anonymous;
3900
+ if (!payload.anonymous)
3901
+ data.device_id = deviceDescriptor.deviceId;
3902
+ if (payload.userId && !payload.anonymous) {
3911
3903
  data.user_id = payload.userId;
3912
3904
  data.user_sign = payload.userIdSign;
3913
3905
  }
@@ -4670,6 +4662,8 @@ class StatisticV2Api {
4670
4662
  }
4671
4663
  isAllowStatisticV2(forceEnableStatisticV2) {
4672
4664
  var _a;
4665
+ if (this.storyManager.config.anonymous)
4666
+ return false;
4673
4667
  const isAllowStatisticV2 = forceEnableStatisticV2 || Boolean((_a = this.storyManager.rootStore.sessionStore.session) === null || _a === void 0 ? void 0 : _a.isAllowStatisticV2);
4674
4668
  if (this.storyManager.isStatisticsDisabled || !isAllowStatisticV2)
4675
4669
  return false;
@@ -7749,6 +7743,13 @@ var external_async_mutex_x = (y) => {
7749
7743
  var external_async_mutex_y = (x) => (() => (x))
7750
7744
  const external_async_mutex_namespaceObject = external_async_mutex_x({ ["Mutex"]: () => (__WEBPACK_EXTERNAL_MODULE_async_mutex_052338b1__.Mutex) });
7751
7745
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storySlideViewModel/storySlideViewModel.ts
7746
+ var storySlideViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
7747
+ var useValue = arguments.length > 2;
7748
+ for (var i = 0; i < initializers.length; i++) {
7749
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
7750
+ }
7751
+ return useValue ? value : void 0;
7752
+ };
7752
7753
  var storySlideViewModel_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
7753
7754
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
7754
7755
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
@@ -7776,13 +7777,6 @@ var storySlideViewModel_esDecorate = (undefined && undefined.__esDecorate) || fu
7776
7777
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
7777
7778
  done = true;
7778
7779
  };
7779
- var storySlideViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
7780
- var useValue = arguments.length > 2;
7781
- for (var i = 0; i < initializers.length; i++) {
7782
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
7783
- }
7784
- return useValue ? value : void 0;
7785
- };
7786
7780
  var storySlideViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7787
7781
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
7788
7782
  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");
@@ -7804,9 +7798,11 @@ const SHOW_SLIDE_TIMEOUT = 500;
7804
7798
  const STORY_LOADER_TIMEOUT = 500;
7805
7799
  let StorySlideViewModel = (() => {
7806
7800
  var _a, _StorySlideViewModel__disabledNextClick_accessor_storage;
7801
+ let _instanceExtraInitializers = [];
7807
7802
  let __disabledNextClick_decorators;
7808
7803
  let __disabledNextClick_initializers = [];
7809
7804
  let __disabledNextClick_extraInitializers = [];
7805
+ let _start_decorators;
7810
7806
  return _a = class StorySlideViewModel {
7811
7807
  get _disabledNextClick() { return storySlideViewModel_classPrivateFieldGet(this, _StorySlideViewModel__disabledNextClick_accessor_storage, "f"); }
7812
7808
  set _disabledNextClick(value) { storySlideViewModel_classPrivateFieldSet(this, _StorySlideViewModel__disabledNextClick_accessor_storage, value, "f"); }
@@ -7815,7 +7811,7 @@ let StorySlideViewModel = (() => {
7815
7811
  enumerable: true,
7816
7812
  configurable: true,
7817
7813
  writable: true,
7818
- value: _story
7814
+ value: (storySlideViewModel_runInitializers(this, _instanceExtraInitializers), _story)
7819
7815
  });
7820
7816
  Object.defineProperty(this, "_index", {
7821
7817
  enumerable: true,
@@ -8012,12 +8008,12 @@ let StorySlideViewModel = (() => {
8012
8008
  try {
8013
8009
  debug(`[SLIDE][STOP]:${this.story.id}:${this.slide.index}`);
8014
8010
  await this.slideApi.slideStop(params);
8015
- this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8016
8011
  }
8017
8012
  catch (error) {
8018
8013
  this.handleSlideError(error);
8019
8014
  }
8020
8015
  finally {
8016
+ this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8021
8017
  release();
8022
8018
  }
8023
8019
  }
@@ -8048,7 +8044,13 @@ let StorySlideViewModel = (() => {
8048
8044
  }
8049
8045
  }
8050
8046
  async destroy() {
8051
- await this.slideApi.destroy();
8047
+ try {
8048
+ this.story.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
8049
+ await this.slideApi.destroy();
8050
+ }
8051
+ catch (error) {
8052
+ console.error(error);
8053
+ }
8052
8054
  }
8053
8055
  getNavigationDirection(event, currentTarget) {
8054
8056
  const xPercent = this.getClickPosition(event, currentTarget);
@@ -8097,7 +8099,9 @@ let StorySlideViewModel = (() => {
8097
8099
  (() => {
8098
8100
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
8099
8101
  __disabledNextClick_decorators = [external_mobx_namespaceObject.observable];
8102
+ _start_decorators = [noConcurrent];
8100
8103
  storySlideViewModel_esDecorate(_a, null, __disabledNextClick_decorators, { kind: "accessor", name: "_disabledNextClick", static: false, private: false, access: { has: obj => "_disabledNextClick" in obj, get: obj => obj._disabledNextClick, set: (obj, value) => { obj._disabledNextClick = value; } }, metadata: _metadata }, __disabledNextClick_initializers, __disabledNextClick_extraInitializers);
8104
+ storySlideViewModel_esDecorate(_a, null, _start_decorators, { kind: "method", name: "start", static: false, private: false, access: { has: obj => "start" in obj, get: obj => obj.start }, metadata: _metadata }, null, _instanceExtraInitializers);
8101
8105
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
8102
8106
  })(),
8103
8107
  _a;
@@ -8393,10 +8397,12 @@ let StoryPauseManager = (() => {
8393
8397
  this.ctx.notifyPauseStateChange();
8394
8398
  }
8395
8399
  resumeAll() {
8396
- this._uiPause.clear();
8397
- this._systemPause.clear();
8398
- this._userPaused = false;
8399
- this.ctx.notifyPauseStateChange();
8400
+ if (this.isPaused) {
8401
+ this._uiPause.clear();
8402
+ this._systemPause.clear();
8403
+ this._userPaused = false;
8404
+ this.ctx.notifyPauseStateChange();
8405
+ }
8400
8406
  }
8401
8407
  },
8402
8408
  _StoryPauseManager__userPaused_accessor_storage = new WeakMap(),
@@ -8569,13 +8575,13 @@ let StoryActionPanelViewModel = (() => {
8569
8575
  return this.model.favorite;
8570
8576
  }
8571
8577
  get hasLike() {
8572
- return this._hasLike;
8578
+ return this._hasLike && !this.storyManager.config.anonymous;
8573
8579
  }
8574
8580
  get hasShare() {
8575
8581
  return this._hasShare;
8576
8582
  }
8577
8583
  get hasFavorite() {
8578
- return this._hasFavorite;
8584
+ return this._hasFavorite && !this.storyManager.config.anonymous;
8579
8585
  }
8580
8586
  get hasAudio() {
8581
8587
  return Boolean(this.model.hasAudio);
@@ -8906,106 +8912,6 @@ let StoryGoodsWidgetViewModel = (() => {
8906
8912
  })();
8907
8913
 
8908
8914
 
8909
- ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyViewModel/storyLifecycleManager.ts
8910
- class StoryLifecycleManager {
8911
- constructor(story, slideApiHandlers) {
8912
- Object.defineProperty(this, "story", {
8913
- enumerable: true,
8914
- configurable: true,
8915
- writable: true,
8916
- value: story
8917
- });
8918
- Object.defineProperty(this, "slideApiHandlers", {
8919
- enumerable: true,
8920
- configurable: true,
8921
- writable: true,
8922
- value: slideApiHandlers
8923
- });
8924
- Object.defineProperty(this, "lastSlide", {
8925
- enumerable: true,
8926
- configurable: true,
8927
- writable: true,
8928
- value: null
8929
- });
8930
- Object.defineProperty(this, "activeSlide", {
8931
- enumerable: true,
8932
- configurable: true,
8933
- writable: true,
8934
- value: null
8935
- });
8936
- Object.defineProperty(this, "isInitialized", {
8937
- enumerable: true,
8938
- configurable: true,
8939
- writable: true,
8940
- value: false
8941
- });
8942
- Object.defineProperty(this, "isActive", {
8943
- enumerable: true,
8944
- configurable: true,
8945
- writable: true,
8946
- value: false
8947
- });
8948
- Object.defineProperty(this, "_activeSlideStartTime", {
8949
- enumerable: true,
8950
- configurable: true,
8951
- writable: true,
8952
- value: 0
8953
- });
8954
- }
8955
- get activeSlideDuration() {
8956
- return Date.now() - this._activeSlideStartTime;
8957
- }
8958
- async init() {
8959
- var _a;
8960
- if (this.isInitialized)
8961
- return;
8962
- this.isInitialized = true;
8963
- await ((_a = this.activeSlide) === null || _a === void 0 ? void 0 : _a.init());
8964
- }
8965
- async start() {
8966
- var _a;
8967
- if (this.isActive)
8968
- return;
8969
- this.isActive = true;
8970
- await ((_a = this.activeSlide) === null || _a === void 0 ? void 0 : _a.start());
8971
- this._activeSlideStartTime = Date.now();
8972
- }
8973
- async restart() {
8974
- if (!this.isActive || !this.activeSlide)
8975
- return;
8976
- await this.activeSlide.restart();
8977
- }
8978
- async stop() {
8979
- if (!this.isActive)
8980
- return;
8981
- this.isActive = false;
8982
- this.slideApiHandlers.clearNarrativeSessionDataCache();
8983
- this.story.resumeAll();
8984
- await this.story.activeSlide.stop({ prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */ });
8985
- }
8986
- async onSlideChange(newSlide) {
8987
- var _a;
8988
- this.lastSlide = this.activeSlide;
8989
- this.activeSlide = newSlide;
8990
- if (this.isInitialized)
8991
- await newSlide.init();
8992
- if (this.isActive) {
8993
- this.story.resumeAll();
8994
- await ((_a = this.lastSlide) === null || _a === void 0 ? void 0 : _a.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ }));
8995
- await newSlide.start();
8996
- this._activeSlideStartTime = Date.now();
8997
- }
8998
- }
8999
- async destroy() {
9000
- var _a, _b;
9001
- this.slideApiHandlers.clearNarrativeSessionDataCache();
9002
- this.isInitialized = false;
9003
- this.isActive = false;
9004
- await ((_a = this.activeSlide) === null || _a === void 0 ? void 0 : _a.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ }));
9005
- await ((_b = this.activeSlide) === null || _b === void 0 ? void 0 : _b.destroy());
9006
- }
9007
- }
9008
-
9009
8915
  ;// CONCATENATED MODULE: ../core/src/readers/storyReader/storyViewModel/timer/timer.ts
9010
8916
 
9011
8917
  var TimerEvent;
@@ -9493,7 +9399,6 @@ var storyViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivate
9493
9399
 
9494
9400
 
9495
9401
 
9496
-
9497
9402
  var StoryEvent;
9498
9403
  (function (StoryEvent) {
9499
9404
  StoryEvent["ShowToast"] = "showToast";
@@ -9588,12 +9493,30 @@ let StoryViewModel = (() => {
9588
9493
  _StoryViewModel__needShowErrorScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __slides_extraInitializers), storyViewModel_runInitializers(this, __needShowErrorScreen_initializers, false)));
9589
9494
  _StoryViewModel__needShowLoaderScreen_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowErrorScreen_extraInitializers), storyViewModel_runInitializers(this, __needShowLoaderScreen_initializers, false)));
9590
9495
  _StoryViewModel__$root_accessor_storage.set(this, (storyViewModel_runInitializers(this, __needShowLoaderScreen_extraInitializers), storyViewModel_runInitializers(this, __$root_initializers, null)));
9496
+ Object.defineProperty(this, "isInited", {
9497
+ enumerable: true,
9498
+ configurable: true,
9499
+ writable: true,
9500
+ value: (storyViewModel_runInitializers(this, __$root_extraInitializers), false)
9501
+ });
9502
+ Object.defineProperty(this, "isActive", {
9503
+ enumerable: true,
9504
+ configurable: true,
9505
+ writable: true,
9506
+ value: false
9507
+ });
9508
+ Object.defineProperty(this, "_activeSlideStartTime", {
9509
+ enumerable: true,
9510
+ configurable: true,
9511
+ writable: true,
9512
+ value: 0
9513
+ });
9591
9514
  // internal services
9592
9515
  Object.defineProperty(this, "slideApi", {
9593
9516
  enumerable: true,
9594
9517
  configurable: true,
9595
9518
  writable: true,
9596
- value: (storyViewModel_runInitializers(this, __$root_extraInitializers), null)
9519
+ value: null
9597
9520
  });
9598
9521
  Object.defineProperty(this, "slideApiHandlers", {
9599
9522
  enumerable: true,
@@ -9650,12 +9573,6 @@ let StoryViewModel = (() => {
9650
9573
  writable: true,
9651
9574
  value: void 0
9652
9575
  });
9653
- Object.defineProperty(this, "lifecycleManager", {
9654
- enumerable: true,
9655
- configurable: true,
9656
- writable: true,
9657
- value: void 0
9658
- });
9659
9576
  Object.defineProperty(this, "initOnce", {
9660
9577
  enumerable: true,
9661
9578
  configurable: true,
@@ -9702,7 +9619,6 @@ let StoryViewModel = (() => {
9702
9619
  this.goodsWidget = new StoryGoodsWidgetViewModel(this.storyManager, this, this.storyReaderStatisticV2Service);
9703
9620
  this.textInput = new TextInputViewModel(this, this.storyReaderStatisticV2Service);
9704
9621
  this.timeline = new StoryTimelineViewModel(this);
9705
- this.lifecycleManager = new StoryLifecycleManager(this, this.slideApiHandlers);
9706
9622
  this.sharePanel = new SharePanelViewModel(this, this.storyReader.touchController);
9707
9623
  this.actionPanel = new StoryActionPanelViewModel(this.storyManager, this, this.sharePanel, this.storyReaderStatisticV2Service);
9708
9624
  this.storySlidesReactionDisposer = this.observeStorySlides();
@@ -9753,17 +9669,19 @@ let StoryViewModel = (() => {
9753
9669
  return this._activeSlideIndex;
9754
9670
  }
9755
9671
  get activeSlide() {
9756
- var _b;
9757
- return (_b = this.slides[this._activeSlideIndex]) !== null && _b !== void 0 ? _b : new NullStorySlideViewModel();
9672
+ return this.getSlideByIndex(this._activeSlideIndex);
9673
+ }
9674
+ get activeSlideDuration() {
9675
+ return Date.now() - this._activeSlideStartTime;
9758
9676
  }
9759
9677
  get slidesCount() {
9760
9678
  return this.story.slidesCount;
9761
9679
  }
9762
9680
  get displayedSlideImage() {
9763
- return this.story.getImagesPerSlide(this._activeSlideIndex);
9681
+ return this.story.getImagesPerSlide(this.activeSlideIndex);
9764
9682
  }
9765
9683
  get reachEnd() {
9766
- return this.slides.length === 0 || this._activeSlideIndex === this.slides.length - 1;
9684
+ return this.slides.length === 0 || this.activeSlideIndex === this.slides.length - 1;
9767
9685
  }
9768
9686
  get reachStart() {
9769
9687
  return this.activeSlideIndex === 0;
@@ -9823,17 +9741,19 @@ let StoryViewModel = (() => {
9823
9741
  hideErrorScreen() {
9824
9742
  this._needShowErrorScreen = false;
9825
9743
  }
9826
- /* @noConcurrent */
9744
+ getSlideByIndex(index) {
9745
+ var _b;
9746
+ return (_b = this.slides[index]) !== null && _b !== void 0 ? _b : new NullStorySlideViewModel();
9747
+ }
9827
9748
  async showSlide(index) {
9828
9749
  var _b;
9829
9750
  if (this.activeSlideIndex === index)
9830
9751
  return;
9831
9752
  (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
9832
9753
  const prevActiveSlideIndex = this.activeSlideIndex;
9833
- this._activeSlideIndex = index;
9834
- await this.lifecycleManager.onSlideChange(this.activeSlide);
9754
+ await this.onSlideChange(index);
9835
9755
  this.emitSlideV1Stat(this.activeSlideIndex);
9836
- this.emitSlideV2Stat(prevActiveSlideIndex, this.lifecycleManager.activeSlideDuration);
9756
+ this.emitSlideV2Stat(prevActiveSlideIndex, this.activeSlideDuration);
9837
9757
  }
9838
9758
  markAsOpened() {
9839
9759
  this.storyManager.rootStore.storyStore.markIsOpenedById(this.story.id);
@@ -9859,7 +9779,9 @@ let StoryViewModel = (() => {
9859
9779
  }
9860
9780
  async prevSlideOrStory() {
9861
9781
  if (this.reachStart && this.storyReader.reachStart) {
9862
- await this.lifecycleManager.restart();
9782
+ if (!this.isActive)
9783
+ return;
9784
+ await this.activeSlide.restart();
9863
9785
  return;
9864
9786
  }
9865
9787
  if (this.reachStart)
@@ -9909,23 +9831,38 @@ let StoryViewModel = (() => {
9909
9831
  this._$root = null;
9910
9832
  }
9911
9833
  async init() {
9834
+ if (this.isInited)
9835
+ return;
9912
9836
  if (!this.initOnce && !this.story.canBeShown) {
9913
9837
  this.showLoaderScreen();
9914
9838
  this.initOnce = true;
9915
9839
  }
9916
- return this.lifecycleManager.init();
9840
+ await (0,external_mobx_namespaceObject.when)(() => this.canBeShown && Boolean(this._$root));
9841
+ await this.activeSlide.init();
9842
+ this.isInited = true;
9917
9843
  }
9918
9844
  async start() {
9845
+ if (!this.isInited)
9846
+ throw new Error("[IAS]: story was not initialized error. Please contact IAS support.");
9847
+ if (this.isActive)
9848
+ return;
9849
+ await this.activeSlide.start();
9919
9850
  document.addEventListener("visibilitychange", this.handleVisibilityChange);
9920
9851
  document.addEventListener("keydown", this.handleKeydown);
9921
- return this.lifecycleManager.start();
9852
+ this.isActive = true;
9853
+ this._activeSlideStartTime = Date.now();
9922
9854
  }
9923
9855
  async stop() {
9924
9856
  var _b;
9857
+ if (!this.isActive || !this.isInited)
9858
+ return;
9859
+ (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
9860
+ this.isActive = false;
9861
+ this.slideApiHandlers.clearNarrativeSessionDataCache();
9862
+ this.resumeAll();
9863
+ await this.activeSlide.stop({ prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */ });
9925
9864
  document.removeEventListener("visibilitychange", this.handleVisibilityChange);
9926
9865
  document.removeEventListener("keydown", this.handleKeydown);
9927
- (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
9928
- return this.lifecycleManager.stop();
9929
9866
  }
9930
9867
  canGoNext() {
9931
9868
  return this.activeSlide.canGoNext();
@@ -9949,9 +9886,15 @@ let StoryViewModel = (() => {
9949
9886
  this.textInput.close();
9950
9887
  this.timeline.destroy();
9951
9888
  this.goodsWidget.close();
9952
- await this.lifecycleManager.destroy();
9889
+ const activeSlide = this.getSlideByIndex(this._activeSlideIndex);
9890
+ this.slideApiHandlers.clearNarrativeSessionDataCache();
9891
+ if (this.isActive)
9892
+ await activeSlide.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ });
9893
+ await activeSlide.destroy();
9953
9894
  (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
9954
9895
  (_c = this.toast) === null || _c === void 0 ? void 0 : _c.destroy();
9896
+ this.isInited = false;
9897
+ this.isActive = false;
9955
9898
  }
9956
9899
  notifyPauseStateChange() {
9957
9900
  if (this.pauseManager.isUserPaused)
@@ -9991,7 +9934,7 @@ let StoryViewModel = (() => {
9991
9934
  });
9992
9935
  }
9993
9936
  createSlideApi(root) {
9994
- return new slide_api_namespaceObject.SlideApi(this.slideApiHandlers, {
9937
+ const slideApi = new slide_api_namespaceObject.SlideApi(this.slideApiHandlers, {
9995
9938
  root,
9996
9939
  slideRatio: SLIDE_RATIO,
9997
9940
  isFullscreen: false,
@@ -10001,10 +9944,13 @@ let StoryViewModel = (() => {
10001
9944
  VODPlayer: this.storyManager.globalProperties.$videoOnDemand,
10002
9945
  overlappingActionBarHeight: this.actionPanel.height
10003
9946
  });
9947
+ slideApi.setSdkClientVariables(this.storyManager.config.options);
9948
+ return slideApi;
10004
9949
  }
10005
9950
  async createSlidesViewModels(slides, slideApi) {
10006
9951
  this._slides = slides.map((slide, index) => new StorySlideViewModel(this, index, slideApi, slide));
10007
- await this.lifecycleManager.onSlideChange(this.activeSlide);
9952
+ // Reaction to `layout` (modern or classsic) change
9953
+ await this.onSlideChange(this.activeSlideIndex);
10008
9954
  }
10009
9955
  handleSpaceKeydown(e) {
10010
9956
  if (e.code !== "Space")
@@ -10022,6 +9968,19 @@ let StoryViewModel = (() => {
10022
9968
  else
10023
9969
  this.mute();
10024
9970
  }
9971
+ async onSlideChange(index) {
9972
+ const lastSlide = this.getSlideByIndex(this._activeSlideIndex);
9973
+ const activeSlide = this.getSlideByIndex(index);
9974
+ this._activeSlideIndex = index;
9975
+ if (this.isInited)
9976
+ await activeSlide.init();
9977
+ if (this.isActive) {
9978
+ this.resumeAll();
9979
+ await (lastSlide === null || lastSlide === void 0 ? void 0 : lastSlide.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ }));
9980
+ await activeSlide.start();
9981
+ this._activeSlideStartTime = Date.now();
9982
+ }
9983
+ }
10025
9984
  },
10026
9985
  _StoryViewModel__activeSlideIndex_accessor_storage = new WeakMap(),
10027
9986
  _StoryViewModel__slides_accessor_storage = new WeakMap(),
@@ -10421,11 +10380,13 @@ class StorySetLocalDataHandler {
10421
10380
  class GameCenterApi {
10422
10381
  async openGame({ gameInstanceId, gameOptions }) {
10423
10382
  const params = {
10383
+ expand: "config",
10424
10384
  fields: "splashScreen,splashLandscapeScreen,splashLottieScreen,screenOptions,config,resources,url,downloadUrl,instanceUserData,canTryReloadCount,loggerLevel,lottie"
10425
10385
  };
10386
+ const body = {};
10426
10387
  if (gameOptions && (0,isObject_js_namespaceObject["default"])(gameOptions) && gameOptions.demoMode != null)
10427
- params.demoMode = Boolean(gameOptions.demoMode);
10428
- const response = await api.post(`game/${gameInstanceId}/launch?expand=config`, params);
10388
+ body.demoMode = Boolean(gameOptions.demoMode);
10389
+ const response = await api.post(`game/${gameInstanceId}/launch`, body, params);
10429
10390
  return response.data;
10430
10391
  }
10431
10392
  }
@@ -10518,7 +10479,7 @@ class GameClientConfig {
10518
10479
  value: void 0
10519
10480
  });
10520
10481
  const storyManagerConfig = this.storyManager.config;
10521
- const sdkVersion = "1.7.5";
10482
+ const sdkVersion = "1.7.6";
10522
10483
  const placeholders = this.storyManager.rootStore.placeholderStore.placeholders;
10523
10484
  const session = this.storyManager.rootStore.sessionStore.session;
10524
10485
  this.sessionId = session.id;
@@ -10750,6 +10711,12 @@ class GameSplashScreen {
10750
10711
  class Game {
10751
10712
  constructor(storyManager, gameDto) {
10752
10713
  var _a, _b;
10714
+ Object.defineProperty(this, "storyManager", {
10715
+ enumerable: true,
10716
+ configurable: true,
10717
+ writable: true,
10718
+ value: storyManager
10719
+ });
10753
10720
  Object.defineProperty(this, "splashScreen", {
10754
10721
  enumerable: true,
10755
10722
  configurable: true,
@@ -10852,8 +10819,9 @@ class Game {
10852
10819
  }
10853
10820
  toInitDto(payload) {
10854
10821
  return (0,external_deepmerge_namespaceObject["default"])(this.config.toJSON(), {
10855
- clientConfig: Object.assign({ fullScreen: false, screenOrientation: this.screenOptions.orientation, safeAreaInsets: payload.safeAreaInsets, widescreen: payload.isWidescreen, dir: payload.dir, nonce: getNonce(), sdkFeatures: {
10856
- gameShouldForegroundCallback: true
10822
+ clientConfig: Object.assign({ fullScreen: false, screenOrientation: this.screenOptions.orientation, variables: this.storyManager.config.options, safeAreaInsets: payload.safeAreaInsets, widescreen: payload.isWidescreen, dir: payload.dir, nonce: getNonce(), sdkFeatures: {
10823
+ gameShouldForegroundCallback: true,
10824
+ writeToClipboard: true
10857
10825
  } }, this.clientConfig.toJSON())
10858
10826
  });
10859
10827
  }
@@ -10914,10 +10882,10 @@ class GameSession extends events.EventEmitter {
10914
10882
  messageListener(event) {
10915
10883
  if (event.origin !== this.origin)
10916
10884
  return;
10917
- const [gameEvent, ...restData] = event.data;
10918
10885
  try {
10919
10886
  if (!Array.isArray(event.data))
10920
10887
  throw new Error(`[IAS]: Invalid MessageEvent data format ${event.data}`);
10888
+ const [gameEvent, ...restData] = event.data;
10921
10889
  this.emit(gameEvent, ...restData);
10922
10890
  }
10923
10891
  catch (err) {
@@ -11162,6 +11130,11 @@ let GameReaderViewModel = (() => {
11162
11130
  return this.storyManager.config.dir;
11163
11131
  }
11164
11132
  async openGame(gameInstanceId, openGameOptions = {}) {
11133
+ const config = await this.storyManager.waitForConfig();
11134
+ if (config.anonymous) {
11135
+ console.warn("[IAS]: You can't open game in anonymous access mode");
11136
+ return;
11137
+ }
11165
11138
  gameInstanceId = gameInstanceId.toString();
11166
11139
  if (gameInstanceId === this._gameInstanceId) {
11167
11140
  console.warn(`[IAS]: Prevented reopening of game with ID ${gameInstanceId}`);
@@ -11262,7 +11235,8 @@ let GameReaderViewModel = (() => {
11262
11235
  .on("event" /* GameSessionEvent.Event */, this.handleGameEvent.bind(this))
11263
11236
  .on("reloadGameReader" /* GameSessionEvent.ReloadGameReader */, this.handleReloadGameReader.bind(this))
11264
11237
  .on("gameLoadFailed" /* GameSessionEvent.GameLoadFailed */, this.handleGameLoadFailed.bind(this))
11265
- .on("gameShouldForegroundCallback" /* GameSessionEvent.GameShouldForegroundCallback */, this.handleGameShouldBeShown.bind(this));
11238
+ .on("gameShouldForegroundCallback" /* GameSessionEvent.GameShouldForegroundCallback */, this.handleGameShouldBeShown.bind(this))
11239
+ .on("writeToClipboard" /* GameSessionEvent.WriteToClipboard */, this.handleWriteToClipboard.bind(this));
11266
11240
  const handlers = {
11267
11241
  ["share" /* GameSessionEvent.Share */]: new ShareActionHandler(gameSession, this, isDesktopMode_isDesktopMode),
11268
11242
  ["storySetLocalData" /* GameSessionEvent.StorySetLocalData */]: new StorySetLocalDataHandler(this.storyManager),
@@ -11375,6 +11349,15 @@ let GameReaderViewModel = (() => {
11375
11349
  }));
11376
11350
  }
11377
11351
  }
11352
+ handleWriteToClipboard(payload) {
11353
+ try {
11354
+ const { type, textValue } = JSON.parse(payload);
11355
+ new Clipboard().copy(textValue);
11356
+ }
11357
+ catch (error) {
11358
+ console.error(`[IAS]: `, error.message);
11359
+ }
11360
+ }
11378
11361
  sendGameCenterEventByApiRequest(eventName, payload) {
11379
11362
  var _b;
11380
11363
  (_b = this.gameSession) === null || _b === void 0 ? void 0 : _b.sendGameCenterEventByApiRequest(eventName, payload);
@@ -11681,6 +11664,8 @@ class OpenGameAction {
11681
11664
  const gameReader = this.storyManager.gameReader;
11682
11665
  const storyReader = this.storyManager.storyReader;
11683
11666
  await gameReader.openGame(payload.gameInstanceId);
11667
+ if (!gameReader.isOpened)
11668
+ return;
11684
11669
  storyReader.pauseUI();
11685
11670
  gameReader.once(GameReaderEvent.Close, () => {
11686
11671
  storyReader.resumeUI();
@@ -12122,13 +12107,14 @@ class StorySlideApiHandlers {
12122
12107
  this.showLayer(0);
12123
12108
  }
12124
12109
  getCardFonts() {
12110
+ var _a;
12125
12111
  const session = this.storyManager.rootStore.sessionStore.session;
12126
- return session.fontsResources;
12112
+ return (_a = session === null || session === void 0 ? void 0 : session.fontsResources) !== null && _a !== void 0 ? _a : [];
12127
12113
  }
12128
12114
  updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError) {
12129
12115
  if (this.story.activeSlideIndex !== slideIndex)
12130
12116
  return;
12131
- debug(`[SLIDE-API]: update timeline`, `<${[...arguments].join(", ")}>`);
12117
+ //debug(`[SLIDE-API]: update timeline`, `<${[...arguments].join(", ")}>`);
12132
12118
  const timelineController = new StoryTimelineController(this.story);
12133
12119
  if (action !== "before_start" /* TIMELINE_ACTION.BEFORE_START */) {
12134
12120
  timelineController.toggleLoaderScreen(showLoader);
@@ -13831,6 +13817,11 @@ let StoryReaderViewModel = (() => {
13831
13817
  });
13832
13818
  }
13833
13819
  async showOnboardingStories(options) {
13820
+ const config = await this.storyManager.waitForConfig();
13821
+ if (config.anonymous) {
13822
+ console.warn("[IAS]: You can't open onboarding in anonymous access mode");
13823
+ return { stories: [] };
13824
+ }
13834
13825
  const showOnboardingStoriesDisplayStrategy = this.storyDisplayStrategyFactory.createShowOnboardingStories();
13835
13826
  this._currentStoryDisplayStrategy = showOnboardingStoriesDisplayStrategy;
13836
13827
  return showOnboardingStoriesDisplayStrategy.show(options);
@@ -14944,7 +14935,7 @@ var StoryManagerConfigEvent;
14944
14935
  StoryManagerConfigEvent["RequestSDKReload"] = "requestSDKReload";
14945
14936
  })(StoryManagerConfigEvent || (StoryManagerConfigEvent = {}));
14946
14937
  let StoryManagerConfig = (() => {
14947
- var _a, _StoryManagerConfig__apiKey_accessor_storage, _StoryManagerConfig__tags_accessor_storage, _StoryManagerConfig__lang_accessor_storage, _StoryManagerConfig__dir_accessor_storage, _StoryManagerConfig__userId_accessor_storage;
14938
+ var _a, _StoryManagerConfig__apiKey_accessor_storage, _StoryManagerConfig__tags_accessor_storage, _StoryManagerConfig__lang_accessor_storage, _StoryManagerConfig__dir_accessor_storage, _StoryManagerConfig__userId_accessor_storage, _StoryManagerConfig__anonymous_accessor_storage, _StoryManagerConfig__options_accessor_storage;
14948
14939
  let _classSuper = events.EventEmitter;
14949
14940
  let _instanceExtraInitializers = [];
14950
14941
  let __apiKey_decorators;
@@ -14962,6 +14953,12 @@ let StoryManagerConfig = (() => {
14962
14953
  let __userId_decorators;
14963
14954
  let __userId_initializers = [];
14964
14955
  let __userId_extraInitializers = [];
14956
+ let __anonymous_decorators;
14957
+ let __anonymous_initializers = [];
14958
+ let __anonymous_extraInitializers = [];
14959
+ let __options_decorators;
14960
+ let __options_initializers = [];
14961
+ let __options_extraInitializers = [];
14965
14962
  let _reloadSdk_decorators;
14966
14963
  return _a = class StoryManagerConfig extends _classSuper {
14967
14964
  get _apiKey() { return storyManagerConfig_classPrivateFieldGet(this, _StoryManagerConfig__apiKey_accessor_storage, "f"); }
@@ -14974,6 +14971,10 @@ let StoryManagerConfig = (() => {
14974
14971
  set _dir(value) { storyManagerConfig_classPrivateFieldSet(this, _StoryManagerConfig__dir_accessor_storage, value, "f"); }
14975
14972
  get _userId() { return storyManagerConfig_classPrivateFieldGet(this, _StoryManagerConfig__userId_accessor_storage, "f"); }
14976
14973
  set _userId(value) { storyManagerConfig_classPrivateFieldSet(this, _StoryManagerConfig__userId_accessor_storage, value, "f"); }
14974
+ get _anonymous() { return storyManagerConfig_classPrivateFieldGet(this, _StoryManagerConfig__anonymous_accessor_storage, "f"); }
14975
+ set _anonymous(value) { storyManagerConfig_classPrivateFieldSet(this, _StoryManagerConfig__anonymous_accessor_storage, value, "f"); }
14976
+ get _options() { return storyManagerConfig_classPrivateFieldGet(this, _StoryManagerConfig__options_accessor_storage, "f"); }
14977
+ set _options(value) { storyManagerConfig_classPrivateFieldSet(this, _StoryManagerConfig__options_accessor_storage, value, "f"); }
14977
14978
  constructor(storyManager, configDto) {
14978
14979
  super();
14979
14980
  Object.defineProperty(this, "storyManager", {
@@ -15029,7 +15030,11 @@ let StoryManagerConfig = (() => {
15029
15030
  writable: true,
15030
15031
  value: false
15031
15032
  });
15032
- this.updateByDto(configDto);
15033
+ _StoryManagerConfig__anonymous_accessor_storage.set(this, storyManagerConfig_runInitializers(this, __anonymous_initializers, false));
15034
+ _StoryManagerConfig__options_accessor_storage.set(this, (storyManagerConfig_runInitializers(this, __anonymous_extraInitializers), storyManagerConfig_runInitializers(this, __options_initializers, {})));
15035
+ storyManagerConfig_runInitializers(this, __options_extraInitializers);
15036
+ this.storyManager = storyManager;
15037
+ this.update(configDto);
15033
15038
  this._isInited = true;
15034
15039
  }
15035
15040
  get userId() {
@@ -15039,7 +15044,7 @@ let StoryManagerConfig = (() => {
15039
15044
  return this._userIdSign;
15040
15045
  }
15041
15046
  get isStatisticsDisabled() {
15042
- return this._isStatisticsDisabled || this._appPackageId === "com.inappstory.webpreview";
15047
+ return this._isStatisticsDisabled || this._appPackageId === "com.inappstory.webpreview" || this._anonymous;
15043
15048
  }
15044
15049
  get appPackageId() {
15045
15050
  return this._appPackageId;
@@ -15068,6 +15073,12 @@ let StoryManagerConfig = (() => {
15068
15073
  get isLtr() {
15069
15074
  return this._dir === TextDir.LTR;
15070
15075
  }
15076
+ get anonymous() {
15077
+ return this._anonymous;
15078
+ }
15079
+ get options() {
15080
+ return this._options;
15081
+ }
15071
15082
  disableStatistic() {
15072
15083
  this._isStatisticsDisabled = true;
15073
15084
  }
@@ -15087,6 +15098,12 @@ let StoryManagerConfig = (() => {
15087
15098
  throw new IasEmptyUserIdError();
15088
15099
  if ((!(0,isString_js_namespaceObject["default"])(userId) && !(0,isNumber_js_namespaceObject["default"])(userId)) || this._userId === userId)
15089
15100
  return;
15101
+ if (this._anonymous) {
15102
+ this._userId = "";
15103
+ this._userIdSign = undefined;
15104
+ console.warn("[IAS]: user ID in anonymous access mode will be ignored");
15105
+ return;
15106
+ }
15090
15107
  new StoryManagerConfigValidator().checkUserIdLength(userId.toString()).validate();
15091
15108
  this._userId = userId;
15092
15109
  this._userIdSign = userIdSign;
@@ -15133,17 +15150,31 @@ let StoryManagerConfig = (() => {
15133
15150
  this._dir = (_b = getComputedStyle(document.documentElement).direction) !== null && _b !== void 0 ? _b : TextDir.LTR;
15134
15151
  }
15135
15152
  }
15136
- updateByDto(configDto) {
15153
+ async setAnonymous(anonymous) {
15154
+ if (this._anonymous === Boolean(anonymous))
15155
+ return;
15156
+ this._anonymous = Boolean(anonymous);
15157
+ if (this._isInited)
15158
+ await this.reloadSdk();
15159
+ }
15160
+ setOptions(options = {}) {
15161
+ if (JSON.stringify(options) === JSON.stringify(this._options))
15162
+ return;
15163
+ this._options = options;
15164
+ }
15165
+ update(configDto) {
15137
15166
  var _b, _c, _d, _e, _f;
15138
15167
  this._appPackageId = (_b = configDto.appPackageId) !== null && _b !== void 0 ? _b : "";
15139
15168
  this._disableDeviceId = Boolean(configDto.disableDeviceId);
15140
15169
  this.setApiKey(configDto.apiKey);
15170
+ this.setAnonymous(configDto.anonymous);
15141
15171
  this.setUserId((_c = configDto.userId) !== null && _c !== void 0 ? _c : "", configDto.userIdSign);
15142
15172
  this.setLang(configDto.lang);
15143
15173
  this.setTextPlaceholders((_d = configDto.placeholders) !== null && _d !== void 0 ? _d : {});
15144
15174
  this.setImagePlaceholders((_e = configDto.imagePlaceholders) !== null && _e !== void 0 ? _e : {});
15145
15175
  this.setTags((_f = configDto.tags) !== null && _f !== void 0 ? _f : []);
15146
15176
  this.setDir(configDto.dir);
15177
+ this.setOptions(configDto.options);
15147
15178
  }
15148
15179
  mapTextPlaceholders(textPlaceholderDtos) {
15149
15180
  const textPlaceholders = [];
@@ -15157,7 +15188,7 @@ let StoryManagerConfig = (() => {
15157
15188
  imagePlaceholders.push(new UserImagePlaceholder(key, value));
15158
15189
  return imagePlaceholders;
15159
15190
  }
15160
- /** Быстрая смена юзеров ломает загрузку ленты (может закрыть сессию, пока лента загружается). Добавил noConcurrent */
15191
+ /** Fast user switching breaks feed loading (may close session while feed is loading). Added noConcurrent */
15161
15192
  async reloadSdk() {
15162
15193
  try {
15163
15194
  this.emit(StoryManagerConfigEvent.RequestSDKReload);
@@ -15176,6 +15207,8 @@ let StoryManagerConfig = (() => {
15176
15207
  _StoryManagerConfig__lang_accessor_storage = new WeakMap(),
15177
15208
  _StoryManagerConfig__dir_accessor_storage = new WeakMap(),
15178
15209
  _StoryManagerConfig__userId_accessor_storage = new WeakMap(),
15210
+ _StoryManagerConfig__anonymous_accessor_storage = new WeakMap(),
15211
+ _StoryManagerConfig__options_accessor_storage = new WeakMap(),
15179
15212
  (() => {
15180
15213
  var _b;
15181
15214
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
@@ -15184,12 +15217,16 @@ let StoryManagerConfig = (() => {
15184
15217
  __lang_decorators = [external_mobx_namespaceObject.observable];
15185
15218
  __dir_decorators = [external_mobx_namespaceObject.observable];
15186
15219
  __userId_decorators = [external_mobx_namespaceObject.observable];
15220
+ __anonymous_decorators = [external_mobx_namespaceObject.observable];
15221
+ __options_decorators = [external_mobx_namespaceObject.observable];
15187
15222
  _reloadSdk_decorators = [noConcurrent];
15188
15223
  storyManagerConfig_esDecorate(_a, null, __apiKey_decorators, { kind: "accessor", name: "_apiKey", static: false, private: false, access: { has: obj => "_apiKey" in obj, get: obj => obj._apiKey, set: (obj, value) => { obj._apiKey = value; } }, metadata: _metadata }, __apiKey_initializers, __apiKey_extraInitializers);
15189
15224
  storyManagerConfig_esDecorate(_a, null, __tags_decorators, { kind: "accessor", name: "_tags", static: false, private: false, access: { has: obj => "_tags" in obj, get: obj => obj._tags, set: (obj, value) => { obj._tags = value; } }, metadata: _metadata }, __tags_initializers, __tags_extraInitializers);
15190
15225
  storyManagerConfig_esDecorate(_a, null, __lang_decorators, { kind: "accessor", name: "_lang", static: false, private: false, access: { has: obj => "_lang" in obj, get: obj => obj._lang, set: (obj, value) => { obj._lang = value; } }, metadata: _metadata }, __lang_initializers, __lang_extraInitializers);
15191
15226
  storyManagerConfig_esDecorate(_a, null, __dir_decorators, { kind: "accessor", name: "_dir", static: false, private: false, access: { has: obj => "_dir" in obj, get: obj => obj._dir, set: (obj, value) => { obj._dir = value; } }, metadata: _metadata }, __dir_initializers, __dir_extraInitializers);
15192
15227
  storyManagerConfig_esDecorate(_a, null, __userId_decorators, { kind: "accessor", name: "_userId", static: false, private: false, access: { has: obj => "_userId" in obj, get: obj => obj._userId, set: (obj, value) => { obj._userId = value; } }, metadata: _metadata }, __userId_initializers, __userId_extraInitializers);
15228
+ storyManagerConfig_esDecorate(_a, null, __anonymous_decorators, { kind: "accessor", name: "_anonymous", static: false, private: false, access: { has: obj => "_anonymous" in obj, get: obj => obj._anonymous, set: (obj, value) => { obj._anonymous = value; } }, metadata: _metadata }, __anonymous_initializers, __anonymous_extraInitializers);
15229
+ storyManagerConfig_esDecorate(_a, null, __options_decorators, { kind: "accessor", name: "_options", static: false, private: false, access: { has: obj => "_options" in obj, get: obj => obj._options, set: (obj, value) => { obj._options = value; } }, metadata: _metadata }, __options_initializers, __options_extraInitializers);
15193
15230
  storyManagerConfig_esDecorate(_a, null, _reloadSdk_decorators, { kind: "method", name: "reloadSdk", static: false, private: false, access: { has: obj => "reloadSdk" in obj, get: obj => obj.reloadSdk }, metadata: _metadata }, null, _instanceExtraInitializers);
15194
15231
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
15195
15232
  })(),
@@ -15237,6 +15274,12 @@ class NullStoryManagerConfig {
15237
15274
  get isLtr() {
15238
15275
  return true;
15239
15276
  }
15277
+ get anonymous() {
15278
+ return false;
15279
+ }
15280
+ get options() {
15281
+ return {};
15282
+ }
15240
15283
  disableStatistic() { }
15241
15284
  enableStatistic() { }
15242
15285
  async setApiKey(apiKey) { }
@@ -15246,7 +15289,7 @@ class NullStoryManagerConfig {
15246
15289
  setImagePlaceholders(imagePlaceholderDtos) { }
15247
15290
  setTags(tags) { }
15248
15291
  setDir(dir) { }
15249
- updateByDto(configDto) { }
15292
+ update(configDto) { }
15250
15293
  on(eventName, listener) {
15251
15294
  return this;
15252
15295
  }
@@ -16795,10 +16838,16 @@ class IamReaderVisibilityObserver {
16795
16838
  ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/exceptions/exceptions.ts
16796
16839
  class IamMessageOpenError extends Error {
16797
16840
  constructor(messageId) {
16798
- super(`[IAM]: you must close IAM with ID ${messageId}`);
16841
+ super(`[IAS]: you must close IAM with ID ${messageId}`);
16799
16842
  this.name = "IamMessageOpenError";
16800
16843
  }
16801
16844
  }
16845
+ class IamMessageAnonymousOpen extends Error {
16846
+ constructor(messageId) {
16847
+ super(`[IAS]: You can't open IAM ${messageId} in anonymous access mode `);
16848
+ this.name = "IamMessageAnonymousOpen";
16849
+ }
16850
+ }
16802
16851
 
16803
16852
  ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/exceptions/index.ts
16804
16853
 
@@ -16922,12 +16971,6 @@ let IamReaderViewModel = (() => {
16922
16971
  writable: true,
16923
16972
  value: new ScrollbarHelper(window)
16924
16973
  });
16925
- Object.defineProperty(this, "eventPublisher", {
16926
- enumerable: true,
16927
- configurable: true,
16928
- writable: true,
16929
- value: void 0
16930
- });
16931
16974
  this.visibilityObserver = new IamReaderVisibilityObserver(this, this.iamStatisticsService);
16932
16975
  }
16933
16976
  get touchController() {
@@ -16946,19 +16989,30 @@ let IamReaderViewModel = (() => {
16946
16989
  return Boolean(this._activeMessage);
16947
16990
  }
16948
16991
  async preload(payload) {
16949
- await this.storyManager.waitStoryManagerConfig();
16992
+ const config = await this.storyManager.waitForConfig();
16993
+ if (config.anonymous) {
16994
+ console.warn("[IAS]: You can't preload IAM in anonymous access mode");
16995
+ return [];
16996
+ }
16950
16997
  const messages = await this.iamStore.preload(payload);
16998
+ this.emit(IamReaderEvent.Loaded, {
16999
+ messages
17000
+ });
16951
17001
  return messages;
16952
17002
  }
16953
17003
  async showMessageById(messageId, options) {
16954
- await this.storyManager.waitStoryManagerConfig();
17004
+ const config = await this.storyManager.waitForConfig();
17005
+ if (config.anonymous)
17006
+ throw new IamMessageAnonymousOpen(messageId);
16955
17007
  this.checkMessageNotOpened();
16956
17008
  const message = await this.iamDisplayService.getMessageById(messageId, options);
16957
17009
  await this.open(message);
16958
17010
  return message;
16959
17011
  }
16960
17012
  async showMessageByEvent(eventName, options) {
16961
- await this.storyManager.waitStoryManagerConfig();
17013
+ const config = await this.storyManager.waitForConfig();
17014
+ if (config.anonymous)
17015
+ throw new IamMessageAnonymousOpen(eventName);
16962
17016
  this.checkMessageNotOpened();
16963
17017
  const message = await this.iamDisplayService.getMessageByEvent(eventName, options);
16964
17018
  await this.open(message);
@@ -16994,13 +17048,6 @@ let IamReaderViewModel = (() => {
16994
17048
  data: widgetEvent.widgetPayload
16995
17049
  });
16996
17050
  }
16997
- setEventPublisher(eventPublisher) {
16998
- this.eventPublisher = eventPublisher;
16999
- }
17000
- emit(eventName, ...args) {
17001
- super.emit(eventName, ...args);
17002
- return this.eventPublisher.emit(eventName, ...args);
17003
- }
17004
17051
  emitCloseEvent(message) {
17005
17052
  this.emit(IamReaderEvent.Close, {
17006
17053
  message: message.toPublicDto()
@@ -17062,81 +17109,10 @@ let IamReaderViewModel = (() => {
17062
17109
  })();
17063
17110
 
17064
17111
 
17065
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/iamReaderViewModelAdapter.ts
17066
-
17067
-
17068
- class IamReaderViewModelAdapter {
17069
- constructor(iamReader) {
17070
- Object.defineProperty(this, "iamReader", {
17071
- enumerable: true,
17072
- configurable: true,
17073
- writable: true,
17074
- value: iamReader
17075
- });
17076
- Object.defineProperty(this, "eventEmitter", {
17077
- enumerable: true,
17078
- configurable: true,
17079
- writable: true,
17080
- value: new (events_default())()
17081
- });
17082
- this.iamReader.setEventPublisher(this.eventEmitter);
17083
- }
17084
- get activeMessage() {
17085
- var _a;
17086
- return (_a = this.iamReader.activeMessage) === null || _a === void 0 ? void 0 : _a.toPublicDto();
17087
- }
17088
- get isLoaded() {
17089
- return this.iamReader.isLoaded;
17090
- }
17091
- get isLoading() {
17092
- return this.iamReader.isLoading;
17093
- }
17094
- get isOpened() {
17095
- return this.iamReader.isOpened;
17096
- }
17097
- async preload(options) {
17098
- const messages = await this.iamReader.preload({ tags: options === null || options === void 0 ? void 0 : options.tags });
17099
- const messageDtos = messages.map(message => message.toPublicDto());
17100
- this.eventEmitter.emit(IamReaderEvent.Loaded, {
17101
- messages: messageDtos
17102
- });
17103
- return messageDtos;
17104
- }
17105
- async showMessageById(messageId, options) {
17106
- const message = await this.iamReader.showMessageById(messageId, {
17107
- showOnlyIfLoaded: options === null || options === void 0 ? void 0 : options.showOnlyIfLoaded
17108
- });
17109
- return message.toPublicDto();
17110
- }
17111
- async showMessageByEvent(eventName, options) {
17112
- const message = await this.iamReader.showMessageByEvent(eventName, {
17113
- showOnlyIfLoaded: options === null || options === void 0 ? void 0 : options.showOnlyIfLoaded,
17114
- tags: options === null || options === void 0 ? void 0 : options.tags
17115
- });
17116
- return message.toPublicDto();
17117
- }
17118
- async close() {
17119
- return this.iamReader.close();
17120
- }
17121
- on(eventName, listener) {
17122
- this.eventEmitter.on(eventName, listener);
17123
- return this;
17124
- }
17125
- once(eventName, listener) {
17126
- this.eventEmitter.once(eventName, listener);
17127
- return this;
17128
- }
17129
- off(eventName, listener) {
17130
- this.eventEmitter.off(eventName, listener);
17131
- return this;
17132
- }
17133
- }
17134
-
17135
17112
  ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/index.ts
17136
17113
 
17137
17114
 
17138
17115
 
17139
-
17140
17116
  ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/actions/openUrlAction.ts
17141
17117
 
17142
17118
 
@@ -19263,12 +19239,13 @@ class StoryFeedService {
19263
19239
  });
19264
19240
  }
19265
19241
  async loadStories({ feedSlug, filter = {}, listType, testKey, needFavorite = true }) {
19242
+ const config = await this.storyManager.waitForConfig();
19266
19243
  const isFavoriteFeed = listType === StoryFeedType.DEFAULT ? needFavorite : false;
19267
19244
  const storyFeedStore = this.storyManager.rootStore.storyFeedStore;
19268
19245
  const storyFeed = await this.fetchStoryFeed(storyFeedStore, feedSlug, filter, testKey);
19269
19246
  let favoriteFeed = null;
19270
19247
  if (isFavoriteFeed)
19271
- favoriteFeed = await storyFeedStore.fetchFavoriteFeed();
19248
+ favoriteFeed = await this.fetchFavoriteFeed({ storyFeedStore, anonymous: config.anonymous });
19272
19249
  const stories = this.getFeedLoadEventStoryDtos(storyFeed);
19273
19250
  this.emitFeedLoadEvent(storyFeed, stories, feedSlug, filter);
19274
19251
  return {
@@ -19297,6 +19274,13 @@ class StoryFeedService {
19297
19274
  return Object.assign({ id: story.id }, additionalPayload);
19298
19275
  });
19299
19276
  }
19277
+ async fetchFavoriteFeed({ storyFeedStore, anonymous }) {
19278
+ if (anonymous) {
19279
+ console.warn("[IAS]: The favorites feed is not available in anonymous access mode");
19280
+ return null;
19281
+ }
19282
+ return await storyFeedStore.fetchFavoriteFeed();
19283
+ }
19300
19284
  emitFeedLoadEvent(storyFeed, storyDtos, feedSlug, filter) {
19301
19285
  const eventData = {
19302
19286
  stories: storyDtos,
@@ -19376,103 +19360,6 @@ class StoryFeedStatisticV2Service {
19376
19360
 
19377
19361
 
19378
19362
 
19379
- ;// CONCATENATED MODULE: ../core/src/storyManager/storyManagerProxy.ts
19380
-
19381
-
19382
-
19383
- class StoryManagerProxy {
19384
- constructor(storyManager) {
19385
- Object.defineProperty(this, "storyManager", {
19386
- enumerable: true,
19387
- configurable: true,
19388
- writable: true,
19389
- value: storyManager
19390
- });
19391
- Object.defineProperty(this, "inAppMessaging", {
19392
- enumerable: true,
19393
- configurable: true,
19394
- writable: true,
19395
- value: void 0
19396
- });
19397
- Object.defineProperty(this, "__IAS_INTERNAL_API__", {
19398
- enumerable: true,
19399
- configurable: true,
19400
- writable: true,
19401
- value: __IAS_INTERNAL_API__
19402
- });
19403
- this.inAppMessaging = new IamReaderViewModelAdapter(storyManager.inAppMessaging);
19404
- }
19405
- get sdkVersionName() {
19406
- return this.storyManager.sdkVersionName;
19407
- }
19408
- get sdkVersionCode() {
19409
- return this.storyManager.sdkVersionCode;
19410
- }
19411
- set storyLinkClickHandler(callback) {
19412
- this.storyManager.storyLinkClickHandler = callback;
19413
- }
19414
- setUserAgent(userAgent) {
19415
- storyManager.setUserAgent(userAgent);
19416
- }
19417
- getConfig() {
19418
- return this.storyManager.config;
19419
- }
19420
- getNonce() {
19421
- return getNonce();
19422
- }
19423
- async showOnboardingStories(options) {
19424
- return this.storyManager.showOnboardingStories(options);
19425
- }
19426
- async showStory(storyId) {
19427
- return this.storyManager.showStory(storyId);
19428
- }
19429
- async showStoryOnce(storyId) {
19430
- return this.storyManager.showStoryOnce(storyId);
19431
- }
19432
- closeAllReaders() {
19433
- this.storyManager.closeAllReaders();
19434
- }
19435
- async openGame(gameInstanceId, gameOptions = {}) {
19436
- return this.storyManager.openGame(gameInstanceId, gameOptions);
19437
- }
19438
- async closeGame() {
19439
- return this.storyManager.closeGame();
19440
- }
19441
- async waitStoryManagerConfig() {
19442
- return this.storyManager.waitStoryManagerConfig();
19443
- }
19444
- async closeStoryReader() {
19445
- return this.storyManager.closeStoryReader();
19446
- }
19447
- getUgcEditorConfig() {
19448
- return this.storyManager.getUgcEditorConfig();
19449
- }
19450
- showSharePage(storyId) {
19451
- return this.storyManager.showSharePage(storyId);
19452
- }
19453
- closeGoodsWidget() {
19454
- this.storyManager.closeGoodsWidget();
19455
- }
19456
- on(eventName, listener) {
19457
- this.storyManager.on(eventName, listener);
19458
- return this;
19459
- }
19460
- once(eventName, listener) {
19461
- this.storyManager.once(eventName, listener);
19462
- return this;
19463
- }
19464
- off(eventName, listener) {
19465
- this.storyManager.off(eventName, listener);
19466
- return this;
19467
- }
19468
- static use(plugin, options) {
19469
- plugin.install({
19470
- INTERNAL_API: __IAS_INTERNAL_API__,
19471
- HOST: StoryManagerProxy
19472
- }, options);
19473
- }
19474
- }
19475
-
19476
19363
  ;// CONCATENATED MODULE: ../core/src/store/inAppMessaging/exceptions/exceptions.ts
19477
19364
  class IamNotFoundByEventError extends Error {
19478
19365
  constructor(eventName) {
@@ -19781,10 +19668,11 @@ let SessionStore = (() => {
19781
19668
  if (this._session)
19782
19669
  return this._session;
19783
19670
  // Since initialization via IASContainer with delay
19784
- const config = await this.storyManager.waitStoryManagerConfig();
19671
+ const config = await this.storyManager.waitForConfig();
19785
19672
  const sessionDto = await this.sessionApi.open({
19786
19673
  userId: config.userId,
19787
- userIdSign: config.userIdSign
19674
+ userIdSign: config.userIdSign,
19675
+ anonymous: config.anonymous
19788
19676
  });
19789
19677
  const session = new Session(this, sessionDto);
19790
19678
  session.loadResources();
@@ -20396,7 +20284,7 @@ class UgcEditorStore {
20396
20284
  const session = await this.storyManager.rootStore.sessionStore.open();
20397
20285
  const ugcEditorConfigDto = await this.ugcEditorApi.fetchUgcEditorConfig();
20398
20286
  const storyManagerConfig = this.storyManager.config;
20399
- const sdkVersion = "1.7.5";
20287
+ const sdkVersion = "1.7.6";
20400
20288
  this._config = {
20401
20289
  sessionId: session.id,
20402
20290
  apiKey: storyManagerConfig.apiKey,
@@ -20617,7 +20505,7 @@ let StoryManagerConfigStore = (() => {
20617
20505
  this._config = new NullStoryManagerConfig();
20618
20506
  this.storyManager.rootStore.sessionStore.close();
20619
20507
  }
20620
- async waitStoryManagerConfig(timeoutMs = 5000) {
20508
+ async waitForConfig(timeoutMs = 5000) {
20621
20509
  if (this._config instanceof StoryManagerConfig)
20622
20510
  return this._config;
20623
20511
  try {
@@ -20632,7 +20520,7 @@ let StoryManagerConfigStore = (() => {
20632
20520
  this._config = new StoryManagerConfig(this.storyManager, configDto);
20633
20521
  }
20634
20522
  updateConfig(configDto) {
20635
- this._config.updateByDto(configDto);
20523
+ this._config.update(configDto);
20636
20524
  }
20637
20525
  },
20638
20526
  _StoryManagerConfigStore__config_accessor_storage = new WeakMap(),
@@ -20828,11 +20716,11 @@ class StoryManager extends TypedEventEmitter {
20828
20716
  return this._userAgent;
20829
20717
  }
20830
20718
  get sdkVersionName() {
20831
- const sdkVersionName = "1.7.5";
20719
+ const sdkVersionName = "1.7.6";
20832
20720
  return sdkVersionName || "0.0.0";
20833
20721
  }
20834
20722
  get sdkVersionCode() {
20835
- const sdkVersionCode = 10705;
20723
+ const sdkVersionCode = 10706;
20836
20724
  return sdkVersionCode ? parseInt(sdkVersionCode) : 0;
20837
20725
  }
20838
20726
  get lang() {
@@ -20859,6 +20747,14 @@ class StoryManager extends TypedEventEmitter {
20859
20747
  get config() {
20860
20748
  return this.rootStore.storyManagerConfigStore.config;
20861
20749
  }
20750
+ /** For UGC editor */
20751
+ getNonce() {
20752
+ return getNonce();
20753
+ }
20754
+ /** For UGC editor */
20755
+ getConfig() {
20756
+ return this.config;
20757
+ }
20862
20758
  static getInstance() {
20863
20759
  if (!StoryManager.instance) {
20864
20760
  return null;
@@ -20881,13 +20777,13 @@ class StoryManager extends TypedEventEmitter {
20881
20777
  this.rootStore.storyManagerConfigStore.setConfig(configDto);
20882
20778
  }
20883
20779
  setUserAgent(userAgent) {
20884
- const sdkVersionCode = 10705;
20780
+ const sdkVersionCode = 10706;
20885
20781
  const buildVersion = sdkVersionCode ? parseInt(sdkVersionCode) : 0;
20886
20782
  // According to RFC5987, HTTP header values can legitimately be supplied using the ISO-8859-1 encoding.
20887
20783
  this._userAgent = `${userAgent} ${convertStrToLatin1(navigator.userAgent)}`;
20888
20784
  }
20889
- async waitStoryManagerConfig() {
20890
- return this.rootStore.storyManagerConfigStore.waitStoryManagerConfig();
20785
+ async waitForConfig() {
20786
+ return this.rootStore.storyManagerConfigStore.waitForConfig();
20891
20787
  }
20892
20788
  async showOnboardingStories(options) {
20893
20789
  var _a, _b;
@@ -20949,20 +20845,24 @@ class StoryManager extends TypedEventEmitter {
20949
20845
  }
20950
20846
  static isSingletonInstanceExists() {
20951
20847
  if (StoryManager.instance) {
20952
- console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead");
20848
+ console.warn("[IAS]: StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead");
20953
20849
  return true;
20954
20850
  }
20955
20851
  return false;
20956
20852
  }
20853
+ static use(plugin, options) {
20854
+ plugin.install({
20855
+ INTERNAL_API: __IAS_INTERNAL_API__,
20856
+ HOST: StoryManager
20857
+ }, options);
20858
+ }
20957
20859
  }
20958
20860
  const storyManager = new StoryManager();
20959
20861
  const __IAS_INTERNAL_API__ = storyManager;
20960
- const storyManagerProxy = new StoryManagerProxy(storyManager);
20961
20862
 
20962
20863
  ;// CONCATENATED MODULE: ../core/src/storyManager/index.ts
20963
20864
 
20964
20865
 
20965
-
20966
20866
  ;// CONCATENATED MODULE: ../js-sdk/src/appRuntime/FavoriteStoryListModal/storyFavoriteReader.ts
20967
20867
  var storyFavoriteReader_CloseButtonPosition;
20968
20868
  (function (CloseButtonPosition) {
@@ -27494,12 +27394,109 @@ let MessageSlide = (() => {
27494
27394
  ;// CONCATENATED MODULE: ./src/InAppMessaging/components/MessageSlide/index.ts
27495
27395
 
27496
27396
 
27497
- ;// CONCATENATED MODULE: ./src/InAppMessaging/components/Spinner/Spinner.styles.ts
27397
+ ;// CONCATENATED MODULE: ./src/InAppMessaging/components/Loader/RefreshIcon.ts
27398
+ var RefreshIcon_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
27399
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
27400
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
27401
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
27402
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
27403
+ var _, done = false;
27404
+ for (var i = decorators.length - 1; i >= 0; i--) {
27405
+ var context = {};
27406
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
27407
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
27408
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
27409
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
27410
+ if (kind === "accessor") {
27411
+ if (result === void 0) continue;
27412
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
27413
+ if (_ = accept(result.get)) descriptor.get = _;
27414
+ if (_ = accept(result.set)) descriptor.set = _;
27415
+ if (_ = accept(result.init)) initializers.unshift(_);
27416
+ }
27417
+ else if (_ = accept(result)) {
27418
+ if (kind === "field") initializers.unshift(_);
27419
+ else descriptor[key] = _;
27420
+ }
27421
+ }
27422
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27423
+ done = true;
27424
+ };
27425
+ var RefreshIcon_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
27426
+ var useValue = arguments.length > 2;
27427
+ for (var i = 0; i < initializers.length; i++) {
27428
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
27429
+ }
27430
+ return useValue ? value : void 0;
27431
+ };
27432
+ var RefreshIcon_setFunctionName = (undefined && undefined.__setFunctionName) || function (f, name, prefix) {
27433
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
27434
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
27435
+ };
27436
+ var RefreshIcon_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
27437
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
27438
+ 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");
27439
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
27440
+ };
27441
+ var RefreshIcon_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
27442
+ if (kind === "m") throw new TypeError("Private method is not writable");
27443
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
27444
+ 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");
27445
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
27446
+ };
27447
+
27448
+
27449
+ let RefreshIcon_RefreshIcon = (() => {
27450
+ var _RefreshIcon_className_accessor_storage;
27451
+ let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-refresh-icon")];
27452
+ let _classDescriptor;
27453
+ let _classExtraInitializers = [];
27454
+ let _classThis;
27455
+ let _classSuper = external_lit_namespaceObject.LitElement;
27456
+ let _className_decorators;
27457
+ let _className_initializers = [];
27458
+ let _className_extraInitializers = [];
27459
+ var RefreshIcon = _classThis = class extends _classSuper {
27460
+ get className() { return RefreshIcon_classPrivateFieldGet(this, _RefreshIcon_className_accessor_storage, "f"); }
27461
+ set className(value) { RefreshIcon_classPrivateFieldSet(this, _RefreshIcon_className_accessor_storage, value, "f"); }
27462
+ _onClick(e) {
27463
+ this.dispatchEvent(new CustomEvent("refresh", { detail: e, bubbles: true, composed: true }));
27464
+ }
27465
+ render() {
27466
+ return (0,external_lit_namespaceObject.html) `<div class="icon ${this.className}" @click="${this._onClick}"><svg viewBox="0 0 24 24"><path fill="currentColor" d="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z"></path></svg></div>`;
27467
+ }
27468
+ constructor() {
27469
+ super(...arguments);
27470
+ _RefreshIcon_className_accessor_storage.set(this, RefreshIcon_runInitializers(this, _className_initializers, ""));
27471
+ RefreshIcon_runInitializers(this, _className_extraInitializers);
27472
+ }
27473
+ };
27474
+ _RefreshIcon_className_accessor_storage = new WeakMap();
27475
+ RefreshIcon_setFunctionName(_classThis, "RefreshIcon");
27476
+ (() => {
27477
+ var _a;
27478
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_a = _classSuper[Symbol.metadata]) !== null && _a !== void 0 ? _a : null) : void 0;
27479
+ _className_decorators = [(0,decorators_js_namespaceObject.property)({ type: String })];
27480
+ RefreshIcon_esDecorate(_classThis, null, _className_decorators, { kind: "accessor", name: "className", static: false, private: false, access: { has: obj => "className" in obj, get: obj => obj.className, set: (obj, value) => { obj.className = value; } }, metadata: _metadata }, _className_initializers, _className_extraInitializers);
27481
+ RefreshIcon_esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
27482
+ RefreshIcon = _classThis = _classDescriptor.value;
27483
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
27484
+ })();
27485
+ Object.defineProperty(_classThis, "styles", {
27486
+ enumerable: true,
27487
+ configurable: true,
27488
+ writable: true,
27489
+ value: (0,external_lit_namespaceObject.css) `:host{display:inline-block;cursor:pointer}.icon{width:24px;height:24px;color:inherit}svg{width:100%;height:100%}`
27490
+ });
27491
+ (() => {
27492
+ RefreshIcon_runInitializers(_classThis, _classExtraInitializers);
27493
+ })();
27494
+ return RefreshIcon = _classThis;
27495
+ })();
27498
27496
 
27499
- const spinnerStyles = (0,external_lit_namespaceObject.css) `@keyframes spin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.spinner{position:absolute;top:calc(50% - 2rem / 2);left:calc(50% - 2rem / 2);width:2rem;height:2rem;border-radius:50%;animation:spin .6s infinite linear}`;
27500
27497
 
27501
- ;// CONCATENATED MODULE: ./src/InAppMessaging/components/Spinner/Spinner.ts
27502
- var Spinner_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
27498
+ ;// CONCATENATED MODULE: ./src/InAppMessaging/components/Loader/Loader.ts
27499
+ var Loader_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
27503
27500
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
27504
27501
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
27505
27502
  var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
@@ -27526,61 +27523,120 @@ var Spinner_esDecorate = (undefined && undefined.__esDecorate) || function (ctor
27526
27523
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
27527
27524
  done = true;
27528
27525
  };
27529
- var Spinner_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
27526
+ var Loader_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
27530
27527
  var useValue = arguments.length > 2;
27531
27528
  for (var i = 0; i < initializers.length; i++) {
27532
27529
  value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
27533
27530
  }
27534
27531
  return useValue ? value : void 0;
27535
27532
  };
27536
- var Spinner_setFunctionName = (undefined && undefined.__setFunctionName) || function (f, name, prefix) {
27533
+ var Loader_setFunctionName = (undefined && undefined.__setFunctionName) || function (f, name, prefix) {
27537
27534
  if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
27538
27535
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
27539
27536
  };
27537
+ var Loader_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
27538
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
27539
+ 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");
27540
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
27541
+ };
27542
+ var Loader_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
27543
+ if (kind === "m") throw new TypeError("Private method is not writable");
27544
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
27545
+ 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");
27546
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
27547
+ };
27540
27548
 
27541
27549
 
27542
27550
 
27543
-
27544
- let Spinner_Spinner = (() => {
27545
- let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-spinner")];
27551
+ let Loader_Loader = (() => {
27552
+ var _Loader_background_accessor_storage, _Loader_color_accessor_storage, _Loader_needShowErrorScreen_accessor_storage, _Loader_needShowLoaderScreen_accessor_storage;
27553
+ let _classDecorators = [(0,decorators_js_namespaceObject.customElement)("iam-loader")];
27546
27554
  let _classDescriptor;
27547
27555
  let _classExtraInitializers = [];
27548
27556
  let _classThis;
27549
27557
  let _classSuper = external_lit_namespaceObject.LitElement;
27550
- var Spinner = _classThis = class extends _classSuper {
27558
+ let _background_decorators;
27559
+ let _background_initializers = [];
27560
+ let _background_extraInitializers = [];
27561
+ let _color_decorators;
27562
+ let _color_initializers = [];
27563
+ let _color_extraInitializers = [];
27564
+ let _needShowErrorScreen_decorators;
27565
+ let _needShowErrorScreen_initializers = [];
27566
+ let _needShowErrorScreen_extraInitializers = [];
27567
+ let _needShowLoaderScreen_decorators;
27568
+ let _needShowLoaderScreen_initializers = [];
27569
+ let _needShowLoaderScreen_extraInitializers = [];
27570
+ var Loader = _classThis = class extends _classSuper {
27571
+ get background() { return Loader_classPrivateFieldGet(this, _Loader_background_accessor_storage, "f"); }
27572
+ set background(value) { Loader_classPrivateFieldSet(this, _Loader_background_accessor_storage, value, "f"); }
27573
+ get color() { return Loader_classPrivateFieldGet(this, _Loader_color_accessor_storage, "f"); }
27574
+ set color(value) { Loader_classPrivateFieldSet(this, _Loader_color_accessor_storage, value, "f"); }
27575
+ get needShowErrorScreen() { return Loader_classPrivateFieldGet(this, _Loader_needShowErrorScreen_accessor_storage, "f"); }
27576
+ set needShowErrorScreen(value) { Loader_classPrivateFieldSet(this, _Loader_needShowErrorScreen_accessor_storage, value, "f"); }
27577
+ get needShowLoaderScreen() { return Loader_classPrivateFieldGet(this, _Loader_needShowLoaderScreen_accessor_storage, "f"); }
27578
+ set needShowLoaderScreen(value) { Loader_classPrivateFieldSet(this, _Loader_needShowLoaderScreen_accessor_storage, value, "f"); }
27579
+ _onReload(e) {
27580
+ e.stopPropagation();
27581
+ this.dispatchEvent(new CustomEvent("reload", { bubbles: true, composed: true }));
27582
+ }
27551
27583
  render() {
27552
- const backgroundColor = "white";
27553
- const accentBackgroundColor = "transparent";
27554
- return (0,external_lit_namespaceObject.html) `<div class="spinner" style="${(0,style_map_js_namespaceObject.styleMap)({
27555
- border: `solid 2px ${backgroundColor}`,
27556
- borderColor: `${accentBackgroundColor} ${backgroundColor} ${backgroundColor} ${backgroundColor}`
27557
- })}"></div>`;
27584
+ const needShowReloadBtn = this.needShowErrorScreen;
27585
+ const isLoading = this.needShowLoaderScreen;
27586
+ if (!isLoading && !needShowReloadBtn) {
27587
+ return null;
27588
+ }
27589
+ return (0,external_lit_namespaceObject.html) `<div class="loader" style="--loader-background:${this.background || "black"}--loaderBackgroundColor:${this.color || "white"}" @click="${(e) => {
27590
+ e.preventDefault();
27591
+ e.stopPropagation();
27592
+ }}">${needShowReloadBtn
27593
+ ? (0,external_lit_namespaceObject.html) `<iam-refresh-icon class="loader__refresh-btn" @refresh="${this._onReload}"></iam-refresh-icon>`
27594
+ : isLoading
27595
+ ? (0,external_lit_namespaceObject.html) `<div class="loader__spinner"></div>`
27596
+ : null}</div>`;
27597
+ }
27598
+ constructor() {
27599
+ super(...arguments);
27600
+ _Loader_background_accessor_storage.set(this, Loader_runInitializers(this, _background_initializers, null));
27601
+ _Loader_color_accessor_storage.set(this, (Loader_runInitializers(this, _background_extraInitializers), Loader_runInitializers(this, _color_initializers, null)));
27602
+ _Loader_needShowErrorScreen_accessor_storage.set(this, (Loader_runInitializers(this, _color_extraInitializers), Loader_runInitializers(this, _needShowErrorScreen_initializers, false)));
27603
+ _Loader_needShowLoaderScreen_accessor_storage.set(this, (Loader_runInitializers(this, _needShowErrorScreen_extraInitializers), Loader_runInitializers(this, _needShowLoaderScreen_initializers, false)));
27604
+ Loader_runInitializers(this, _needShowLoaderScreen_extraInitializers);
27558
27605
  }
27559
27606
  };
27560
- Spinner_setFunctionName(_classThis, "Spinner");
27607
+ _Loader_background_accessor_storage = new WeakMap();
27608
+ _Loader_color_accessor_storage = new WeakMap();
27609
+ _Loader_needShowErrorScreen_accessor_storage = new WeakMap();
27610
+ _Loader_needShowLoaderScreen_accessor_storage = new WeakMap();
27611
+ Loader_setFunctionName(_classThis, "Loader");
27561
27612
  (() => {
27562
27613
  var _a;
27563
27614
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_a = _classSuper[Symbol.metadata]) !== null && _a !== void 0 ? _a : null) : void 0;
27564
- Spinner_esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
27565
- Spinner = _classThis = _classDescriptor.value;
27615
+ _background_decorators = [(0,decorators_js_namespaceObject.property)({ type: String })];
27616
+ _color_decorators = [(0,decorators_js_namespaceObject.property)({ type: String })];
27617
+ _needShowErrorScreen_decorators = [(0,decorators_js_namespaceObject.property)({ type: Boolean })];
27618
+ _needShowLoaderScreen_decorators = [(0,decorators_js_namespaceObject.property)({ type: Boolean })];
27619
+ Loader_esDecorate(_classThis, null, _background_decorators, { kind: "accessor", name: "background", static: false, private: false, access: { has: obj => "background" in obj, get: obj => obj.background, set: (obj, value) => { obj.background = value; } }, metadata: _metadata }, _background_initializers, _background_extraInitializers);
27620
+ Loader_esDecorate(_classThis, null, _color_decorators, { kind: "accessor", name: "color", static: false, private: false, access: { has: obj => "color" in obj, get: obj => obj.color, set: (obj, value) => { obj.color = value; } }, metadata: _metadata }, _color_initializers, _color_extraInitializers);
27621
+ Loader_esDecorate(_classThis, 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);
27622
+ Loader_esDecorate(_classThis, 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);
27623
+ Loader_esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
27624
+ Loader = _classThis = _classDescriptor.value;
27566
27625
  if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
27567
27626
  })();
27568
27627
  Object.defineProperty(_classThis, "styles", {
27569
27628
  enumerable: true,
27570
27629
  configurable: true,
27571
27630
  writable: true,
27572
- value: spinnerStyles
27631
+ value: (0,external_lit_namespaceObject.css) `.loader{position:absolute;z-index:10001;top:0;bottom:0;left:0;right:0;display:flex;justify-content:center;align-items:center;background:var(--loader-background,#000)}.loader__refresh-btn{color:#fff;cursor:pointer;position:absolute;left:50%;top:50%;transform:translate3d(-50%,-50%,0);pointer-events:auto;padding:20px;width:32px;height:32px;box-sizing:content-box}.loader__spinner{flex-shrink:0;display:inline-block;width:32px;height:32px;border-radius:50%;border:solid 2px var(--loaderBackgroundColor,#fff);border-color:var(--loaderBackgroundAccentColor,transparent) var(--loaderBackgroundColor,#fff) var(--loaderBackgroundColor,#fff) var(--loaderBackgroundColor,#fff);animation:loading-spinner .6s infinite linear}@keyframes loading-spinner{from{transform:rotate(0)}to{transform:rotate(359deg)}}`
27573
27632
  });
27574
27633
  (() => {
27575
- Spinner_runInitializers(_classThis, _classExtraInitializers);
27634
+ Loader_runInitializers(_classThis, _classExtraInitializers);
27576
27635
  })();
27577
- return Spinner = _classThis;
27636
+ return Loader = _classThis;
27578
27637
  })();
27579
27638
 
27580
27639
 
27581
- ;// CONCATENATED MODULE: ./src/InAppMessaging/components/Spinner/index.ts
27582
-
27583
-
27584
27640
  ;// CONCATENATED MODULE: ./src/InAppMessaging/InAppMessagingReader.ts
27585
27641
  var InAppMessagingReader_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
27586
27642
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
@@ -27681,7 +27737,6 @@ let InAppMessagingReader = (() => {
27681
27737
  _InAppMessagingReader_dir_accessor_storage.set(this, (InAppMessagingReader_runInitializers(this, _desktopMode_extraInitializers), InAppMessagingReader_runInitializers(this, _dir_initializers, TextDir.LTR)));
27682
27738
  _InAppMessagingReader_viewModel_accessor_storage.set(this, (InAppMessagingReader_runInitializers(this, _dir_extraInitializers), InAppMessagingReader_runInitializers(this, _viewModel_initializers, null)));
27683
27739
  _InAppMessagingReader_open_accessor_storage.set(this, (InAppMessagingReader_runInitializers(this, _viewModel_extraInitializers), InAppMessagingReader_runInitializers(this, _open_initializers, true)));
27684
- /* @query("#iam-container") private accessor iamContainerRef: HTMLElement | null = null; */
27685
27740
  Object.defineProperty(this, "viewportController", {
27686
27741
  enumerable: true,
27687
27742
  configurable: true,
@@ -27742,6 +27797,15 @@ let InAppMessagingReader = (() => {
27742
27797
  desktopMode: this.desktopMode
27743
27798
  });
27744
27799
  }
27800
+ async handleReloadMessage() {
27801
+ var _a, _b, _c;
27802
+ try {
27803
+ await ((_c = (_b = (_a = this.viewModel) === null || _a === void 0 ? void 0 : _a.activeMessage) === null || _b === void 0 ? void 0 : _b.activeSlide) === null || _c === void 0 ? void 0 : _c.restart());
27804
+ }
27805
+ catch (error) {
27806
+ console.error(error);
27807
+ }
27808
+ }
27745
27809
  render() {
27746
27810
  var _a, _b;
27747
27811
  const message = (_a = this.viewModel) === null || _a === void 0 ? void 0 : _a.activeMessage;
@@ -27751,7 +27815,7 @@ let InAppMessagingReader = (() => {
27751
27815
  const type = message.type;
27752
27816
  const messageGeometry = this.createMessageGeometry(type, message.appearanceOptions);
27753
27817
  const slideGeometry = this.createSlideGeometry(messageGeometry);
27754
- return (0,external_lit_namespaceObject.html) `<message-view-factory type="${type}" @closed="${this.handleClosed}" .appearanceOptions="${message.appearanceOptions}" .geometry="${messageGeometry}" .open="${this.open}" .dir="${this.dir}" .desktopMode="${this.desktopMode}" .touchController="${touchController}"><message-slide .message="${message}" .styleContext="${message.context.style}" .geometry="${slideGeometry}"></message-slide></message-view-factory>`;
27818
+ return (0,external_lit_namespaceObject.html) `<message-view-factory type="${type}" @closed="${this.handleClosed}" .appearanceOptions="${message.appearanceOptions}" .geometry="${messageGeometry}" .open="${this.open}" .dir="${this.dir}" .desktopMode="${this.desktopMode}" .touchController="${touchController}"><message-slide .message="${message}" .styleContext="${message.context.style}" .geometry="${slideGeometry}"></message-slide><iam-loader .needShowErrorScreen="${message.needShowErrorScreen}" .needShowLoaderScreen="${message.needShowLoaderScreen}" @reload="${this.handleReloadMessage}"></iam-loader></message-view-factory>`;
27755
27819
  }
27756
27820
  };
27757
27821
  _InAppMessagingReader_options_accessor_storage = new WeakMap();