@bigbinary/neeto-molecules 3.16.27 → 3.16.29
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/NavigationHeader.js +2 -4
- package/dist/NavigationHeader.js.map +1 -1
- package/dist/ProductEmbed.js +112 -39
- package/dist/ProductEmbed.js.map +1 -1
- package/dist/PublishBlock.js +77 -189
- package/dist/PublishBlock.js.map +1 -1
- package/dist/cjs/NavigationHeader.js +2 -4
- package/dist/cjs/NavigationHeader.js.map +1 -1
- package/dist/cjs/ProductEmbed.js +112 -39
- package/dist/cjs/ProductEmbed.js.map +1 -1
- package/dist/cjs/PublishBlock.js +76 -188
- package/dist/cjs/PublishBlock.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +4 -3
- package/types/PublishBlock.d.ts +35 -54
package/dist/NavigationHeader.js
CHANGED
|
@@ -31,15 +31,13 @@ import './MoreDropdown.js';
|
|
|
31
31
|
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
32
32
|
import '@bigbinary/neeto-icons/MenuHorizontal';
|
|
33
33
|
import '@bigbinary/neeto-icons/MenuVertical';
|
|
34
|
-
import '@babel/runtime/helpers/asyncToGenerator';
|
|
35
|
-
import '@babel/runtime/regenerator';
|
|
36
34
|
import '@bigbinary/neeto-commons-frontend/react-utils/withT';
|
|
35
|
+
import '@bigbinary/neeto-commons-frontend/utils';
|
|
37
36
|
import '@bigbinary/neeto-icons/ExternalLink';
|
|
38
37
|
import '@bigbinary/neeto-icons/Undo';
|
|
38
|
+
import '@bigbinary/neeto-icons/Clock';
|
|
39
39
|
import '@bigbinary/neetoui/Alert';
|
|
40
40
|
import '@bigbinary/neetoui/Pane';
|
|
41
|
-
import '@bigbinary/neetoui/Switch';
|
|
42
|
-
import '@bigbinary/neeto-commons-frontend/utils';
|
|
43
41
|
import '@bigbinary/neeto-team-members-frontend/Profile';
|
|
44
42
|
import '@bigbinary/neetoui/DatePicker';
|
|
45
43
|
import '@bigbinary/neeto-commons-frontend/initializers';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationHeader.js","sources":["../src/components/NavigationHeader/constants.jsx","../src/components/NavigationHeader/LeftBlock.jsx","../src/components/NavigationHeader/Navigation.jsx","../src/components/NavigationHeader/utils.js","../src/components/NavigationHeader/RightBlock.jsx","../src/components/NavigationHeader/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport { Home } from \"neetoicons\";\n\nexport const DEFAULT_HOME_BUTTON_PROPS = {\n tooltip: {\n content: t(\"neetoMolecules.navigationHeader.home\"),\n position: \"bottom\",\n },\n homeUrl: \"/\",\n icon: <Home />,\n};\n","import { isPresent } from \"neetocist\";\nimport { Tooltip } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { mergeDeepRight } from \"ramda\";\nimport { Link } from \"react-router-dom\";\n\nimport Rename from \"components/Rename\";\n\nimport { DEFAULT_HOME_BUTTON_PROPS } from \"./constants\";\n\nconst LeftBlock = ({\n homeButtonProps: customHomeButtonProps,\n homeUrl,\n renameProps,\n children,\n}) => {\n const homeButtonProps = mergeDeepRight(\n DEFAULT_HOME_BUTTON_PROPS,\n customHomeButtonProps\n );\n\n return (\n <div\n className=\"flex items-center gap-1 md:gap-2\"\n data-cy=\"navigation-header-left-block\"\n data-testid=\"navigation-header-left-block\"\n >\n <Tooltip\n content={homeButtonProps.tooltip.content}\n position={homeButtonProps.tooltip.position}\n touch={[\"hold\", 500]}\n >\n <Link data-cy=\"home-button\" data-testid=\"home-button\" to={homeUrl}>\n <div className=\"neeto-ui-rounded hover:neeto-ui-bg-gray-200 p-1\">\n {homeButtonProps.icon}\n </div>\n </Link>\n </Tooltip>\n {isPresent(renameProps) && (\n <Rename\n dropdownItems={renameProps.dropdownItems}\n value={renameProps.value}\n {...renameProps}\n />\n )}\n {children}\n </div>\n );\n};\n\nLeftBlock.propTypes = {\n /**\n * Object containing the home button icon and the props to be passed to the tooltip of the home button.\n */\n homeButtonProps: PropTypes.shape({\n tooltip: PropTypes.shape({\n content: PropTypes.string,\n postition: PropTypes.string,\n }),\n icon: PropTypes.node,\n }),\n /**\n * URL to navigate when the home button is clicked.\n */\n homeUrl: PropTypes.string.isRequired,\n /**\n * Props to be passed to the `Rename` component. Please check the `Rename` component props for more details\n */\n renameProps: PropTypes.object,\n /**\n * To render extra content in the block.\n */\n children: PropTypes.node,\n};\n\nexport default LeftBlock;\n","import classNames from \"classnames\";\nimport { existsBy, isNotEmpty } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/utils/general\";\nimport { Dropdown, Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\nimport { NavLink, useLocation } from \"react-router-dom\";\n\nconst { Menu, MenuItem } = Dropdown;\n\nconst NavigationLinks = ({ headerLinks, maxVisibleLinks = 5 }) => {\n const { pathname } = useLocation();\n const { t } = useTranslation();\n\n const visibleLinks = headerLinks.slice(0, maxVisibleLinks);\n const overflowLinks = headerLinks.slice(maxVisibleLinks);\n\n const isMoreButtonActive = existsBy({ to: pathname }, overflowLinks);\n\n return (\n <div\n className=\"font- flex w-full items-center justify-between gap-4 md:justify-center md:gap-3 lg:gap-6\"\n data-cy=\"navigation-header-navigation-links\"\n data-testid=\"navigation-header-navigation-links\"\n >\n {visibleLinks.map(headerLink => (\n <NavLink\n activeClassName=\"active\"\n className=\"neeto-molecules-navigation-header__link px-2 capitalize no-underline md:px-0\"\n data-cy={`${joinHyphenCase(headerLink.key)}-tab`}\n key={headerLink.key}\n {...headerLink}\n >\n <Typography\n component=\"span\"\n lineHeight=\"normal\"\n style=\"h4\"\n weight=\"semibold\"\n >\n {headerLink.label}\n </Typography>\n </NavLink>\n ))}\n {isNotEmpty(overflowLinks) && (\n <Dropdown\n buttonStyle=\"text\"\n label={t(\"neetoMolecules.navigationHeader.more\")}\n position=\"bottom-end\"\n buttonProps={{\n className: classNames(\n \"neeto-molecules-navigation-header__link neeto-molecules-navigation-header__link--more neeto-ui-typography neeto-ui-text-h4 neeto-ui-font-semibold neeto-ui-leading-normal px-2 capitalize no-underline md:px-0\",\n { active: isMoreButtonActive }\n ),\n }}\n >\n <Menu>\n {overflowLinks.map(headerLink => (\n <MenuItem.Button\n data-cy={`${joinHyphenCase(headerLink.key)}-more-tab`}\n isActive={headerLink.to === pathname}\n key={headerLink.key}\n to={headerLink.to}\n {...headerLink}\n >\n {headerLink.label}\n </MenuItem.Button>\n ))}\n </Menu>\n </Dropdown>\n )}\n </div>\n );\n};\n\nNavigationLinks.propTypes = {\n /**\n * Links to be rendered in the center of the navigation header. It is an array of objects.\n * Each object should have the properties `key`, `to` and `label`. Other props will be passed on to the `Navlink` component from\n `react-router-dom`.\n */\n headerLinks: PropTypes.arrayOf(\n PropTypes.shape({\n key: PropTypes.string,\n to: PropTypes.string,\n label: PropTypes.string,\n })\n ),\n /**\n * Maximum number of links to be visible in the navigation header. Remaining links will be shown in a more dropdown.\n */\n maxVisibleLinks: PropTypes.number,\n};\n\nexport default NavigationLinks;\n","export const isAbsoluteUrl = url => /^https?:\\/\\//.test(url);\n","import classNames from \"classnames\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport PublishBlock from \"components/PublishBlock\";\n\nimport \"./navigation-header.scss\";\nimport { isAbsoluteUrl } from \"./utils\";\n\nconst RightBlock = ({\n isDraftBlockHidden,\n previewDraftUrl,\n isResetDraftButtonVisible,\n onResetClick,\n isResetting,\n isPublishDisabled,\n isPublishing,\n handlePublish,\n isPublishPreviewDisabled,\n previewPublishedUrl,\n isPublishButtonVisible,\n isResetAlertOpen,\n setIsResetAlertOpen,\n handleReset,\n publishAlertTitle,\n publishAlertDescription,\n publishButtonProps = {},\n}) => {\n const { t } = useTranslation();\n\n const renderDraftButtons = ({ ViewDraftButton, ResetDraftButton }) =>\n !isDraftBlockHidden && (\n <>\n <ViewDraftButton\n {...(isAbsoluteUrl(previewDraftUrl)\n ? { href: previewDraftUrl }\n : { to: previewDraftUrl })}\n />\n {isResetDraftButtonVisible && (\n <ResetDraftButton\n loading={isResetting}\n onClick={() => onResetClick()}\n />\n )}\n </>\n );\n\n const renderPublishButtons = ({ PublishButton, PublishPreviewButton }) => (\n <>\n {isPublishButtonVisible && (\n <PublishButton\n disabled={isPublishDisabled}\n loading={isPublishing}\n onClick={() => handlePublish()}\n {...publishButtonProps}\n />\n )}\n <PublishPreviewButton\n {...(isAbsoluteUrl(previewPublishedUrl)\n ? { href: previewPublishedUrl }\n : { to: previewPublishedUrl })}\n disabled={isPublishPreviewDisabled}\n className={classNames({\n \"standalone-publish-preview-button\": !isPublishButtonVisible,\n })}\n />\n </>\n );\n\n return (\n <>\n <PublishBlock {...{ renderDraftButtons, renderPublishButtons }} />\n <PublishBlock.Alert\n isOpen={isResetAlertOpen}\n isSubmitting={isResetting}\n message={\n publishAlertDescription ||\n t(\"neetoMolecules.navigationHeader.resetDescription\")\n }\n title={\n publishAlertTitle || t(\"neetoMolecules.navigationHeader.resetTitle\")\n }\n onClose={() => setIsResetAlertOpen(false)}\n onSubmit={handleReset}\n />\n </>\n );\n};\n\nRightBlock.propTypes = {\n /**\n * To show/hide the draft block.\n */\n isDraftBlockHidden: PropTypes.bool,\n /**\n * Draft preview URL, when the draft button is clicked user will be redirected to this URL.\n */\n previewDraftUrl: PropTypes.string,\n /**\n * Boolean to control the visibility of reset draft button.\n */\n isResetDraftButtonVisible: PropTypes.bool,\n /**\n * Callback function that will be called when the reset button is clicked.\n */\n onResetClick: PropTypes.func,\n /**\n * Setting this to `true` will show a spinner on the reset button. Use when the reset process is in progress.\n */\n isResetting: PropTypes.bool,\n /**\n * To disable the publish button.\n */\n isPublishDisabled: PropTypes.bool,\n /**\n * Setting this to `true` will show a spinner on the publish button. Use when the publish process is in progress.\n */\n isPublishing: PropTypes.bool,\n /**\n * Callback function that will be called when the publish button is clicked.\n */\n handlePublish: PropTypes.func,\n /**\n * To disable the publish preview button.\n */\n isPublishPreviewDisabled: PropTypes.bool,\n /**\n * Publish preview URL, when the preview publish button is clicked user will be redirected to this URL.\n */\n previewPublishedUrl: PropTypes.string,\n /**\n * Boolean to control whether the user have the ability to publish.\n */\n isPublishButtonVisible: PropTypes.bool,\n /**\n * Boolean to control whether the reset alert is open.\n */\n isResetAlertOpen: PropTypes.bool,\n /**\n * Handler to control the `isResetAlert` state variable.\n */\n setIsResetAlertOpen: PropTypes.func,\n /**\n * Callback function that will be called when the reset button is clicked.\n */\n handleReset: PropTypes.func,\n /**\n * Description to be shown in the publish alert\n */\n publishAlertDescription: PropTypes.string,\n /**\n * Title of the publish alert\n */\n publishAlertTitle: PropTypes.string,\n /**\n * Props to be passed to the publish button\n */\n publishButtonProps: PropTypes.object,\n};\n\nexport default RightBlock;\n","import { isPresent } from \"neetocist\";\nimport useBreakpoints from \"neetocommons/react-utils/useBreakpoints\";\nimport PropTypes from \"prop-types\";\nimport { filter, length } from \"ramda\";\n\nimport LeftBlock from \"./LeftBlock\";\nimport NavigationLinks from \"./Navigation\";\nimport RightBlock from \"./RightBlock\";\n\nconst NavigationHeader = ({\n leftActionBlock,\n navigationLinks,\n rightActionBlock,\n}) => {\n const { isSize } = useBreakpoints();\n const isMobile = isSize(\"mobile\");\n\n const numberOfChildren = length(\n filter(isPresent, [leftActionBlock, navigationLinks, rightActionBlock])\n );\n\n const gridStyle = {\n gridTemplateColumns: isMobile\n ? `repeat(${\n navigationLinks ? numberOfChildren - 1 : numberOfChildren\n }, auto)`\n : `repeat(${numberOfChildren}, 1fr)`,\n };\n\n return (\n <div className=\"w-full\">\n <div\n className=\"neeto-molecules-navigation-header neeto-ui-border-gray-200 neeto-ui-bg-white flex h-16 w-full flex-shrink-0 items-center overflow-x-auto border-b px-2 py-2 md:px-4 lg:px-6\"\n data-cy=\"navigation-header\"\n data-testid=\"navigation-header\"\n >\n <div className=\"grid w-full gap-4\" style={gridStyle}>\n {leftActionBlock}\n {!isMobile && navigationLinks}\n {rightActionBlock}\n </div>\n </div>\n {isMobile && (\n <div className=\"neeto-molecules-navigation-header neeto-ui-border-gray-200 neeto-ui-bg-white flex flex-shrink-0 items-center overflow-x-auto border-b px-4 py-2 lg:px-6\">\n {navigationLinks}\n </div>\n )}\n </div>\n );\n};\n\nNavigationHeader.LeftActionBlock = LeftBlock;\nNavigationHeader.NavigationLinks = NavigationLinks;\nNavigationHeader.RightActionBlock = RightBlock;\n\nNavigationHeader.propTypes = {\n /**\n * To specify the content to be rendered in the left side of the `NavigationHeader`.\n */\n leftActionBlock: PropTypes.node,\n /**\n * To specify the content to be rendered at the center of the `NavigationHeader`.\n */\n navigationLinks: PropTypes.node,\n /**\n * To specify the content to be rendered in the right side of the `NavigationHeader`.\n */\n rightActionBlock: PropTypes.node,\n};\n\nexport default NavigationHeader;\n"],"names":["DEFAULT_HOME_BUTTON_PROPS","tooltip","content","t","position","homeUrl","icon","_jsx","Home","LeftBlock","_ref","customHomeButtonProps","homeButtonProps","renameProps","children","mergeDeepRight","_jsxs","className","Tooltip","touch","Link","to","isPresent","Rename","_objectSpread","dropdownItems","value","Menu","Dropdown","MenuItem","NavigationLinks","headerLinks","_ref$maxVisibleLinks","maxVisibleLinks","_useLocation","useLocation","pathname","_useTranslation","useTranslation","visibleLinks","slice","overflowLinks","isMoreButtonActive","existsBy","map","headerLink","NavLink","activeClassName","concat","joinHyphenCase","key","Typography","component","lineHeight","style","weight","label","isNotEmpty","buttonStyle","buttonProps","classNames","active","Button","isActive","isAbsoluteUrl","url","test","RightBlock","isDraftBlockHidden","previewDraftUrl","isResetDraftButtonVisible","onResetClick","isResetting","isPublishDisabled","isPublishing","handlePublish","isPublishPreviewDisabled","previewPublishedUrl","isPublishButtonVisible","isResetAlertOpen","setIsResetAlertOpen","handleReset","publishAlertTitle","publishAlertDescription","_ref$publishButtonPro","publishButtonProps","renderDraftButtons","_ref2","ViewDraftButton","ResetDraftButton","_Fragment","href","loading","onClick","renderPublishButtons","_ref3","PublishButton","PublishPreviewButton","disabled","PublishBlock","Alert","isOpen","isSubmitting","message","title","onClose","onSubmit","NavigationHeader","leftActionBlock","navigationLinks","rightActionBlock","_useBreakpoints","useBreakpoints","isSize","isMobile","numberOfChildren","length","filter","gridStyle","gridTemplateColumns","LeftActionBlock","RightActionBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,yBAAyB,GAAG;AACvCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,OAAO,EAAEC,CAAC,CAAC,sCAAsC,CAAC;AAClDC,IAAAA,QAAQ,EAAE,QAAA;GACX;AACDC,EAAAA,OAAO,EAAE,GAAG;AACZC,EAAAA,IAAI,eAAEC,GAAA,CAACC,IAAI,EAAE,EAAA,CAAA;AACf,CAAC;;;;ACAD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAKT;AAAA,EAAA,IAJaC,qBAAqB,GAAAD,IAAA,CAAtCE,eAAe;IACfP,OAAO,GAAAK,IAAA,CAAPL,OAAO;IACPQ,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ,CAAA;AAER,EAAA,IAAMF,eAAe,GAAGG,cAAc,CACpCf,yBAAyB,EACzBW,qBACF,CAAC,CAAA;AAED,EAAA,oBACEK,IAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,SAAS,EAAC,kCAAkC;AAC5C,IAAA,SAAA,EAAQ,8BAA8B;AACtC,IAAA,aAAA,EAAY,8BAA8B;IAAAH,QAAA,EAAA,cAE1CP,GAAA,CAACW,OAAO,EAAA;AACNhB,MAAAA,OAAO,EAAEU,eAAe,CAACX,OAAO,CAACC,OAAQ;AACzCE,MAAAA,QAAQ,EAAEQ,eAAe,CAACX,OAAO,CAACG,QAAS;AAC3Ce,MAAAA,KAAK,EAAE,CAAC,MAAM,EAAE,GAAG,CAAE;MAAAL,QAAA,eAErBP,GAAA,CAACa,IAAI,EAAA;AAAC,QAAA,SAAA,EAAQ,aAAa;AAAC,QAAA,aAAA,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,EAAA;AACEU,MAAAA,SAAS,EAAC,6KAA6K;AACvL,MAAA,SAAA,EAAQ,mBAAmB;AAC3B,MAAA,aAAA,EAAY,mBAAmB;AAAAH,MAAAA,QAAA,eAE/BE,IAAA,CAAA,KAAA,EAAA;AAAKC,QAAAA,SAAS,EAAC,mBAAmB;AAACqC,QAAAA,KAAK,EAAEgE,SAAU;QAAAxG,QAAA,EAAA,CACjD8F,eAAe,EACf,CAACM,QAAQ,IAAIL,eAAe,EAC5BC,gBAAgB,CAAA;OACd,CAAA;AAAC,KACH,CAAC,EACLI,QAAQ,iBACP3G,GAAA,CAAA,KAAA,EAAA;AAAKU,MAAAA,SAAS,EAAC,yJAAyJ;AAAAH,MAAAA,QAAA,EACrK+F,eAAAA;AAAe,KACb,CACN,CAAA;AAAA,GACE,CAAC,CAAA;AAEV,EAAC;AAEDF,gBAAgB,CAACa,eAAe,GAAG/G,SAAS,CAAA;AAC5CkG,gBAAgB,CAAC7E,eAAe,GAAGA,eAAe,CAAA;AAClD6E,gBAAgB,CAACc,gBAAgB,GAAGtD,UAAU;;;;"}
|
|
1
|
+
{"version":3,"file":"NavigationHeader.js","sources":["../src/components/NavigationHeader/constants.jsx","../src/components/NavigationHeader/LeftBlock.jsx","../src/components/NavigationHeader/Navigation.jsx","../src/components/NavigationHeader/utils.js","../src/components/NavigationHeader/RightBlock.jsx","../src/components/NavigationHeader/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport { Home } from \"neetoicons\";\n\nexport const DEFAULT_HOME_BUTTON_PROPS = {\n tooltip: {\n content: t(\"neetoMolecules.navigationHeader.home\"),\n position: \"bottom\",\n },\n homeUrl: \"/\",\n icon: <Home />,\n};\n","import { isPresent } from \"neetocist\";\nimport { Tooltip } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { mergeDeepRight } from \"ramda\";\nimport { Link } from \"react-router-dom\";\n\nimport Rename from \"components/Rename\";\n\nimport { DEFAULT_HOME_BUTTON_PROPS } from \"./constants\";\n\nconst LeftBlock = ({\n homeButtonProps: customHomeButtonProps,\n homeUrl,\n renameProps,\n children,\n}) => {\n const homeButtonProps = mergeDeepRight(\n DEFAULT_HOME_BUTTON_PROPS,\n customHomeButtonProps\n );\n\n return (\n <div\n className=\"flex items-center gap-1 md:gap-2\"\n data-cy=\"navigation-header-left-block\"\n data-testid=\"navigation-header-left-block\"\n >\n <Tooltip\n content={homeButtonProps.tooltip.content}\n position={homeButtonProps.tooltip.position}\n touch={[\"hold\", 500]}\n >\n <Link data-cy=\"home-button\" data-testid=\"home-button\" to={homeUrl}>\n <div className=\"neeto-ui-rounded hover:neeto-ui-bg-gray-200 p-1\">\n {homeButtonProps.icon}\n </div>\n </Link>\n </Tooltip>\n {isPresent(renameProps) && (\n <Rename\n dropdownItems={renameProps.dropdownItems}\n value={renameProps.value}\n {...renameProps}\n />\n )}\n {children}\n </div>\n );\n};\n\nLeftBlock.propTypes = {\n /**\n * Object containing the home button icon and the props to be passed to the tooltip of the home button.\n */\n homeButtonProps: PropTypes.shape({\n tooltip: PropTypes.shape({\n content: PropTypes.string,\n postition: PropTypes.string,\n }),\n icon: PropTypes.node,\n }),\n /**\n * URL to navigate when the home button is clicked.\n */\n homeUrl: PropTypes.string.isRequired,\n /**\n * Props to be passed to the `Rename` component. Please check the `Rename` component props for more details\n */\n renameProps: PropTypes.object,\n /**\n * To render extra content in the block.\n */\n children: PropTypes.node,\n};\n\nexport default LeftBlock;\n","import classNames from \"classnames\";\nimport { existsBy, isNotEmpty } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/utils/general\";\nimport { Dropdown, Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\nimport { NavLink, useLocation } from \"react-router-dom\";\n\nconst { Menu, MenuItem } = Dropdown;\n\nconst NavigationLinks = ({ headerLinks, maxVisibleLinks = 5 }) => {\n const { pathname } = useLocation();\n const { t } = useTranslation();\n\n const visibleLinks = headerLinks.slice(0, maxVisibleLinks);\n const overflowLinks = headerLinks.slice(maxVisibleLinks);\n\n const isMoreButtonActive = existsBy({ to: pathname }, overflowLinks);\n\n return (\n <div\n className=\"font- flex w-full items-center justify-between gap-4 md:justify-center md:gap-3 lg:gap-6\"\n data-cy=\"navigation-header-navigation-links\"\n data-testid=\"navigation-header-navigation-links\"\n >\n {visibleLinks.map(headerLink => (\n <NavLink\n activeClassName=\"active\"\n className=\"neeto-molecules-navigation-header__link px-2 capitalize no-underline md:px-0\"\n data-cy={`${joinHyphenCase(headerLink.key)}-tab`}\n key={headerLink.key}\n {...headerLink}\n >\n <Typography\n component=\"span\"\n lineHeight=\"normal\"\n style=\"h4\"\n weight=\"semibold\"\n >\n {headerLink.label}\n </Typography>\n </NavLink>\n ))}\n {isNotEmpty(overflowLinks) && (\n <Dropdown\n buttonStyle=\"text\"\n label={t(\"neetoMolecules.navigationHeader.more\")}\n position=\"bottom-end\"\n buttonProps={{\n className: classNames(\n \"neeto-molecules-navigation-header__link neeto-molecules-navigation-header__link--more neeto-ui-typography neeto-ui-text-h4 neeto-ui-font-semibold neeto-ui-leading-normal px-2 capitalize no-underline md:px-0\",\n { active: isMoreButtonActive }\n ),\n }}\n >\n <Menu>\n {overflowLinks.map(headerLink => (\n <MenuItem.Button\n data-cy={`${joinHyphenCase(headerLink.key)}-more-tab`}\n isActive={headerLink.to === pathname}\n key={headerLink.key}\n to={headerLink.to}\n {...headerLink}\n >\n {headerLink.label}\n </MenuItem.Button>\n ))}\n </Menu>\n </Dropdown>\n )}\n </div>\n );\n};\n\nNavigationLinks.propTypes = {\n /**\n * Links to be rendered in the center of the navigation header. It is an array of objects.\n * Each object should have the properties `key`, `to` and `label`. Other props will be passed on to the `Navlink` component from\n `react-router-dom`.\n */\n headerLinks: PropTypes.arrayOf(\n PropTypes.shape({\n key: PropTypes.string,\n to: PropTypes.string,\n label: PropTypes.string,\n })\n ),\n /**\n * Maximum number of links to be visible in the navigation header. Remaining links will be shown in a more dropdown.\n */\n maxVisibleLinks: PropTypes.number,\n};\n\nexport default NavigationLinks;\n","export const isAbsoluteUrl = url => /^https?:\\/\\//.test(url);\n","import classNames from \"classnames\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport PublishBlock from \"components/PublishBlock\";\n\nimport \"./navigation-header.scss\";\nimport { isAbsoluteUrl } from \"./utils\";\n\nconst RightBlock = ({\n isDraftBlockHidden,\n previewDraftUrl,\n isResetDraftButtonVisible,\n onResetClick,\n isResetting,\n isPublishDisabled,\n isPublishing,\n handlePublish,\n isPublishPreviewDisabled,\n previewPublishedUrl,\n isPublishButtonVisible,\n isResetAlertOpen,\n setIsResetAlertOpen,\n handleReset,\n publishAlertTitle,\n publishAlertDescription,\n publishButtonProps = {},\n}) => {\n const { t } = useTranslation();\n\n const renderDraftButtons = ({ ViewDraftButton, ResetDraftButton }) =>\n !isDraftBlockHidden && (\n <>\n <ViewDraftButton\n {...(isAbsoluteUrl(previewDraftUrl)\n ? { href: previewDraftUrl }\n : { to: previewDraftUrl })}\n />\n {isResetDraftButtonVisible && (\n <ResetDraftButton\n loading={isResetting}\n onClick={() => onResetClick()}\n />\n )}\n </>\n );\n\n const renderPublishButtons = ({ PublishButton, PublishPreviewButton }) => (\n <>\n {isPublishButtonVisible && (\n <PublishButton\n disabled={isPublishDisabled}\n loading={isPublishing}\n onClick={() => handlePublish()}\n {...publishButtonProps}\n />\n )}\n <PublishPreviewButton\n {...(isAbsoluteUrl(previewPublishedUrl)\n ? { href: previewPublishedUrl }\n : { to: previewPublishedUrl })}\n disabled={isPublishPreviewDisabled}\n className={classNames({\n \"standalone-publish-preview-button\": !isPublishButtonVisible,\n })}\n />\n </>\n );\n\n return (\n <>\n <PublishBlock {...{ renderDraftButtons, renderPublishButtons }} />\n <PublishBlock.Alert\n isOpen={isResetAlertOpen}\n isSubmitting={isResetting}\n message={\n publishAlertDescription ||\n t(\"neetoMolecules.navigationHeader.resetDescription\")\n }\n title={\n publishAlertTitle || t(\"neetoMolecules.navigationHeader.resetTitle\")\n }\n onClose={() => setIsResetAlertOpen(false)}\n onSubmit={handleReset}\n />\n </>\n );\n};\n\nRightBlock.propTypes = {\n /**\n * To show/hide the draft block.\n */\n isDraftBlockHidden: PropTypes.bool,\n /**\n * Draft preview URL, when the draft button is clicked user will be redirected to this URL.\n */\n previewDraftUrl: PropTypes.string,\n /**\n * Boolean to control the visibility of reset draft button.\n */\n isResetDraftButtonVisible: PropTypes.bool,\n /**\n * Callback function that will be called when the reset button is clicked.\n */\n onResetClick: PropTypes.func,\n /**\n * Setting this to `true` will show a spinner on the reset button. Use when the reset process is in progress.\n */\n isResetting: PropTypes.bool,\n /**\n * To disable the publish button.\n */\n isPublishDisabled: PropTypes.bool,\n /**\n * Setting this to `true` will show a spinner on the publish button. Use when the publish process is in progress.\n */\n isPublishing: PropTypes.bool,\n /**\n * Callback function that will be called when the publish button is clicked.\n */\n handlePublish: PropTypes.func,\n /**\n * To disable the publish preview button.\n */\n isPublishPreviewDisabled: PropTypes.bool,\n /**\n * Publish preview URL, when the preview publish button is clicked user will be redirected to this URL.\n */\n previewPublishedUrl: PropTypes.string,\n /**\n * Boolean to control whether the user have the ability to publish.\n */\n isPublishButtonVisible: PropTypes.bool,\n /**\n * Boolean to control whether the reset alert is open.\n */\n isResetAlertOpen: PropTypes.bool,\n /**\n * Handler to control the `isResetAlert` state variable.\n */\n setIsResetAlertOpen: PropTypes.func,\n /**\n * Callback function that will be called when the reset button is clicked.\n */\n handleReset: PropTypes.func,\n /**\n * Description to be shown in the publish alert\n */\n publishAlertDescription: PropTypes.string,\n /**\n * Title of the publish alert\n */\n publishAlertTitle: PropTypes.string,\n /**\n * Props to be passed to the publish button\n */\n publishButtonProps: PropTypes.object,\n};\n\nexport default RightBlock;\n","import { isPresent } from \"neetocist\";\nimport useBreakpoints from \"neetocommons/react-utils/useBreakpoints\";\nimport PropTypes from \"prop-types\";\nimport { filter, length } from \"ramda\";\n\nimport LeftBlock from \"./LeftBlock\";\nimport NavigationLinks from \"./Navigation\";\nimport RightBlock from \"./RightBlock\";\n\nconst NavigationHeader = ({\n leftActionBlock,\n navigationLinks,\n rightActionBlock,\n}) => {\n const { isSize } = useBreakpoints();\n const isMobile = isSize(\"mobile\");\n\n const numberOfChildren = length(\n filter(isPresent, [leftActionBlock, navigationLinks, rightActionBlock])\n );\n\n const gridStyle = {\n gridTemplateColumns: isMobile\n ? `repeat(${\n navigationLinks ? numberOfChildren - 1 : numberOfChildren\n }, auto)`\n : `repeat(${numberOfChildren}, 1fr)`,\n };\n\n return (\n <div className=\"w-full\">\n <div\n className=\"neeto-molecules-navigation-header neeto-ui-border-gray-200 neeto-ui-bg-white flex h-16 w-full flex-shrink-0 items-center overflow-x-auto border-b px-2 py-2 md:px-4 lg:px-6\"\n data-cy=\"navigation-header\"\n data-testid=\"navigation-header\"\n >\n <div className=\"grid w-full gap-4\" style={gridStyle}>\n {leftActionBlock}\n {!isMobile && navigationLinks}\n {rightActionBlock}\n </div>\n </div>\n {isMobile && (\n <div className=\"neeto-molecules-navigation-header neeto-ui-border-gray-200 neeto-ui-bg-white flex flex-shrink-0 items-center overflow-x-auto border-b px-4 py-2 lg:px-6\">\n {navigationLinks}\n </div>\n )}\n </div>\n );\n};\n\nNavigationHeader.LeftActionBlock = LeftBlock;\nNavigationHeader.NavigationLinks = NavigationLinks;\nNavigationHeader.RightActionBlock = RightBlock;\n\nNavigationHeader.propTypes = {\n /**\n * To specify the content to be rendered in the left side of the `NavigationHeader`.\n */\n leftActionBlock: PropTypes.node,\n /**\n * To specify the content to be rendered at the center of the `NavigationHeader`.\n */\n navigationLinks: PropTypes.node,\n /**\n * To specify the content to be rendered in the right side of the `NavigationHeader`.\n */\n rightActionBlock: PropTypes.node,\n};\n\nexport default NavigationHeader;\n"],"names":["DEFAULT_HOME_BUTTON_PROPS","tooltip","content","t","position","homeUrl","icon","_jsx","Home","LeftBlock","_ref","customHomeButtonProps","homeButtonProps","renameProps","children","mergeDeepRight","_jsxs","className","Tooltip","touch","Link","to","isPresent","Rename","_objectSpread","dropdownItems","value","Menu","Dropdown","MenuItem","NavigationLinks","headerLinks","_ref$maxVisibleLinks","maxVisibleLinks","_useLocation","useLocation","pathname","_useTranslation","useTranslation","visibleLinks","slice","overflowLinks","isMoreButtonActive","existsBy","map","headerLink","NavLink","activeClassName","concat","joinHyphenCase","key","Typography","component","lineHeight","style","weight","label","isNotEmpty","buttonStyle","buttonProps","classNames","active","Button","isActive","isAbsoluteUrl","url","test","RightBlock","isDraftBlockHidden","previewDraftUrl","isResetDraftButtonVisible","onResetClick","isResetting","isPublishDisabled","isPublishing","handlePublish","isPublishPreviewDisabled","previewPublishedUrl","isPublishButtonVisible","isResetAlertOpen","setIsResetAlertOpen","handleReset","publishAlertTitle","publishAlertDescription","_ref$publishButtonPro","publishButtonProps","renderDraftButtons","_ref2","ViewDraftButton","ResetDraftButton","_Fragment","href","loading","onClick","renderPublishButtons","_ref3","PublishButton","PublishPreviewButton","disabled","PublishBlock","Alert","isOpen","isSubmitting","message","title","onClose","onSubmit","NavigationHeader","leftActionBlock","navigationLinks","rightActionBlock","_useBreakpoints","useBreakpoints","isSize","isMobile","numberOfChildren","length","filter","gridStyle","gridTemplateColumns","LeftActionBlock","RightActionBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,yBAAyB,GAAG;AACvCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,OAAO,EAAEC,CAAC,CAAC,sCAAsC,CAAC;AAClDC,IAAAA,QAAQ,EAAE,QAAA;GACX;AACDC,EAAAA,OAAO,EAAE,GAAG;AACZC,EAAAA,IAAI,eAAEC,GAAA,CAACC,IAAI,EAAE,EAAA,CAAA;AACf,CAAC;;;;ACAD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAKT;AAAA,EAAA,IAJaC,qBAAqB,GAAAD,IAAA,CAAtCE,eAAe;IACfP,OAAO,GAAAK,IAAA,CAAPL,OAAO;IACPQ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AGA,eAAe,CAAA;AAClD6E,gBAAgB,CAACc,gBAAgB,GAAGtD,UAAU;;;;"}
|
package/dist/ProductEmbed.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { shallow } from 'zustand/shallow';
|
|
2
|
+
import { useEffect, useState, useMemo } from 'react';
|
|
1
3
|
import { isPresent, filterBy, hyphenate, noop } from '@bigbinary/neeto-cist';
|
|
2
4
|
import { useLocation, useHistory } from 'react-router-dom';
|
|
3
5
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
6
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
|
-
import { useState, useEffect } from 'react';
|
|
6
7
|
import classnames from 'classnames';
|
|
7
8
|
import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
|
|
8
9
|
import Button from '@bigbinary/neetoui/Button';
|
|
@@ -21,6 +22,8 @@ import Delete from '@bigbinary/neeto-icons/Delete';
|
|
|
21
22
|
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
22
23
|
import Label from '@bigbinary/neetoui/Label';
|
|
23
24
|
import HelpPopover from './HelpPopover.js';
|
|
25
|
+
import { withImmutableActions, handleMetaClick } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
26
|
+
import { create } from 'zustand';
|
|
24
27
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
25
28
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
26
29
|
import Checkbox from '@bigbinary/neetoui/Checkbox';
|
|
@@ -29,7 +32,6 @@ import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructurin
|
|
|
29
32
|
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
30
33
|
import BrowserPreview from './BrowserPreview.js';
|
|
31
34
|
import { n } from './inject-css-DmrvuTKK.js';
|
|
32
|
-
import { handleMetaClick } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
33
35
|
import './index-DAYCJu79.js';
|
|
34
36
|
import './_commonjsHelpers-BFTU3MAI.js';
|
|
35
37
|
import './Breadcrumbs.js';
|
|
@@ -65,6 +67,24 @@ var INITIAL_QUERY_PARAM = {
|
|
|
65
67
|
value: ""
|
|
66
68
|
};
|
|
67
69
|
|
|
70
|
+
/** @type {import("neetocommons/react-utils").ZustandStoreHook} */
|
|
71
|
+
var useProductEmbedStore = create(withImmutableActions(function (set) {
|
|
72
|
+
return {
|
|
73
|
+
isQueryParamsEnabled: false,
|
|
74
|
+
queryParams: [INITIAL_QUERY_PARAM],
|
|
75
|
+
queryParamsProps: {
|
|
76
|
+
helpPopoverProps: {},
|
|
77
|
+
label: ""
|
|
78
|
+
},
|
|
79
|
+
setProductEmbedState: set,
|
|
80
|
+
setQueryParams: function setQueryParams(queryParams) {
|
|
81
|
+
return set({
|
|
82
|
+
queryParams: queryParams
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}));
|
|
87
|
+
|
|
68
88
|
var camelCasedAppName$1 = globalProps.appName.replace(/^neeto/i, "neeto");
|
|
69
89
|
var embedBaseScript = function embedBaseScript(embedScriptLink) {
|
|
70
90
|
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>");
|
|
@@ -237,14 +257,19 @@ var toCamelCasedString = function toCamelCasedString(string) {
|
|
|
237
257
|
function ownKeys$3(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; }
|
|
238
258
|
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
239
259
|
var DynamicQueryParams = function DynamicQueryParams(_ref) {
|
|
240
|
-
var updateCustomization = _ref.updateCustomization
|
|
241
|
-
queryParamsProps = _ref.queryParamsProps;
|
|
260
|
+
var updateCustomization = _ref.updateCustomization;
|
|
242
261
|
var _useTranslation = useTranslation(),
|
|
243
262
|
t = _useTranslation.t;
|
|
244
|
-
var
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
263
|
+
var _useProductEmbedStore = useProductEmbedStore(function (store) {
|
|
264
|
+
return {
|
|
265
|
+
queryParamsProps: store["queryParamsProps"],
|
|
266
|
+
queryParams: store["queryParams"],
|
|
267
|
+
setQueryParams: store["setQueryParams"]
|
|
268
|
+
};
|
|
269
|
+
}, shallow),
|
|
270
|
+
queryParamsProps = _useProductEmbedStore.queryParamsProps,
|
|
271
|
+
queryParams = _useProductEmbedStore.queryParams,
|
|
272
|
+
setQueryParams = _useProductEmbedStore.setQueryParams;
|
|
248
273
|
var handleAddQueryParam = function handleAddQueryParam() {
|
|
249
274
|
setQueryParams([].concat(_toConsumableArray(queryParams), [INITIAL_QUERY_PARAM]));
|
|
250
275
|
};
|
|
@@ -320,12 +345,16 @@ var DynamicQueryParams = function DynamicQueryParams(_ref) {
|
|
|
320
345
|
var ElementPopup$1 = function ElementPopup(_ref) {
|
|
321
346
|
var customization = _ref.customization,
|
|
322
347
|
updateCustomization = _ref.updateCustomization,
|
|
323
|
-
isQueryParamsEnabled = _ref.isQueryParamsEnabled,
|
|
324
|
-
queryParamsProps = _ref.queryParamsProps,
|
|
325
348
|
otherCustomizations = _ref.otherCustomizations;
|
|
326
349
|
var elementSelector = customization.elementSelector;
|
|
327
350
|
var _useTranslation = useTranslation(),
|
|
328
351
|
t = _useTranslation.t;
|
|
352
|
+
var _useProductEmbedStore = useProductEmbedStore(function (store) {
|
|
353
|
+
return {
|
|
354
|
+
isQueryParamsEnabled: store["isQueryParamsEnabled"]
|
|
355
|
+
};
|
|
356
|
+
}, shallow),
|
|
357
|
+
isQueryParamsEnabled = _useProductEmbedStore.isQueryParamsEnabled;
|
|
329
358
|
useEffect(function () {
|
|
330
359
|
if (isQueryParamsEnabled) return;
|
|
331
360
|
updateCustomization({
|
|
@@ -349,7 +378,6 @@ var ElementPopup$1 = function ElementPopup(_ref) {
|
|
|
349
378
|
});
|
|
350
379
|
}
|
|
351
380
|
}), otherCustomizations(), isQueryParamsEnabled && /*#__PURE__*/jsx(DynamicQueryParams, {
|
|
352
|
-
queryParamsProps: queryParamsProps,
|
|
353
381
|
updateCustomization: updateCustomization
|
|
354
382
|
})]
|
|
355
383
|
});
|
|
@@ -358,11 +386,15 @@ var ElementPopup$1 = function ElementPopup(_ref) {
|
|
|
358
386
|
var FloatingPopup$1 = function FloatingPopup(_ref) {
|
|
359
387
|
var customization = _ref.customization,
|
|
360
388
|
updateCustomization = _ref.updateCustomization,
|
|
361
|
-
isQueryParamsEnabled = _ref.isQueryParamsEnabled,
|
|
362
|
-
queryParamsProps = _ref.queryParamsProps,
|
|
363
389
|
otherCustomizations = _ref.otherCustomizations;
|
|
364
390
|
var _useTranslation = useTranslation(),
|
|
365
391
|
t = _useTranslation.t;
|
|
392
|
+
var _useProductEmbedStore = useProductEmbedStore(function (store) {
|
|
393
|
+
return {
|
|
394
|
+
isQueryParamsEnabled: store["isQueryParamsEnabled"]
|
|
395
|
+
};
|
|
396
|
+
}, shallow),
|
|
397
|
+
isQueryParamsEnabled = _useProductEmbedStore.isQueryParamsEnabled;
|
|
366
398
|
var btnTextColor = customization.btnTextColor,
|
|
367
399
|
showIcon = customization.showIcon,
|
|
368
400
|
btnText = customization.btnText,
|
|
@@ -446,7 +478,6 @@ var FloatingPopup$1 = function FloatingPopup(_ref) {
|
|
|
446
478
|
});
|
|
447
479
|
}
|
|
448
480
|
}), otherCustomizations(), isQueryParamsEnabled && /*#__PURE__*/jsx(DynamicQueryParams, {
|
|
449
|
-
queryParamsProps: queryParamsProps,
|
|
450
481
|
updateCustomization: updateCustomization
|
|
451
482
|
})]
|
|
452
483
|
});
|
|
@@ -455,14 +486,18 @@ var FloatingPopup$1 = function FloatingPopup(_ref) {
|
|
|
455
486
|
var Inline$1 = function Inline(_ref) {
|
|
456
487
|
var customization = _ref.customization,
|
|
457
488
|
updateCustomization = _ref.updateCustomization,
|
|
458
|
-
isQueryParamsEnabled = _ref.isQueryParamsEnabled,
|
|
459
|
-
queryParamsProps = _ref.queryParamsProps,
|
|
460
489
|
otherCustomizations = _ref.otherCustomizations;
|
|
490
|
+
var _useTranslation = useTranslation(),
|
|
491
|
+
t = _useTranslation.t;
|
|
492
|
+
var _useProductEmbedStore = useProductEmbedStore(function (store) {
|
|
493
|
+
return {
|
|
494
|
+
isQueryParamsEnabled: store["isQueryParamsEnabled"]
|
|
495
|
+
};
|
|
496
|
+
}, shallow),
|
|
497
|
+
isQueryParamsEnabled = _useProductEmbedStore.isQueryParamsEnabled;
|
|
461
498
|
var height = customization.height,
|
|
462
499
|
width = customization.width,
|
|
463
500
|
elementSelector = customization.elementSelector;
|
|
464
|
-
var _useTranslation = useTranslation(),
|
|
465
|
-
t = _useTranslation.t;
|
|
466
501
|
var handleInputChange = function handleInputChange(_ref2, attribute) {
|
|
467
502
|
var value = _ref2.target.value;
|
|
468
503
|
return updateCustomization(_defineProperty({}, attribute, value));
|
|
@@ -523,7 +558,6 @@ var Inline$1 = function Inline(_ref) {
|
|
|
523
558
|
}
|
|
524
559
|
})]
|
|
525
560
|
}), otherCustomizations(), isQueryParamsEnabled && /*#__PURE__*/jsx(DynamicQueryParams, {
|
|
526
|
-
queryParamsProps: queryParamsProps,
|
|
527
561
|
updateCustomization: updateCustomization
|
|
528
562
|
})]
|
|
529
563
|
});
|
|
@@ -1251,18 +1285,25 @@ var ElementPopupPlaceholderImage = function ElementPopupPlaceholderImage(_ref2)
|
|
|
1251
1285
|
};
|
|
1252
1286
|
|
|
1253
1287
|
var ElementPopup = function ElementPopup(_ref) {
|
|
1254
|
-
var iframeURL = _ref.iframeURL
|
|
1255
|
-
customization = _ref.customization;
|
|
1288
|
+
var iframeURL = _ref.iframeURL;
|
|
1256
1289
|
var _useTranslation = useTranslation(),
|
|
1257
1290
|
t = _useTranslation.t;
|
|
1258
|
-
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* Currently embed() function doesn't have an unembed handler.
|
|
1294
|
+
* When iframe link changes, we don't have an option to reinitiate it.
|
|
1295
|
+
* So we forcefully recreate the element with `key` and call embed() again
|
|
1296
|
+
*/
|
|
1297
|
+
var elementSelectorId = useMemo(function () {
|
|
1298
|
+
return "popup-button-".concat(Math.random().toString().substring(2, 10));
|
|
1299
|
+
}, [iframeURL]);
|
|
1259
1300
|
useEffect(function () {
|
|
1260
|
-
var element = document.getElementById(
|
|
1301
|
+
var element = document.getElementById(elementSelectorId);
|
|
1261
1302
|
if (element) {
|
|
1262
1303
|
var _window$globalProps$a;
|
|
1263
1304
|
(_window$globalProps$a = window[globalProps.appName.replace(/^neeto/i, "neeto")]) === null || _window$globalProps$a === void 0 || _window$globalProps$a.embed(element, iframeURL);
|
|
1264
1305
|
}
|
|
1265
|
-
}, []);
|
|
1306
|
+
}, [iframeURL]);
|
|
1266
1307
|
return /*#__PURE__*/jsxs("div", {
|
|
1267
1308
|
className: "relative h-full w-full overflow-hidden",
|
|
1268
1309
|
children: [/*#__PURE__*/jsx(ElementPopupPlaceholderImage, {
|
|
@@ -1271,9 +1312,9 @@ var ElementPopup = function ElementPopup(_ref) {
|
|
|
1271
1312
|
className: "absolute left-[48.5294117647%] top-[39.0804597701%]",
|
|
1272
1313
|
"data-cy": "preview-element-popup-button",
|
|
1273
1314
|
"data-testid": "preview-element-popup-button",
|
|
1274
|
-
id:
|
|
1315
|
+
id: elementSelectorId,
|
|
1275
1316
|
label: t("neetoMolecules.productEmbed.elementPopup.label")
|
|
1276
|
-
})]
|
|
1317
|
+
}, elementSelectorId)]
|
|
1277
1318
|
});
|
|
1278
1319
|
};
|
|
1279
1320
|
|
|
@@ -1286,13 +1327,24 @@ var FloatingPopup = function FloatingPopup(_ref) {
|
|
|
1286
1327
|
btnPosition = customization.btnPosition,
|
|
1287
1328
|
btnColor = customization.btnColor,
|
|
1288
1329
|
icon = customization.icon;
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* Currently embed() function doesn't have an unembed handler.
|
|
1333
|
+
* When iframe link changes, we don't have an option to reinitiate it.
|
|
1334
|
+
* So we forcefully recreate the element with `key` and call embed() again
|
|
1335
|
+
*/
|
|
1336
|
+
var elementSelectorId = useMemo(function () {
|
|
1337
|
+
return "popup-button-".concat(Math.random().toString().substring(2, 10));
|
|
1338
|
+
}, [iframeURL]);
|
|
1289
1339
|
useEffect(function () {
|
|
1290
|
-
var
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1340
|
+
var element = document.getElementById(elementSelectorId);
|
|
1341
|
+
if (element) {
|
|
1342
|
+
var _window$globalProps$a;
|
|
1343
|
+
(_window$globalProps$a = window[globalProps.appName.replace(/^neeto/i, "neeto")]) === null || _window$globalProps$a === void 0 || _window$globalProps$a.embed(element, iframeURL);
|
|
1344
|
+
}
|
|
1345
|
+
}, [iframeURL]);
|
|
1294
1346
|
useEffect(function () {
|
|
1295
|
-
var btn = document.getElementById(
|
|
1347
|
+
var btn = document.getElementById(elementSelectorId);
|
|
1296
1348
|
btn.style.backgroundColor = btnColor;
|
|
1297
1349
|
btn.style.color = btnTextColor;
|
|
1298
1350
|
}, [btnColor, btnTextColor]);
|
|
@@ -1304,13 +1356,13 @@ var FloatingPopup = function FloatingPopup(_ref) {
|
|
|
1304
1356
|
"data-cy": "popup-preview-button",
|
|
1305
1357
|
icon: icon && showIcon ? icon : null,
|
|
1306
1358
|
iconPosition: "left",
|
|
1307
|
-
id:
|
|
1359
|
+
id: elementSelectorId,
|
|
1308
1360
|
label: btnText,
|
|
1309
1361
|
className: classnames("absolute bottom-0 m-4", {
|
|
1310
1362
|
"left-0": btnPosition === "bottomLeft",
|
|
1311
1363
|
"right-0": btnPosition === "bottomRight"
|
|
1312
1364
|
})
|
|
1313
|
-
})]
|
|
1365
|
+
}, elementSelectorId)]
|
|
1314
1366
|
});
|
|
1315
1367
|
};
|
|
1316
1368
|
|
|
@@ -1327,6 +1379,14 @@ var Inline = function Inline(_ref) {
|
|
|
1327
1379
|
});
|
|
1328
1380
|
};
|
|
1329
1381
|
|
|
1382
|
+
var buildIframeURL = function buildIframeURL(iframeURL, queryParams) {
|
|
1383
|
+
var url = new URL(iframeURL);
|
|
1384
|
+
queryParams.forEach(function (param) {
|
|
1385
|
+
url.searchParams.append(param.name, param.value);
|
|
1386
|
+
});
|
|
1387
|
+
return url.toString();
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1330
1390
|
var Preview = function Preview(_ref) {
|
|
1331
1391
|
var isScriptLoading = _ref.isScriptLoading,
|
|
1332
1392
|
selectedEmbed = _ref.selectedEmbed,
|
|
@@ -1334,8 +1394,14 @@ var Preview = function Preview(_ref) {
|
|
|
1334
1394
|
customization = _ref.customization,
|
|
1335
1395
|
_ref$customPreviewIfr = _ref.customPreviewIframeUrl,
|
|
1336
1396
|
customPreviewIframeUrl = _ref$customPreviewIfr === void 0 ? "" : _ref$customPreviewIfr;
|
|
1397
|
+
var _useProductEmbedStore = useProductEmbedStore(function (store) {
|
|
1398
|
+
return {
|
|
1399
|
+
queryParams: store["queryParams"]
|
|
1400
|
+
};
|
|
1401
|
+
}, shallow),
|
|
1402
|
+
queryParams = _useProductEmbedStore.queryParams;
|
|
1337
1403
|
var preview = _defineProperty(_defineProperty(_defineProperty({}, EMBED_OPTIONS.INLINE, Inline), EMBED_OPTIONS.FLOATING_POPUP, FloatingPopup), EMBED_OPTIONS.ELEMENT_POPUP, ElementPopup);
|
|
1338
|
-
var iframeURL = customPreviewIframeUrl || "".concat(location.origin, "/embed/").concat(id);
|
|
1404
|
+
var iframeURL = buildIframeURL(customPreviewIframeUrl || "".concat(location.origin, "/embed/").concat(id), queryParams);
|
|
1339
1405
|
var Component = preview[selectedEmbed];
|
|
1340
1406
|
if (isScriptLoading) {
|
|
1341
1407
|
return /*#__PURE__*/jsx("div", {
|
|
@@ -1363,8 +1429,6 @@ var EmbedRenderer = function EmbedRenderer(_ref) {
|
|
|
1363
1429
|
customEmbedScriptPath = _ref.customEmbedScriptPath,
|
|
1364
1430
|
customPreviewIframeUrl = _ref.customPreviewIframeUrl,
|
|
1365
1431
|
id = _ref.id,
|
|
1366
|
-
queryParamsProps = _ref.queryParamsProps,
|
|
1367
|
-
isQueryParamsEnabled = _ref.isQueryParamsEnabled,
|
|
1368
1432
|
options = _ref.options,
|
|
1369
1433
|
extraArgs = _ref.extraArgs,
|
|
1370
1434
|
otherCustomizations = _ref.otherCustomizations,
|
|
@@ -1444,9 +1508,7 @@ var EmbedRenderer = function EmbedRenderer(_ref) {
|
|
|
1444
1508
|
supportedLanguages: supportedLanguages
|
|
1445
1509
|
}), /*#__PURE__*/jsx(CustomizationComponent, {
|
|
1446
1510
|
customization: customization,
|
|
1447
|
-
isQueryParamsEnabled: isQueryParamsEnabled,
|
|
1448
1511
|
otherCustomizations: otherCustomizations,
|
|
1449
|
-
queryParamsProps: queryParamsProps,
|
|
1450
1512
|
updateCustomization: updateCustomization
|
|
1451
1513
|
})]
|
|
1452
1514
|
})
|
|
@@ -1566,6 +1628,18 @@ var ProductEmbed = function ProductEmbed(_ref) {
|
|
|
1566
1628
|
search = _useLocation.search;
|
|
1567
1629
|
var queryParams = new URLSearchParams(search);
|
|
1568
1630
|
var selectedEmbed = toCamelCasedString(queryParams.get("type"));
|
|
1631
|
+
var _useProductEmbedStore = useProductEmbedStore(function (store) {
|
|
1632
|
+
return {
|
|
1633
|
+
setProductEmbedState: store["setProductEmbedState"]
|
|
1634
|
+
};
|
|
1635
|
+
}, shallow),
|
|
1636
|
+
setProductEmbedState = _useProductEmbedStore.setProductEmbedState;
|
|
1637
|
+
useEffect(function () {
|
|
1638
|
+
setProductEmbedState({
|
|
1639
|
+
isQueryParamsEnabled: isQueryParamsEnabled,
|
|
1640
|
+
queryParamsProps: queryParamsProps
|
|
1641
|
+
});
|
|
1642
|
+
}, []);
|
|
1569
1643
|
return selectedEmbed ? /*#__PURE__*/jsx(EmbedRenderer, {
|
|
1570
1644
|
className: className,
|
|
1571
1645
|
customEmbedScriptPath: customEmbedScriptPath,
|
|
@@ -1573,7 +1647,6 @@ var ProductEmbed = function ProductEmbed(_ref) {
|
|
|
1573
1647
|
extraArgs: extraArgs,
|
|
1574
1648
|
id: id,
|
|
1575
1649
|
inlineWrapperStyle: inlineWrapperStyle,
|
|
1576
|
-
isQueryParamsEnabled: isQueryParamsEnabled,
|
|
1577
1650
|
options: options,
|
|
1578
1651
|
otherCustomizations: otherCustomizations,
|
|
1579
1652
|
queryParamsProps: queryParamsProps,
|