@inappstory/react-sdk 1.9.0-rc.0 → 1.9.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.
@@ -7661,13 +7661,6 @@ class SharingService {
7661
7661
  }), hideElementsSelector);
7662
7662
  return { file, url: URL.createObjectURL(file) };
7663
7663
  }
7664
- getNavigatorShareFunction() {
7665
- var _a, _b;
7666
- let shareFn = (_a = navigator.share) === null || _a === void 0 ? void 0 : _a.bind(navigator);
7667
- if (!shareFn && ((_b = window.parent) === null || _b === void 0 ? void 0 : _b.navigator.share))
7668
- shareFn = window.parent.navigator.share.bind(window.parent.navigator);
7669
- return shareFn;
7670
- }
7671
7664
  getFilteredConfigDto(configDto) {
7672
7665
  const newConfig = {};
7673
7666
  for (const [key, value] of Object.entries(configDto !== null && configDto !== void 0 ? configDto : {})) {
@@ -7746,12 +7739,18 @@ let SharePanelViewModel = (() => {
7746
7739
  set _isOpened(value) { sharePanelViewModel_classPrivateFieldSet(this, _SharePanelViewModel__isOpened_accessor_storage, value, "f"); }
7747
7740
  get _params() { return sharePanelViewModel_classPrivateFieldGet(this, _SharePanelViewModel__params_accessor_storage, "f"); }
7748
7741
  set _params(value) { sharePanelViewModel_classPrivateFieldSet(this, _SharePanelViewModel__params_accessor_storage, value, "f"); }
7749
- constructor(story, touchController) {
7742
+ constructor(storyManager, story, touchController) {
7743
+ Object.defineProperty(this, "storyManager", {
7744
+ enumerable: true,
7745
+ configurable: true,
7746
+ writable: true,
7747
+ value: (sharePanelViewModel_runInitializers(this, _instanceExtraInitializers), storyManager)
7748
+ });
7750
7749
  Object.defineProperty(this, "story", {
7751
7750
  enumerable: true,
7752
7751
  configurable: true,
7753
7752
  writable: true,
7754
- value: (sharePanelViewModel_runInitializers(this, _instanceExtraInitializers), story)
7753
+ value: story
7755
7754
  });
7756
7755
  Object.defineProperty(this, "touchController", {
7757
7756
  enumerable: true,
@@ -7867,14 +7866,13 @@ let SharePanelViewModel = (() => {
7867
7866
  }
7868
7867
  }
7869
7868
  async startNativeSharing(nativeSharingId, config) {
7870
- const shareFn = this.sharingService.getNavigatorShareFunction();
7871
- if (!shareFn)
7869
+ if (!this.storyManager.shareHandler)
7872
7870
  throw new Error();
7873
7871
  try {
7874
7872
  this.story.pauseUI(nativeSharingId);
7875
7873
  this.runNativeSharing({ id: nativeSharingId });
7876
7874
  // В браузере в режиме разработки под мобильные устройства завершается мгновенно :(
7877
- await shareFn(config);
7875
+ await this.storyManager.shareHandler(config);
7878
7876
  this.completeNativeSharing({ result: true });
7879
7877
  }
7880
7878
  catch (err) {
@@ -8651,13 +8649,11 @@ let StoryPauseManager = (() => {
8651
8649
  }
8652
8650
  pauseSystem(source) {
8653
8651
  this._systemPause.pause(source);
8654
- this.ctx.notifyPauseStateChange();
8655
8652
  }
8656
8653
  resumeSystem(source) {
8657
8654
  if (!this._systemPause.isPaused)
8658
8655
  return;
8659
8656
  this._systemPause.resume(source);
8660
- this.ctx.notifyPauseStateChange();
8661
8657
  }
8662
8658
  resumeAll() {
8663
8659
  if (this.isPaused) {
@@ -9894,7 +9890,7 @@ let StoryViewModel = (() => {
9894
9890
  this.goodsWidget = new StoryGoodsWidgetViewModel(this.storyManager, this, this.storyReaderStatisticV2Service);
9895
9891
  this.textInput = new TextInputViewModel(this, this.storyReaderStatisticV2Service);
9896
9892
  this.timeline = new StoryTimelineViewModel(this);
9897
- this.sharePanel = new SharePanelViewModel(this, this.storyReader.touchController);
9893
+ this.sharePanel = new SharePanelViewModel(this.storyManager, this, this.storyReader.touchController);
9898
9894
  this.actionPanel = new StoryActionPanelViewModel(this.storyManager, this, this.sharePanel, this.storyReaderStatisticV2Service);
9899
9895
  this.storySlidesReactionDisposer = this.observeStorySlides();
9900
9896
  }
@@ -10475,7 +10471,7 @@ class GameClientConfig {
10475
10471
  value: void 0
10476
10472
  });
10477
10473
  const storyManagerConfig = this.storyManager.config;
10478
- const sdkVersion = "1.9.0-rc.0";
10474
+ const sdkVersion = "1.9.1";
10479
10475
  const placeholders = this.storyManager.rootStore.placeholderStore.placeholders;
10480
10476
  const session = this.storyManager.rootStore.sessionStore.session;
10481
10477
  this.sessionId = session.id;
@@ -11080,7 +11076,13 @@ var shareModule_ShareType;
11080
11076
  ShareType["SlideScreenshot"] = "slide-screenshot";
11081
11077
  })(shareModule_ShareType || (shareModule_ShareType = {}));
11082
11078
  class GameShareModule {
11083
- constructor(shareNotifier) {
11079
+ constructor(storyManager, shareNotifier) {
11080
+ Object.defineProperty(this, "storyManager", {
11081
+ enumerable: true,
11082
+ configurable: true,
11083
+ writable: true,
11084
+ value: storyManager
11085
+ });
11084
11086
  Object.defineProperty(this, "shareNotifier", {
11085
11087
  enumerable: true,
11086
11088
  configurable: true,
@@ -11132,8 +11134,7 @@ class GameShareModule {
11132
11134
  }
11133
11135
  async startNativeSharing(shareId, config) {
11134
11136
  try {
11135
- const shareFn = this.getNavigatorShareFunction();
11136
- await shareFn(config);
11137
+ await this.storyManager.shareHandler(config);
11137
11138
  this.shareNotifier.notifyShareCompleted({ shareId, isSuccess: true });
11138
11139
  }
11139
11140
  catch (err) {
@@ -11146,13 +11147,6 @@ class GameShareModule {
11146
11147
  this.shareNotifier.notifyShareCompleted({ shareId, isSuccess: false });
11147
11148
  }
11148
11149
  }
11149
- getNavigatorShareFunction() {
11150
- var _a, _b;
11151
- let shareFn = (_a = navigator.share) === null || _a === void 0 ? void 0 : _a.bind(navigator);
11152
- if (!shareFn && ((_b = window.parent) === null || _b === void 0 ? void 0 : _b.navigator.share))
11153
- shareFn = window.parent.navigator.share.bind(window.parent.navigator);
11154
- return shareFn;
11155
- }
11156
11150
  getFilteredConfigDto(configDto) {
11157
11151
  const newConfig = {};
11158
11152
  for (const [key, value] of Object.entries(configDto !== null && configDto !== void 0 ? configDto : {})) {
@@ -11591,7 +11585,7 @@ let GameReaderViewModel = (() => {
11591
11585
  new GameNavigationModule(this.storyManager),
11592
11586
  new GameStoryLocalDataModule(this.storyManager),
11593
11587
  new GameLocalDataModule(this.storyManager),
11594
- new GameShareModule(this)
11588
+ new GameShareModule(this.storyManager, this)
11595
11589
  ];
11596
11590
  }
11597
11591
  get closeBtnVisible() {
@@ -12379,9 +12373,29 @@ class StorySlideApiHandlers {
12379
12373
  value: new NarrativeDataCache()
12380
12374
  });
12381
12375
  }
12376
+ onWidgetRequirePauseUI() {
12377
+ this.story.pauseUI(this);
12378
+ }
12379
+ onWidgetRequireResumeUI() {
12380
+ this.story.resumeUI(this);
12381
+ }
12382
+ productCartUpdate(data) {
12383
+ return new Promise((resolve, reject) => {
12384
+ this.storyManager.emit("productCartUpdated", {
12385
+ offer: data.offer,
12386
+ onSuccess: resolve,
12387
+ onError: reject
12388
+ });
12389
+ });
12390
+ }
12391
+ productCartClicked() {
12392
+ this.storyManager.emit("productCartClicked");
12393
+ }
12394
+ async productCartGetState() {
12395
+ return this.storyManager.products.getProductCartState();
12396
+ }
12382
12397
  onEvent(name, event) { }
12383
12398
  onCardLoadingStateChange(state) { }
12384
- ;
12385
12399
  clearNarrativeSessionDataCache() {
12386
12400
  this.sessionNarrativeDataCache.clear();
12387
12401
  }
@@ -12545,7 +12559,7 @@ class StorySlideApiHandlers {
12545
12559
  const session = this.storyManager.rootStore.sessionStore.session;
12546
12560
  return (_a = session === null || session === void 0 ? void 0 : session.fontsResources) !== null && _a !== void 0 ? _a : [];
12547
12561
  }
12548
- updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError) {
12562
+ async updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError) {
12549
12563
  if (this.story.activeSlideIndex !== slideIndex)
12550
12564
  return;
12551
12565
  //debug(`[SLIDE-API]: update timeline`, `<${[...arguments].join(", ")}>`);
@@ -17056,237 +17070,110 @@ class MessageGeometryFactory {
17056
17070
 
17057
17071
 
17058
17072
 
17059
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/squareSlideGeometry.ts
17060
- class SquareSlideGeometry {
17061
- constructor(_vw, _vh, _contentRatio) {
17062
- Object.defineProperty(this, "_vw", {
17063
- enumerable: true,
17064
- configurable: true,
17065
- writable: true,
17066
- value: _vw
17067
- });
17068
- Object.defineProperty(this, "_vh", {
17069
- enumerable: true,
17070
- configurable: true,
17071
- writable: true,
17072
- value: _vh
17073
- });
17074
- Object.defineProperty(this, "_contentRatio", {
17075
- enumerable: true,
17076
- configurable: true,
17077
- writable: true,
17078
- value: _contentRatio
17079
- });
17080
- }
17081
- get contentRatio() {
17082
- return this._contentRatio;
17083
- }
17084
- getWidth() {
17085
- return `${this.calculateWidth()}px`;
17086
- }
17087
- getHeight() {
17088
- return `${this.calculateHeight()}px`;
17089
- }
17090
- calculateWidth() {
17091
- return this._vw;
17092
- }
17093
- calculateHeight() {
17094
- return Math.ceil(this._vw / this._contentRatio);
17095
- }
17096
- }
17073
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/actions/openGameAction.ts
17097
17074
 
17098
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/wideSlideGeometry.ts
17099
- class WideSlideGeometry {
17100
- constructor(_vw, _vh, _contentRatio) {
17101
- Object.defineProperty(this, "_vw", {
17102
- enumerable: true,
17103
- configurable: true,
17104
- writable: true,
17105
- value: _vw
17106
- });
17107
- Object.defineProperty(this, "_vh", {
17075
+ class openGameAction_OpenGameAction {
17076
+ constructor(storyManager, iamMessage) {
17077
+ Object.defineProperty(this, "storyManager", {
17108
17078
  enumerable: true,
17109
17079
  configurable: true,
17110
17080
  writable: true,
17111
- value: _vh
17081
+ value: storyManager
17112
17082
  });
17113
- Object.defineProperty(this, "_contentRatio", {
17083
+ Object.defineProperty(this, "iamMessage", {
17114
17084
  enumerable: true,
17115
17085
  configurable: true,
17116
17086
  writable: true,
17117
- value: _contentRatio
17087
+ value: iamMessage
17118
17088
  });
17119
17089
  }
17120
- get contentRatio() {
17121
- return this._contentRatio;
17122
- }
17123
- get vw() {
17124
- return this._vw;
17125
- }
17126
- get vh() {
17127
- return this._vh;
17128
- }
17129
- getWidth() {
17130
- return `${this.calculateWidth()}px`;
17131
- }
17132
- getHeight() {
17133
- return `${this.calculateHeight()}px`;
17134
- }
17135
- calculateWidth() {
17136
- return Math.ceil(this._vh * this._contentRatio);
17137
- }
17138
- calculateHeight() {
17139
- return this._vh;
17090
+ async handle(payload) {
17091
+ try {
17092
+ await this.storyManager.openGame(payload.gameInstanceId);
17093
+ this.iamMessage.pauseAndLock();
17094
+ this.storyManager.gameReader.once(GameReaderEvent.Close, () => {
17095
+ this.iamMessage.resumeAndUnlock();
17096
+ });
17097
+ }
17098
+ catch (error) {
17099
+ console.error(error);
17100
+ }
17140
17101
  }
17141
17102
  }
17142
17103
 
17143
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/fullscreen/fullscreenSlideGeometry.ts
17144
- class FullscreenSlideGeometry {
17145
- }
17146
-
17147
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/fullscreen/portraitFullscreenSlideGeometry.ts
17148
-
17149
- class PortraitFullscreenSlideGeometry extends FullscreenSlideGeometry {
17150
- constructor(_vw, _vh, _contentRatio) {
17151
- super();
17152
- Object.defineProperty(this, "_vw", {
17153
- enumerable: true,
17154
- configurable: true,
17155
- writable: true,
17156
- value: _vw
17157
- });
17158
- Object.defineProperty(this, "_vh", {
17104
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/iamReaderVisibilityObserver.ts
17105
+ class IamReaderVisibilityObserver {
17106
+ constructor(iamReader, iamStatisticsService) {
17107
+ Object.defineProperty(this, "iamReader", {
17159
17108
  enumerable: true,
17160
17109
  configurable: true,
17161
17110
  writable: true,
17162
- value: _vh
17111
+ value: iamReader
17163
17112
  });
17164
- Object.defineProperty(this, "_contentRatio", {
17113
+ Object.defineProperty(this, "iamStatisticsService", {
17165
17114
  enumerable: true,
17166
17115
  configurable: true,
17167
17116
  writable: true,
17168
- value: _contentRatio
17117
+ value: iamStatisticsService
17169
17118
  });
17119
+ this.handleDocumentVisibilityChange = this.handleDocumentVisibilityChange.bind(this);
17170
17120
  }
17171
- get contentRatio() {
17172
- return this._contentRatio;
17173
- }
17174
- getWidth() {
17175
- return `${this.calculateWidth()}px`;
17176
- }
17177
- getHeight() {
17178
- return `${this.calculateHeight()}px`;
17121
+ subscribe() {
17122
+ document.addEventListener("visibilitychange", this.handleDocumentVisibilityChange);
17179
17123
  }
17180
- calculateWidth() {
17181
- return this._vw;
17124
+ unsubscribe() {
17125
+ document.removeEventListener("visibilitychange", this.handleDocumentVisibilityChange);
17182
17126
  }
17183
- calculateHeight() {
17184
- return Math.ceil(this._vw / this._contentRatio);
17127
+ handleDocumentVisibilityChange() {
17128
+ const activeMessage = this.iamReader.activeMessage;
17129
+ if (document.hidden) {
17130
+ this.iamStatisticsService.sendCloseEvent({
17131
+ messageId: activeMessage.id,
17132
+ iterationId: activeMessage.iterationId,
17133
+ slidesTotal: activeMessage.slides.length,
17134
+ slideIndex: activeMessage.activeSlideIndex,
17135
+ duration: activeMessage.timeSinceLastShow,
17136
+ slideAnalytics: activeMessage.slidesAnalytics
17137
+ });
17138
+ }
17139
+ else {
17140
+ const { iterationId } = activeMessage.open();
17141
+ this.iamStatisticsService.sendOpenEvent({
17142
+ messageId: activeMessage.id,
17143
+ iterationId: iterationId,
17144
+ slidesTotal: activeMessage.slides.length,
17145
+ slideIndex: activeMessage.activeSlideIndex
17146
+ });
17147
+ }
17185
17148
  }
17186
17149
  }
17187
17150
 
17188
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/fullscreen/landscapeFullscreenSlideGeometry.ts
17189
-
17190
- class LandscapeFullscreenSlideGeometry extends FullscreenSlideGeometry {
17191
- constructor(_vw, _vh, _contentRatio) {
17192
- super();
17193
- Object.defineProperty(this, "_vw", {
17194
- enumerable: true,
17195
- configurable: true,
17196
- writable: true,
17197
- value: _vw
17198
- });
17199
- Object.defineProperty(this, "_vh", {
17200
- enumerable: true,
17201
- configurable: true,
17202
- writable: true,
17203
- value: _vh
17204
- });
17205
- Object.defineProperty(this, "_contentRatio", {
17206
- enumerable: true,
17207
- configurable: true,
17208
- writable: true,
17209
- value: _contentRatio
17210
- });
17211
- }
17212
- get contentRatio() {
17213
- return this._contentRatio;
17214
- }
17215
- getWidth() {
17216
- return `${this.calculateWidth()}px`;
17217
- }
17218
- getHeight() {
17219
- return `${this.calculateHeight()}px`;
17220
- }
17221
- calculateWidth() {
17222
- return Math.ceil(this.calculateHeight() * this._contentRatio);
17151
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/exceptions/exceptions.ts
17152
+ class IamMessageOpenError extends Error {
17153
+ constructor(messageId) {
17154
+ super(`[IAS]: you must close IAM with ID ${messageId}`);
17155
+ this.name = "IamMessageOpenError";
17223
17156
  }
17224
- calculateHeight() {
17225
- return this._vh;
17157
+ }
17158
+ class IamMessageAnonymousOpen extends Error {
17159
+ constructor(messageId) {
17160
+ super(`[IAS]: You can't open IAM ${messageId} in anonymous access mode `);
17161
+ this.name = "IamMessageAnonymousOpen";
17226
17162
  }
17227
17163
  }
17228
17164
 
17229
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/slideGeometryFactory.ts
17230
-
17231
-
17232
-
17165
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/exceptions/index.ts
17233
17166
 
17234
17167
 
17235
- class SlideGeometryFactory {
17236
- constructor() { }
17237
- create(messageGeometry) {
17238
- const params = this.getViewportParams(messageGeometry);
17239
- if (this.isFullscreen(messageGeometry, params))
17240
- return this.createFullscreenSlideGeometry(params);
17241
- return this.createWideOrSquareGeometry(params);
17242
- }
17243
- isFullscreen(messageGeometry, params) {
17244
- return messageGeometry instanceof FullscreenModalGeometry;
17245
- }
17246
- createWideOrSquareGeometry(params) {
17247
- if (params.viewportRatio > params.contentRatio)
17248
- return new SquareSlideGeometry(params.vw, params.vh, params.contentRatio);
17249
- else
17250
- return new WideSlideGeometry(params.vw, params.vh, params.contentRatio);
17251
- }
17252
- getViewportParams(messageGeometry) {
17253
- const vw = messageGeometry.getWidth();
17254
- const vh = messageGeometry.getHeight();
17255
- const viewportRatio = messageGeometry.getWidth() / messageGeometry.getHeight();
17256
- const contentRatio = messageGeometry.contentRatio;
17257
- return { vw, vh, viewportRatio, contentRatio };
17258
- }
17259
- createFullscreenSlideGeometry(params) {
17260
- if (params.viewportRatio > params.contentRatio) {
17261
- return new LandscapeFullscreenSlideGeometry(params.vw, params.vh, params.contentRatio);
17262
- }
17263
- else {
17264
- return new PortraitFullscreenSlideGeometry(params.vw, params.vh, params.contentRatio);
17265
- }
17266
- }
17267
- }
17268
-
17269
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/fullscreen/index.ts
17270
-
17271
-
17272
-
17273
-
17274
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/index.ts
17275
-
17276
-
17277
-
17278
-
17279
-
17280
-
17281
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/iamMessageSlideViewModel.ts
17282
- var iamMessageSlideViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
17283
- var useValue = arguments.length > 2;
17284
- for (var i = 0; i < initializers.length; i++) {
17285
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
17168
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/iamReaderViewModel.ts
17169
+ var iamReaderViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
17170
+ var useValue = arguments.length > 2;
17171
+ for (var i = 0; i < initializers.length; i++) {
17172
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
17286
17173
  }
17287
17174
  return useValue ? value : void 0;
17288
17175
  };
17289
- var iamMessageSlideViewModel_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
17176
+ var iamReaderViewModel_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
17290
17177
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
17291
17178
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
17292
17179
  var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
@@ -17313,12 +17200,12 @@ var iamMessageSlideViewModel_esDecorate = (undefined && undefined.__esDecorate)
17313
17200
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
17314
17201
  done = true;
17315
17202
  };
17316
- var iamMessageSlideViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
17203
+ var iamReaderViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
17317
17204
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
17318
17205
  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");
17319
17206
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17320
17207
  };
17321
- var iamMessageSlideViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
17208
+ var iamReaderViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
17322
17209
  if (kind === "m") throw new TypeError("Private method is not writable");
17323
17210
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
17324
17211
  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");
@@ -17327,322 +17214,233 @@ var iamMessageSlideViewModel_classPrivateFieldSet = (undefined && undefined.__cl
17327
17214
 
17328
17215
 
17329
17216
 
17330
- const iamMessageSlideViewModel_SWIPE_UP_THRESHOLD = 10;
17331
- const iamMessageSlideViewModel_SLIDE_CLICK_THRESHOLD = 0.3;
17332
- const iamMessageSlideViewModel_SHOW_SLIDE_TIMEOUT = 500;
17333
- const MESSAGE_LOADER_TIMEOUT = 500;
17334
- let IamMessageSlideViewModel = (() => {
17335
- var _a, _IamMessageSlideViewModel__disabledNextClick_accessor_storage;
17217
+
17218
+
17219
+
17220
+
17221
+
17222
+ var IamReaderEvent;
17223
+ (function (IamReaderEvent) {
17224
+ IamReaderEvent["Loaded"] = "loaded";
17225
+ IamReaderEvent["Close"] = "close";
17226
+ IamReaderEvent["WidgetEvent"] = "widgetEvent";
17227
+ IamReaderEvent["ClickOnButton"] = "ClickOnButton";
17228
+ })(IamReaderEvent || (IamReaderEvent = {}));
17229
+ let IamReaderViewModel = (() => {
17230
+ var _a, _IamReaderViewModel__activeMessage_accessor_storage;
17231
+ let _classSuper = ViewModel;
17336
17232
  let _instanceExtraInitializers = [];
17337
- let __disabledNextClick_decorators;
17338
- let __disabledNextClick_initializers = [];
17339
- let __disabledNextClick_extraInitializers = [];
17340
- let _get_isLoading_decorators;
17341
- return _a = class IamMessageSlideViewModel {
17342
- get _disabledNextClick() { return iamMessageSlideViewModel_classPrivateFieldGet(this, _IamMessageSlideViewModel__disabledNextClick_accessor_storage, "f"); }
17343
- set _disabledNextClick(value) { iamMessageSlideViewModel_classPrivateFieldSet(this, _IamMessageSlideViewModel__disabledNextClick_accessor_storage, value, "f"); }
17344
- constructor(message, iamMessageSlide, slideApi) {
17345
- Object.defineProperty(this, "message", {
17233
+ let __activeMessage_decorators;
17234
+ let __activeMessage_initializers = [];
17235
+ let __activeMessage_extraInitializers = [];
17236
+ let _showMessageById_decorators;
17237
+ let _showMessageByEvent_decorators;
17238
+ let _close_decorators;
17239
+ return _a = class IamReaderViewModel extends _classSuper {
17240
+ get _activeMessage() { return iamReaderViewModel_classPrivateFieldGet(this, _IamReaderViewModel__activeMessage_accessor_storage, "f"); }
17241
+ set _activeMessage(value) { iamReaderViewModel_classPrivateFieldSet(this, _IamReaderViewModel__activeMessage_accessor_storage, value, "f"); }
17242
+ constructor(storyManager, iamStore, iamDisplayService, iamStatisticsService) {
17243
+ super();
17244
+ Object.defineProperty(this, "storyManager", {
17346
17245
  enumerable: true,
17347
17246
  configurable: true,
17348
17247
  writable: true,
17349
- value: (iamMessageSlideViewModel_runInitializers(this, _instanceExtraInitializers), message)
17248
+ value: (iamReaderViewModel_runInitializers(this, _instanceExtraInitializers), storyManager)
17350
17249
  });
17351
- Object.defineProperty(this, "iamMessageSlide", {
17250
+ Object.defineProperty(this, "iamStore", {
17352
17251
  enumerable: true,
17353
17252
  configurable: true,
17354
17253
  writable: true,
17355
- value: iamMessageSlide
17254
+ value: iamStore
17356
17255
  });
17357
- Object.defineProperty(this, "slideApi", {
17256
+ Object.defineProperty(this, "iamDisplayService", {
17358
17257
  enumerable: true,
17359
17258
  configurable: true,
17360
17259
  writable: true,
17361
- value: slideApi
17260
+ value: iamDisplayService
17362
17261
  });
17363
- Object.defineProperty(this, "locked", {
17262
+ Object.defineProperty(this, "iamStatisticsService", {
17364
17263
  enumerable: true,
17365
17264
  configurable: true,
17366
17265
  writable: true,
17367
- value: false
17266
+ value: iamStatisticsService
17368
17267
  });
17369
- Object.defineProperty(this, "toast", {
17268
+ _IamReaderViewModel__activeMessage_accessor_storage.set(this, iamReaderViewModel_runInitializers(this, __activeMessage_initializers, null));
17269
+ Object.defineProperty(this, "visibilityObserver", {
17370
17270
  enumerable: true,
17371
17271
  configurable: true,
17372
17272
  writable: true,
17373
- value: null
17273
+ value: iamReaderViewModel_runInitializers(this, __activeMessage_extraInitializers)
17374
17274
  });
17375
- _IamMessageSlideViewModel__disabledNextClick_accessor_storage.set(this, iamMessageSlideViewModel_runInitializers(this, __disabledNextClick_initializers, false));
17376
- Object.defineProperty(this, "mutex", {
17275
+ Object.defineProperty(this, "_touchController", {
17377
17276
  enumerable: true,
17378
17277
  configurable: true,
17379
17278
  writable: true,
17380
- value: (iamMessageSlideViewModel_runInitializers(this, __disabledNextClick_extraInitializers), new external_async_mutex_namespaceObject.Mutex())
17279
+ value: new TouchController()
17381
17280
  });
17382
- Object.defineProperty(this, "handleTouchEnd", {
17281
+ Object.defineProperty(this, "scrollbarHelper", {
17383
17282
  enumerable: true,
17384
17283
  configurable: true,
17385
17284
  writable: true,
17386
- value: ({ dy }) => {
17387
- if (!this.message.touchController)
17388
- return;
17389
- if (dy < iamMessageSlideViewModel_SWIPE_UP_THRESHOLD && this.message.touchController.verticalSwipeGesture)
17390
- this.slideApi.slideSwipeUpHandler();
17391
- }
17285
+ value: new ScrollbarHelper(window)
17392
17286
  });
17393
- this.handleDocumentVisibilityChange = this.handleDocumentVisibilityChange.bind(this);
17394
- }
17395
- get isLoading() {
17396
- return this.slideApi.state == 0;
17287
+ this.visibilityObserver = new IamReaderVisibilityObserver(this, this.iamStatisticsService);
17397
17288
  }
17398
- get html() {
17399
- return this.iamMessageSlide.html;
17289
+ get touchController() {
17290
+ return this._touchController;
17400
17291
  }
17401
- get state() {
17402
- return this.slideApi.state;
17292
+ get activeMessage() {
17293
+ return this._activeMessage;
17403
17294
  }
17404
- get navigationDisabled() {
17405
- return this._disabledNextClick;
17295
+ get isLoaded() {
17296
+ return this.iamStore.isLoaded;
17406
17297
  }
17407
- async reload() {
17408
- return this.slideApi.slideRestart({ muted: false });
17298
+ get isLoading() {
17299
+ return this.iamStore.isLoading;
17409
17300
  }
17410
- mute() {
17411
- this.slideApi.disableAudio();
17301
+ get isOpened() {
17302
+ return Boolean(this._activeMessage);
17412
17303
  }
17413
- unmute() {
17414
- this.slideApi.enableAudio();
17304
+ async preload(payload) {
17305
+ const config = await this.storyManager.waitForConfig();
17306
+ if (config.anonymous) {
17307
+ console.warn("[IAS]: You can't preload IAM in anonymous access mode");
17308
+ return [];
17309
+ }
17310
+ const messages = await this.iamStore.preload(payload);
17311
+ this.emit(IamReaderEvent.Loaded, {
17312
+ messages
17313
+ });
17314
+ return messages;
17415
17315
  }
17416
- notifyTimerEnd() {
17417
- this.slideApi.slideTimerEnd();
17316
+ async showMessageById(messageId, options = {}) {
17317
+ const config = await this.storyManager.waitForConfig();
17318
+ if (config.anonymous)
17319
+ throw new IamMessageAnonymousOpen(messageId);
17320
+ this.checkMessageNotOpened();
17321
+ const message = await this.iamDisplayService.getMessageById(messageId, options);
17322
+ await this.open(message);
17323
+ return message;
17418
17324
  }
17419
- pauseAndLock() {
17420
- this.locked = true;
17421
- return this.pauseByApp();
17325
+ async showMessageByEvent(eventName, options = {}) {
17326
+ const config = await this.storyManager.waitForConfig();
17327
+ if (config.anonymous)
17328
+ throw new IamMessageAnonymousOpen(eventName);
17329
+ this.checkMessageNotOpened();
17330
+ const message = await this.iamDisplayService.getMessageByEvent(eventName, options);
17331
+ await this.open(message);
17332
+ return message;
17422
17333
  }
17423
- resumeAndUnlock() {
17424
- this.locked = false;
17425
- return this.resumeByApp();
17334
+ async forceClose() {
17335
+ if (!this._activeMessage)
17336
+ return;
17337
+ this.emitCloseEvent(this._activeMessage);
17338
+ this.clearActiveMessage();
17339
+ this.visibilityObserver.unsubscribe();
17340
+ this.touchController.destroy();
17341
+ this.scrollbarHelper.disable();
17426
17342
  }
17427
- async showLayerByIndex(index) {
17428
- this.slideApi.showLayer(index);
17343
+ async close() {
17344
+ var _b;
17345
+ if ((_b = this._activeMessage) === null || _b === void 0 ? void 0 : _b.disableClose)
17346
+ return;
17347
+ this.forceClose();
17429
17348
  }
17430
- setUserData(id, text) {
17431
- this.slideApi.setTextInputResult(id, text);
17349
+ async open(message) {
17350
+ message.updatePlaceholders(this.storyManager.rootStore.placeholderStore.placeholders);
17351
+ this.touchController.init(document.body);
17352
+ this.setActiveMessage(message);
17353
+ this.visibilityObserver.subscribe();
17354
+ this.scrollbarHelper.enable();
17432
17355
  }
17433
- setShareComplete(id, isSuccess) {
17434
- this.slideApi.setShareComplete(id, isSuccess);
17356
+ destroy() { }
17357
+ emitWidgetEvent(widgetEvent) {
17358
+ if (!this.activeMessage)
17359
+ return;
17360
+ this.emit(IamReaderEvent.WidgetEvent, {
17361
+ message: this.activeMessage.toPublicDto(),
17362
+ name: widgetEvent.type,
17363
+ data: widgetEvent.widgetPayload
17364
+ });
17365
+ this.storyManager.emit(StoryManagerEvent.WidgetEvent, {
17366
+ name: widgetEvent.type,
17367
+ data: widgetEvent.widgetPayload
17368
+ });
17435
17369
  }
17436
- notifySwipeUp(target) {
17437
- this.slideApi.slideSwipeUpHandler();
17370
+ emitCloseEvent(message) {
17371
+ this.emit(IamReaderEvent.Close, {
17372
+ message: message.toPublicDto()
17373
+ });
17438
17374
  }
17439
- showToast(options) {
17440
- this.toast = new Toast(Object.assign(Object.assign({}, options), { mountPoint: this.message.$root }));
17441
- this.toast.show(options.content);
17375
+ setActiveMessage(message) {
17376
+ const activeMessage = new IamMultiSlideMessageViewModel(this, this.storyManager, message, this.iamStatisticsService);
17377
+ const { iterationId } = activeMessage.open();
17378
+ this._activeMessage = activeMessage;
17379
+ this.iamStatisticsService.sendOpenEvent({
17380
+ messageId: activeMessage.id,
17381
+ iterationId: iterationId,
17382
+ slidesTotal: activeMessage.slides.length,
17383
+ slideIndex: activeMessage.activeSlideIndex
17384
+ });
17442
17385
  }
17443
- handleDocumentVisibilityChange() {
17444
- if (this.locked)
17386
+ clearActiveMessage() {
17387
+ if (!this._activeMessage)
17445
17388
  return;
17446
- if (document.visibilityState === "hidden")
17447
- this.pauseByApp();
17448
- if (document.visibilityState === "visible")
17449
- this.resumeByApp();
17450
- }
17451
- async init() {
17452
- const release = await this.mutex.acquire();
17453
- let loaderShown = this.message.needShowLoaderScreen;
17454
- const loaderTimeout = setTimeout(() => {
17455
- this.message.showLoaderScreen();
17456
- loaderShown = true;
17457
- }, iamMessageSlideViewModel_SHOW_SLIDE_TIMEOUT);
17458
- try {
17459
- const { result, reason } = await this.slideApi.showSlide(this.html);
17460
- if (!result)
17461
- throw new Error(reason);
17462
- }
17463
- catch (error) {
17464
- this.handleSlideError(error);
17465
- }
17466
- finally {
17467
- clearTimeout(loaderTimeout);
17468
- this.cleanupLoaderIfNeeded(loaderShown);
17469
- release();
17470
- }
17389
+ const activeMessage = this._activeMessage;
17390
+ this._activeMessage = null;
17391
+ this.iamStatisticsService.sendCloseEvent({
17392
+ messageId: activeMessage.id,
17393
+ iterationId: activeMessage.iterationId,
17394
+ slidesTotal: activeMessage.slides.length,
17395
+ slideIndex: activeMessage.activeSlideIndex,
17396
+ duration: activeMessage.timeSinceLastShow,
17397
+ slideAnalytics: activeMessage.slidesAnalytics
17398
+ });
17471
17399
  }
17472
- async start() {
17473
- const release = await this.mutex.acquire();
17474
- try {
17475
- await this.slideApi.slideStart({ muted: true });
17476
- this.message.touchController.on(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
17477
- document.addEventListener("visibilitychange", this.handleDocumentVisibilityChange);
17478
- }
17479
- catch (error) {
17480
- this.handleSlideError(error);
17481
- }
17482
- finally {
17483
- release();
17484
- }
17485
- }
17486
- async restart() {
17487
- const release = await this.mutex.acquire();
17488
- try {
17489
- this.message.hideErrorScreen();
17490
- this.message.showLoaderScreen();
17491
- await this.slideApi.slideRestart({ muted: true });
17492
- }
17493
- catch (error) {
17494
- this.handleSlideError(error);
17495
- }
17496
- finally {
17497
- this.message.hideLoaderScreen();
17498
- release();
17499
- }
17500
- }
17501
- async resumeByApp() {
17502
- const release = await this.mutex.acquire();
17503
- try {
17504
- await this.slideApi.slideAppResume();
17505
- }
17506
- catch (error) {
17507
- this.handleSlideError(error);
17508
- }
17509
- finally {
17510
- release();
17511
- }
17512
- }
17513
- async pauseByApp() {
17514
- const release = await this.mutex.acquire();
17515
- try {
17516
- await this.slideApi.slideAppPause();
17517
- }
17518
- catch (error) {
17519
- this.handleSlideError(error);
17520
- }
17521
- finally {
17522
- release();
17523
- }
17524
- }
17525
- async resumeByUser() {
17526
- const release = await this.mutex.acquire();
17527
- try {
17528
- await this.slideApi.slideUserResume();
17529
- }
17530
- catch (error) {
17531
- this.handleSlideError(error);
17532
- }
17533
- finally {
17534
- release();
17535
- }
17536
- }
17537
- async pauseByUser() {
17538
- const release = await this.mutex.acquire();
17539
- try {
17540
- await this.slideApi.slideUserPause();
17541
- }
17542
- catch (error) {
17543
- this.handleSlideError(error);
17544
- }
17545
- finally {
17546
- release();
17547
- }
17548
- }
17549
- async stop() {
17550
- var _b;
17551
- const release = await this.mutex.acquire();
17552
- try {
17553
- await this.slideApi.slideStop({
17554
- prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */
17555
- });
17556
- this.message.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
17557
- document.removeEventListener("visibilitychange", this.handleDocumentVisibilityChange);
17558
- (_b = this.toast) === null || _b === void 0 ? void 0 : _b.destroy();
17559
- }
17560
- catch (error) {
17561
- this.handleSlideError(error);
17562
- }
17563
- finally {
17564
- release();
17565
- }
17566
- }
17567
- onClick(event, currentTarget) {
17568
- if (!event.target)
17569
- return;
17570
- event.preventDefault();
17571
- event.stopPropagation();
17572
- const direction = this.getNavigationDirection(event, currentTarget);
17573
- const { canClickNext } = this.slideApi.slideClickHandler(event.target, direction);
17574
- this._disabledNextClick = !canClickNext;
17575
- }
17576
- async destroy() {
17577
- try {
17578
- this.message.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
17579
- document.removeEventListener("visibilitychange", this.handleDocumentVisibilityChange);
17580
- await this.slideApi.destroy();
17581
- }
17582
- catch (error) {
17583
- console.error(error);
17584
- }
17585
- }
17586
- getNavigationDirection(event, currentTarget) {
17587
- const xPercent = this.getClickPosition(event, currentTarget);
17588
- const k = this.slideApi.layoutDirection === "ltr" ? 1 : -1;
17589
- const direction = xPercent >= iamMessageSlideViewModel_SLIDE_CLICK_THRESHOLD ? k : -k;
17590
- return direction > 0 ? "forward" : "backward";
17591
- }
17592
- getClickPosition(event, currentTarget) {
17593
- const rect = currentTarget.getBoundingClientRect();
17594
- const width = rect.width;
17595
- if (width <= 0)
17596
- return 0;
17597
- let x;
17598
- if (event instanceof MouseEvent) {
17599
- x = event.pageX - rect.left;
17600
- }
17601
- else if (event.touches && event.touches.length > 0) {
17602
- x = event.touches[0].pageX - rect.left;
17603
- }
17604
- else {
17605
- return 0;
17606
- }
17607
- return Math.max(0, Math.min(1, x / width));
17608
- }
17609
- handleSlideError(error) {
17610
- console.error(error);
17611
- this.message.showErrorScreen();
17612
- this.message.touchController.off(TouchControllerEvent.TouchEnd, this.handleTouchEnd);
17613
- }
17614
- delay(ms) {
17615
- return new Promise(resolve => setTimeout(resolve, ms));
17616
- }
17617
- async cleanupLoaderIfNeeded(loaderShown) {
17618
- if (loaderShown) {
17619
- await this.delay(MESSAGE_LOADER_TIMEOUT);
17620
- this.message.hideLoaderScreen();
17621
- }
17400
+ checkMessageNotOpened() {
17401
+ if (this.activeMessage)
17402
+ throw new IamMessageOpenError(this.activeMessage.id);
17622
17403
  }
17623
17404
  },
17624
- _IamMessageSlideViewModel__disabledNextClick_accessor_storage = new WeakMap(),
17405
+ _IamReaderViewModel__activeMessage_accessor_storage = new WeakMap(),
17625
17406
  (() => {
17626
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
17627
- __disabledNextClick_decorators = [external_mobx_namespaceObject.observable];
17628
- _get_isLoading_decorators = [external_mobx_namespaceObject.computed];
17629
- iamMessageSlideViewModel_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);
17630
- iamMessageSlideViewModel_esDecorate(_a, null, _get_isLoading_decorators, { kind: "getter", name: "isLoading", static: false, private: false, access: { has: obj => "isLoading" in obj, get: obj => obj.isLoading }, metadata: _metadata }, null, _instanceExtraInitializers);
17407
+ var _b;
17408
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
17409
+ __activeMessage_decorators = [external_mobx_namespaceObject.observable];
17410
+ _showMessageById_decorators = [external_mobx_namespaceObject.action];
17411
+ _showMessageByEvent_decorators = [external_mobx_namespaceObject.action];
17412
+ _close_decorators = [external_mobx_namespaceObject.action];
17413
+ iamReaderViewModel_esDecorate(_a, null, __activeMessage_decorators, { kind: "accessor", name: "_activeMessage", static: false, private: false, access: { has: obj => "_activeMessage" in obj, get: obj => obj._activeMessage, set: (obj, value) => { obj._activeMessage = value; } }, metadata: _metadata }, __activeMessage_initializers, __activeMessage_extraInitializers);
17414
+ iamReaderViewModel_esDecorate(_a, null, _showMessageById_decorators, { kind: "method", name: "showMessageById", static: false, private: false, access: { has: obj => "showMessageById" in obj, get: obj => obj.showMessageById }, metadata: _metadata }, null, _instanceExtraInitializers);
17415
+ iamReaderViewModel_esDecorate(_a, null, _showMessageByEvent_decorators, { kind: "method", name: "showMessageByEvent", static: false, private: false, access: { has: obj => "showMessageByEvent" in obj, get: obj => obj.showMessageByEvent }, metadata: _metadata }, null, _instanceExtraInitializers);
17416
+ iamReaderViewModel_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);
17631
17417
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
17632
17418
  })(),
17419
+ Object.defineProperty(_a, "id", {
17420
+ enumerable: true,
17421
+ configurable: true,
17422
+ writable: true,
17423
+ value: "IamReaderViewModel"
17424
+ }),
17633
17425
  _a;
17634
17426
  })();
17635
17427
 
17636
17428
 
17637
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/index.ts
17429
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/index.ts
17638
17430
 
17639
17431
 
17640
17432
 
17433
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/actions/openUrlAction.ts
17641
17434
 
17642
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/actions/openGameAction.ts
17643
17435
 
17644
- class openGameAction_OpenGameAction {
17645
- constructor(storyManager, iamMessage) {
17436
+ class openUrlAction_OpenUrlAction {
17437
+ constructor(iamReader, storyManager, iamMessage, iamStatisticsService) {
17438
+ Object.defineProperty(this, "iamReader", {
17439
+ enumerable: true,
17440
+ configurable: true,
17441
+ writable: true,
17442
+ value: iamReader
17443
+ });
17646
17444
  Object.defineProperty(this, "storyManager", {
17647
17445
  enumerable: true,
17648
17446
  configurable: true,
@@ -17655,13 +17453,54 @@ class openGameAction_OpenGameAction {
17655
17453
  writable: true,
17656
17454
  value: iamMessage
17657
17455
  });
17456
+ Object.defineProperty(this, "iamStatisticsService", {
17457
+ enumerable: true,
17458
+ configurable: true,
17459
+ writable: true,
17460
+ value: iamStatisticsService
17461
+ });
17462
+ }
17463
+ handle(payload) {
17464
+ const url = payload.linkTarget;
17465
+ const event = {
17466
+ src: StoryManagerLinkEventSource.IamReader,
17467
+ data: {
17468
+ id: this.iamMessage.id,
17469
+ index: this.iamMessage.activeSlideIndex,
17470
+ url,
17471
+ elementId: payload.elementId
17472
+ }
17473
+ };
17474
+ this.storyManager.storyLinkClickHandler(event);
17475
+ // @deprecated
17476
+ this.storyManager.emit("clickOnButton", event);
17477
+ this.iamReader.emit(IamReaderEvent.ClickOnButton, event);
17478
+ }
17479
+ }
17480
+
17481
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/actions/showStoryAction.ts
17482
+
17483
+ class showStoryAction_ShowStoryAction {
17484
+ constructor(storyManager, message) {
17485
+ Object.defineProperty(this, "storyManager", {
17486
+ enumerable: true,
17487
+ configurable: true,
17488
+ writable: true,
17489
+ value: storyManager
17490
+ });
17491
+ Object.defineProperty(this, "message", {
17492
+ enumerable: true,
17493
+ configurable: true,
17494
+ writable: true,
17495
+ value: message
17496
+ });
17658
17497
  }
17659
17498
  async handle(payload) {
17660
17499
  try {
17661
- await this.storyManager.openGame(payload.gameInstanceId);
17662
- this.iamMessage.pauseAndLock();
17663
- this.storyManager.gameReader.once(GameReaderEvent.Close, () => {
17664
- this.iamMessage.resumeAndUnlock();
17500
+ await this.storyManager.showStory(payload.storyId);
17501
+ this.message.pauseAndLock();
17502
+ this.storyManager.storyReader.once(StoryReaderEvent.Close, () => {
17503
+ this.message.resumeAndUnlock();
17665
17504
  });
17666
17505
  }
17667
17506
  catch (error) {
@@ -17670,1016 +17509,265 @@ class openGameAction_OpenGameAction {
17670
17509
  }
17671
17510
  }
17672
17511
 
17673
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/iamReaderVisibilityObserver.ts
17674
- class IamReaderVisibilityObserver {
17675
- constructor(iamReader, iamStatisticsService) {
17512
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/actions/index.ts
17513
+
17514
+
17515
+
17516
+
17517
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/narrativeDataCache.ts
17518
+ class narrativeDataCache_NarrativeDataCache {
17519
+ constructor() {
17520
+ Object.defineProperty(this, "cache", {
17521
+ enumerable: true,
17522
+ configurable: true,
17523
+ writable: true,
17524
+ value: {}
17525
+ });
17526
+ }
17527
+ set(key, value) {
17528
+ this.cache[key] = value;
17529
+ }
17530
+ clear() {
17531
+ this.cache = {};
17532
+ }
17533
+ get(key) {
17534
+ return this.cache[key];
17535
+ }
17536
+ }
17537
+
17538
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/iamSlideApiHandlers.ts
17539
+
17540
+
17541
+
17542
+
17543
+ class IamSlideApiHandlers {
17544
+ constructor(storyManager, iamReader, iamMessage, iamStatisticsService) {
17545
+ Object.defineProperty(this, "storyManager", {
17546
+ enumerable: true,
17547
+ configurable: true,
17548
+ writable: true,
17549
+ value: storyManager
17550
+ });
17676
17551
  Object.defineProperty(this, "iamReader", {
17677
17552
  enumerable: true,
17678
17553
  configurable: true,
17679
17554
  writable: true,
17680
17555
  value: iamReader
17681
17556
  });
17557
+ Object.defineProperty(this, "iamMessage", {
17558
+ enumerable: true,
17559
+ configurable: true,
17560
+ writable: true,
17561
+ value: iamMessage
17562
+ });
17682
17563
  Object.defineProperty(this, "iamStatisticsService", {
17683
17564
  enumerable: true,
17684
17565
  configurable: true,
17685
17566
  writable: true,
17686
17567
  value: iamStatisticsService
17687
17568
  });
17688
- this.handleDocumentVisibilityChange = this.handleDocumentVisibilityChange.bind(this);
17689
- }
17690
- subscribe() {
17691
- document.addEventListener("visibilitychange", this.handleDocumentVisibilityChange);
17692
- }
17693
- unsubscribe() {
17694
- document.removeEventListener("visibilitychange", this.handleDocumentVisibilityChange);
17695
- }
17696
- handleDocumentVisibilityChange() {
17697
- const activeMessage = this.iamReader.activeMessage;
17698
- if (document.hidden) {
17699
- this.iamStatisticsService.sendCloseEvent({
17700
- messageId: activeMessage.id,
17701
- iterationId: activeMessage.iterationId,
17702
- slidesTotal: activeMessage.slides.length,
17703
- slideIndex: activeMessage.activeSlideIndex,
17704
- duration: activeMessage.timeSinceLastShow,
17705
- slideAnalytics: activeMessage.slidesAnalytics
17706
- });
17707
- }
17708
- else {
17709
- const { iterationId } = activeMessage.open();
17710
- this.iamStatisticsService.sendOpenEvent({
17711
- messageId: activeMessage.id,
17712
- iterationId: iterationId,
17713
- slidesTotal: activeMessage.slides.length,
17714
- slideIndex: activeMessage.activeSlideIndex
17715
- });
17716
- }
17717
- }
17718
- }
17719
-
17720
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/exceptions/exceptions.ts
17721
- class IamMessageOpenError extends Error {
17722
- constructor(messageId) {
17723
- super(`[IAS]: you must close IAM with ID ${messageId}`);
17724
- this.name = "IamMessageOpenError";
17725
- }
17726
- }
17727
- class IamMessageAnonymousOpen extends Error {
17728
- constructor(messageId) {
17729
- super(`[IAS]: You can't open IAM ${messageId} in anonymous access mode `);
17730
- this.name = "IamMessageAnonymousOpen";
17731
- }
17732
- }
17733
-
17734
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/exceptions/index.ts
17735
-
17736
-
17737
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/iamReaderViewModel.ts
17738
- var iamReaderViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
17739
- var useValue = arguments.length > 2;
17740
- for (var i = 0; i < initializers.length; i++) {
17741
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
17742
- }
17743
- return useValue ? value : void 0;
17744
- };
17745
- var iamReaderViewModel_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
17746
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
17747
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
17748
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
17749
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
17750
- var _, done = false;
17751
- for (var i = decorators.length - 1; i >= 0; i--) {
17752
- var context = {};
17753
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
17754
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
17755
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
17756
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
17757
- if (kind === "accessor") {
17758
- if (result === void 0) continue;
17759
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17760
- if (_ = accept(result.get)) descriptor.get = _;
17761
- if (_ = accept(result.set)) descriptor.set = _;
17762
- if (_ = accept(result.init)) initializers.unshift(_);
17763
- }
17764
- else if (_ = accept(result)) {
17765
- if (kind === "field") initializers.unshift(_);
17766
- else descriptor[key] = _;
17767
- }
17768
- }
17769
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
17770
- done = true;
17771
- };
17772
- var iamReaderViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
17773
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
17774
- 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");
17775
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17776
- };
17777
- var iamReaderViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
17778
- if (kind === "m") throw new TypeError("Private method is not writable");
17779
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
17780
- 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");
17781
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17782
- };
17783
-
17784
-
17785
-
17786
-
17787
-
17788
-
17789
-
17790
-
17791
- var IamReaderEvent;
17792
- (function (IamReaderEvent) {
17793
- IamReaderEvent["Loaded"] = "loaded";
17794
- IamReaderEvent["Close"] = "close";
17795
- IamReaderEvent["WidgetEvent"] = "widgetEvent";
17796
- IamReaderEvent["ClickOnButton"] = "ClickOnButton";
17797
- })(IamReaderEvent || (IamReaderEvent = {}));
17798
- let IamReaderViewModel = (() => {
17799
- var _a, _IamReaderViewModel__activeMessage_accessor_storage;
17800
- let _classSuper = ViewModel;
17801
- let _instanceExtraInitializers = [];
17802
- let __activeMessage_decorators;
17803
- let __activeMessage_initializers = [];
17804
- let __activeMessage_extraInitializers = [];
17805
- let _showMessageById_decorators;
17806
- let _showMessageByEvent_decorators;
17807
- let _close_decorators;
17808
- return _a = class IamReaderViewModel extends _classSuper {
17809
- get _activeMessage() { return iamReaderViewModel_classPrivateFieldGet(this, _IamReaderViewModel__activeMessage_accessor_storage, "f"); }
17810
- set _activeMessage(value) { iamReaderViewModel_classPrivateFieldSet(this, _IamReaderViewModel__activeMessage_accessor_storage, value, "f"); }
17811
- constructor(storyManager, iamStore, iamDisplayService, iamStatisticsService) {
17812
- super();
17813
- Object.defineProperty(this, "storyManager", {
17814
- enumerable: true,
17815
- configurable: true,
17816
- writable: true,
17817
- value: (iamReaderViewModel_runInitializers(this, _instanceExtraInitializers), storyManager)
17818
- });
17819
- Object.defineProperty(this, "iamStore", {
17820
- enumerable: true,
17821
- configurable: true,
17822
- writable: true,
17823
- value: iamStore
17824
- });
17825
- Object.defineProperty(this, "iamDisplayService", {
17826
- enumerable: true,
17827
- configurable: true,
17828
- writable: true,
17829
- value: iamDisplayService
17830
- });
17831
- Object.defineProperty(this, "iamStatisticsService", {
17832
- enumerable: true,
17833
- configurable: true,
17834
- writable: true,
17835
- value: iamStatisticsService
17836
- });
17837
- _IamReaderViewModel__activeMessage_accessor_storage.set(this, iamReaderViewModel_runInitializers(this, __activeMessage_initializers, null));
17838
- Object.defineProperty(this, "visibilityObserver", {
17839
- enumerable: true,
17840
- configurable: true,
17841
- writable: true,
17842
- value: iamReaderViewModel_runInitializers(this, __activeMessage_extraInitializers)
17843
- });
17844
- Object.defineProperty(this, "_touchController", {
17845
- enumerable: true,
17846
- configurable: true,
17847
- writable: true,
17848
- value: new TouchController()
17849
- });
17850
- Object.defineProperty(this, "scrollbarHelper", {
17851
- enumerable: true,
17852
- configurable: true,
17853
- writable: true,
17854
- value: new ScrollbarHelper(window)
17855
- });
17856
- this.visibilityObserver = new IamReaderVisibilityObserver(this, this.iamStatisticsService);
17857
- }
17858
- get touchController() {
17859
- return this._touchController;
17860
- }
17861
- get activeMessage() {
17862
- return this._activeMessage;
17863
- }
17864
- get isLoaded() {
17865
- return this.iamStore.isLoaded;
17866
- }
17867
- get isLoading() {
17868
- return this.iamStore.isLoading;
17869
- }
17870
- get isOpened() {
17871
- return Boolean(this._activeMessage);
17872
- }
17873
- async preload(payload) {
17874
- const config = await this.storyManager.waitForConfig();
17875
- if (config.anonymous) {
17876
- console.warn("[IAS]: You can't preload IAM in anonymous access mode");
17877
- return [];
17878
- }
17879
- const messages = await this.iamStore.preload(payload);
17880
- this.emit(IamReaderEvent.Loaded, {
17881
- messages
17882
- });
17883
- return messages;
17884
- }
17885
- async showMessageById(messageId, options = {}) {
17886
- const config = await this.storyManager.waitForConfig();
17887
- if (config.anonymous)
17888
- throw new IamMessageAnonymousOpen(messageId);
17889
- this.checkMessageNotOpened();
17890
- const message = await this.iamDisplayService.getMessageById(messageId, options);
17891
- await this.open(message);
17892
- return message;
17893
- }
17894
- async showMessageByEvent(eventName, options = {}) {
17895
- const config = await this.storyManager.waitForConfig();
17896
- if (config.anonymous)
17897
- throw new IamMessageAnonymousOpen(eventName);
17898
- this.checkMessageNotOpened();
17899
- const message = await this.iamDisplayService.getMessageByEvent(eventName, options);
17900
- await this.open(message);
17901
- return message;
17902
- }
17903
- async forceClose() {
17904
- if (!this._activeMessage)
17905
- return;
17906
- this.emitCloseEvent(this._activeMessage);
17907
- this.clearActiveMessage();
17908
- this.visibilityObserver.unsubscribe();
17909
- this.touchController.destroy();
17910
- this.scrollbarHelper.disable();
17911
- }
17912
- async close() {
17913
- var _b;
17914
- if ((_b = this._activeMessage) === null || _b === void 0 ? void 0 : _b.disableClose)
17915
- return;
17916
- this.forceClose();
17917
- }
17918
- async open(message) {
17919
- message.updatePlaceholders(this.storyManager.rootStore.placeholderStore.placeholders);
17920
- this.touchController.init(document.body);
17921
- this.setActiveMessage(message);
17922
- this.visibilityObserver.subscribe();
17923
- this.scrollbarHelper.enable();
17924
- }
17925
- destroy() { }
17926
- emitWidgetEvent(widgetEvent) {
17927
- if (!this.activeMessage)
17928
- return;
17929
- this.emit(IamReaderEvent.WidgetEvent, {
17930
- message: this.activeMessage.toPublicDto(),
17931
- name: widgetEvent.type,
17932
- data: widgetEvent.widgetPayload
17933
- });
17934
- this.storyManager.emit(StoryManagerEvent.WidgetEvent, {
17935
- name: widgetEvent.type,
17936
- data: widgetEvent.widgetPayload
17937
- });
17938
- }
17939
- emitCloseEvent(message) {
17940
- this.emit(IamReaderEvent.Close, {
17941
- message: message.toPublicDto()
17942
- });
17943
- }
17944
- setActiveMessage(message) {
17945
- const activeMessage = this.createIamMessageViewModel(message);
17946
- const { iterationId } = activeMessage.open();
17947
- this._activeMessage = activeMessage;
17948
- this.iamStatisticsService.sendOpenEvent({
17949
- messageId: activeMessage.id,
17950
- iterationId: iterationId,
17951
- slidesTotal: activeMessage.slides.length,
17952
- slideIndex: activeMessage.activeSlideIndex
17953
- });
17954
- }
17955
- clearActiveMessage() {
17956
- if (!this._activeMessage)
17957
- return;
17958
- const activeMessage = this._activeMessage;
17959
- this._activeMessage = null;
17960
- this.iamStatisticsService.sendCloseEvent({
17961
- messageId: activeMessage.id,
17962
- iterationId: activeMessage.iterationId,
17963
- slidesTotal: activeMessage.slides.length,
17964
- slideIndex: activeMessage.activeSlideIndex,
17965
- duration: activeMessage.timeSinceLastShow,
17966
- slideAnalytics: activeMessage.slidesAnalytics
17967
- });
17968
- }
17969
- createIamMessageViewModel(message) {
17970
- if (message.slides.length > 1) {
17971
- return new IamMultiSlideMessageViewModel(this, this.storyManager, message, this.iamStatisticsService);
17972
- }
17973
- else {
17974
- return new IamMessageViewModel(this, this.storyManager, message, this.iamStatisticsService);
17975
- }
17976
- }
17977
- checkMessageNotOpened() {
17978
- if (this.activeMessage)
17979
- throw new IamMessageOpenError(this.activeMessage.id);
17980
- }
17981
- },
17982
- _IamReaderViewModel__activeMessage_accessor_storage = new WeakMap(),
17983
- (() => {
17984
- var _b;
17985
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
17986
- __activeMessage_decorators = [external_mobx_namespaceObject.observable];
17987
- _showMessageById_decorators = [external_mobx_namespaceObject.action];
17988
- _showMessageByEvent_decorators = [external_mobx_namespaceObject.action];
17989
- _close_decorators = [external_mobx_namespaceObject.action];
17990
- iamReaderViewModel_esDecorate(_a, null, __activeMessage_decorators, { kind: "accessor", name: "_activeMessage", static: false, private: false, access: { has: obj => "_activeMessage" in obj, get: obj => obj._activeMessage, set: (obj, value) => { obj._activeMessage = value; } }, metadata: _metadata }, __activeMessage_initializers, __activeMessage_extraInitializers);
17991
- iamReaderViewModel_esDecorate(_a, null, _showMessageById_decorators, { kind: "method", name: "showMessageById", static: false, private: false, access: { has: obj => "showMessageById" in obj, get: obj => obj.showMessageById }, metadata: _metadata }, null, _instanceExtraInitializers);
17992
- iamReaderViewModel_esDecorate(_a, null, _showMessageByEvent_decorators, { kind: "method", name: "showMessageByEvent", static: false, private: false, access: { has: obj => "showMessageByEvent" in obj, get: obj => obj.showMessageByEvent }, metadata: _metadata }, null, _instanceExtraInitializers);
17993
- iamReaderViewModel_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);
17994
- if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
17995
- })(),
17996
- Object.defineProperty(_a, "id", {
17997
- enumerable: true,
17998
- configurable: true,
17999
- writable: true,
18000
- value: "IamReaderViewModel"
18001
- }),
18002
- _a;
18003
- })();
18004
-
18005
-
18006
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamReader/index.ts
18007
-
18008
-
18009
-
18010
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/actions/openUrlAction.ts
18011
-
18012
-
18013
- class openUrlAction_OpenUrlAction {
18014
- constructor(iamReader, storyManager, iamMessage, iamStatisticsService) {
18015
- Object.defineProperty(this, "iamReader", {
18016
- enumerable: true,
18017
- configurable: true,
18018
- writable: true,
18019
- value: iamReader
18020
- });
18021
- Object.defineProperty(this, "storyManager", {
18022
- enumerable: true,
18023
- configurable: true,
18024
- writable: true,
18025
- value: storyManager
18026
- });
18027
- Object.defineProperty(this, "iamMessage", {
18028
- enumerable: true,
18029
- configurable: true,
18030
- writable: true,
18031
- value: iamMessage
18032
- });
18033
- Object.defineProperty(this, "iamStatisticsService", {
18034
- enumerable: true,
18035
- configurable: true,
18036
- writable: true,
18037
- value: iamStatisticsService
18038
- });
18039
- }
18040
- handle(payload) {
18041
- const url = payload.linkTarget;
18042
- const event = {
18043
- src: StoryManagerLinkEventSource.IamReader,
18044
- data: {
18045
- id: this.iamMessage.id,
18046
- index: this.iamMessage.activeSlideIndex,
18047
- url,
18048
- elementId: payload.elementId
18049
- }
18050
- };
18051
- this.storyManager.storyLinkClickHandler(event);
18052
- // @deprecated
18053
- this.storyManager.emit("clickOnButton", event);
18054
- this.iamReader.emit(IamReaderEvent.ClickOnButton, event);
18055
- }
18056
- }
18057
-
18058
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/actions/showStoryAction.ts
18059
-
18060
- class showStoryAction_ShowStoryAction {
18061
- constructor(storyManager, message) {
18062
- Object.defineProperty(this, "storyManager", {
18063
- enumerable: true,
18064
- configurable: true,
18065
- writable: true,
18066
- value: storyManager
18067
- });
18068
- Object.defineProperty(this, "message", {
18069
- enumerable: true,
18070
- configurable: true,
18071
- writable: true,
18072
- value: message
18073
- });
18074
- }
18075
- async handle(payload) {
18076
- try {
18077
- await this.storyManager.showStory(payload.storyId);
18078
- this.message.pauseAndLock();
18079
- this.storyManager.storyReader.once(StoryReaderEvent.Close, () => {
18080
- this.message.resumeAndUnlock();
18081
- });
18082
- }
18083
- catch (error) {
18084
- console.error(error);
18085
- }
18086
- }
18087
- }
18088
-
18089
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/actions/index.ts
18090
-
18091
-
18092
-
18093
-
18094
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/narrativeDataCache.ts
18095
- class narrativeDataCache_NarrativeDataCache {
18096
- constructor() {
18097
- Object.defineProperty(this, "cache", {
18098
- enumerable: true,
18099
- configurable: true,
18100
- writable: true,
18101
- value: {}
18102
- });
18103
- }
18104
- set(key, value) {
18105
- this.cache[key] = value;
18106
- }
18107
- clear() {
18108
- this.cache = {};
18109
- }
18110
- get(key) {
18111
- return this.cache[key];
18112
- }
18113
- }
18114
-
18115
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/iamSlideApiHandlers.ts
18116
-
18117
-
18118
-
18119
-
18120
-
18121
- class IamSlideApiHandlers {
18122
- constructor(storyManager, iamReader, iamMessage, iamStatisticsService) {
18123
- Object.defineProperty(this, "storyManager", {
18124
- enumerable: true,
18125
- configurable: true,
18126
- writable: true,
18127
- value: storyManager
18128
- });
18129
- Object.defineProperty(this, "iamReader", {
18130
- enumerable: true,
18131
- configurable: true,
18132
- writable: true,
18133
- value: iamReader
18134
- });
18135
- Object.defineProperty(this, "iamMessage", {
18136
- enumerable: true,
18137
- configurable: true,
18138
- writable: true,
18139
- value: iamMessage
18140
- });
18141
- Object.defineProperty(this, "iamStatisticsService", {
18142
- enumerable: true,
18143
- configurable: true,
18144
- writable: true,
18145
- value: iamStatisticsService
18146
- });
18147
- Object.defineProperty(this, "activeMessageNarrativeDataCache", {
18148
- enumerable: true,
18149
- configurable: true,
18150
- writable: true,
18151
- value: new narrativeDataCache_NarrativeDataCache()
18152
- });
18153
- Object.defineProperty(this, "narrativeDataCache", {
18154
- enumerable: true,
18155
- configurable: true,
18156
- writable: true,
18157
- value: new narrativeDataCache_NarrativeDataCache()
18158
- });
18159
- }
18160
- onEvent(name, event) {
18161
- try {
18162
- switch (name) {
18163
- case "showSlide":
18164
- if (this.iamMessage instanceof IamMultiSlideMessageViewModel) {
18165
- this.iamMessage.onShowSlide(event.index);
18166
- }
18167
- case "slideLeft":
18168
- {
18169
- if (this.iamMessage instanceof IamMultiSlideMessageViewModel) {
18170
- this.iamMessage.onSlideLeft(event.index);
18171
- }
18172
- }
18173
- break;
18174
- }
18175
- }
18176
- catch (error) {
18177
- console.error(error);
18178
- }
18179
- }
18180
- onCardLoadingStateChange(state) {
18181
- switch (state) {
18182
- case 0 /* CARD_LOADING_STATE.LOADING */:
18183
- this.iamMessage.showLoaderScreen();
18184
- break;
18185
- case 1 /* CARD_LOADING_STATE.LOADED */:
18186
- this.iamMessage.hideErrorScreen();
18187
- this.iamMessage.hideLoaderScreen();
18188
- break;
18189
- case 2 /* CARD_LOADING_STATE.LOADING_ERROR */:
18190
- this.iamMessage.showErrorScreen();
18191
- break;
18192
- }
18193
- }
18194
- clearActiveNarrativeDataCache() {
18195
- this.activeMessageNarrativeDataCache.clear();
18196
- }
18197
- writeToClipboard(data) {
18198
- new Clipboard().copy(data.textValue);
18199
- }
18200
- updateCardServerDataLocally(data) {
18201
- this.iamMessage.context.updateNarrativeData(data);
18202
- }
18203
- openUrl(data) {
18204
- if (data.type === "swipeUpItems")
18205
- return;
18206
- new openUrlAction_OpenUrlAction(this.iamReader, this.storyManager, this.iamMessage, this.iamStatisticsService).handle({
18207
- linkTarget: data.link.target,
18208
- elementId: data.elementId
18209
- });
18210
- }
18211
- closeCard(reason) {
18212
- this.iamReader.forceClose();
18213
- }
18214
- openStory(id, index) {
18215
- new showStoryAction_ShowStoryAction(this.storyManager, this.iamMessage).handle({
18216
- storyId: id
18217
- });
18218
- }
18219
- openGame(gameInstanceId) {
18220
- new openGameAction_OpenGameAction(this.storyManager, this.iamMessage).handle({ gameInstanceId });
18221
- }
18222
- disableVerticalSwipeGesture() {
18223
- this.iamReader.touchController.disableVerticalSwipeGesture();
18224
- }
18225
- enableVerticalSwipeGesture() {
18226
- this.iamReader.touchController.enableVerticalSwipeGesture();
18227
- }
18228
- disableHorizontalSwipeGesture() {
18229
- this.iamReader.touchController.disableHorizontalSwipeGesture();
18230
- }
18231
- enableHorizontalSwipeGesture() {
18232
- this.iamReader.touchController.enableHorizontalSwipeGesture();
18233
- }
18234
- async getCardLocalData() {
18235
- let localData = this.narrativeDataCache.get(`iam_${this.iamMessage.id}_data_${this.storyManager.rootStore.sessionStore.userId}`);
18236
- if (localData)
18237
- return JSON.parse(localData);
18238
- return {};
18239
- }
18240
- setCardLocalData(obj, sendToServer) {
18241
- let data = JSON.stringify(obj);
18242
- this.narrativeDataCache.set(`iam_${this.iamMessage.id}_data_${this.storyManager.rootStore.sessionStore.userId}`, data);
18243
- this.iamMessage.context.updateNarrativeData(obj);
18244
- if (sendToServer)
18245
- this.iamMessage.updateUserData(data).catch(console.error);
18246
- }
18247
- getCardServerData(messageId) {
18248
- var _a;
18249
- const widgetsData = this.iamMessage.context.widgetsData;
18250
- return (_a = widgetsData._narrative_saved_data) !== null && _a !== void 0 ? _a : null;
18251
- }
18252
- showCardTextInput(id, config) { }
18253
- setCardSessionValue(key, value) {
18254
- this.activeMessageNarrativeDataCache.set(key, value);
18255
- }
18256
- getCardSessionValue(key) {
18257
- return this.activeMessageNarrativeDataCache.get(key);
18258
- }
18259
- getWidgetsSharedData(messageId, widget) {
18260
- const widgetsData = this.iamMessage.context.widgetsData;
18261
- switch (widget) {
18262
- case "rangeSlider" /* Widgets.RangeSlider */: {
18263
- return widgetsData._narrative_range_slider_data;
18264
- }
18265
- case "poll" /* Widgets.Poll */: {
18266
- return widgetsData._narrative_poll_data;
18267
- }
18268
- case "vote" /* Widgets.Vote */: {
18269
- return widgetsData._narrative_vote_data;
18270
- }
18271
- }
18272
- return null;
18273
- }
18274
- async sendApiRequest(url, method, params, headers, data, profilingKey) {
18275
- var _a, _b, _c;
18276
- try {
18277
- const response = await api.request({
18278
- url,
18279
- method: method,
18280
- params: params !== null && params !== void 0 ? params : {},
18281
- headers: headers !== null && headers !== void 0 ? headers : {},
18282
- data: data !== null && data !== void 0 ? data : {}
18283
- });
18284
- return {
18285
- status: response.status,
18286
- headers: response.headers,
18287
- data: response.data
18288
- };
18289
- }
18290
- catch (error) {
18291
- if (error instanceof ApiRequestError) {
18292
- return {
18293
- status: (_a = error.networkStatus) !== null && _a !== void 0 ? _a : 400,
18294
- headers: (_b = error.response) === null || _b === void 0 ? void 0 : _b.headers,
18295
- data: (_c = error.response) === null || _c === void 0 ? void 0 : _c.data
18296
- };
18297
- }
18298
- }
18299
- }
18300
- share(id, config) { }
18301
- shareSlideScreenshot(shareId, hideElementsSelector, shareText) { }
18302
- showLayer(index) {
18303
- this.iamMessage.showLayerByIndex(index);
18304
- }
18305
- showCardSlide(slideIndex) { }
18306
- cardShowNext() { }
18307
- showNextSlide() { }
18308
- sendStatisticEvent(eventName, data, devPayload, forceEnableStatisticV2) {
18309
- this.iamStatisticsService.sendWidgetEvent({
18310
- iterationId: this.iamMessage.iterationId,
18311
- messageId: this.iamMessage.id,
18312
- slideIndex: this.iamMessage.activeSlideIndex,
18313
- slideTotal: this.iamMessage.slides.length,
18314
- duration: this.iamMessage.timeSinceLastShow,
18315
- type: eventName,
18316
- widgetPayload: data
17569
+ Object.defineProperty(this, "activeMessageNarrativeDataCache", {
17570
+ enumerable: true,
17571
+ configurable: true,
17572
+ writable: true,
17573
+ value: new narrativeDataCache_NarrativeDataCache()
18317
17574
  });
18318
- this.iamReader.emitWidgetEvent({
18319
- type: eventName,
18320
- widgetPayload: devPayload !== null && devPayload !== void 0 ? devPayload : {}
17575
+ Object.defineProperty(this, "narrativeDataCache", {
17576
+ enumerable: true,
17577
+ configurable: true,
17578
+ writable: true,
17579
+ value: new narrativeDataCache_NarrativeDataCache()
18321
17580
  });
18322
17581
  }
18323
- async resetCard(messageId) { }
18324
- getCardFonts() {
18325
- var _a, _b;
18326
- return (_b = (_a = this.storyManager.rootStore.sessionStore.session) === null || _a === void 0 ? void 0 : _a.fontsResources) !== null && _b !== void 0 ? _b : [];
18327
- }
18328
- updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError) {
18329
- if (showLoader)
18330
- this.iamMessage.showLoaderScreen();
18331
- else
18332
- this.iamMessage.hideLoaderScreen();
18333
- if (showError)
18334
- this.iamMessage.showErrorScreen();
18335
- else
18336
- this.iamMessage.hideErrorScreen();
18337
- }
18338
- showToast(text) {
18339
- this.iamMessage.showToast({ content: text });
18340
- }
18341
- }
18342
-
18343
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/nullIamMessageSlideViewModel.ts
18344
- class NullIamMessageSlideViewModel {
18345
- get isLoading() {
18346
- return true;
18347
- }
18348
- get html() {
18349
- return "";
18350
- }
18351
- get navigationDisabled() {
18352
- return false;
17582
+ onWidgetRequirePauseUI() {
17583
+ this.iamMessage.pauseAndLock();
18353
17584
  }
18354
- async reload() {
18355
- return {
18356
- currentTime: Date.now()
18357
- };
17585
+ onWidgetRequireResumeUI() {
17586
+ this.iamMessage.resumeAndUnlock();
18358
17587
  }
18359
- mute() { }
18360
- unmute() { }
18361
- notifyTimerEnd() { }
18362
- pauseAndLock() { }
18363
- resumeAndUnlock() { }
18364
- async showLayerByIndex(index) { }
18365
- setUserData(id, text) { }
18366
- setShareComplete(id, isSuccess) { }
18367
- notifySwipeUp(target) { }
18368
- showToast(options) { }
18369
- async init() { }
18370
- async start() { }
18371
- async restart() { }
18372
- async resumeByApp() { }
18373
- async pauseByApp() { }
18374
- async resumeByUser() { }
18375
- async pauseByUser() { }
18376
- async stop() { }
18377
- onClick(event, currentTarget) { }
18378
- async destroy() { }
18379
- }
18380
-
18381
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/iamMessageViewModel.ts
18382
- var iamMessageViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
18383
- var useValue = arguments.length > 2;
18384
- for (var i = 0; i < initializers.length; i++) {
18385
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
17588
+ productCartUpdate(data) {
17589
+ return Promise.reject({ message: "Not implemented" });
18386
17590
  }
18387
- return useValue ? value : void 0;
18388
- };
18389
- var iamMessageViewModel_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
18390
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
18391
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
18392
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
18393
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
18394
- var _, done = false;
18395
- for (var i = decorators.length - 1; i >= 0; i--) {
18396
- var context = {};
18397
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
18398
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
18399
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
18400
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
18401
- if (kind === "accessor") {
18402
- if (result === void 0) continue;
18403
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
18404
- if (_ = accept(result.get)) descriptor.get = _;
18405
- if (_ = accept(result.set)) descriptor.set = _;
18406
- if (_ = accept(result.init)) initializers.unshift(_);
18407
- }
18408
- else if (_ = accept(result)) {
18409
- if (kind === "field") initializers.unshift(_);
18410
- else descriptor[key] = _;
18411
- }
17591
+ productCartClicked() { }
17592
+ async productCartGetState() {
17593
+ return Promise.reject("Not implemented");
18412
17594
  }
18413
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
18414
- done = true;
18415
- };
18416
- var iamMessageViewModel_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18417
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
18418
- 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");
18419
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
18420
- };
18421
- var iamMessageViewModel_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
18422
- if (kind === "m") throw new TypeError("Private method is not writable");
18423
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
18424
- 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");
18425
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
18426
- };
18427
-
18428
-
18429
-
18430
-
18431
-
18432
-
18433
-
18434
-
18435
- let IamMessageViewModel = (() => {
18436
- var _a, _IamMessageViewModel__isOnceOpened_accessor_storage, _IamMessageViewModel__$root_accessor_storage, _IamMessageViewModel__needShowErrorScreen_accessor_storage, _IamMessageViewModel__needShowLoaderScreen_accessor_storage;
18437
- let _classSuper = events.EventEmitter;
18438
- let _instanceExtraInitializers = [];
18439
- let __isOnceOpened_decorators;
18440
- let __isOnceOpened_initializers = [];
18441
- let __isOnceOpened_extraInitializers = [];
18442
- let __$root_decorators;
18443
- let __$root_initializers = [];
18444
- let __$root_extraInitializers = [];
18445
- let __needShowErrorScreen_decorators;
18446
- let __needShowErrorScreen_initializers = [];
18447
- let __needShowErrorScreen_extraInitializers = [];
18448
- let __needShowLoaderScreen_decorators;
18449
- let __needShowLoaderScreen_initializers = [];
18450
- let __needShowLoaderScreen_extraInitializers = [];
18451
- let _showErrorScreen_decorators;
18452
- let _showLoaderScreen_decorators;
18453
- let _hideLoaderScreen_decorators;
18454
- let _hideErrorScreen_decorators;
18455
- return _a = class IamMessageViewModel extends _classSuper {
18456
- get _isOnceOpened() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__isOnceOpened_accessor_storage, "f"); }
18457
- set _isOnceOpened(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__isOnceOpened_accessor_storage, value, "f"); }
18458
- get _$root() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__$root_accessor_storage, "f"); }
18459
- set _$root(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__$root_accessor_storage, value, "f"); }
18460
- get _needShowErrorScreen() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__needShowErrorScreen_accessor_storage, "f"); }
18461
- set _needShowErrorScreen(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__needShowErrorScreen_accessor_storage, value, "f"); }
18462
- get _needShowLoaderScreen() { return iamMessageViewModel_classPrivateFieldGet(this, _IamMessageViewModel__needShowLoaderScreen_accessor_storage, "f"); }
18463
- set _needShowLoaderScreen(value) { iamMessageViewModel_classPrivateFieldSet(this, _IamMessageViewModel__needShowLoaderScreen_accessor_storage, value, "f"); }
18464
- constructor(iamReader, storyManager, iamMessage, iamStatisticsService) {
18465
- super();
18466
- Object.defineProperty(this, "iamReader", {
18467
- enumerable: true,
18468
- configurable: true,
18469
- writable: true,
18470
- value: (iamMessageViewModel_runInitializers(this, _instanceExtraInitializers), iamReader)
18471
- });
18472
- Object.defineProperty(this, "storyManager", {
18473
- enumerable: true,
18474
- configurable: true,
18475
- writable: true,
18476
- value: storyManager
18477
- });
18478
- Object.defineProperty(this, "iamMessage", {
18479
- enumerable: true,
18480
- configurable: true,
18481
- writable: true,
18482
- value: iamMessage
18483
- });
18484
- Object.defineProperty(this, "iamStatisticsService", {
18485
- enumerable: true,
18486
- configurable: true,
18487
- writable: true,
18488
- value: iamStatisticsService
18489
- });
18490
- Object.defineProperty(this, "_slides", {
18491
- enumerable: true,
18492
- configurable: true,
18493
- writable: true,
18494
- value: []
18495
- });
18496
- Object.defineProperty(this, "slideApiHandlers", {
18497
- enumerable: true,
18498
- configurable: true,
18499
- writable: true,
18500
- value: void 0
18501
- });
18502
- _IamMessageViewModel__isOnceOpened_accessor_storage.set(this, iamMessageViewModel_runInitializers(this, __isOnceOpened_initializers, false));
18503
- _IamMessageViewModel__$root_accessor_storage.set(this, (iamMessageViewModel_runInitializers(this, __isOnceOpened_extraInitializers), iamMessageViewModel_runInitializers(this, __$root_initializers, null)));
18504
- _IamMessageViewModel__needShowErrorScreen_accessor_storage.set(this, (iamMessageViewModel_runInitializers(this, __$root_extraInitializers), iamMessageViewModel_runInitializers(this, __needShowErrorScreen_initializers, false)));
18505
- _IamMessageViewModel__needShowLoaderScreen_accessor_storage.set(this, (iamMessageViewModel_runInitializers(this, __needShowErrorScreen_extraInitializers), iamMessageViewModel_runInitializers(this, __needShowLoaderScreen_initializers, false)));
18506
- Object.defineProperty(this, "touchController", {
18507
- enumerable: true,
18508
- configurable: true,
18509
- writable: true,
18510
- value: iamMessageViewModel_runInitializers(this, __needShowLoaderScreen_extraInitializers)
18511
- });
18512
- Object.defineProperty(this, "slideApi", {
18513
- enumerable: true,
18514
- configurable: true,
18515
- writable: true,
18516
- value: void 0
18517
- });
18518
- Object.defineProperty(this, "attachRoot", {
18519
- enumerable: true,
18520
- configurable: true,
18521
- writable: true,
18522
- value: (el) => {
18523
- this._$root = el;
18524
- this.createSlidesViewModels();
18525
- }
18526
- });
18527
- this.touchController = iamReader.touchController;
18528
- this.slideApiHandlers = new IamSlideApiHandlers(this.storyManager, this.iamReader, this, this.iamStatisticsService);
18529
- }
18530
- get id() {
18531
- return this.iamMessage.id;
18532
- }
18533
- get $root() {
18534
- return this._$root;
18535
- }
18536
- get activeSlideIndex() {
18537
- return 0;
18538
- }
18539
- get activeSlide() {
18540
- var _b;
18541
- return (_b = this._slides[this.activeSlideIndex]) !== null && _b !== void 0 ? _b : new NullIamMessageSlideViewModel();
18542
- }
18543
- get slides() {
18544
- return this._slides;
18545
- }
18546
- get context() {
18547
- return this.iamMessage.context;
18548
- }
18549
- get appearanceOptions() {
18550
- return this.iamMessage.appearanceOptions;
18551
- }
18552
- get iterationId() {
18553
- return this.iamMessage.iterationId;
18554
- }
18555
- get type() {
18556
- return this.iamMessage.type;
18557
- }
18558
- get needShowErrorScreen() {
18559
- return this._needShowErrorScreen;
18560
- }
18561
- get needShowLoaderScreen() {
18562
- return this._needShowLoaderScreen;
17595
+ onEvent(name, event) {
17596
+ try {
17597
+ switch (name) {
17598
+ case "showSlide":
17599
+ this.iamMessage.onShowSlide(event.index);
17600
+ case "slideLeft":
17601
+ this.iamMessage.onSlideLeft(event.index);
17602
+ break;
18563
17603
  }
18564
- get timeSinceLastShow() {
18565
- return this.iamMessage.timeSinceLastShow;
17604
+ }
17605
+ catch (error) {
17606
+ console.error(error);
17607
+ }
17608
+ }
17609
+ onCardLoadingStateChange(state) {
17610
+ switch (state) {
17611
+ case 0 /* CARD_LOADING_STATE.LOADING */:
17612
+ this.iamMessage.showLoaderScreen();
17613
+ break;
17614
+ case 1 /* CARD_LOADING_STATE.LOADED */:
17615
+ this.iamMessage.hideErrorScreen();
17616
+ this.iamMessage.hideLoaderScreen();
17617
+ break;
17618
+ case 2 /* CARD_LOADING_STATE.LOADING_ERROR */:
17619
+ this.iamMessage.showErrorScreen();
17620
+ break;
17621
+ }
17622
+ }
17623
+ clearActiveNarrativeDataCache() {
17624
+ this.activeMessageNarrativeDataCache.clear();
17625
+ }
17626
+ writeToClipboard(data) {
17627
+ new Clipboard().copy(data.textValue);
17628
+ }
17629
+ updateCardServerDataLocally(data) {
17630
+ this.iamMessage.context.updateNarrativeData(data);
17631
+ }
17632
+ openUrl(data) {
17633
+ if (data.type === "swipeUpItems")
17634
+ return;
17635
+ new openUrlAction_OpenUrlAction(this.iamReader, this.storyManager, this.iamMessage, this.iamStatisticsService).handle({
17636
+ linkTarget: data.link.target,
17637
+ elementId: data.elementId
17638
+ });
17639
+ }
17640
+ closeCard(reason) {
17641
+ this.iamReader.forceClose();
17642
+ }
17643
+ openStory(id, index) {
17644
+ new showStoryAction_ShowStoryAction(this.storyManager, this.iamMessage).handle({
17645
+ storyId: id
17646
+ });
17647
+ }
17648
+ openGame(gameInstanceId) {
17649
+ new openGameAction_OpenGameAction(this.storyManager, this.iamMessage).handle({ gameInstanceId });
17650
+ }
17651
+ disableVerticalSwipeGesture() {
17652
+ this.iamReader.touchController.disableVerticalSwipeGesture();
17653
+ }
17654
+ enableVerticalSwipeGesture() {
17655
+ this.iamReader.touchController.enableVerticalSwipeGesture();
17656
+ }
17657
+ disableHorizontalSwipeGesture() {
17658
+ this.iamReader.touchController.disableHorizontalSwipeGesture();
17659
+ }
17660
+ enableHorizontalSwipeGesture() {
17661
+ this.iamReader.touchController.enableHorizontalSwipeGesture();
17662
+ }
17663
+ async getCardLocalData() {
17664
+ let localData = this.narrativeDataCache.get(`iam_${this.iamMessage.id}_data_${this.storyManager.rootStore.sessionStore.userId}`);
17665
+ if (localData)
17666
+ return JSON.parse(localData);
17667
+ return {};
17668
+ }
17669
+ setCardLocalData(obj, sendToServer) {
17670
+ let data = JSON.stringify(obj);
17671
+ this.narrativeDataCache.set(`iam_${this.iamMessage.id}_data_${this.storyManager.rootStore.sessionStore.userId}`, data);
17672
+ this.iamMessage.context.updateNarrativeData(obj);
17673
+ if (sendToServer)
17674
+ this.iamMessage.updateUserData(data).catch(console.error);
17675
+ }
17676
+ getCardServerData(messageId) {
17677
+ var _a;
17678
+ const widgetsData = this.iamMessage.context.widgetsData;
17679
+ return (_a = widgetsData._narrative_saved_data) !== null && _a !== void 0 ? _a : null;
17680
+ }
17681
+ showCardTextInput(id, config) { }
17682
+ setCardSessionValue(key, value) {
17683
+ this.activeMessageNarrativeDataCache.set(key, value);
17684
+ }
17685
+ getCardSessionValue(key) {
17686
+ return this.activeMessageNarrativeDataCache.get(key);
17687
+ }
17688
+ getWidgetsSharedData(messageId, widget) {
17689
+ const widgetsData = this.iamMessage.context.widgetsData;
17690
+ switch (widget) {
17691
+ case "rangeSlider" /* Widgets.RangeSlider */: {
17692
+ return widgetsData._narrative_range_slider_data;
18566
17693
  }
18567
- get disableClose() {
18568
- return this.iamMessage.disableClose;
17694
+ case "poll" /* Widgets.Poll */: {
17695
+ return widgetsData._narrative_poll_data;
18569
17696
  }
18570
- get slidesAnalytics() {
18571
- return [{ slideIndex: this.activeSlideIndex, duration: this.timeSinceLastShow }];
17697
+ case "vote" /* Widgets.Vote */: {
17698
+ return widgetsData._narrative_vote_data;
18572
17699
  }
18573
- open() {
18574
- this._isOnceOpened = true;
18575
- const iterationId = this.iamMessage.trackOpen();
17700
+ }
17701
+ return null;
17702
+ }
17703
+ async sendApiRequest(url, method, params, headers, data, profilingKey) {
17704
+ var _a, _b, _c;
17705
+ try {
17706
+ const response = await api.request({
17707
+ url,
17708
+ method: method,
17709
+ params: params !== null && params !== void 0 ? params : {},
17710
+ headers: headers !== null && headers !== void 0 ? headers : {},
17711
+ data: data !== null && data !== void 0 ? data : {}
17712
+ });
17713
+ return {
17714
+ status: response.status,
17715
+ headers: response.headers,
17716
+ data: response.data
17717
+ };
17718
+ }
17719
+ catch (error) {
17720
+ if (error instanceof ApiRequestError) {
18576
17721
  return {
18577
- iterationId
17722
+ status: (_a = error.networkStatus) !== null && _a !== void 0 ? _a : 400,
17723
+ headers: (_b = error.response) === null || _b === void 0 ? void 0 : _b.headers,
17724
+ data: (_c = error.response) === null || _c === void 0 ? void 0 : _c.data
18578
17725
  };
18579
17726
  }
18580
- async updateUserData(data) {
18581
- return this.storyManager.rootStore.iamStore.updateMessageUserData(this.id, data);
18582
- }
18583
- async init() {
18584
- await this.activeSlide.init();
18585
- }
18586
- async start() {
18587
- await this.activeSlide.start();
18588
- }
18589
- async stop() {
18590
- this.slideApiHandlers.clearActiveNarrativeDataCache();
18591
- await this.activeSlide.stop();
18592
- }
18593
- onClick(event, currentTarget) {
18594
- this.activeSlide.onClick(event, currentTarget);
18595
- }
18596
- toPublicDto() {
18597
- return this.iamMessage.toPublicDto();
18598
- }
18599
- showErrorScreen() {
18600
- this._needShowErrorScreen = true;
18601
- }
18602
- showLoaderScreen() {
18603
- this._needShowLoaderScreen = true;
18604
- }
18605
- hideLoaderScreen() {
18606
- this._needShowLoaderScreen = false;
18607
- }
18608
- hideErrorScreen() {
18609
- this._needShowErrorScreen = false;
18610
- }
18611
- async destroy() {
18612
- var _b;
18613
- return (_b = this.slideApi) === null || _b === void 0 ? void 0 : _b.destroy();
18614
- }
18615
- resumeAndUnlock() {
18616
- this.activeSlide.resumeAndUnlock();
18617
- }
18618
- pauseAndLock() {
18619
- this.activeSlide.resumeAndUnlock();
18620
- }
18621
- showLayerByIndex(index) {
18622
- this.activeSlide.showLayerByIndex(index);
18623
- }
18624
- showToast(options) {
18625
- this.activeSlide.showToast(options);
18626
- }
18627
- restart() {
18628
- var _b;
18629
- return (_b = this.activeSlide) === null || _b === void 0 ? void 0 : _b.restart();
18630
- }
18631
- createSlidesViewModels() {
18632
- if (this._slides.length > 0)
18633
- return;
18634
- const isFullscreen = this.type === IamMessageType.Fullscreen;
18635
- const slideApi = new slide_api_namespaceObject.SlideApi(this.slideApiHandlers, {
18636
- root: this._$root,
18637
- slideRatio: this.getContentRatio(),
18638
- isFullscreen,
18639
- nonce: getNonce(),
18640
- viewport: window,
18641
- userResizeHandler: undefined,
18642
- VODPlayer: this.storyManager.globalProperties.$videoOnDemand,
18643
- useSdkCacheForMultislideMode: false
18644
- });
18645
- this._slides = this.iamMessage.slides.map(slide => new IamMessageSlideViewModel(this, slide, slideApi));
18646
- this.slideApi = slideApi;
18647
- }
18648
- getContentRatio() {
18649
- if (this.appearanceOptions instanceof IamBottomSheetAppearanceOptions ||
18650
- this.appearanceOptions instanceof IamModalAppearanceOptions)
18651
- return this.appearanceOptions.contentRatio;
18652
- return 9 / 16;
18653
- }
18654
- },
18655
- _IamMessageViewModel__isOnceOpened_accessor_storage = new WeakMap(),
18656
- _IamMessageViewModel__$root_accessor_storage = new WeakMap(),
18657
- _IamMessageViewModel__needShowErrorScreen_accessor_storage = new WeakMap(),
18658
- _IamMessageViewModel__needShowLoaderScreen_accessor_storage = new WeakMap(),
18659
- (() => {
18660
- var _b;
18661
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
18662
- __isOnceOpened_decorators = [external_mobx_namespaceObject.observable];
18663
- __$root_decorators = [external_mobx_namespaceObject.observable];
18664
- __needShowErrorScreen_decorators = [external_mobx_namespaceObject.observable];
18665
- __needShowLoaderScreen_decorators = [external_mobx_namespaceObject.observable];
18666
- _showErrorScreen_decorators = [external_mobx_namespaceObject.action];
18667
- _showLoaderScreen_decorators = [external_mobx_namespaceObject.action];
18668
- _hideLoaderScreen_decorators = [external_mobx_namespaceObject.action];
18669
- _hideErrorScreen_decorators = [external_mobx_namespaceObject.action];
18670
- 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);
18671
- 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);
18672
- 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);
18673
- 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);
18674
- 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);
18675
- 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);
18676
- 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);
18677
- 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);
18678
- if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
18679
- })(),
18680
- _a;
18681
- })();
18682
-
17727
+ }
17728
+ }
17729
+ share(id, config) { }
17730
+ shareSlideScreenshot(shareId, hideElementsSelector, shareText) { }
17731
+ showLayer(index) {
17732
+ this.iamMessage.showLayerByIndex(index);
17733
+ }
17734
+ showCardSlide(slideIndex) { }
17735
+ cardShowNext() { }
17736
+ showNextSlide() { }
17737
+ sendStatisticEvent(eventName, data, devPayload, forceEnableStatisticV2) {
17738
+ this.iamStatisticsService.sendWidgetEvent({
17739
+ iterationId: this.iamMessage.iterationId,
17740
+ messageId: this.iamMessage.id,
17741
+ slideIndex: this.iamMessage.activeSlideIndex,
17742
+ slideTotal: this.iamMessage.slides.length,
17743
+ duration: this.iamMessage.timeSinceLastShow,
17744
+ type: eventName,
17745
+ widgetPayload: data
17746
+ });
17747
+ this.iamReader.emitWidgetEvent({
17748
+ type: eventName,
17749
+ widgetPayload: devPayload !== null && devPayload !== void 0 ? devPayload : {}
17750
+ });
17751
+ }
17752
+ async resetCard(messageId) { }
17753
+ getCardFonts() {
17754
+ var _a, _b;
17755
+ return (_b = (_a = this.storyManager.rootStore.sessionStore.session) === null || _a === void 0 ? void 0 : _a.fontsResources) !== null && _b !== void 0 ? _b : [];
17756
+ }
17757
+ async updateTimeline(slideIndex, action, currentTime, duration, showLoader, showError) {
17758
+ if (showLoader)
17759
+ this.iamMessage.showLoaderScreen();
17760
+ else
17761
+ this.iamMessage.hideLoaderScreen();
17762
+ if (showError)
17763
+ this.iamMessage.showErrorScreen();
17764
+ else
17765
+ this.iamMessage.hideErrorScreen();
17766
+ }
17767
+ showToast(text) {
17768
+ this.iamMessage.showToast({ content: text });
17769
+ }
17770
+ }
18683
17771
 
18684
17772
  ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/iamMultiSlideMessageViewModel.ts
18685
17773
  var iamMultiSlideMessageViewModel_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
@@ -19115,11 +18203,236 @@ let IamMultiSlideMessageViewModel = (() => {
19115
18203
  })();
19116
18204
 
19117
18205
 
19118
- ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/index.ts
18206
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessage/index.ts
18207
+
18208
+
18209
+
18210
+
18211
+
18212
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/squareSlideGeometry.ts
18213
+ class SquareSlideGeometry {
18214
+ constructor(_vw, _vh, _contentRatio) {
18215
+ Object.defineProperty(this, "_vw", {
18216
+ enumerable: true,
18217
+ configurable: true,
18218
+ writable: true,
18219
+ value: _vw
18220
+ });
18221
+ Object.defineProperty(this, "_vh", {
18222
+ enumerable: true,
18223
+ configurable: true,
18224
+ writable: true,
18225
+ value: _vh
18226
+ });
18227
+ Object.defineProperty(this, "_contentRatio", {
18228
+ enumerable: true,
18229
+ configurable: true,
18230
+ writable: true,
18231
+ value: _contentRatio
18232
+ });
18233
+ }
18234
+ get contentRatio() {
18235
+ return this._contentRatio;
18236
+ }
18237
+ getWidth() {
18238
+ return `${this.calculateWidth()}px`;
18239
+ }
18240
+ getHeight() {
18241
+ return `${this.calculateHeight()}px`;
18242
+ }
18243
+ calculateWidth() {
18244
+ return this._vw;
18245
+ }
18246
+ calculateHeight() {
18247
+ return Math.ceil(this._vw / this._contentRatio);
18248
+ }
18249
+ }
18250
+
18251
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/wideSlideGeometry.ts
18252
+ class WideSlideGeometry {
18253
+ constructor(_vw, _vh, _contentRatio) {
18254
+ Object.defineProperty(this, "_vw", {
18255
+ enumerable: true,
18256
+ configurable: true,
18257
+ writable: true,
18258
+ value: _vw
18259
+ });
18260
+ Object.defineProperty(this, "_vh", {
18261
+ enumerable: true,
18262
+ configurable: true,
18263
+ writable: true,
18264
+ value: _vh
18265
+ });
18266
+ Object.defineProperty(this, "_contentRatio", {
18267
+ enumerable: true,
18268
+ configurable: true,
18269
+ writable: true,
18270
+ value: _contentRatio
18271
+ });
18272
+ }
18273
+ get contentRatio() {
18274
+ return this._contentRatio;
18275
+ }
18276
+ get vw() {
18277
+ return this._vw;
18278
+ }
18279
+ get vh() {
18280
+ return this._vh;
18281
+ }
18282
+ getWidth() {
18283
+ return `${this.calculateWidth()}px`;
18284
+ }
18285
+ getHeight() {
18286
+ return `${this.calculateHeight()}px`;
18287
+ }
18288
+ calculateWidth() {
18289
+ return Math.ceil(this._vh * this._contentRatio);
18290
+ }
18291
+ calculateHeight() {
18292
+ return this._vh;
18293
+ }
18294
+ }
18295
+
18296
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/fullscreen/fullscreenSlideGeometry.ts
18297
+ class FullscreenSlideGeometry {
18298
+ }
18299
+
18300
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/fullscreen/portraitFullscreenSlideGeometry.ts
18301
+
18302
+ class PortraitFullscreenSlideGeometry extends FullscreenSlideGeometry {
18303
+ constructor(_vw, _vh, _contentRatio) {
18304
+ super();
18305
+ Object.defineProperty(this, "_vw", {
18306
+ enumerable: true,
18307
+ configurable: true,
18308
+ writable: true,
18309
+ value: _vw
18310
+ });
18311
+ Object.defineProperty(this, "_vh", {
18312
+ enumerable: true,
18313
+ configurable: true,
18314
+ writable: true,
18315
+ value: _vh
18316
+ });
18317
+ Object.defineProperty(this, "_contentRatio", {
18318
+ enumerable: true,
18319
+ configurable: true,
18320
+ writable: true,
18321
+ value: _contentRatio
18322
+ });
18323
+ }
18324
+ get contentRatio() {
18325
+ return this._contentRatio;
18326
+ }
18327
+ getWidth() {
18328
+ return `${this.calculateWidth()}px`;
18329
+ }
18330
+ getHeight() {
18331
+ return `${this.calculateHeight()}px`;
18332
+ }
18333
+ calculateWidth() {
18334
+ return this._vw;
18335
+ }
18336
+ calculateHeight() {
18337
+ return Math.ceil(this._vw / this._contentRatio);
18338
+ }
18339
+ }
18340
+
18341
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/fullscreen/landscapeFullscreenSlideGeometry.ts
18342
+
18343
+ class LandscapeFullscreenSlideGeometry extends FullscreenSlideGeometry {
18344
+ constructor(_vw, _vh, _contentRatio) {
18345
+ super();
18346
+ Object.defineProperty(this, "_vw", {
18347
+ enumerable: true,
18348
+ configurable: true,
18349
+ writable: true,
18350
+ value: _vw
18351
+ });
18352
+ Object.defineProperty(this, "_vh", {
18353
+ enumerable: true,
18354
+ configurable: true,
18355
+ writable: true,
18356
+ value: _vh
18357
+ });
18358
+ Object.defineProperty(this, "_contentRatio", {
18359
+ enumerable: true,
18360
+ configurable: true,
18361
+ writable: true,
18362
+ value: _contentRatio
18363
+ });
18364
+ }
18365
+ get contentRatio() {
18366
+ return this._contentRatio;
18367
+ }
18368
+ getWidth() {
18369
+ return `${this.calculateWidth()}px`;
18370
+ }
18371
+ getHeight() {
18372
+ return `${this.calculateHeight()}px`;
18373
+ }
18374
+ calculateWidth() {
18375
+ return Math.ceil(this.calculateHeight() * this._contentRatio);
18376
+ }
18377
+ calculateHeight() {
18378
+ return this._vh;
18379
+ }
18380
+ }
18381
+
18382
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/slideGeometryFactory.ts
18383
+
18384
+
18385
+
18386
+
18387
+
18388
+ class SlideGeometryFactory {
18389
+ constructor() { }
18390
+ create(messageGeometry) {
18391
+ const params = this.getViewportParams(messageGeometry);
18392
+ if (this.isFullscreen(messageGeometry, params))
18393
+ return this.createFullscreenSlideGeometry(params);
18394
+ return this.createWideOrSquareGeometry(params);
18395
+ }
18396
+ isFullscreen(messageGeometry, params) {
18397
+ return messageGeometry instanceof FullscreenModalGeometry;
18398
+ }
18399
+ createWideOrSquareGeometry(params) {
18400
+ if (params.viewportRatio > params.contentRatio)
18401
+ return new SquareSlideGeometry(params.vw, params.vh, params.contentRatio);
18402
+ else
18403
+ return new WideSlideGeometry(params.vw, params.vh, params.contentRatio);
18404
+ }
18405
+ getViewportParams(messageGeometry) {
18406
+ const vw = messageGeometry.getWidth();
18407
+ const vh = messageGeometry.getHeight();
18408
+ const viewportRatio = messageGeometry.getWidth() / messageGeometry.getHeight();
18409
+ const contentRatio = messageGeometry.contentRatio;
18410
+ return { vw, vh, viewportRatio, contentRatio };
18411
+ }
18412
+ createFullscreenSlideGeometry(params) {
18413
+ if (params.viewportRatio > params.contentRatio) {
18414
+ return new LandscapeFullscreenSlideGeometry(params.vw, params.vh, params.contentRatio);
18415
+ }
18416
+ else {
18417
+ return new PortraitFullscreenSlideGeometry(params.vw, params.vh, params.contentRatio);
18418
+ }
18419
+ }
18420
+ }
18421
+
18422
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/fullscreen/index.ts
18423
+
18424
+
18425
+
18426
+
18427
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/geometry/index.ts
18428
+
18429
+
19119
18430
 
19120
18431
 
19121
18432
 
19122
18433
 
18434
+ ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/iamMessageSlide/index.ts
18435
+
19123
18436
 
19124
18437
 
19125
18438
  ;// CONCATENATED MODULE: ../core/src/readers/inAppMessaging/index.ts
@@ -21723,7 +21036,7 @@ class UgcEditorStore {
21723
21036
  const session = await this.storyManager.rootStore.sessionStore.open();
21724
21037
  const ugcEditorConfigDto = await this.ugcEditorApi.fetchUgcEditorConfig();
21725
21038
  const storyManagerConfig = this.storyManager.config;
21726
- const sdkVersion = "1.9.0-rc.0";
21039
+ const sdkVersion = "1.9.1";
21727
21040
  this._config = {
21728
21041
  sessionId: session.id,
21729
21042
  apiKey: storyManagerConfig.apiKey,
@@ -22070,6 +21383,30 @@ const convertStrToLatin1 = (str) => {
22070
21383
  return newStr;
22071
21384
  };
22072
21385
 
21386
+ ;// CONCATENATED MODULE: ../core/src/storyManager/products.ts
21387
+ class Products {
21388
+ constructor() {
21389
+ Object.defineProperty(this, "_getProductCartState", {
21390
+ enumerable: true,
21391
+ configurable: true,
21392
+ writable: true,
21393
+ value: async () => ({
21394
+ offers: [],
21395
+ price: "0",
21396
+ priceCurrency: ""
21397
+ })
21398
+ });
21399
+ }
21400
+ set getProductCartState(fn) {
21401
+ if (typeof fn === "function") {
21402
+ this._getProductCartState = fn;
21403
+ }
21404
+ }
21405
+ get getProductCartState() {
21406
+ return this._getProductCartState;
21407
+ }
21408
+ }
21409
+
22073
21410
  ;// CONCATENATED MODULE: ../core/src/storyManager/storyManager.ts
22074
21411
 
22075
21412
 
@@ -22081,6 +21418,7 @@ const convertStrToLatin1 = (str) => {
22081
21418
 
22082
21419
 
22083
21420
 
21421
+
22084
21422
  class StoryManager extends TypedEventEmitter {
22085
21423
  constructor() {
22086
21424
  super();
@@ -22134,6 +21472,18 @@ class StoryManager extends TypedEventEmitter {
22134
21472
  writable: true,
22135
21473
  value: void 0
22136
21474
  });
21475
+ Object.defineProperty(this, "_shareHandler", {
21476
+ enumerable: true,
21477
+ configurable: true,
21478
+ writable: true,
21479
+ value: null
21480
+ });
21481
+ Object.defineProperty(this, "products", {
21482
+ enumerable: true,
21483
+ configurable: true,
21484
+ writable: true,
21485
+ value: new Products()
21486
+ });
22137
21487
  if (StoryManager.isSingletonInstanceExists())
22138
21488
  return StoryManager.instance;
22139
21489
  StoryManager.instance = this;
@@ -22153,12 +21503,15 @@ class StoryManager extends TypedEventEmitter {
22153
21503
  get userAgent() {
22154
21504
  return this._userAgent;
22155
21505
  }
21506
+ get deviceId() {
21507
+ return deviceDescriptor.deviceId;
21508
+ }
22156
21509
  get sdkVersionName() {
22157
- const sdkVersionName = "1.9.0-rc.0";
21510
+ const sdkVersionName = "1.9.1";
22158
21511
  return sdkVersionName || "0.0.0";
22159
21512
  }
22160
21513
  get sdkVersionCode() {
22161
- const sdkVersionCode = 10900;
21514
+ const sdkVersionCode = 10901;
22162
21515
  return sdkVersionCode ? parseInt(sdkVersionCode) : 0;
22163
21516
  }
22164
21517
  get lang() {
@@ -22179,6 +21532,13 @@ class StoryManager extends TypedEventEmitter {
22179
21532
  get storyLinkClickHandler() {
22180
21533
  return this._storyLinkClickHandler;
22181
21534
  }
21535
+ get shareHandler() {
21536
+ var _a;
21537
+ return (_a = this._shareHandler) !== null && _a !== void 0 ? _a : this.getNavigatorShareFunction();
21538
+ }
21539
+ set shareHandler(callback) {
21540
+ this._shareHandler = callback;
21541
+ }
22182
21542
  get isStatisticsDisabled() {
22183
21543
  return this.config.isStatisticsDisabled;
22184
21544
  }
@@ -22215,7 +21575,7 @@ class StoryManager extends TypedEventEmitter {
22215
21575
  this.rootStore.storyManagerConfigStore.setConfig(configDto);
22216
21576
  }
22217
21577
  setUserAgent(userAgent) {
22218
- const sdkVersionCode = 10900;
21578
+ const sdkVersionCode = 10901;
22219
21579
  const buildVersion = sdkVersionCode ? parseInt(sdkVersionCode) : 0;
22220
21580
  // According to RFC5987, HTTP header values can legitimately be supplied using the ISO-8859-1 encoding.
22221
21581
  this._userAgent = `${userAgent} ${convertStrToLatin1(navigator.userAgent)}`;
@@ -22281,6 +21641,13 @@ class StoryManager extends TypedEventEmitter {
22281
21641
  this.inAppMessaging.forceClose();
22282
21642
  this.rootStore.storyManagerConfigStore.clear();
22283
21643
  }
21644
+ getNavigatorShareFunction() {
21645
+ var _a, _b;
21646
+ let shareFn = (_a = navigator.share) === null || _a === void 0 ? void 0 : _a.bind(navigator);
21647
+ if (!shareFn && ((_b = window.parent) === null || _b === void 0 ? void 0 : _b.navigator.share))
21648
+ shareFn = window.parent.navigator.share.bind(window.parent.navigator);
21649
+ return shareFn;
21650
+ }
22284
21651
  static isSingletonInstanceExists() {
22285
21652
  if (StoryManager.instance) {
22286
21653
  console.warn("[IAS]: StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead");
@@ -23328,6 +22695,20 @@ var socialSharePanelBody_module_update = injectStylesIntoStyleTag_default()(soci
23328
22695
 
23329
22696
 
23330
22697
  /* harmony default export */ const SocialSharePanelBody_socialSharePanelBody_module = (socialSharePanelBody_module/* default */.A.locals || {});
22698
+ ;// CONCATENATED MODULE: ./src/UI/SharePanel/SocialSharePanelBody/Favicon.tsx
22699
+
22700
+
22701
+
22702
+ const fallbackSvg = ((0,jsx_runtime_namespaceObject.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "60", height: "60", viewBox: "0 0 24 24", stroke: "white", fill: "black", strokeWidth: "1", strokeLinecap: "round", strokeLinejoin: "round", children: [(0,jsx_runtime_namespaceObject.jsx)("circle", { cx: "12", cy: "12", r: "10" }), (0,jsx_runtime_namespaceObject.jsx)("path", { d: "M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" }), (0,jsx_runtime_namespaceObject.jsx)("path", { d: "M4 8h16" }), (0,jsx_runtime_namespaceObject.jsx)("path", { d: "M4 16h16" })] }));
22703
+ const faviconApiUrl = "https://favicon.inappstory.ru";
22704
+ const Favicon = (props) => {
22705
+ var _a, _b;
22706
+ const [failed, setFailed] = (0,external_react_namespaceObject.useState)(false);
22707
+ const favicon = (_a = props.sharePanelOptions.title) === null || _a === void 0 ? void 0 : _a.favicon;
22708
+ return (props.shareDomain &&
22709
+ (favicon === null || favicon === void 0 ? void 0 : favicon.display) && ((0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-url-favicon"], style: { background: favicon.background }, children: !failed ? ((0,jsx_runtime_namespaceObject.jsx)("img", { src: `${(_b = props.faviconApiUrl) !== null && _b !== void 0 ? _b : faviconApiUrl}?sz=64&domain_url=${props.shareDomain}`, onError: () => setFailed(true), alt: "favicon" })) : (fallbackSvg) })));
22710
+ };
22711
+
23331
22712
  ;// CONCATENATED MODULE: ./src/UI/SharePanel/SocialSharePanelBody/SocialSharePanelBody.tsx
23332
22713
  var SocialSharePanelBody_rest = (undefined && undefined.__rest) || function (s, e) {
23333
22714
  var t = {};
@@ -23344,9 +22725,9 @@ var SocialSharePanelBody_rest = (undefined && undefined.__rest) || function (s,
23344
22725
 
23345
22726
 
23346
22727
 
23347
- const faviconApiUrl = "https://favicon.inappstory.ru";
22728
+
23348
22729
  const SocialSharePanelBody = (_a) => {
23349
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
22730
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
23350
22731
  var { shareLink, sharePanelOptions, onShareComplete } = _a, props = SocialSharePanelBody_rest(_a, ["shareLink", "sharePanelOptions", "onShareComplete"]);
23351
22732
  const getShareUrlDomain = () => {
23352
22733
  try {
@@ -23392,18 +22773,17 @@ const SocialSharePanelBody = (_a) => {
23392
22773
  text: getEncodedShareText()
23393
22774
  });
23394
22775
  };
23395
- const favicon = (_b = sharePanelOptions.title) === null || _b === void 0 ? void 0 : _b.favicon;
23396
22776
  const textStyles = sharePanelOptions.text;
23397
- return ((0,jsx_runtime_namespaceObject.jsxs)("div", { className: SharePanel_sharePanel_module["share-panel__body"], children: [(0,jsx_runtime_namespaceObject.jsxs)("div", { className: `${SharePanel_sharePanel_module["share-panel-row"]} ${SharePanel_sharePanel_module["title-row"]}`, children: [getShareUrlDomain() && Boolean(favicon === null || favicon === void 0 ? void 0 : favicon.display) && ((0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-url-favicon"], style: { background: favicon === null || favicon === void 0 ? void 0 : favicon.background }, children: (0,jsx_runtime_namespaceObject.jsx)("img", { src: `${(_c = props.faviconApiUrl) !== null && _c !== void 0 ? _c : faviconApiUrl}?sz=64&domain_url=${getShareUrlDomain()}` }) })), (0,jsx_runtime_namespaceObject.jsx)("span", { className: SharePanel_sharePanel_module["title"], dir: props.dir, style: textStyles, children: (_e = (_d = sharePanelOptions.title) === null || _d === void 0 ? void 0 : _d.getValue) === null || _e === void 0 ? void 0 : _e.call(_d, { url: shareLink, text: getEncodedShareText() }) })] }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-separator"], style: { background: (_f = sharePanelOptions.divider) === null || _f === void 0 ? void 0 : _f.background } }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: `${SharePanel_sharePanel_module["share-panel-row"]} ${SocialSharePanelBody_socialSharePanelBody_module["social-list"]}`, children: (_g = sharePanelOptions.targets) === null || _g === void 0 ? void 0 : _g.map((target, index) => {
22777
+ return ((0,jsx_runtime_namespaceObject.jsxs)("div", { className: SharePanel_sharePanel_module["share-panel__body"], children: [(0,jsx_runtime_namespaceObject.jsxs)("div", { className: `${SharePanel_sharePanel_module["share-panel-row"]} ${SharePanel_sharePanel_module["title-row"]}`, children: [(0,jsx_runtime_namespaceObject.jsx)(Favicon, { shareDomain: getShareUrlDomain(), sharePanelOptions: sharePanelOptions, faviconApiUrl: props.faviconApiUrl }), (0,jsx_runtime_namespaceObject.jsx)("span", { className: SharePanel_sharePanel_module["title"], dir: props.dir, style: textStyles, children: (_c = (_b = sharePanelOptions.title) === null || _b === void 0 ? void 0 : _b.getValue) === null || _c === void 0 ? void 0 : _c.call(_b, { url: shareLink, text: getEncodedShareText() }) })] }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-separator"], style: { background: (_d = sharePanelOptions.divider) === null || _d === void 0 ? void 0 : _d.background } }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: `${SharePanel_sharePanel_module["share-panel-row"]} ${SocialSharePanelBody_socialSharePanelBody_module["social-list"]}`, children: (_e = sharePanelOptions.targets) === null || _e === void 0 ? void 0 : _e.map((target, index) => {
23398
22778
  var _a, _b, _c;
23399
22779
  const socialTargetParams = (_a = sharePanelOptions.targetParams) === null || _a === void 0 ? void 0 : _a[target];
23400
22780
  const iconSvg = (_c = (_b = socialTargetParams === null || socialTargetParams === void 0 ? void 0 : socialTargetParams.icon) === null || _b === void 0 ? void 0 : _b.svgSrc.baseState) !== null && _c !== void 0 ? _c : "<svg></svg>";
23401
22781
  return ((0,jsx_runtime_namespaceObject.jsx)("div", { className: SocialSharePanelBody_socialSharePanelBody_module["social-list__item"], children: (0,jsx_runtime_namespaceObject.jsxs)("a", { href: getUrlByTarget(target), onClick: () => openWindow(getUrlByTarget(target), "newwindow", "width=650,height=570"), target: "_blank", rel: "noopener noreferrer", className: `${SharePanel_sharePanel_module["share-item"]} ${SocialSharePanelBody_socialSharePanelBody_module["share-item"]}`, children: [(0,jsx_runtime_namespaceObject.jsx)("div", { dangerouslySetInnerHTML: {
23402
22782
  __html: iconSvg
23403
22783
  } }), (0,jsx_runtime_namespaceObject.jsx)("span", { className: SharePanel_sharePanel_module["share-item-title"], style: textStyles, children: socialTargetParams === null || socialTargetParams === void 0 ? void 0 : socialTargetParams.label })] }) }, index));
23404
- }) }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-separator"], style: { background: (_h = sharePanelOptions.divider) === null || _h === void 0 ? void 0 : _h.background } }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-row"], children: (0,jsx_runtime_namespaceObject.jsxs)("a", { className: `${SharePanel_sharePanel_module["share-item"]} ${SocialSharePanelBody_socialSharePanelBody_module["share-item"]}`, onClick: onCopyClick, children: [(0,jsx_runtime_namespaceObject.jsx)("div", { dangerouslySetInnerHTML: {
23405
- __html: (_l = (_k = (_j = sharePanelOptions.copyButton) === null || _j === void 0 ? void 0 : _j.svgSrc) === null || _k === void 0 ? void 0 : _k.baseState) !== null && _l !== void 0 ? _l : ""
23406
- } }), (0,jsx_runtime_namespaceObject.jsx)("span", { className: SharePanel_sharePanel_module["share-item-title"], style: textStyles, children: (_m = sharePanelOptions.copyButton) === null || _m === void 0 ? void 0 : _m.label })] }) })] }));
22784
+ }) }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-separator"], style: { background: (_f = sharePanelOptions.divider) === null || _f === void 0 ? void 0 : _f.background } }), (0,jsx_runtime_namespaceObject.jsx)("div", { className: SharePanel_sharePanel_module["share-panel-row"], children: (0,jsx_runtime_namespaceObject.jsxs)("a", { className: `${SharePanel_sharePanel_module["share-item"]} ${SocialSharePanelBody_socialSharePanelBody_module["share-item"]}`, onClick: onCopyClick, children: [(0,jsx_runtime_namespaceObject.jsx)("div", { dangerouslySetInnerHTML: {
22785
+ __html: (_j = (_h = (_g = sharePanelOptions.copyButton) === null || _g === void 0 ? void 0 : _g.svgSrc) === null || _h === void 0 ? void 0 : _h.baseState) !== null && _j !== void 0 ? _j : ""
22786
+ } }), (0,jsx_runtime_namespaceObject.jsx)("span", { className: SharePanel_sharePanel_module["share-item-title"], style: textStyles, children: (_k = sharePanelOptions.copyButton) === null || _k === void 0 ? void 0 : _k.label })] }) })] }));
23407
22787
  };
23408
22788
 
23409
22789
  ;// CONCATENATED MODULE: ./src/UI/SharePanel/SocialSharePanelBody/index.ts
@@ -29452,7 +28832,7 @@ const useStoryManagerConfig = (config) => {
29452
28832
  ;// CONCATENATED MODULE: ./src/IASContainer/hooks/useStoryManagerEvents.ts
29453
28833
 
29454
28834
 
29455
- const useStoryManagerEvents = ({ onClickOnStory, onClickOnButton, onShowStory, onCloseStory, onShowSlide, onLikeStory, onDislikeStory, onFavoriteStory, onShareStory, onShareStoryWithPath, onFeedImpression, onVisibleAreaUpdated, onWidgetEvent, onStartGame, onCloseGame, onFinishGame, onEventGame }) => {
28835
+ const useStoryManagerEvents = ({ onClickOnStory, onClickOnButton, onShowStory, onCloseStory, onShowSlide, onLikeStory, onDislikeStory, onFavoriteStory, onShareStory, onShareStoryWithPath, onFeedImpression, onVisibleAreaUpdated, onWidgetEvent, onStartGame, onCloseGame, onFinishGame, onEventGame, onCloseStoryReader, onProductCartUpdated, onProductCartClicked }) => {
29456
28836
  (0,external_react_namespaceObject.useEffect)(() => {
29457
28837
  const handlers = [
29458
28838
  { event: "clickOnStory", handler: onClickOnStory },
@@ -29471,7 +28851,10 @@ const useStoryManagerEvents = ({ onClickOnStory, onClickOnButton, onShowStory, o
29471
28851
  { event: "closeGame", handler: onCloseGame },
29472
28852
  { event: "finishGame", handler: onFinishGame },
29473
28853
  { event: "eventGame", handler: onEventGame },
29474
- { event: "clickOnButton", handler: onClickOnButton }
28854
+ { event: "clickOnButton", handler: onClickOnButton },
28855
+ { event: "closeStoryReader", handler: onCloseStoryReader },
28856
+ { event: "productCartUpdated", handler: onProductCartUpdated },
28857
+ { event: "onProductCartClicked", handler: onProductCartClicked }
29475
28858
  ];
29476
28859
  handlers.forEach(({ event, handler }) => {
29477
28860
  if (handler)
@@ -29500,7 +28883,10 @@ const useStoryManagerEvents = ({ onClickOnStory, onClickOnButton, onShowStory, o
29500
28883
  onShareStoryWithPath,
29501
28884
  onFeedImpression,
29502
28885
  onVisibleAreaUpdated,
29503
- onWidgetEvent
28886
+ onWidgetEvent,
28887
+ onCloseStoryReader,
28888
+ onProductCartUpdated,
28889
+ onProductCartClicked
29504
28890
  ]);
29505
28891
  };
29506
28892
 
@@ -30234,16 +29620,16 @@ const BaseStoryList = (0,external_mobx_react_lite_namespaceObject.observer)((0,e
30234
29620
 
30235
29621
 
30236
29622
  const StoryList = (0,external_mobx_react_lite_namespaceObject.observer)((0,external_react_namespaceObject.forwardRef)((props, ref) => {
30237
- var _a, _b, _c;
29623
+ var _a;
30238
29624
  const { storyManager } = useIASContainer();
30239
- const feedSlug = (_a = props.feedSlug) !== null && _a !== void 0 ? _a : "default";
29625
+ const feedSlug = props.feedSlug || "default";
30240
29626
  const listType = StoryFeedType.DEFAULT;
30241
29627
  const { storyListViewModel, storyListOptions } = useStoryListViewModel(Object.assign(Object.assign({}, props), { storyManager,
30242
29628
  feedSlug,
30243
29629
  listType, hasFavorite: Boolean(props.hasFavorite), isFavorite: false }));
30244
- if (!storyListViewModel || !((_b = storyListViewModel.session) === null || _b === void 0 ? void 0 : _b.id))
29630
+ if (!storyListViewModel || !((_a = storyListViewModel.session) === null || _a === void 0 ? void 0 : _a.id))
30245
29631
  return null;
30246
- return ((0,jsx_runtime_namespaceObject.jsx)(BaseStoryList, Object.assign({}, props, { dir: storyListViewModel.dir, storyManager: storyManager, feedSlug: (_c = props.feedSlug) !== null && _c !== void 0 ? _c : "default", listType: StoryFeedType.DEFAULT, storyListViewModel: storyListViewModel, storyListOptions: storyListOptions, onStoryCardClick: props.onStoryCardClick, onFavoriteCardClick: () => {
29632
+ return ((0,jsx_runtime_namespaceObject.jsx)(BaseStoryList, Object.assign({}, props, { dir: storyListViewModel.dir, storyManager: storyManager, feedSlug: props.feedSlug || "default", listType: StoryFeedType.DEFAULT, storyListViewModel: storyListViewModel, storyListOptions: storyListOptions, onStoryCardClick: props.onStoryCardClick, onFavoriteCardClick: () => {
30247
29633
  var _a;
30248
29634
  storyManager.emit("clickOnFavoriteCell", { feed: feedSlug });
30249
29635
  (_a = props.onFavoriteCardClick) === null || _a === void 0 ? void 0 : _a.call(props);