@inappstory/react-sdk 1.9.1 → 1.9.2

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.
@@ -8649,11 +8649,13 @@ let StoryPauseManager = (() => {
8649
8649
  }
8650
8650
  pauseSystem(source) {
8651
8651
  this._systemPause.pause(source);
8652
+ this.ctx.notifyPauseStateChange();
8652
8653
  }
8653
8654
  resumeSystem(source) {
8654
8655
  if (!this._systemPause.isPaused)
8655
8656
  return;
8656
8657
  this._systemPause.resume(source);
8658
+ this.ctx.notifyPauseStateChange();
8657
8659
  }
8658
8660
  resumeAll() {
8659
8661
  if (this.isPaused) {
@@ -10155,9 +10157,9 @@ let StoryViewModel = (() => {
10155
10157
  this.isStarted = false;
10156
10158
  this.slideApiHandlers.clearNarrativeSessionDataCache();
10157
10159
  this.resumeAll();
10158
- await this.activeSlide.stop({ prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */ });
10159
10160
  document.removeEventListener("visibilitychange", this.handleVisibilityChange);
10160
10161
  document.removeEventListener("keydown", this.handleKeydown);
10162
+ await this.activeSlide.stop({ prepareForRestart: 1 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.PREPARE */ });
10161
10163
  });
10162
10164
  }
10163
10165
  canGoNext() {
@@ -10273,8 +10275,8 @@ let StoryViewModel = (() => {
10273
10275
  this.resumeAll();
10274
10276
  if (!((_b = this.storyManager.config.cache) === null || _b === void 0 ? void 0 : _b.prefetch))
10275
10277
  await this.preloadActiveSlide(ACTIVE_SLIDE_PRELOAD_PRIORITY);
10276
- await activeSlide.init();
10277
10278
  await (lastSlide === null || lastSlide === void 0 ? void 0 : lastSlide.stop({ prepareForRestart: 2 /* ON_SLIDE_STOP_PREPARE_FOR_RESTART.NOT_PREPARE */ }));
10279
+ await activeSlide.init();
10278
10280
  await activeSlide.start();
10279
10281
  this._activeSlideStartTime = Date.now();
10280
10282
  }
@@ -10471,7 +10473,7 @@ class GameClientConfig {
10471
10473
  value: void 0
10472
10474
  });
10473
10475
  const storyManagerConfig = this.storyManager.config;
10474
- const sdkVersion = "1.9.1";
10476
+ const sdkVersion = "1.9.2";
10475
10477
  const placeholders = this.storyManager.rootStore.placeholderStore.placeholders;
10476
10478
  const session = this.storyManager.rootStore.sessionStore.session;
10477
10479
  this.sessionId = session.id;
@@ -21036,7 +21038,7 @@ class UgcEditorStore {
21036
21038
  const session = await this.storyManager.rootStore.sessionStore.open();
21037
21039
  const ugcEditorConfigDto = await this.ugcEditorApi.fetchUgcEditorConfig();
21038
21040
  const storyManagerConfig = this.storyManager.config;
21039
- const sdkVersion = "1.9.1";
21041
+ const sdkVersion = "1.9.2";
21040
21042
  this._config = {
21041
21043
  sessionId: session.id,
21042
21044
  apiKey: storyManagerConfig.apiKey,
@@ -21507,11 +21509,11 @@ class StoryManager extends TypedEventEmitter {
21507
21509
  return deviceDescriptor.deviceId;
21508
21510
  }
21509
21511
  get sdkVersionName() {
21510
- const sdkVersionName = "1.9.1";
21512
+ const sdkVersionName = "1.9.2";
21511
21513
  return sdkVersionName || "0.0.0";
21512
21514
  }
21513
21515
  get sdkVersionCode() {
21514
- const sdkVersionCode = 10901;
21516
+ const sdkVersionCode = 10902;
21515
21517
  return sdkVersionCode ? parseInt(sdkVersionCode) : 0;
21516
21518
  }
21517
21519
  get lang() {
@@ -21575,7 +21577,7 @@ class StoryManager extends TypedEventEmitter {
21575
21577
  this.rootStore.storyManagerConfigStore.setConfig(configDto);
21576
21578
  }
21577
21579
  setUserAgent(userAgent) {
21578
- const sdkVersionCode = 10901;
21580
+ const sdkVersionCode = 10902;
21579
21581
  const buildVersion = sdkVersionCode ? parseInt(sdkVersionCode) : 0;
21580
21582
  // According to RFC5987, HTTP header values can legitimately be supplied using the ISO-8859-1 encoding.
21581
21583
  this._userAgent = `${userAgent} ${convertStrToLatin1(navigator.userAgent)}`;
@@ -25611,17 +25613,15 @@ class StorySlidesContainer extends HTMLElement {
25611
25613
  this.styleElement = style;
25612
25614
  this.mountPoint.prepend(style);
25613
25615
  }
25614
- init(story) {
25615
- requestAnimationFrame(() => {
25616
- /** React uses its own virtual DOM and can reuse or move nodes without actually removing them from the DOM. So connectedCallback and disconnectedCallback are not always called.React uses its own virtual DOM and can reuse or move nodes without actually removing them from the DOM. So connectedCallback and disconnectedCallback are not always called. */
25617
- if (!this.mountPoint)
25618
- throw new Error("[IAS]: Mount point was undefined");
25619
- this.story = story;
25620
- this.story.attachRoot(this.mountPoint);
25621
- this.mountPoint.addEventListener("click", this.handleClick);
25622
- });
25616
+ attach(story) {
25617
+ /** React uses its own virtual DOM and can reuse or move nodes without actually removing them from the DOM. So connectedCallback and disconnectedCallback are not always called.React uses its own virtual DOM and can reuse or move nodes without actually removing them from the DOM. So connectedCallback and disconnectedCallback are not always called. */
25618
+ if (!this.mountPoint)
25619
+ throw new Error("[IAS]: Mount point was undefined");
25620
+ this.story = story;
25621
+ this.story.attachRoot(this.mountPoint);
25622
+ this.mountPoint.addEventListener("click", this.handleClick);
25623
25623
  }
25624
- destroy() {
25624
+ detach() {
25625
25625
  var _a, _b;
25626
25626
  /** React uses its own virtual DOM and can reuse or move nodes without actually removing them from the DOM. So connectedCallback and disconnectedCallback are not always called. */
25627
25627
  (_a = this.story) === null || _a === void 0 ? void 0 : _a.detachRoot();
@@ -25654,29 +25654,31 @@ var StorySlidesRenderer_rest = (undefined && undefined.__rest) || function (s, e
25654
25654
 
25655
25655
 
25656
25656
 
25657
- const StorySlidesRenderer = (0,external_mobx_react_lite_namespaceObject.observer)((_a) => {
25657
+ const StorySlidesRenderer = (0,external_mobx_react_lite_namespaceObject.observer)((0,external_react_namespaceObject.forwardRef)((_a, ref) => {
25658
25658
  var { className, story, preventNavigation, isActiveStory } = _a, props = StorySlidesRenderer_rest(_a, ["className", "story", "preventNavigation", "isActiveStory"]);
25659
25659
  const storySlidesRef = (0,external_react_namespaceObject.useRef)(null);
25660
- (0,external_react_namespaceObject.useLayoutEffect)(() => {
25661
- if (!storySlidesRef.current)
25662
- return;
25663
- storySlidesRef.current.setStyle(story.context.style);
25664
- }, [story.context.style]);
25665
- (0,external_react_namespaceObject.useLayoutEffect)(() => {
25666
- if (!storySlidesRef.current)
25667
- return;
25668
- const storySlides = storySlidesRef.current;
25669
- storySlides.init(story);
25670
- return () => {
25671
- storySlides.destroy();
25660
+ (0,external_react_namespaceObject.useImperativeHandle)(ref, () => {
25661
+ return {
25662
+ setStyle: (style) => {
25663
+ var _a;
25664
+ (_a = storySlidesRef.current) === null || _a === void 0 ? void 0 : _a.setStyle(style);
25665
+ },
25666
+ attach: (story) => {
25667
+ var _a;
25668
+ (_a = storySlidesRef.current) === null || _a === void 0 ? void 0 : _a.attach(story);
25669
+ },
25670
+ detach: () => {
25671
+ var _a;
25672
+ (_a = storySlidesRef.current) === null || _a === void 0 ? void 0 : _a.detach();
25673
+ }
25672
25674
  };
25673
- }, [story]);
25675
+ }, [ref, storySlidesRef]);
25674
25676
  const bottomOffset = !props.isDesktopGeometry ? `${story.actionPanel.height}px` : "0px";
25675
25677
  // Bug with attributes in React 19. Explicit cast to string required
25676
25678
  return ((0,jsx_runtime_namespaceObject.jsx)("story-slides-container", { ref: storySlidesRef, style: {
25677
25679
  bottom: bottomOffset
25678
25680
  }, class: className, dir: story.dir, "prevent-navigation": preventNavigation.toString(), "is-active-story": isActiveStory.toString() }));
25679
- });
25681
+ }));
25680
25682
 
25681
25683
  ;// CONCATENATED MODULE: ./src/StoryReader/Story/Story.tsx
25682
25684
  var Story_rest = (undefined && undefined.__rest) || function (s, e) {
@@ -25708,6 +25710,7 @@ const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) =
25708
25710
  var { story, geometry, className } = _a, props = Story_rest(_a, ["story", "geometry", "className"]);
25709
25711
  const { storyReaderOptions, commonOptions, goodsWidgetOptions } = useIASContainer();
25710
25712
  const storyRef = (0,external_react_namespaceObject.useRef)(null);
25713
+ const slideRef = (0,external_react_namespaceObject.useRef)(null);
25711
25714
  const isActiveStory = story === props.activeStory;
25712
25715
  const isDesktopGeometry = geometry instanceof DesktopStoryGeometry;
25713
25716
  const useModernLayout = storyReaderOptions.layout === StoryReaderLayout.Modern;
@@ -25720,6 +25723,20 @@ const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) =
25720
25723
  story.actionPanel.setOptions(commonOptions);
25721
25724
  story.actionPanel.setActionPanelHeight(bottomOffset);
25722
25725
  }, [story, commonOptions, storyReaderOptions.actionPanelBottomOffset, isDesktopGeometry]);
25726
+ (0,external_react_namespaceObject.useLayoutEffect)(() => {
25727
+ if (!slideRef.current)
25728
+ return;
25729
+ slideRef.current.setStyle(story.context.style);
25730
+ }, [story.context.style]);
25731
+ (0,external_react_namespaceObject.useLayoutEffect)(() => {
25732
+ if (!slideRef.current)
25733
+ return;
25734
+ const storySlides = slideRef.current;
25735
+ storySlides.attach(story);
25736
+ return () => {
25737
+ storySlides.detach();
25738
+ };
25739
+ }, [story]);
25723
25740
  const handleReloadStory = async () => {
25724
25741
  const storyError = Boolean(story.error);
25725
25742
  try {
@@ -25738,7 +25755,7 @@ const Story_Story = (0,external_mobx_react_lite_namespaceObject.observer)((_a) =
25738
25755
  story.sharePanel.completeNativeSharing({ result: false });
25739
25756
  }, onTouchStart: () => {
25740
25757
  story.sharePanel.completeNativeSharing({ result: false });
25741
- }, "data-testid": "story", children: [isDesktopGeometry && useModernLayout && story.isSlideRendered && (0,jsx_runtime_namespaceObject.jsx)(StoryBackdrop, { hidden: isActiveStory }), story.canBeShown && story.isSlideRendered && ((0,jsx_runtime_namespaceObject.jsx)(StoryHeader, { hidden: shouldHideHeader, story: story, onClose: props.onClose, isDesktopGeometry: isDesktopGeometry })), (0,jsx_runtime_namespaceObject.jsx)(StorySlidesRenderer, { className: Story_story_module["story-slides"], story: story, preventNavigation: useModernLayout && isDesktopGeometry, isActiveStory: isActiveStory, isDesktopGeometry: isDesktopGeometry }), story.actionPanel.needShown && story.isSlideRendered && ((0,jsx_runtime_namespaceObject.jsx)(StoryActionPanel, { dir: story.dir, isDesktopGeometry: isDesktopGeometry, hidden: shouldHideActionPanel, actionPanel: story.actionPanel, commonOptions: commonOptions, storyReaderOptions: storyReaderOptions })), props.activeStory === story && ((0,jsx_runtime_namespaceObject.jsx)(GoodsWidgetViewer, { story: story, goodsWidgetOptions: goodsWidgetOptions })), props.activeStory === story && ((0,jsx_runtime_namespaceObject.jsx)(TextInputModal, { story: story, storyRef: storyRef, storyGeometry: geometry })), story.sharePanel.isOpened && ((0,jsx_runtime_namespaceObject.jsx)(SharePanel, { dir: story.dir, className: Story_story_module["share-panel-wrapper"], shareText: story.sharePanel.params.text, shareType: story.sharePanel.params.type, shareLink: story.sharePanel.params.link, onShareCompelete: (result) => story.sharePanel.handleShareComplete(story.sharePanel.params.id, result), sharePanelOptions: storyReaderOptions.sharePanel })), (0,jsx_runtime_namespaceObject.jsx)(Loader, { needShowErrorScreen: story.needShowErrorScreen, needShowLoaderScreen: story.needShowLoaderScreen, onReload: handleReloadStory })] }));
25758
+ }, "data-testid": "story", children: [isDesktopGeometry && useModernLayout && story.isSlideRendered && (0,jsx_runtime_namespaceObject.jsx)(StoryBackdrop, { hidden: isActiveStory }), story.canBeShown && story.isSlideRendered && ((0,jsx_runtime_namespaceObject.jsx)(StoryHeader, { hidden: shouldHideHeader, story: story, onClose: props.onClose, isDesktopGeometry: isDesktopGeometry })), (0,jsx_runtime_namespaceObject.jsx)(StorySlidesRenderer, { className: Story_story_module["story-slides"], story: story, ref: slideRef, preventNavigation: useModernLayout && isDesktopGeometry, isActiveStory: isActiveStory, isDesktopGeometry: isDesktopGeometry }), story.actionPanel.needShown && story.isSlideRendered && ((0,jsx_runtime_namespaceObject.jsx)(StoryActionPanel, { dir: story.dir, isDesktopGeometry: isDesktopGeometry, hidden: shouldHideActionPanel, actionPanel: story.actionPanel, commonOptions: commonOptions, storyReaderOptions: storyReaderOptions })), props.activeStory === story && ((0,jsx_runtime_namespaceObject.jsx)(GoodsWidgetViewer, { story: story, goodsWidgetOptions: goodsWidgetOptions })), props.activeStory === story && ((0,jsx_runtime_namespaceObject.jsx)(TextInputModal, { story: story, storyRef: storyRef, storyGeometry: geometry })), story.sharePanel.isOpened && ((0,jsx_runtime_namespaceObject.jsx)(SharePanel, { dir: story.dir, className: Story_story_module["share-panel-wrapper"], shareText: story.sharePanel.params.text, shareType: story.sharePanel.params.type, shareLink: story.sharePanel.params.link, onShareCompelete: (result) => story.sharePanel.handleShareComplete(story.sharePanel.params.id, result), sharePanelOptions: storyReaderOptions.sharePanel })), (0,jsx_runtime_namespaceObject.jsx)(Loader, { needShowErrorScreen: story.needShowErrorScreen, needShowLoaderScreen: story.needShowLoaderScreen, onReload: handleReloadStory })] }));
25742
25759
  });
25743
25760
 
25744
25761
  ;// CONCATENATED MODULE: ./src/StoryReader/Story/index.ts