@bigbinary/neeto-molecules 4.0.118 → 4.0.119

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.
@@ -1429,11 +1429,11 @@ var ElementPopup = function ElementPopup(_ref) {
1429
1429
  return "popup-button-".concat(Math.random().toString().substring(2, 10));
1430
1430
  }, [iframeURL]);
1431
1431
  useEffect(function () {
1432
+ var _window$appName;
1432
1433
  var element = document.getElementById(elementSelectorId);
1433
- if (element) {
1434
- var _window$globalProps$a;
1435
- (_window$globalProps$a = window[globalProps.appName.replace(/^neeto/i, "neeto")]) === null || _window$globalProps$a === void 0 || _window$globalProps$a.embed(element, iframeURL);
1436
- }
1434
+ if (!element) return;
1435
+ var appName = globalProps.appName.replace(/^neeto/i, "neeto");
1436
+ (_window$appName = window[appName]) === null || _window$appName === void 0 || _window$appName.embed(element, iframeURL);
1437
1437
  }, [iframeURL]);
1438
1438
  return /*#__PURE__*/jsxs("div", {
1439
1439
  className: "relative h-full w-full overflow-hidden",
@@ -1468,11 +1468,11 @@ var FloatingPopup = function FloatingPopup(_ref) {
1468
1468
  return "popup-button-".concat(Math.random().toString().substring(2, 10));
1469
1469
  }, [iframeURL]);
1470
1470
  useEffect(function () {
1471
+ var _window$appName;
1471
1472
  var element = document.getElementById(elementSelectorId);
1472
- if (element) {
1473
- var _window$globalProps$a;
1474
- (_window$globalProps$a = window[globalProps.appName.replace(/^neeto/i, "neeto")]) === null || _window$globalProps$a === void 0 || _window$globalProps$a.embed(element, iframeURL);
1475
- }
1473
+ if (!element) return;
1474
+ var appName = globalProps.appName.replace(/^neeto/i, "neeto");
1475
+ (_window$appName = window[appName]) === null || _window$appName === void 0 || _window$appName.embed(element, iframeURL);
1476
1476
  }, [iframeURL]);
1477
1477
  useEffect(function () {
1478
1478
  var btn = document.getElementById(elementSelectorId);
@@ -1551,15 +1551,22 @@ var buildQueryParams = function buildQueryParams() {
1551
1551
  }, {});
1552
1552
  return _objectSpread$1(_objectSpread$1({}, existingQueryParams), activeOptions);
1553
1553
  };
1554
- var buildIframeURL = function buildIframeURL(iframeURL, queryParams, customization) {
1555
- var url = new URL(iframeURL);
1554
+ var buildIframeURL = function buildIframeURL(_ref) {
1555
+ var previewURL = _ref.previewURL,
1556
+ selectedEmbed = _ref.selectedEmbed,
1557
+ queryParams = _ref.queryParams,
1558
+ customization = _ref.customization;
1559
+ var url = new URL(previewURL);
1556
1560
  var params = buildQueryParams(customization, queryParams);
1557
- Object.entries(params).forEach(function (_ref) {
1558
- var _ref2 = _slicedToArray(_ref, 2),
1559
- name = _ref2[0],
1560
- value = _ref2[1];
1561
+ Object.entries(params).forEach(function (_ref2) {
1562
+ var _ref3 = _slicedToArray(_ref2, 2),
1563
+ name = _ref3[0],
1564
+ value = _ref3[1];
1561
1565
  url.searchParams.append(name, value);
1562
1566
  });
1567
+ if (selectedEmbed === EMBED_OPTIONS.FLOATING_POPUP || selectedEmbed === EMBED_OPTIONS.ELEMENT_POPUP) {
1568
+ url.searchParams.set("dynamicHeight", "true");
1569
+ }
1563
1570
  return url.toString();
1564
1571
  };
1565
1572
 
@@ -1578,7 +1585,12 @@ var Preview = function Preview(_ref) {
1578
1585
  queryParams = _useProductEmbedStore.queryParams;
1579
1586
  var preview = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, EMBED_OPTIONS.INLINE, Inline), EMBED_OPTIONS.FLOATING_POPUP, FloatingPopup), EMBED_OPTIONS.ELEMENT_POPUP, ElementPopup), EMBED_OPTIONS.IFRAME, Iframe);
1580
1587
  var previewURL = customPreviewIframeUrl || "".concat(location.origin, "/embed/").concat(id);
1581
- var iframeURL = buildIframeURL(previewURL, queryParams, customization);
1588
+ var iframeURL = buildIframeURL({
1589
+ previewURL: previewURL,
1590
+ selectedEmbed: selectedEmbed,
1591
+ queryParams: queryParams,
1592
+ customization: customization
1593
+ });
1582
1594
  var Component = preview[selectedEmbed];
1583
1595
  if (isScriptLoading) {
1584
1596
  return /*#__PURE__*/jsx("div", {