@bigbinary/neeto-site-blocks 1.13.5 → 1.13.7

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
@@ -5680,6 +5680,10 @@ var DropdownWrapper = styled__default["default"].div(function (_ref) {
5680
5680
  } : {};
5681
5681
  });
5682
5682
 
5683
+ var embedPage = function embedPage(href) {
5684
+ return "<!DOCTYPE html>\n<html>\n<head>\n <style>\n html {\n overflow: hidden;\n }\n .embed-booking {\n height: 100vh;\n width: 100%;\n position: relative;\n overflow-x: hidden;\n }\n .new-header {\n height: 12rem;\n width: 100%;\n background: white;\n display: flex;\n flex-direction: column;\n font-size: 0.875rem;\n font-family: Inter;\n padding: 10px;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n opacity: 1;\n z-index: 1;\n\n @media (min-width: 576px) {\n width: 32rem;\n border: 1px solid gray;\n }\n }\n .background {\n height: 100%;\n width: 100%;\n display: flex;\n background-size: contain;\n opacity: 40%;\n background: url(https://ik.imagekit.io/a6t22upil/neeto-site-web/static/neeto-cal-cover-image);\n background-repeat: no-repeat;\n }\n\n .anchor {\n background: #101828;\n padding: 10px;\n border: none;\n color: white;\n border-radius: 9999px;\n cursor: pointer;\n text-decoration: none;\n }\n\n p {\n font-size: 1rem;\n text-align: center;\n font-weight: 500;\n }\n </style>\n</head>\n<body>\n <div class=\"embed-booking\">\n <div class=\"background\"/></div>\n <div class=\"new-header\">\n <p> Paste the inline embed code of your booking page in properties to add your booking page here </p>\n <p> If you don't have booking page </p>\n <a target=\"_blank\" class=\"anchor\" href=".concat(href, "> Create a booking page on NeetoCal</a>\n </div>\n </div>\n</body>\n</html>\n");
5685
+ };
5686
+
5683
5687
  var useElementClick = function useElementClick(_ref) {
5684
5688
  var id = _ref.id,
5685
5689
  _ref$index = _ref.index,
@@ -7141,6 +7145,8 @@ var Button = function Button(_ref) {
7141
7145
  className = _ref$className === void 0 ? "" : _ref$className,
7142
7146
  _ref$action = _ref.action,
7143
7147
  action = _ref$action === void 0 ? "" : _ref$action,
7148
+ _ref$popupCode = _ref.popupCode,
7149
+ popupCode = _ref$popupCode === void 0 ? "" : _ref$popupCode,
7144
7150
  _ref$draftMode = _ref.draftMode,
7145
7151
  draftMode = _ref$draftMode === void 0 ? false : _ref$draftMode,
7146
7152
  _ref$baseUrl = _ref.baseUrl,
@@ -7171,6 +7177,27 @@ var Button = function Button(_ref) {
7171
7177
  id: id,
7172
7178
  "aria-label": label
7173
7179
  };
7180
+ React.useEffect(function () {
7181
+ if (!popupCode && !document && disableButtonAndLinks) return;
7182
+ var tempDiv = document.createElement("div");
7183
+ tempDiv.innerHTML = popupCode;
7184
+ var nodes = Array.from(tempDiv.childNodes);
7185
+ if (ramda.isEmpty(nodes)) return;
7186
+ nodes.forEach(function (node) {
7187
+ if (node.tagName === "SCRIPT") {
7188
+ var script = document.createElement("script");
7189
+ if (node.src) {
7190
+ script.src = node.src;
7191
+ script.async = node.async || false;
7192
+ } else {
7193
+ script.textContent = node.textContent;
7194
+ }
7195
+ document.body.appendChild(script);
7196
+ } else {
7197
+ document.body.appendChild(node);
7198
+ }
7199
+ });
7200
+ }, [popupCode]);
7174
7201
  if (action === "external") {
7175
7202
  return /*#__PURE__*/jsxRuntime.jsx(StyledAnchor, _objectSpread$B(_objectSpread$B({}, commonProps), {}, {
7176
7203
  target: "_blank",
@@ -7188,6 +7215,8 @@ var Button = function Button(_ref) {
7188
7215
  }));
7189
7216
  }
7190
7217
  return /*#__PURE__*/jsxRuntime.jsx(StyledAnchor, _objectSpread$B(_objectSpread$B({}, commonProps), {}, {
7218
+ as: "button",
7219
+ href: action === "embed" && "",
7191
7220
  children: label
7192
7221
  }));
7193
7222
  };
@@ -13456,7 +13485,6 @@ var POSITIONS = {
13456
13485
  }
13457
13486
  };
13458
13487
  var EMAIL_REGEX = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
13459
- var EMBED_DEFAULT_PAGE = "<!DOCTYPE html>\n<html>\n<head>\n <style>\n .embed-booking {\n height: 100vh;\n width: 100%;\n position: relative;\n }\n .new-header {\n height: 12rem;\n width: 32rem;\n background: white;\n display: flex;\n flex-direction: column;\n font-size: 0.875rem;\n font-family: Inter;\n padding: 10px;\n justify-content: center;\n border: 1px solid gray;\n align-items: center;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n opacity: 1;\n z-index: 1;\n }\n .background {\n height: 100%;\n width: 100%;\n display: flex;\n background-size: contain;\n opacity: 40%;\n background: url(https://ik.imagekit.io/a6t22upil/neeto-site-web/static/neeto-cal-cover-image);\n background-repeat: no-repeat;\n }\n\n .anchor {\n background: #101828;\n padding: 10px;\n border: none;\n color: white;\n border-radius: 9999px;\n cursor: pointer;\n text-decoration: none;\n }\n\n p {\n font-size: 1rem;\n text-align: center;\n font-weight: 500;\n }\n </style>\n</head>\n<body>\n <div class=\"embed-booking\">\n <div class=\"background\"/></div>\n <div class=\"new-header\">\n <p> Paste the inline embed code of your booking page in properties to add your booking page here </p>\n <p> If you don't have booking page </p>\n <a target=\"_blank\" class=\"anchor\"> Create a booking page on NeetoCal</a>\n </div>\n </div>\n</body>\n</html>\n";
13460
13488
 
13461
13489
  var validateEmail = function validateEmail(email) {
13462
13490
  return EMAIL_REGEX.test(email);
@@ -13720,32 +13748,7 @@ var CtaWithLogo = function CtaWithLogo(_ref) {
13720
13748
  });
13721
13749
  };
