@betterstore/react 0.3.61 → 0.3.63

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.3.63
4
+
5
+ ### Patch Changes
6
+
7
+ - bug fixes
8
+
9
+ ## 0.3.62
10
+
11
+ ### Patch Changes
12
+
13
+ - bug fix
14
+
3
15
  ## 0.3.61
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -529,6 +529,10 @@ const IframeWrapper = ({ children, iframeRef, wrapperRef, }) => {
529
529
  const iframeDoc = iframe.contentDocument || ((_a = iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.document);
530
530
  if (!iframeDoc)
531
531
  return;
532
+ const updateHeight = () => {
533
+ const newHeight = iframeDoc.body.scrollHeight + 100;
534
+ iframe.style.height = `${newHeight}px`;
535
+ };
532
536
  const onLoad = () => {
533
537
  // Remove previous style if it exists
534
538
  if (styleRef.current && styleRef.current.parentNode) {
@@ -540,25 +544,18 @@ const IframeWrapper = ({ children, iframeRef, wrapperRef, }) => {
540
544
  iframeDoc.head.appendChild(style);
541
545
  styleRef.current = style;
542
546
  setIframeBody(iframeDoc.body);
543
- // Set up ResizeObserver to adjust iframe height
544
- const resizeObserver = new ResizeObserver((entries) => {
545
- for (const entry of entries) {
546
- const height = entry.contentRect.height;
547
- iframe.style.height = `${height}px`;
548
- }
549
- });
550
- resizeObserver.observe(iframeDoc.body);
551
- return () => {
552
- resizeObserver.disconnect();
553
- };
547
+ updateHeight();
554
548
  };
555
549
  // For first load
556
550
  if (iframeDoc.readyState === "complete")
557
551
  onLoad();
558
552
  else
559
553
  iframe.addEventListener("load", onLoad);
554
+ // Add resize listener
555
+ window.addEventListener("resize", updateHeight);
560
556
  return () => {
561
557
  iframe.removeEventListener("load", onLoad);
558
+ window.removeEventListener("resize", updateHeight);
562
559
  // Cleanup style on unmount
563
560
  if (styleRef.current && styleRef.current.parentNode) {
564
561
  styleRef.current.parentNode.removeChild(styleRef.current);
@@ -580,7 +577,7 @@ const IframeWrapper = ({ children, iframeRef, wrapperRef, }) => {
580
577
  React.createElement("iframe", { ref: iframeRef, style: {
581
578
  width: "100%",
582
579
  border: "none",
583
- minHeight: "100%",
580
+ minHeight: "100vh",
584
581
  }, sandbox: "allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-top-navigation" }),
585
582
  iframeBody && ReactDOM.createPortal(children, iframeBody)));
586
583
  };
package/dist/index.mjs CHANGED
@@ -506,6 +506,10 @@ const IframeWrapper = ({ children, iframeRef, wrapperRef, }) => {
506
506
  const iframeDoc = iframe.contentDocument || ((_a = iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.document);
507
507
  if (!iframeDoc)
508
508
  return;
509
+ const updateHeight = () => {
510
+ const newHeight = iframeDoc.body.scrollHeight + 100;
511
+ iframe.style.height = `${newHeight}px`;
512
+ };
509
513
  const onLoad = () => {
510
514
  // Remove previous style if it exists
511
515
  if (styleRef.current && styleRef.current.parentNode) {
@@ -517,25 +521,18 @@ const IframeWrapper = ({ children, iframeRef, wrapperRef, }) => {
517
521
  iframeDoc.head.appendChild(style);
518
522
  styleRef.current = style;
519
523
  setIframeBody(iframeDoc.body);
520
- // Set up ResizeObserver to adjust iframe height
521
- const resizeObserver = new ResizeObserver((entries) => {
522
- for (const entry of entries) {
523
- const height = entry.contentRect.height;
524
- iframe.style.height = `${height}px`;
525
- }
526
- });
527
- resizeObserver.observe(iframeDoc.body);
528
- return () => {
529
- resizeObserver.disconnect();
530
- };
524
+ updateHeight();
531
525
  };
532
526
  // For first load
533
527
  if (iframeDoc.readyState === "complete")
534
528
  onLoad();
535
529
  else
536
530
  iframe.addEventListener("load", onLoad);
531
+ // Add resize listener
532
+ window.addEventListener("resize", updateHeight);
537
533
  return () => {
538
534
  iframe.removeEventListener("load", onLoad);
535
+ window.removeEventListener("resize", updateHeight);
539
536
  // Cleanup style on unmount
540
537
  if (styleRef.current && styleRef.current.parentNode) {
541
538
  styleRef.current.parentNode.removeChild(styleRef.current);
@@ -557,7 +554,7 @@ const IframeWrapper = ({ children, iframeRef, wrapperRef, }) => {
557
554
  React__default.createElement("iframe", { ref: iframeRef, style: {
558
555
  width: "100%",
559
556
  border: "none",
560
- minHeight: "100%",
557
+ minHeight: "100vh",
561
558
  }, sandbox: "allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-top-navigation" }),
562
559
  iframeBody && ReactDOM.createPortal(children, iframeBody)));
563
560
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/react",
3
- "version": "0.3.61",
3
+ "version": "0.3.63",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {