{"version":3,"file":"8661.6b640d81e64c676b.js","sources":["webpack://storefronts/./src/shared/components/FederatedModules/Navigation.ts","webpack://storefronts/./src/shared/components/FederatedModules/RemoteHeader.tsx"],"sourcesContent":["import { routes } from '@shared/routerHistory';\nimport { Constants } from '@shared/utils/constants';\nimport { getEntityRegistration } from '@shared/utils/entityRegistration';\nexport const generateUrlNavigation = (buildHref, options)=>{\n const { type, params, query } = options;\n const entityType = Constants.EntityType[`${type}`];\n const isPartner = entityType === Constants.EntityType.Partner;\n const route = isPartner ? routes.marketplacePartners : entityType ? getEntityRegistration(entityType).route : routes[`${type}`];\n if (!route) {\n return '';\n }\n if (route.name === routes.marketplacePartnerSuggestion.name) {\n return buildHref(route, null, query);\n } else {\n return buildHref(route, params, query, false, true);\n }\n};\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\nfunction _async_to_generator(fn) {\n return function() {\n var self = this, args = arguments;\n return new Promise(function(resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport React from 'react';\nimport propTypes from 'prop-types';\nimport { getEntityRegistration } from '@shared/utils/entityRegistration';\nimport { routes } from '@shared/routerHistory';\nimport { Constants } from '@shared/utils/constants';\nimport { PartnerSearchResultType } from '@shared/Models';\nimport { logger } from '@src/logger';\nimport { useDispatch, useSelector } from 'react-redux';\nimport { useNavigate, useLocation } from 'react-router';\nimport { getWindow } from '@shared/services/window';\nimport { setSuggestionsRequestId } from 'actions/actions';\nimport { getNpsModule } from '@appsource/utils/nps';\nimport RemoteAppSourceHeader from '@layout/Header';\nimport { generateUrlNavigation } from './Navigation';\nconst RemoteHeader = ({ market, locale, userProps, onMarketChange, onLocaleChange }, context)=>{\n const { buildHref } = context;\n const activeFilters = useSelector((state)=>state.apps.activeFilters.filter((activeFilter)=>Boolean(activeFilter.BackendKey)));\n const unifiedExperience = useSelector(({ config })=>config.isConverged);\n const navigate = useNavigate();\n const location = useLocation();\n const dispatch = useDispatch();\n const handleNavigation = (options)=>{\n var _getNpsModule;\n const url = generateUrlNavigation(buildHref, options);\n if (url) {\n navigate(url);\n }\n (_getNpsModule = getNpsModule()) === null || _getNpsModule === void 0 ? void 0 : _getNpsModule.increaseActionsCounter(Constants.NpsActions.galleryChangesCount);\n getWindow().scrollTo(0, 0);\n };\n const handleSearch = /*#__PURE__*/ function() {\n var _ref = _async_to_generator(function*(options) {\n var _getEntityRegistration;\n const { gallery, searchTerm, useCurrentFilters, suggestionsRequestId } = options;\n const entityType = Constants.EntityType[`${gallery}`];\n const isPartner = entityType === Constants.EntityType.Partner;\n const route = isPartner ? routes.marketplacePartnerSuggestion : (_getEntityRegistration = getEntityRegistration(entityType)) === null || _getEntityRegistration === void 0 ? void 0 : _getEntityRegistration.route;\n if (!route) {\n return;\n }\n if (isPartner) {\n const url = buildHref(route, null, {\n text: searchTerm,\n type: PartnerSearchResultType.FreeText.toString(),\n value: searchTerm\n });\n navigate(url);\n return;\n }\n yield dispatch(setSuggestionsRequestId({\n suggestionsRequestId\n }));\n if (useCurrentFilters) {\n const url = buildHref(route, null, {\n search: searchTerm,\n page: '1'\n });\n navigate(url);\n return;\n }\n const url = buildHref(route, null, {\n search: searchTerm,\n page: '1',\n [Constants.FilterQuery.category]: null,\n [Constants.FilterQuery.industry]: null,\n [Constants.FilterQuery.subcategories]: null,\n [Constants.FilterQuery.subindustries]: null,\n [Constants.FilterQuery.product]: null,\n [Constants.FilterQuery.filters]: null,\n serviceType: null\n });\n navigate(url);\n });\n return function handleSearch(options) {\n return _ref.apply(this, arguments);\n };\n }();\n return /*#__PURE__*/ _jsx(RemoteAppSourceHeader, {\n userProps: userProps,\n navigate: handleNavigation,\n logger: logger,\n market: market,\n locale: locale,\n searchProps: {\n onSearch: handleSearch,\n filters: activeFilters\n },\n location: location,\n onMarketChange: onMarketChange,\n onLocaleChange: onLocaleChange,\n unifiedExperience: unifiedExperience\n });\n};\nRemoteHeader.contextTypes = {\n buildHref: propTypes.func\n};\nexport default RemoteHeader;\n"],"names":["generateUrlNavigation","buildHref","options","type","params","query","entityType","route","isPartner","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","Promise","RemoteHeader","market","locale","userProps","onMarketChange","onLocaleChange","context","fn","_ref","activeFilters","state","activeFilter","Boolean","unifiedExperience","config","navigate","location","dispatch","handleSearch","_getEntityRegistration","gallery","searchTerm","useCurrentFilters","suggestionsRequestId","self","args","arguments","err","undefined","_getNpsModule","url"],"mappings":"yKAGO,IAAMA,EAAwB,CAACC,EAAWC,KAC7C,GAAM,CAAEC,KAAAA,CAAI,CAAEC,OAAAA,CAAM,CAAEC,MAAAA,CAAK,CAAE,CAAGH,EAC1BI,EAAa,eAAoB,CAAC,CAAC,EAAEH,EAAK,CAAC,CAAC,CAE5CI,EAAQC,AADIF,IAAe,uBAA4B,CACnC,wBAA0B,CAAGA,EAAa,SAAsBA,GAAY,KAAK,CAAG,IAAM,CAAC,CAAC,EAAEH,EAAK,CAAC,CAAC,QAC/H,AAAKI,EAGDA,EAAM,IAAI,GAAK,sCAAwC,CAChDN,EAAUM,EAAO,KAAMF,GAEvBJ,EAAUM,EAAOH,EAAQC,EAAO,GAAO,IALvC,EAOf,C,kPChBA,SAASI,EAAmBC,CAAG,CAAEC,CAAO,CAAEC,CAAM,CAAEC,CAAK,CAAEC,CAAM,CAAEC,CAAG,CAAEC,CAAG,EACrE,GAAI,CACA,IAAIC,EAAOP,CAAG,CAACK,EAAI,CAACC,GAChBE,EAAQD,EAAK,KAAK,AAC1B,CAAE,MAAOE,EAAO,CACZP,EAAOO,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