@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.cjs.js CHANGED
@@ -7181,24 +7181,31 @@ var Button = function Button(_ref) {
7181
7181
  };
7182
7182
  React.useEffect(function () {
7183
7183
  if (!popupCode && !document && disableButtonAndLinks) return;
7184
- var tempDiv = document.createElement("div");
7185
- tempDiv.innerHTML = popupCode;
7186
- var nodes = Array.from(tempDiv.childNodes);
7187
- if (ramda.isEmpty(nodes)) return;
7188
- nodes.forEach(function (node) {
7189
- if (node.tagName === "SCRIPT") {
7190
- var script = document.createElement("script");
7191
- if (node.src) {
7192
- script.src = node.src;
7193
- script.async = node.async || false;
7184
+ try {
7185
+ var tempDiv = document.createElement("div");
7186
+ tempDiv.innerHTML = popupCode;
7187
+ var nodes = Array.from(tempDiv.childNodes);
7188
+ if (ramda.isEmpty(nodes)) return;
7189
+ nodes.forEach(function () {
7190
+ var node = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7191
+ if (node.tagName === "SCRIPT") {
7192
+ var script = document.createElement("script");
7193
+ if (node.src) {
7194
+ script.src = node.src;
7195
+ script.async = node.async || false;
7196
+ } else {
7197
+ script.textContent = node.textContent;
7198
+ }
7199
+ document.body.appendChild(script);
7194
7200
  } else {
7195
- script.textContent = node.textContent;
7201
+ document.body.appendChild(node);
7196
7202
  }
7197
- document.body.appendChild(script);
7198
- } else {
7199
- document.body.appendChild(node);
7200
- }
7201
- });
7203
+ });
7204
+ } catch (_unused) {
7205
+ // NOTE: An error can occur while the user is typing out the embed code.
7206
+ // It could also throw an error if the embed code is invalid. These errors
7207
+ // are ignored since these cannot be handled by NeetoSite.
7208
+ }
7202
7209
  }, [popupCode]);
7203
7210
  if (action === "external") {
7204
7211
  return /*#__PURE__*/jsxRuntime.jsx(StyledAnchor, _objectSpread$B(_objectSpread$B({}, commonProps), {}, {