13722
13750
 
13723
- var Embed = function Embed(_ref) {
13724
- var configurations = _ref.configurations,
13725
- className = _ref.className,
13726
- id = _ref.id;
13727
- var properties = configurations.properties,
13728
- design = configurations.design;
13729
- var content = properties.content,
13730
- enableAnimation = properties.enableAnimation;
13731
- return /*#__PURE__*/jsxRuntime.jsx(BlockWrapper, {
13732
- className: className,
13733
- enableAnimation: enableAnimation,
13734
- id: id,
13735
- design: design.body,
13736
- nestedClassName: "h-full flex items-center justify-center",
13737
- children: neetoCist.isNotEmpty(content) ? /*#__PURE__*/jsxRuntime.jsx(Interweave, {
13738
- content: content,
13739
- allowList: ["iframe"],
13740
- className: "ns-embed-block relative flex h-0 w-full pb-[56.25%] lg:static lg:pb-0"
13741
- }) : /*#__PURE__*/jsxRuntime.jsx(Typography$1, {
13742
- className: "text-center font-semibold",
13743
- children: "No content to display"
13744
- })
13745
- });
13746
- };
13747
-
13748
- var _excluded$m = ["configurations", "className", "id"];
13751
+ var _excluded$m = ["configurations", "className", "id", "disableButtonAndLinks", "embedUrl", "isAddNewPane"];
13749
13752
  function ownKeys$m(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13750
13753
  function _objectSpread$m(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$m(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$m(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13751
13754
  var EmbedBooking = function EmbedBooking(_ref) {
@@ -13753,6 +13756,10 @@ var EmbedBooking = function EmbedBooking(_ref) {
13753
13756
  _ref$className = _ref.className,
13754
13757
  className = _ref$className === void 0 ? "" : _ref$className,
13755
13758
  id = _ref.id,
13759
+ disableButtonAndLinks = _ref.disableButtonAndLinks,
13760
+ _ref$embedUrl = _ref.embedUrl,
13761
+ embedUrl = _ref$embedUrl === void 0 ? "" : _ref$embedUrl,
13762
+ isAddNewPane = _ref.isAddNewPane,
13756
13763
  otherProps = _objectWithoutProperties__default["default"](_ref, _excluded$m);
13757
13764
  var properties = configurations.properties,
13758
13765
  design = configurations.design;
@@ -13763,7 +13770,7 @@ var EmbedBooking = function EmbedBooking(_ref) {
13763
13770
  code = _properties$embed.code,
13764
13771
  embedPosition = _properties$embed.embedPosition,
13765
13772
  src = properties.backgroundImage.src;
13766
- var iframeInitialContent = neetoCist.isNotEmpty(code) ? "<!DOCTYPE html><html><head></head><body><div class=\"embed-booking\">\n ".concat(code, "\n </div></body></html>") : EMBED_DEFAULT_PAGE;
13773
+ var iframeInitialContent = neetoCist.isNotEmpty(code) ? "<!DOCTYPE html><html><head></head><body><div class=\"embed-booking\">\n ".concat(code, "\n </div></body></html>") : (disableButtonAndLinks || isAddNewPane) && embedPage(embedUrl);
13767
13774
  var baseClasses = "grid gap-y-6 lg:gap-6 grid-cols-12 grid-flow-row-dense";
13768
13775
  var mediaBaseClasses = classnames__default["default"]("col-span-12 flex flex-col items-center justify-center w-full h-[550px] border border-gray-100", {
13769
13776
  "order-1 lg:col-span-7": POSITIONS.LEFT.label === embedPosition,
@@ -13824,13 +13831,37 @@ var EmbedBooking = function EmbedBooking(_ref) {
13824
13831
  design: design.embed,
13825
13832
  children: /*#__PURE__*/jsxRuntime.jsx(Frame__default["default"], {
13826
13833
  className: "h-full w-full",
13827
- initialContent: iframeInitialContent,
13828
- sandbox: "allow-scripts allow-same-origin allow-forms allow-modals allow-orientation-lock allow-popups"
13834
+ initialContent: iframeInitialContent
13829
13835
  })
13830
13836
  })]
13831
13837
  });
13832
13838
  };
13833
13839
 
13840
+ var EmbedVideo = function EmbedVideo(_ref) {
13841
+ var configurations = _ref.configurations,
13842
+ className = _ref.className,
13843
+ id = _ref.id;
13844
+ var properties = configurations.properties,
13845
+ design = configurations.design;
13846
+ var content = properties.content,
13847
+ enableAnimation = properties.enableAnimation;
13848
+ return /*#__PURE__*/jsxRuntime.jsx(BlockWrapper, {
13849
+ className: className,
13850
+ enableAnimation: enableAnimation,
13851
+ id: id,
13852
+ design: design.body,
13853
+ nestedClassName: "h-full flex items-center justify-center",
13854
+ children: neetoCist.isNotEmpty(content) ? /*#__PURE__*/jsxRuntime.jsx(Interweave, {
13855
+ content: content,
13856
+ allowList: ["iframe"],
13857
+ className: "ns-embed-block relative flex h-0 w-full pb-[56.25%] lg:static lg:pb-0"
13858
+ }) : /*#__PURE__*/jsxRuntime.jsx(Typography$1, {
13859
+ className: "text-center font-semibold",
13860
+ children: "No content to display"
13861
+ })
13862
+ });
13863
+ };
13864
+
13834
13865
  var _excluded$l = ["configurations", "className", "id"],
13835
13866
  _excluded2$1 = ["question", "answer", "design", "enableAnimation", "index"];
13836
13867
  function ownKeys$l(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -17620,8 +17651,8 @@ exports.CtaClassic = CtaClassic;
17620
17651
  exports.CtaWithEmailAction = CtaWithEmailAction;
17621
17652
  exports.CtaWithLogo = CtaWithLogo;
17622
17653
  exports.DESIGN_OPTIONS = index$1;
17623
- exports.Embed = Embed;
17624
17654
  exports.EmbedBooking = EmbedBooking;
17655
+ exports.EmbedVideo = EmbedVideo;
17625
17656
  exports.FaqWithAccordion = FaqWithHamburgerView;
17626
17657
  exports.FeatureWithBulletList = FeatureWithBulletList;
17627
17658
  exports.FeatureWithDetails = FeatureWithDetails;