{"version":3,"file":"mobile-side-menu-e5a73f1a.js","sources":["../../../client/src/javascripts/customer_pages/_megamenu/mobile-side-menu.jsx"],"sourcesContent":["'use strict';\n\n// Import Libraries\nimport React, { useState } from 'react';\nimport classNames from 'classnames';\nimport FocusTrap from 'focus-trap-react';\nimport PropTypes from 'prop-types';\nimport { href, link_classes } from './utils';\nimport { builderDispatch, WebUI } from '../_utils/ui';\n\nconst MobileSideMenu = ({ headerLinks, links }) => {\n React.useEffect(() => {\n const builderDispatchLogin = builderDispatch.register((event) => {\n switch (event.type) {\n case WebUI.LOGIN:\n updateComponent();\n break;\n }\n });\n return () => {\n builderDispatch.unregister(builderDispatchLogin);\n };\n });\n\n const [values, setValues] = useState({\n opened: false,\n display: 'none',\n update: false,\n });\n\n const updateComponent = () => {\n setValues({ ...values, update: !values.update });\n };\n\n const renderAccountTools = () => {\n const loggedIn =\n typeof window.App !== 'undefined' && window.App.order.logged_in();\n const { store_finder: storeFinderUrl, help_page: helpPageUrl } = headerLinks;\n const utilityLinks = () => {\n if (!storeFinderUrl && !helpPageUrl) {\n return null;\n }\n\n return (\n <>\n
  • \n \n Store Finder\n \n
  • \n
  • \n \n Help\n \n
  • \n \n );\n };\n\n const renderHeaderLinks = () => {\n if (loggedIn) {\n const {\n logged_in_links: {\n order_prints: orderPrintsUrl,\n user_albums: userAlbumsUrl,\n },\n } = headerLinks;\n\n const uploadLinks = () => {\n const storageProviderPresent =\n typeof window.App !== 'undefined' &&\n window.App.order.storage_provider_present;\n if (!storageProviderPresent) {\n return null;\n }\n\n return (\n <>\n
  • \n \n Upload Photos\n \n
  • \n
  • \n \n My Photos\n \n
  • \n \n );\n };\n const userName =\n typeof window.App !== 'undefined' &&\n window.App.order.logged_in_user_name;\n\n const {\n logged_in_links: {\n user_projects: userProjectsUrl,\n user_account: userAccountUrl,\n track_orders: trackOrdersUrl,\n logout: logoutUrl,\n },\n } = headerLinks;\n\n return (\n <>\n Hello, {userName}\n \n \n );\n } else {\n const { new_account: newAccountUrl, store_name: storeName } = headerLinks;\n\n return (\n <>\n Account\n \n \n );\n }\n };\n\n return (\n
  • \n {renderHeaderLinks()}\n
  • \n );\n };\n\n return (\n <>\n \n
    \n \n \n \n
      \n {renderAccountTools()}\n
    • \n Categories\n \n
    • \n
    \n
    \n
    \n \n );\n};\n\nMobileSideMenu.propTypes = {\n headerLinks: PropTypes.object,\n links: PropTypes.array,\n};\n\nMobileSideMenu.defaultTypes = {\n headerLinks: null,\n links: null,\n};\n\nexport default MobileSideMenu;\n"],"names":["MobileSideMenu","headerLinks","links","React","builderDispatchLogin","builderDispatch","event","WebUI","updateComponent","values","setValues","useState","renderAccountTools","loggedIn","storeFinderUrl","helpPageUrl","utilityLinks","renderHeaderLinks","orderPrintsUrl","userAlbumsUrl","uploadLinks","userName","userProjectsUrl","userAccountUrl","trackOrdersUrl","logoutUrl","newAccountUrl","storeName","FocusTrap","link","i","classNames","link_classes","href","PropTypes"],"mappings":"6QAUA,MAAMA,EAAiB,CAAC,CAAE,YAAAC,EAAa,MAAAC,KAAY,CACjDC,EAAM,UAAU,IAAM,CACpB,MAAMC,EAAuBC,EAAgB,SAAUC,GAAU,CAC/D,OAAQA,EAAM,KAAM,CAClB,KAAKC,EAAM,MACOC,IAChB,KACJ,CAAA,CACD,EACD,MAAO,IAAM,CACXH,EAAgB,WAAWD,CAAoB,CAAA,CACjD,CACD,EAED,KAAM,CAACK,EAAQC,CAAS,EAAIC,WAAS,CACnC,OAAQ,GACR,QAAS,OACT,OAAQ,EAAA,CACT,EAEKH,EAAkB,IAAM,CAC5BE,EAAU,CAAE,GAAGD,EAAQ,OAAQ,CAACA,EAAO,OAAQ,CAAA,EAG3CG,EAAqB,IAAM,CACzB,MAAAC,EACJ,OAAO,OAAO,IAAQ,KAAe,OAAO,IAAI,MAAM,YAClD,CAAE,aAAcC,EAAgB,UAAWC,GAAgBd,EAC3De,EAAe,IACf,CAACF,GAAkB,CAACC,EACf,qCAKJZ,EAAA,cAAA,KAAA,CAAG,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