@bigbinary/neeto-site-blocks 1.17.0 → 1.17.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.
package/dist/index.js CHANGED
@@ -7162,24 +7162,31 @@ var Button = function Button(_ref) {
7162
7162
  };
7163
7163
  useEffect(function () {
7164
7164
  if (!popupCode && !document && disableButtonAndLinks) return;
7165
- var tempDiv = document.createElement("div");
7166
- tempDiv.innerHTML = popupCode;
7167
- var nodes = Array.from(tempDiv.childNodes);
7168
- if (isEmpty(nodes)) return;
7169
- nodes.forEach(function (node) {
7170
- if (node.tagName === "SCRIPT") {
7171
- var script = document.createElement("script");
7172
- if (node.src) {
7173
- script.src = node.src;
7174
- script.async = node.async || false;
7165
+ try {
7166
+ var tempDiv = document.createElement("div");
7167
+ tempDiv.innerHTML = popupCode;
7168
+ var nodes = Array.from(tempDiv.childNodes);
7169
+ if (isEmpty(nodes)) return;
7170
+ nodes.forEach(function () {
7171
+ var node = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7172
+ if (node.tagName === "SCRIPT") {
7173
+ var script = document.createElement("script");
7174
+ if (node.src) {
7175
+ script.src = node.src;
7176
+ script.async = node.async || false;
7177
+ } else {
7178
+ script.textContent = node.textContent;
7179
+ }
7180
+ document.body.appendChild(script);
7175
7181
  } else {
7176
- script.textContent = node.textContent;
7182
+ document.body.appendChild(node);
7177
7183
  }
7178
- document.body.appendChild(script);
7179
- } else {
7180
- document.body.appendChild(node);
7181
- }
7182
- });
7184
+ });
7185
+ } catch (_unused) {
7186
+ // NOTE: An error can occur while the user is typing out the embed code.
7187
+ // It could also throw an error if the embed code is invalid. These errors
7188
+ // are ignored since these cannot be handled by NeetoSite.
7189
+ }
7183
7190
  }, [popupCode]);
7184
7191
  if (action === "external") {
7185
7192
  return /*#__PURE__*/jsx(StyledAnchor, _objectSpread$B(_objectSpread$B({}, commonProps), {}, {