@bigbinary/neeto-molecules 3.15.1 → 3.15.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.
@@ -29,10 +29,11 @@ var BrowserIcon = function BrowserIcon() {
29
29
  };
30
30
 
31
31
  var BrowserPreview = function BrowserPreview(_ref) {
32
- var className = _ref.className,
32
+ var wrapperClassName = _ref.wrapperClassName,
33
+ className = _ref.className,
33
34
  children = _ref.children;
34
35
  return /*#__PURE__*/jsxs("div", {
35
- className: "neeto-molecules-browser-preview",
36
+ className: classnames("neeto-molecules-browser-preview", wrapperClassName),
36
37
  "data-testid": "browser-preview",
37
38
  children: [/*#__PURE__*/jsx("div", {
38
39
  className: "neeto-molecules-browser-preview__header",
@@ -1 +1 @@
1
- {"version":3,"file":"BrowserPreview.js","sources":["../src/components/BrowserPreview/BrowserIcon.jsx","../src/components/BrowserPreview/index.jsx"],"sourcesContent":["const BrowserIcon = () => (\n <svg\n fill=\"none\"\n height=\"12\"\n viewBox=\"0 0 52 12\"\n width=\"52\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M11.5 6a5.5 5.5 0 11-11 0 5.5 5.5 0 0111 0z\"\n fill=\"#FF5F57\"\n stroke=\"#E14640\"\n />\n <path\n d=\"M31.5 6a5.5 5.5 0 11-11 0 5.5 5.5 0 0111 0z\"\n fill=\"#FFBD2E\"\n stroke=\"#DFA123\"\n />\n <path\n d=\"M51.5 6a5.5 5.5 0 11-11 0 5.5 5.5 0 0111 0z\"\n fill=\"#28CA42\"\n stroke=\"#1DAD2C\"\n />\n </svg>\n);\n\nexport default BrowserIcon;\n","import classNames from \"classnames\";\nimport PropTypes from \"prop-types\";\n\nimport \"./browser-preview.scss\";\nimport BrowserIcon from \"./BrowserIcon.jsx\";\n\nconst BrowserPreview = ({ className, children }) => (\n <div\n className=\"neeto-molecules-browser-preview\"\n data-testid=\"browser-preview\"\n >\n <div className=\"neeto-molecules-browser-preview__header\">\n <BrowserIcon />\n </div>\n <div\n className={classNames(\"neeto-molecules-browser-preview__body\", className)}\n data-testid=\"browser-preview-body\"\n >\n {children}\n </div>\n </div>\n);\n\nBrowserPreview.propTypes = {\n /**\n * The content to be rendered inside the browser preview body.\n */\n children: PropTypes.node,\n /*\n * To provide additional classes to the browser preview body.\n */\n className: PropTypes.string,\n};\n\nexport default BrowserPreview;\n"],"names":["BrowserIcon","_jsxs","fill","height","viewBox","width","xmlns","children","_jsx","d","stroke","BrowserPreview","_ref","className","classNames"],"mappings":";;;;;;;AAAA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,GAAA;AAAA,EAAA,oBACfC,IAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,IAAI,EAAC,MAAM;AACXC,IAAAA,MAAM,EAAC,IAAI;AACXC,IAAAA,OAAO,EAAC,WAAW;AACnBC,IAAAA,KAAK,EAAC,IAAI;AACVC,IAAAA,KAAK,EAAC,4BAA4B;AAAAC,IAAAA,QAAA,gBAElCC,GAAA,CAAA,MAAA,EAAA;AACEC,MAAAA,CAAC,EAAC,6CAA6C;AAC/CP,MAAAA,IAAI,EAAC,SAAS;AACdQ,MAAAA,MAAM,EAAC,SAAA;KACR,CAAC,eACFF,GAAA,CAAA,MAAA,EAAA;AACEC,MAAAA,CAAC,EAAC,6CAA6C;AAC/CP,MAAAA,IAAI,EAAC,SAAS;AACdQ,MAAAA,MAAM,EAAC,SAAA;KACR,CAAC,eACFF,GAAA,CAAA,MAAA,EAAA;AACEC,MAAAA,CAAC,EAAC,6CAA6C;AAC/CP,MAAAA,IAAI,EAAC,SAAS;AACdQ,MAAAA,MAAM,EAAC,SAAA;AAAS,KACjB,CAAC,CAAA;AAAA,GACC,CAAC,CAAA;AAAA,CACP;;AClBD,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEN,QAAQ,GAAAK,IAAA,CAARL,QAAQ,CAAA;AAAA,EAAA,oBAC3CN,IAAA,CAAA,KAAA,EAAA;AACEY,IAAAA,SAAS,EAAC,iCAAiC;AAC3C,IAAA,aAAA,EAAY,iBAAiB;AAAAN,IAAAA,QAAA,gBAE7BC,GAAA,CAAA,KAAA,EAAA;AAAKK,MAAAA,SAAS,EAAC,yCAAyC;AAAAN,MAAAA,QAAA,eACtDC,GAAA,CAACR,WAAW,EAAE,EAAA,CAAA;KACX,CAAC,eACNQ,GAAA,CAAA,KAAA,EAAA;AACEK,MAAAA,SAAS,EAAEC,UAAU,CAAC,uCAAuC,EAAED,SAAS,CAAE;AAC1E,MAAA,aAAA,EAAY,sBAAsB;AAAAN,MAAAA,QAAA,EAEjCA,QAAAA;AAAQ,KACN,CAAC,CAAA;AAAA,GACH,CAAC,CAAA;AAAA;;;;"}
1
+ {"version":3,"file":"BrowserPreview.js","sources":["../src/components/BrowserPreview/BrowserIcon.jsx","../src/components/BrowserPreview/index.jsx"],"sourcesContent":["const BrowserIcon = () => (\n <svg\n fill=\"none\"\n height=\"12\"\n viewBox=\"0 0 52 12\"\n width=\"52\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M11.5 6a5.5 5.5 0 11-11 0 5.5 5.5 0 0111 0z\"\n fill=\"#FF5F57\"\n stroke=\"#E14640\"\n />\n <path\n d=\"M31.5 6a5.5 5.5 0 11-11 0 5.5 5.5 0 0111 0z\"\n fill=\"#FFBD2E\"\n stroke=\"#DFA123\"\n />\n <path\n d=\"M51.5 6a5.5 5.5 0 11-11 0 5.5 5.5 0 0111 0z\"\n fill=\"#28CA42\"\n stroke=\"#1DAD2C\"\n />\n </svg>\n);\n\nexport default BrowserIcon;\n","import classNames from \"classnames\";\nimport PropTypes from \"prop-types\";\n\nimport \"./browser-preview.scss\";\nimport BrowserIcon from \"./BrowserIcon.jsx\";\n\nconst BrowserPreview = ({ wrapperClassName, className, children }) => (\n <div\n className={classNames(\"neeto-molecules-browser-preview\", wrapperClassName)}\n data-testid=\"browser-preview\"\n >\n <div className=\"neeto-molecules-browser-preview__header\">\n <BrowserIcon />\n </div>\n <div\n className={classNames(\"neeto-molecules-browser-preview__body\", className)}\n data-testid=\"browser-preview-body\"\n >\n {children}\n </div>\n </div>\n);\n\nBrowserPreview.propTypes = {\n /**\n * The content to be rendered inside the browser preview body.\n */\n children: PropTypes.node,\n /*\n * To provide additional classes to the browser preview container.\n */\n wrapperClassName: PropTypes.string,\n /*\n * To provide additional classes to the browser preview body.\n */\n className: PropTypes.string,\n};\n\nexport default BrowserPreview;\n"],"names":["BrowserIcon","_jsxs","fill","height","viewBox","width","xmlns","children","_jsx","d","stroke","BrowserPreview","_ref","wrapperClassName","className","classNames"],"mappings":";;;;;;;AAAA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,GAAA;AAAA,EAAA,oBACfC,IAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,IAAI,EAAC,MAAM;AACXC,IAAAA,MAAM,EAAC,IAAI;AACXC,IAAAA,OAAO,EAAC,WAAW;AACnBC,IAAAA,KAAK,EAAC,IAAI;AACVC,IAAAA,KAAK,EAAC,4BAA4B;AAAAC,IAAAA,QAAA,gBAElCC,GAAA,CAAA,MAAA,EAAA;AACEC,MAAAA,CAAC,EAAC,6CAA6C;AAC/CP,MAAAA,IAAI,EAAC,SAAS;AACdQ,MAAAA,MAAM,EAAC,SAAA;KACR,CAAC,eACFF,GAAA,CAAA,MAAA,EAAA;AACEC,MAAAA,CAAC,EAAC,6CAA6C;AAC/CP,MAAAA,IAAI,EAAC,SAAS;AACdQ,MAAAA,MAAM,EAAC,SAAA;KACR,CAAC,eACFF,GAAA,CAAA,MAAA,EAAA;AACEC,MAAAA,CAAC,EAAC,6CAA6C;AAC/CP,MAAAA,IAAI,EAAC,SAAS;AACdQ,MAAAA,MAAM,EAAC,SAAA;AAAS,KACjB,CAAC,CAAA;AAAA,GACC,CAAC,CAAA;AAAA,CACP;;AClBD,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMC,gBAAgB,GAAAD,IAAA,CAAhBC,gBAAgB;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;IAAEP,QAAQ,GAAAK,IAAA,CAARL,QAAQ,CAAA;AAAA,EAAA,oBAC7DN,IAAA,CAAA,KAAA,EAAA;AACEa,IAAAA,SAAS,EAAEC,UAAU,CAAC,iCAAiC,EAAEF,gBAAgB,CAAE;AAC3E,IAAA,aAAA,EAAY,iBAAiB;AAAAN,IAAAA,QAAA,gBAE7BC,GAAA,CAAA,KAAA,EAAA;AAAKM,MAAAA,SAAS,EAAC,yCAAyC;AAAAP,MAAAA,QAAA,eACtDC,GAAA,CAACR,WAAW,EAAE,EAAA,CAAA;KACX,CAAC,eACNQ,GAAA,CAAA,KAAA,EAAA;AACEM,MAAAA,SAAS,EAAEC,UAAU,CAAC,uCAAuC,EAAED,SAAS,CAAE;AAC1E,MAAA,aAAA,EAAY,sBAAsB;AAAAP,MAAAA,QAAA,EAEjCA,QAAAA;AAAQ,KACN,CAAC,CAAA;AAAA,GACH,CAAC,CAAA;AAAA;;;;"}
package/dist/Codeblock.js CHANGED
@@ -31,7 +31,7 @@ var Codeblock = function Codeblock(_ref) {
31
31
  className: "relative",
32
32
  children: [/*#__PURE__*/jsx(PrismLight, _objectSpread(_objectSpread({
33
33
  wrapLines: true,
34
- className: "p-4 pr-12 md:pr-4",
34
+ className: "neeto-molecules-code-block p-4 pr-12 md:pr-4",
35
35
  codeTagProps: {
36
36
  "data-cy": "code-block-content"
37
37
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Codeblock.js","sources":["../src/components/Codeblock.jsx"],"sourcesContent":["import PropTypes from \"prop-types\";\nimport { PrismLight as CodeBlock } from \"react-syntax-highlighter\";\nimport { dracula } from \"react-syntax-highlighter/dist/esm/styles/prism\";\n\nimport CopyCode from \"components/CopyToClipboardButton\";\n\nconst Codeblock = ({\n code,\n showCopyButton = true,\n codeblockProps,\n copyButtonProps = { label: \"Copy\" },\n}) => {\n const isLargerScreen = window.innerWidth > 768;\n\n return (\n <div className=\"relative\">\n <CodeBlock\n wrapLines\n className=\"p-4 pr-12 md:pr-4\"\n codeTagProps={{ \"data-cy\": \"code-block-content\" }}\n data-cy=\"code-block\"\n data-testid=\"codeblock-react-highlighter\"\n language=\"javascript\"\n style={dracula}\n {...codeblockProps}\n >\n {code}\n </CodeBlock>\n {showCopyButton && (\n <CopyCode\n className=\"absolute right-2 top-2\"\n data-cy=\"copy-button\"\n data-testid=\"codeblock-copy-button\"\n size=\"small\"\n style=\"secondary\"\n value={code}\n {...copyButtonProps}\n label={isLargerScreen ? copyButtonProps.label : \"\"}\n />\n )}\n </div>\n );\n};\n\nCodeblock.propTypes = {\n /**\n * The code to be displayed.\n */\n code: PropTypes.string,\n /**\n * Flag to determine whether the 'Copy' button is displayed.\n */\n showCopyButton: PropTypes.bool,\n /**\n * Additional props that can be passed on to the 'PrismLight' component from 'react-syntax-highlighter'.\n */\n codeblockProps: PropTypes.object,\n /**\n * Additional props that can be passed on to the 'CopyToClipboardButton' component from 'neeto-molecules'.\n */\n copyButtonProps: PropTypes.object,\n};\n\nexport default Codeblock;\n"],"names":["Codeblock","_ref","code","_ref$showCopyButton","showCopyButton","codeblockProps","_ref$copyButtonProps","copyButtonProps","label","isLargerScreen","window","innerWidth","_jsxs","className","children","_jsx","CodeBlock","_objectSpread","wrapLines","codeTagProps","language","style","dracula","CopyCode","size","value"],"mappings":";;;;;;;;;;;;;;;;;;;AAMA,IAAMA,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAKT;AAAA,EAAA,IAJJC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAAC,mBAAA,GAAAF,IAAA,CACJG,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA;IACrBE,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IAAAC,oBAAA,GAAAL,IAAA,CACdM,eAAe;IAAfA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA;AAAEE,MAAAA,KAAK,EAAE,MAAA;AAAO,KAAC,GAAAF,oBAAA,CAAA;AAEnC,EAAA,IAAMG,cAAc,GAAGC,MAAM,CAACC,UAAU,GAAG,GAAG,CAAA;AAE9C,EAAA,oBACEC,IAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,UAAU;AAAAC,IAAAA,QAAA,gBACvBC,GAAA,CAACC,UAAS,EAAAC,aAAA,CAAAA,aAAA,CAAA;MACRC,SAAS,EAAA,IAAA;AACTL,MAAAA,SAAS,EAAC,mBAAmB;AAC7BM,MAAAA,YAAY,EAAE;AAAE,QAAA,SAAS,EAAE,oBAAA;OAAuB;AAClD,MAAA,SAAA,EAAQ,YAAY;AACpB,MAAA,aAAA,EAAY,6BAA6B;AACzCC,MAAAA,QAAQ,EAAC,YAAY;AACrBC,MAAAA,KAAK,EAAEC,OAAAA;AAAQ,KAAA,EACXjB,cAAc,CAAA,EAAA,EAAA,EAAA;AAAAS,MAAAA,QAAA,EAEjBZ,IAAAA;KACQ,CAAA,CAAC,EACXE,cAAc,iBACbW,GAAA,CAACQ,qBAAQ,EAAAN,aAAA,CAAAA,aAAA,CAAA;AACPJ,MAAAA,SAAS,EAAC,wBAAwB;AAClC,MAAA,SAAA,EAAQ,aAAa;AACrB,MAAA,aAAA,EAAY,uBAAuB;AACnCW,MAAAA,IAAI,EAAC,OAAO;AACZH,MAAAA,KAAK,EAAC,WAAW;AACjBI,MAAAA,KAAK,EAAEvB,IAAAA;AAAK,KAAA,EACRK,eAAe,CAAA,EAAA,EAAA,EAAA;AACnBC,MAAAA,KAAK,EAAEC,cAAc,GAAGF,eAAe,CAACC,KAAK,GAAG,EAAA;AAAG,KAAA,CACpD,CACF,CAAA;AAAA,GACE,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"Codeblock.js","sources":["../src/components/Codeblock.jsx"],"sourcesContent":["import PropTypes from \"prop-types\";\nimport { PrismLight as CodeBlock } from \"react-syntax-highlighter\";\nimport { dracula } from \"react-syntax-highlighter/dist/esm/styles/prism\";\n\nimport CopyCode from \"components/CopyToClipboardButton\";\n\nconst Codeblock = ({\n code,\n showCopyButton = true,\n codeblockProps,\n copyButtonProps = { label: \"Copy\" },\n}) => {\n const isLargerScreen = window.innerWidth > 768;\n\n return (\n <div className=\"relative\">\n <CodeBlock\n wrapLines\n className=\"neeto-molecules-code-block p-4 pr-12 md:pr-4\"\n codeTagProps={{ \"data-cy\": \"code-block-content\" }}\n data-cy=\"code-block\"\n data-testid=\"codeblock-react-highlighter\"\n language=\"javascript\"\n style={dracula}\n {...codeblockProps}\n >\n {code}\n </CodeBlock>\n {showCopyButton && (\n <CopyCode\n className=\"absolute right-2 top-2\"\n data-cy=\"copy-button\"\n data-testid=\"codeblock-copy-button\"\n size=\"small\"\n style=\"secondary\"\n value={code}\n {...copyButtonProps}\n label={isLargerScreen ? copyButtonProps.label : \"\"}\n />\n )}\n </div>\n );\n};\n\nCodeblock.propTypes = {\n /**\n * The code to be displayed.\n */\n code: PropTypes.string,\n /**\n * Flag to determine whether the 'Copy' button is displayed.\n */\n showCopyButton: PropTypes.bool,\n /**\n * Additional props that can be passed on to the 'PrismLight' component from 'react-syntax-highlighter'.\n */\n codeblockProps: PropTypes.object,\n /**\n * Additional props that can be passed on to the 'CopyToClipboardButton' component from 'neeto-molecules'.\n */\n copyButtonProps: PropTypes.object,\n};\n\nexport default Codeblock;\n"],"names":["Codeblock","_ref","code","_ref$showCopyButton","showCopyButton","codeblockProps","_ref$copyButtonProps","copyButtonProps","label","isLargerScreen","window","innerWidth","_jsxs","className","children","_jsx","CodeBlock","_objectSpread","wrapLines","codeTagProps","language","style","dracula","CopyCode","size","value"],"mappings":";;;;;;;;;;;;;;;;;;;AAMA,IAAMA,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAKT;AAAA,EAAA,IAJJC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAAC,mBAAA,GAAAF,IAAA,CACJG,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA;IACrBE,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IAAAC,oBAAA,GAAAL,IAAA,CACdM,eAAe;IAAfA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA;AAAEE,MAAAA,KAAK,EAAE,MAAA;AAAO,KAAC,GAAAF,oBAAA,CAAA;AAEnC,EAAA,IAAMG,cAAc,GAAGC,MAAM,CAACC,UAAU,GAAG,GAAG,CAAA;AAE9C,EAAA,oBACEC,IAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,UAAU;AAAAC,IAAAA,QAAA,gBACvBC,GAAA,CAACC,UAAS,EAAAC,aAAA,CAAAA,aAAA,CAAA;MACRC,SAAS,EAAA,IAAA;AACTL,MAAAA,SAAS,EAAC,8CAA8C;AACxDM,MAAAA,YAAY,EAAE;AAAE,QAAA,SAAS,EAAE,oBAAA;OAAuB;AAClD,MAAA,SAAA,EAAQ,YAAY;AACpB,MAAA,aAAA,EAAY,6BAA6B;AACzCC,MAAAA,QAAQ,EAAC,YAAY;AACrBC,MAAAA,KAAK,EAAEC,OAAAA;AAAQ,KAAA,EACXjB,cAAc,CAAA,EAAA,EAAA,EAAA;AAAAS,MAAAA,QAAA,EAEjBZ,IAAAA;KACQ,CAAA,CAAC,EACXE,cAAc,iBACbW,GAAA,CAACQ,qBAAQ,EAAAN,aAAA,CAAAA,aAAA,CAAA;AACPJ,MAAAA,SAAS,EAAC,wBAAwB;AAClC,MAAA,SAAA,EAAQ,aAAa;AACrB,MAAA,aAAA,EAAY,uBAAuB;AACnCW,MAAAA,IAAI,EAAC,OAAO;AACZH,MAAAA,KAAK,EAAC,WAAW;AACjBI,MAAAA,KAAK,EAAEvB,IAAAA;AAAK,KAAA,EACRK,eAAe,CAAA,EAAA,EAAA,EAAA;AACnBC,MAAAA,KAAK,EAAEC,cAAc,GAAGF,eAAe,CAACC,KAAK,GAAG,EAAA;AAAG,KAAA,CACpD,CACF,CAAA;AAAA,GACE,CAAC,CAAA;AAEV;;;;"}
@@ -2,23 +2,23 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
3
  import { useState, useEffect, createElement } from 'react';
4
4
  import classnames from 'classnames';
5
- import { noop } from '@bigbinary/neeto-cist';
5
+ import { filterBy, noop } from '@bigbinary/neeto-cist';
6
6
  import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
7
7
  import Button from '@bigbinary/neetoui/Button';
8
8
  import Typography from '@bigbinary/neetoui/Typography';
9
- import { mergeDeepLeft, toPairs, isEmpty, mergeLeft } from 'ramda';
9
+ import { toPairs, mergeDeepLeft, isEmpty, mergeLeft } from 'ramda';
10
10
  import { useTranslation } from 'react-i18next';
11
11
  import Codeblock from './Codeblock.js';
12
12
  import { jsx, jsxs } from 'react/jsx-runtime';
13
13
  import { t } from 'i18next';
14
14
  import Code$1 from '@bigbinary/neeto-icons/Code';
15
- import Eye from '@bigbinary/neeto-icons/Eye';
16
15
  import Input from '@bigbinary/neetoui/Input';
17
16
  import Callout from '@bigbinary/neetoui/Callout';
18
17
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
19
18
  import Delete from '@bigbinary/neeto-icons/Delete';
20
19
  import Plus from '@bigbinary/neeto-icons/Plus';
21
20
  import Label from '@bigbinary/neetoui/Label';
21
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
22
22
  import Checkbox from '@bigbinary/neetoui/Checkbox';
23
23
  import Select from '@bigbinary/neetoui/Select';
24
24
  import ColorPicker from '@bigbinary/neetoui/ColorPicker';
@@ -30,17 +30,17 @@ import { n } from './inject-css-DmrvuTKK.js';
30
30
  import 'react-syntax-highlighter';
31
31
  import 'react-syntax-highlighter/dist/esm/styles/prism';
32
32
  import './CopyToClipboardButton.js';
33
- import '@babel/runtime/helpers/objectWithoutProperties';
34
33
  import '@bigbinary/neeto-commons-frontend/utils/general';
35
34
  import '@bigbinary/neeto-icons/Copy';
36
35
  import '@bigbinary/neeto-icons/Check';
37
36
 
38
37
  var Code = function Code(_ref) {
39
- var code = _ref.code;
38
+ var code = _ref.code,
39
+ tab = _ref.tab;
40
40
  return /*#__PURE__*/jsx("div", {
41
- className: "relative w-full overflow-y-auto",
41
+ className: "neeto-molecules-embed__code-block relative w-full overflow-y-auto",
42
42
  "data-cy": "embed-code-block",
43
- "data-testid": "embed-code-block",
43
+ "data-testid": "".concat(tab, "-code-block"),
44
44
  children: /*#__PURE__*/jsx(Codeblock, {
45
45
  code: code
46
46
  })
@@ -49,16 +49,16 @@ var Code = function Code(_ref) {
49
49
 
50
50
  var TAB_KEYS = {
51
51
  HTML: "html",
52
- PREVIEW: "preview"
52
+ REACT: "react"
53
53
  };
54
54
  var TABS = [{
55
55
  key: TAB_KEYS.HTML,
56
56
  label: t("neetoMolecules.productEmbed.tab.html"),
57
57
  icon: Code$1
58
58
  }, {
59
- key: TAB_KEYS.PREVIEW,
60
- label: t("neetoMolecules.productEmbed.tab.preview"),
61
- icon: Eye
59
+ key: TAB_KEYS.REACT,
60
+ label: t("neetoMolecules.productEmbed.tab.react"),
61
+ icon: Code$1
62
62
  }];
63
63
  var EMBED_OPTIONS = {
64
64
  INLINE: "inline",
@@ -93,17 +93,17 @@ var INITIAL_QUERY_PARAM = {
93
93
  value: ""
94
94
  };
95
95
 
96
- var camelCasedAppName = globalProps.appName.replace(/^neeto/i, "neeto");
96
+ var camelCasedAppName$1 = globalProps.appName.replace(/^neeto/i, "neeto");
97
97
  var embedBaseScript = function embedBaseScript(embedScriptLink) {
98
- return "<script>window.".concat(camelCasedAppName, " = window.").concat(camelCasedAppName, " || { embed: function(){(").concat(camelCasedAppName, ".q=").concat(camelCasedAppName, ".q||[]).push(arguments)} };</script>\n <script async\n src=\"").concat(embedScriptLink, "\">\n </script>");
98
+ return "<script>window.".concat(camelCasedAppName$1, " = window.").concat(camelCasedAppName$1, " || { embed: function(){(").concat(camelCasedAppName$1, ".q=").concat(camelCasedAppName$1, ".q||[]).push(arguments)} };</script>\n <script async\n src=\"").concat(embedScriptLink, "\">\n </script>");
99
99
  };
100
- var embedEnv = function embedEnv() {
100
+ var embedEnv$1 = function embedEnv() {
101
101
  return globalProps.railsEnv !== "production" ? "\n".concat(TAB_STRING, " env: \"").concat(globalProps.railsEnv, "\",") : "";
102
102
  };
103
- var embedQueryParam = function embedQueryParam(queryParams) {
103
+ var embedQueryParam$1 = function embedQueryParam(queryParams) {
104
104
  return queryParams ? "\n".concat(TAB_STRING, " queryParams: ").concat(queryParams, ",") : "";
105
105
  };
106
- var parseExtraArgs = function parseExtraArgs(extraArgs) {
106
+ var parseExtraArgs$1 = function parseExtraArgs(extraArgs) {
107
107
  return toPairs(extraArgs).map(function (_ref) {
108
108
  var _ref2 = _slicedToArray(_ref, 2),
109
109
  key = _ref2[0],
@@ -111,6 +111,81 @@ var parseExtraArgs = function parseExtraArgs(extraArgs) {
111
111
  return "\n".concat(TAB_STRING, " ").concat(key, ": \"").concat(value, "\"");
112
112
  });
113
113
  };
114
+ var inlineEmbedCode$1 = function inlineEmbedCode(_ref3) {
115
+ var customization = _ref3.customization,
116
+ id = _ref3.id,
117
+ embedScriptLink = _ref3.embedScriptLink,
118
+ extraArgs = _ref3.extraArgs,
119
+ inlineWrapperStyle = _ref3.inlineWrapperStyle;
120
+ var elementSelector = customization.elementSelector,
121
+ _customization$width = customization.width,
122
+ width = _customization$width === void 0 ? 100 : _customization$width,
123
+ _customization$height = customization.height,
124
+ height = _customization$height === void 0 ? 100 : _customization$height,
125
+ queryParams = customization.queryParams;
126
+ return "\n <!-- ".concat(globalProps.appName, " inline embed code begins -->\n <div style=\"").concat(inlineWrapperStyle || "height: 90vh; width: 100%;", "\" id=\"").concat(elementSelector, "\">\n <!-- ").concat(globalProps.appName, " widget will be added here -->\n </div>\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(camelCasedAppName$1, ".embed({\n type: \"inline\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",\n styles: { height: \"").concat(height, "%\", width: \"").concat(width, "%\"},").concat(embedQueryParam$1(queryParams)).concat(embedEnv$1()).concat(parseExtraArgs$1(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " inline embed code ends -->");
127
+ };
128
+ var floatingPopupEmbedCode$1 = function floatingPopupEmbedCode(_ref4) {
129
+ var customization = _ref4.customization,
130
+ id = _ref4.id,
131
+ embedScriptLink = _ref4.embedScriptLink,
132
+ extraArgs = _ref4.extraArgs;
133
+ var btnTextColor = customization.btnTextColor,
134
+ showIcon = customization.showIcon,
135
+ btnText = customization.btnText,
136
+ btnPosition = customization.btnPosition,
137
+ btnColor = customization.btnColor,
138
+ icon = customization.icon,
139
+ queryParams = customization.queryParams;
140
+ return "\n <!-- ".concat(globalProps.appName, " floating-popup embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(camelCasedAppName$1, ".embed({\n type: \"floatingPopup\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n styles: {\n btnTextColor: \"").concat(btnTextColor, "\",\n btnPosition: \"").concat(btnPosition, "\",\n btnColor: \"").concat(btnColor, "\",\n btnText: \"").concat(btnText, "\", ").concat(icon ? "\n".concat(TAB_STRING).concat(TAB_STRING, "showIcon: ").concat(showIcon, ",") : "", "\n },").concat(embedQueryParam$1(queryParams)).concat(embedEnv$1()).concat(parseExtraArgs$1(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " floating-popup embed code ends -->");
141
+ };
142
+ var elementPopupEmbedCode$1 = function elementPopupEmbedCode(_ref5) {
143
+ var customization = _ref5.customization,
144
+ id = _ref5.id,
145
+ embedScriptLink = _ref5.embedScriptLink,
146
+ extraArgs = _ref5.extraArgs;
147
+ var elementSelector = customization.elementSelector,
148
+ queryParams = customization.queryParams;
149
+ return "\n <!-- This is a demo button, you can use any element on your website instead. -->\n <button id=\"".concat(elementSelector, "\">Click to open popup</button>\n\n <!-- ").concat(globalProps.appName, " element-click embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(camelCasedAppName$1, ".embed({\n type: \"elementClick\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",").concat(embedQueryParam$1(queryParams)).concat(embedEnv$1()).concat(parseExtraArgs$1(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " element-click embed code ends -->");
150
+ };
151
+ var htmlCodeGenerators = {
152
+ inline: inlineEmbedCode$1,
153
+ floatingPopup: floatingPopupEmbedCode$1,
154
+ elementPopup: elementPopupEmbedCode$1
155
+ };
156
+
157
+ var camelCasedAppName = globalProps.appName.replace(/^neeto/i, "neeto");
158
+ var embedFunctionName = "".concat(camelCasedAppName, "Embed");
159
+ var baseScript = "const baseScript = document.createElement(\"script\");\n baseScript.innerHTML = `window.".concat(camelCasedAppName, " = window.").concat(camelCasedAppName, " || { embed: function(){(").concat(camelCasedAppName, ".q=").concat(camelCasedAppName, ".q||[]).push(arguments)} };`\n document.body.appendChild(baseScript);\n");
160
+ var embedScript = function embedScript(scriptLink) {
161
+ return "const embedScript = document.createElement(\"script\");\n embedScript.src = \"".concat(scriptLink, "\";\n embedScript.async = true;\n document.body.appendChild(embedScript);\n");
162
+ };
163
+ var cleanupFunction = "// Cleanup function\n return () => {\n document.body.removeChild(baseScript);\n document.body.removeChild(embedScript);\n };";
164
+ var embedEnv = function embedEnv() {
165
+ return globalProps.railsEnv !== "production" ? "\n".concat(TAB_STRING).concat(TAB_STRING, "env: \"").concat(globalProps.railsEnv, "\",") : "";
166
+ };
167
+ var embedQueryParam = function embedQueryParam(queryParams) {
168
+ return queryParams ? "\n".concat(TAB_STRING).concat(TAB_STRING, "queryParams: ").concat(queryParams, ",") : "";
169
+ };
170
+ var parseExtraArgs = function parseExtraArgs(extraArgs) {
171
+ return toPairs(extraArgs).map(function (_ref) {
172
+ var _ref2 = _slicedToArray(_ref, 2),
173
+ key = _ref2[0],
174
+ value = _ref2[1];
175
+ return "\n".concat(TAB_STRING).concat(TAB_STRING).concat(key, ": \"").concat(value, "\"");
176
+ });
177
+ };
178
+ var parseInlineStyle = function parseInlineStyle(styleString) {
179
+ return styleString ? styleString.split(";").map(function (rule) {
180
+ var _rule$split$map = rule.split(":").map(function (s) {
181
+ return s.trim();
182
+ }),
183
+ _rule$split$map2 = _slicedToArray(_rule$split$map, 2),
184
+ key = _rule$split$map2[0],
185
+ value = _rule$split$map2[1];
186
+ return key && value ? "".concat(key, ": \"").concat(value, "\"") : null;
187
+ }).filter(Boolean).join(", ") : 'height: "90vh", width: "100%"';
188
+ };
114
189
  var inlineEmbedCode = function inlineEmbedCode(_ref3) {
115
190
  var customization = _ref3.customization,
116
191
  id = _ref3.id,
@@ -123,7 +198,7 @@ var inlineEmbedCode = function inlineEmbedCode(_ref3) {
123
198
  _customization$height = customization.height,
124
199
  height = _customization$height === void 0 ? 100 : _customization$height,
125
200
  queryParams = customization.queryParams;
126
- return "\n <!-- ".concat(globalProps.appName, " inline embed code begins -->\n <div style=\"").concat(inlineWrapperStyle || "height: 90vh; width: 100%;", "\" id=\"").concat(elementSelector, "\">\n <!-- ").concat(globalProps.appName, " widget will be added here -->\n </div>\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(camelCasedAppName, ".embed({\n type: \"inline\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",\n styles: { height: \"").concat(height, "%\", width: \"").concat(width, "%\"},").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " inline embed code ends -->");
201
+ return "\n import { useEffect } from \"react\";\n\n const App = () => {\n const ".concat(embedFunctionName, " = () => {\n ").concat(baseScript, "\n ").concat(embedScript(embedScriptLink), "\n ").concat(camelCasedAppName, ".embed({\n type: \"inline\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",\n styles: { height: \"").concat(height, "%\", width: \"").concat(width, "%\" },").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n\n ").concat(cleanupFunction, "\n };\n\n useEffect(() => ").concat(embedFunctionName, "(), []);\n\n return (\n <div\n id=\"inline-embed-container\"\n style={{ ").concat(parseInlineStyle(inlineWrapperStyle), " }}\n />\n );\n };");
127
202
  };
128
203
  var floatingPopupEmbedCode = function floatingPopupEmbedCode(_ref4) {
129
204
  var customization = _ref4.customization,
@@ -137,7 +212,7 @@ var floatingPopupEmbedCode = function floatingPopupEmbedCode(_ref4) {
137
212
  btnColor = customization.btnColor,
138
213
  icon = customization.icon,
139
214
  queryParams = customization.queryParams;
140
- return "\n <!-- ".concat(globalProps.appName, " floating-popup embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(camelCasedAppName, ".embed({\n type: \"floatingPopup\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n styles: {\n btnTextColor: \"").concat(btnTextColor, "\",\n btnPosition: \"").concat(btnPosition, "\",\n btnColor: \"").concat(btnColor, "\",\n btnText: \"").concat(btnText, "\", ").concat(icon ? "\n".concat(TAB_STRING).concat(TAB_STRING, "showIcon: ").concat(showIcon, ",") : "", "\n },").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " floating-popup embed code ends -->");
215
+ return "\n import { useEffect } from \"react\";\n\n const App = () => {\n const ".concat(embedFunctionName, " = () => {\n ").concat(baseScript, "\n ").concat(embedScript(embedScriptLink), "\n ").concat(camelCasedAppName, ".embed({\n type: \"floatingPopup\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n styles: {\n btnTextColor: \"").concat(btnTextColor, "\",\n btnPosition: \"").concat(btnPosition, "\",\n btnColor: \"").concat(btnColor, "\",\n btnText: \"").concat(btnText, "\",").concat(icon ? "\n".concat(TAB_STRING).concat(TAB_STRING, " showIcon: ").concat(showIcon, ",") : "", "\n },").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n\n ").concat(cleanupFunction, "\n };\n\n useEffect(() => ").concat(embedFunctionName, "(), []);\n\n return <div />;\n };");
141
216
  };
142
217
  var elementPopupEmbedCode = function elementPopupEmbedCode(_ref5) {
143
218
  var customization = _ref5.customization,
@@ -146,55 +221,34 @@ var elementPopupEmbedCode = function elementPopupEmbedCode(_ref5) {
146
221
  extraArgs = _ref5.extraArgs;
147
222
  var elementSelector = customization.elementSelector,
148
223
  queryParams = customization.queryParams;
149
- return "\n <!-- This is a demo button, you can use any element on your website instead. -->\n <button id=\"".concat(elementSelector, "\">Click to open popup</button>\n\n <!-- ").concat(globalProps.appName, " element-click embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(camelCasedAppName, ".embed({\n type: \"elementClick\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " element-click embed code ends -->");
150
- };
151
- var embedCode = function embedCode(_ref6) {
152
- var type = _ref6.type,
153
- customization = _ref6.customization,
154
- id = _ref6.id,
155
- embedScriptLink = _ref6.embedScriptLink,
156
- _ref6$extraArgs = _ref6.extraArgs,
157
- extraArgs = _ref6$extraArgs === void 0 ? {} : _ref6$extraArgs,
158
- inlineWrapperStyle = _ref6.inlineWrapperStyle;
159
- switch (type) {
160
- case "inline":
161
- return inlineEmbedCode({
162
- customization: customization,
163
- id: id,
164
- embedScriptLink: embedScriptLink,
165
- extraArgs: extraArgs,
166
- inlineWrapperStyle: inlineWrapperStyle
167
- });
168
- case "floatingPopup":
169
- return floatingPopupEmbedCode({
170
- customization: customization,
171
- id: id,
172
- embedScriptLink: embedScriptLink,
173
- extraArgs: extraArgs
174
- });
175
- case "elementPopup":
176
- return elementPopupEmbedCode({
177
- customization: customization,
178
- id: id,
179
- embedScriptLink: embedScriptLink,
180
- extraArgs: extraArgs
181
- });
182
- default:
183
- return "";
184
- }
224
+ return "\n import { useEffect } from \"react\";\n\n const App = () => {\n const ".concat(embedFunctionName, " = () => {\n ").concat(baseScript, "\n ").concat(embedScript(embedScriptLink), "\n ").concat(camelCasedAppName, ".embed({\n type: \"elementClick\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n\n ").concat(cleanupFunction, "\n };\n\n useEffect(() => ").concat(embedFunctionName, "(), []);\n\n return <div />;\n };");
225
+ };
226
+ var reactCodeGenerators = {
227
+ inline: inlineEmbedCode,
228
+ floatingPopup: floatingPopupEmbedCode,
229
+ elementPopup: elementPopupEmbedCode
230
+ };
231
+
232
+ var _excluded = ["tab", "type"];
233
+ var generateCode = function generateCode(options) {
234
+ var _reactCodeGenerators$, _htmlCodeGenerators$t;
235
+ var tab = options.tab,
236
+ type = options.type,
237
+ embeddedCodeOptions = _objectWithoutProperties(options, _excluded);
238
+ return tab === "react" ? (_reactCodeGenerators$ = reactCodeGenerators[type]) === null || _reactCodeGenerators$ === void 0 ? void 0 : _reactCodeGenerators$.call(reactCodeGenerators, embeddedCodeOptions) : (_htmlCodeGenerators$t = htmlCodeGenerators[type]) === null || _htmlCodeGenerators$t === void 0 ? void 0 : _htmlCodeGenerators$t.call(htmlCodeGenerators, embeddedCodeOptions);
185
239
  };
186
240
  var buildDefaultCustomization = function buildDefaultCustomization(defaultCustomizations) {
187
241
  return mergeDeepLeft(defaultCustomizations, DEFAULT_CUSTOMIZATION);
188
242
  };
189
243
  var buildQueryParamsFromInputFields = function buildQueryParamsFromInputFields(inputFields) {
190
- var filteredInputFields = inputFields.filter(function (_ref7) {
191
- var name = _ref7.name,
192
- value = _ref7.value;
244
+ var filteredInputFields = inputFields.filter(function (_ref) {
245
+ var name = _ref.name,
246
+ value = _ref.value;
193
247
  return name && value;
194
248
  });
195
- var queryParams = filteredInputFields.reduce(function (queryParams, _ref8) {
196
- var name = _ref8.name,
197
- value = _ref8.value;
249
+ var queryParams = filteredInputFields.reduce(function (queryParams, _ref2) {
250
+ var name = _ref2.name,
251
+ value = _ref2.value;
198
252
  queryParams[name] = value;
199
253
  return queryParams;
200
254
  }, {});
@@ -515,14 +569,15 @@ var Customization = function Customization(_ref) {
515
569
  };
516
570
 
517
571
  var Header = function Header(_ref) {
518
- var tab = _ref.tab,
519
- setTab = _ref.setTab;
572
+ var supportedLanguagesTabs = _ref.supportedLanguagesTabs,
573
+ setTab = _ref.setTab,
574
+ tab = _ref.tab;
520
575
  return /*#__PURE__*/jsx("div", {
521
- className: "flex w-full pt-2",
576
+ className: "flex w-full",
522
577
  children: /*#__PURE__*/jsx(Tab, {
523
578
  noUnderline: true,
524
579
  className: "neeto-molecules-product-embed-tab",
525
- children: TABS.map(function (_ref2) {
580
+ children: supportedLanguagesTabs.map(function (_ref2) {
526
581
  var key = _ref2.key,
527
582
  label = _ref2.label,
528
583
  icon = _ref2.icon;
@@ -675,6 +730,8 @@ var Preview = function Preview(_ref) {
675
730
  });
676
731
  }
677
732
  return /*#__PURE__*/jsx(BrowserPreview, {
733
+ className: "h-full",
734
+ wrapperClassName: "neeto-molecules-embed__browser-preview pointer-events-auto",
678
735
  children: /*#__PURE__*/jsx(Component, {
679
736
  customization: customization,
680
737
  iframeURL: iframeURL
@@ -682,7 +739,7 @@ var Preview = function Preview(_ref) {
682
739
  });
683
740
  };
684
741
 
685
- var css = ".neeto-molecules-product-embed-size-input.neeto-ui-input__wrapper .neeto-ui-input__prefix{align-self:stretch;background-color:rgb(var(--neeto-ui-gray-200));margin-left:0!important;padding-left:.75rem;padding-right:.75rem}.neeto-molecules-product-embed-tab{gap:.5rem}.neeto-molecules-product-embed-tab .neeto-ui-tab{border-radius:var(--neeto-ui-btn-border-radius);color:rgb(var(--neeto-ui-gray-800))}.neeto-molecules-product-embed-tab .neeto-ui-tab:not(.active):hover{background-color:rgb(var(--neeto-ui-gray-100))}.neeto-molecules-product-embed-tab .neeto-ui-tab.active{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-embed__left-sidebar{align-items:flex-start;display:flex;flex-direction:column;flex-shrink:0;overflow-y:auto;padding:1.5rem;width:100%}@media (min-width:768px){.neeto-molecules-embed__left-sidebar{border-right:1px solid rgb(var(--neeto-ui-gray-200));max-width:25rem}}@media (min-width:1024px){.neeto-molecules-embed__left-sidebar{max-width:27.5rem}}";
742
+ var css = ".neeto-molecules-product-embed-size-input.neeto-ui-input__wrapper .neeto-ui-input__prefix{align-self:stretch;background-color:rgb(var(--neeto-ui-gray-200));margin-left:0!important;padding-left:.75rem;padding-right:.75rem}.neeto-molecules-product-embed-tab{gap:.5rem}.neeto-molecules-product-embed-tab .neeto-ui-tab{border-radius:var(--neeto-ui-btn-border-radius);color:rgb(var(--neeto-ui-gray-800))}.neeto-molecules-product-embed-tab .neeto-ui-tab:not(.active):hover{background-color:rgb(var(--neeto-ui-gray-100))}.neeto-molecules-product-embed-tab .neeto-ui-tab.active{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-embed__left-sidebar{align-items:flex-start;display:flex;flex-direction:column;flex-shrink:0;overflow-y:auto;padding:1.5rem;width:100%}@media (min-width:768px){.neeto-molecules-embed__left-sidebar{border-right:1px solid rgb(var(--neeto-ui-gray-200));max-width:25rem}}@media (min-width:1024px){.neeto-molecules-embed__left-sidebar{max-width:27.5rem}}.neeto-molecules-embed__code-block .neeto-molecules-code-block{font-size:.875rem;height:15.625rem;margin-top:0!important}.neeto-molecules-embed__browser-preview{height:100%;min-height:18.75rem}.neeto-molecules-embed__browser-preview .neeto-molecules-browser-preview__body{position:relative}.neeto-molecules-embed__browser-preview .neeto-molecules-browser-preview__body iframe{height:100%;left:0;position:absolute;top:0;width:100%}";
686
743
  n(css,{});
687
744
 
688
745
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -706,12 +763,19 @@ var ProductEmbed = function ProductEmbed(_ref) {
706
763
  _ref$otherCustomizati = _ref.otherCustomizations,
707
764
  otherCustomizations = _ref$otherCustomizati === void 0 ? noop : _ref$otherCustomizati,
708
765
  _ref$inlineWrapperSty = _ref.inlineWrapperStyle,
709
- inlineWrapperStyle = _ref$inlineWrapperSty === void 0 ? "" : _ref$inlineWrapperSty;
766
+ inlineWrapperStyle = _ref$inlineWrapperSty === void 0 ? "" : _ref$inlineWrapperSty,
767
+ _ref$supportedLanguag = _ref.supportedLanguages,
768
+ supportedLanguages = _ref$supportedLanguag === void 0 ? ["html"] : _ref$supportedLanguag;
769
+ var supportedLanguagesTabs = filterBy({
770
+ key: function key(_key) {
771
+ return supportedLanguages === null || supportedLanguages === void 0 ? void 0 : supportedLanguages.includes(_key);
772
+ }
773
+ }, TABS);
710
774
  var _useState = useState(true),
711
775
  _useState2 = _slicedToArray(_useState, 2),
712
776
  isScriptLoading = _useState2[0],
713
777
  setIsScriptLoading = _useState2[1];
714
- var _useState3 = useState(TAB_KEYS.HTML),
778
+ var _useState3 = useState(supportedLanguagesTabs[0].key),
715
779
  _useState4 = _slicedToArray(_useState3, 2),
716
780
  tab = _useState4[0],
717
781
  setTab = _useState4[1];
@@ -728,8 +792,9 @@ var ProductEmbed = function ProductEmbed(_ref) {
728
792
  var _useTranslation = useTranslation(),
729
793
  t = _useTranslation.t;
730
794
  var embedScriptLink = customEmbedScriptPath || "".concat(window.location.protocol, "//").concat(window.location.host, "/javascript/embed.js");
731
- var code = embedCode({
795
+ var code = generateCode({
732
796
  id: id,
797
+ tab: tab,
733
798
  type: selectedOption,
734
799
  customization: customizations[selectedOption],
735
800
  embedScriptLink: embedScriptLink,
@@ -786,21 +851,30 @@ var ProductEmbed = function ProductEmbed(_ref) {
786
851
  })]
787
852
  })]
788
853
  }), /*#__PURE__*/jsxs("div", {
789
- className: "neeto-molecules-embed__preview neeto-ui-bg-white flex min-h-screen w-full min-w-0 flex-col gap-4 p-6 md:min-h-0 md:flex-grow",
854
+ className: "neeto-molecules-embed__preview neeto-ui-bg-white flex min-h-screen w-full min-w-0 flex-col gap-3 overflow-y-auto p-6 md:min-h-0 md:flex-grow",
790
855
  children: [/*#__PURE__*/jsx(Header, {
791
856
  setTab: setTab,
857
+ supportedLanguagesTabs: supportedLanguagesTabs,
792
858
  tab: tab
793
- }), /*#__PURE__*/jsx("div", {
794
- className: "flex flex-grow overflow-y-auto",
795
- children: tab === TAB_KEYS.PREVIEW ? /*#__PURE__*/jsx(Preview, {
796
- customPreviewIframeUrl: customPreviewIframeUrl,
797
- id: id,
798
- isScriptLoading: isScriptLoading,
799
- selectedOption: selectedOption,
800
- customization: customizations[selectedOption]
801
- }) : /*#__PURE__*/jsx(Code, {
802
- code: code
803
- })
859
+ }), /*#__PURE__*/jsxs("div", {
860
+ className: "flex min-h-0 flex-grow flex-col gap-3",
861
+ children: [/*#__PURE__*/jsx("div", {
862
+ className: "flex-shrink-0",
863
+ "data-testid": "embed-code-block",
864
+ children: /*#__PURE__*/jsx(Code, {
865
+ code: code,
866
+ tab: tab
867
+ })
868
+ }), /*#__PURE__*/jsx("div", {
869
+ className: "flex-grow",
870
+ children: /*#__PURE__*/jsx(Preview, {
871
+ customPreviewIframeUrl: customPreviewIframeUrl,
872
+ id: id,
873
+ isScriptLoading: isScriptLoading,
874
+ selectedOption: selectedOption,
875
+ customization: customizations[selectedOption]
876
+ })
877
+ })]
804
878
  })]
805
879
  })]
806
880
  });