eat-js-sdk 2.0.47 → 2.0.49

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.
@@ -7790,8 +7790,8 @@ function getDynamicMarginTop(containerElement) {
7790
7790
  }
7791
7791
  const windowHeight = window.innerHeight;
7792
7792
  const contentHeight = containerElement.scrollHeight;
7793
- const rect = containerElement.getBoundingClientRect();
7794
- const availableSpace = windowHeight - rect.top;
7793
+ const offsetTop = containerElement.offsetTop;
7794
+ const availableSpace = windowHeight - offsetTop;
7795
7795
  if (availableSpace <= 0 || contentHeight <= 0) {
7796
7796
  return "margin-top: 0px";
7797
7797
  }
@@ -8579,7 +8579,35 @@ function PromptContainer($$anchor, $$props) {
8579
8579
  let containerElement = /* @__PURE__ */ state(void 0);
8580
8580
  let windowHeight = getWindowHeight();
8581
8581
  let contentLoader = /* @__PURE__ */ user_derived(() => useContentLoader(get$1(containerElement)));
8582
- let dynamicMarginTop = /* @__PURE__ */ user_derived(() => windowHeight.value > 0 && get$1(containerElement) && get$1(contentLoader).isLoaded ? getDynamicMarginTop(get$1(containerElement)) : "margin-top: 0px");
8582
+ let dynamicMarginTop = /* @__PURE__ */ state("margin-top: 0px");
8583
+ const RESIZE_DEBOUNCE_DELAY = 150;
8584
+ user_effect(() => {
8585
+ if (windowHeight.value > 0 && get$1(containerElement) && get$1(contentLoader).isLoaded) {
8586
+ set(dynamicMarginTop, getDynamicMarginTop(get$1(containerElement)), true);
8587
+ }
8588
+ });
8589
+ user_effect(() => {
8590
+ if (windowHeight.value > 0 && get$1(containerElement) && get$1(contentLoader).isLoaded) {
8591
+ let resizeTimeout;
8592
+ const handleResize = () => {
8593
+ clearTimeout(resizeTimeout);
8594
+ resizeTimeout = window.setTimeout(
8595
+ () => {
8596
+ const newMargin = getDynamicMarginTop(get$1(containerElement));
8597
+ if (newMargin !== get$1(dynamicMarginTop)) {
8598
+ set(dynamicMarginTop, newMargin, true);
8599
+ }
8600
+ },
8601
+ RESIZE_DEBOUNCE_DELAY
8602
+ );
8603
+ };
8604
+ window.addEventListener("resize", handleResize);
8605
+ return () => {
8606
+ clearTimeout(resizeTimeout);
8607
+ window.removeEventListener("resize", handleResize);
8608
+ };
8609
+ }
8610
+ });
8583
8611
  let isStimulusModalOpen = /* @__PURE__ */ state(false);
8584
8612
  let lastFocusedStimulusButton = /* @__PURE__ */ state(null);
8585
8613
  const openStimulusModal = (event2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eat-js-sdk",
3
- "version": "2.0.47",
3
+ "version": "2.0.49",
4
4
  "change version": "2.0.0",
5
5
  "description": "Authoring tool frontend SDK",
6
6
  "contributors": [