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C,EAAqBC,KAUlD,GADAlB,EAAQE,YAAYe,GAAuBC,GACtClB,EAAQE,YAAYe,GAAqBE,QAC1C,MAAM,IAAIC,MAAM,oBAAsBH,EAAsB,mCAEhEjB,EAAQE,YAAYe,GAAqBE,QAAQE,UAAUC,eAAiBL,EACxEjB,EAAQE,YAAYe,GAAqBE,QAAQE,UAAUE,KAC3DvB,EAAQE,YAAYF,EAAQE,YAAYe,GAAqBE,QAAQE,UAAUE,IAAMN,IA0BzFD,CAF4B,kEACXZ,EAAQ,KAMjCP,OAAO2B,aAAe3B,OAAO2B,cAAgB,GAC7C3B,OAAO2B,aAAavB,QAAOwB,EAAAA,EAAA,GACpB5B,OAAO2B,aAAavB,SAAW,IAC/BD,EAAQC,SAGXJ,OAAO2B,aAAatB,YAAWuB,EAAAA,EAAA,GAC5B5B,OAAO2B,aAAatB,aAAe,IACnCF,EAAQE,iCCzEnBwB,EAAOC,QAAUnE,2BCAjBkE,EAAOC,QAAUC","sources":["webpack://Msdyn365.Commerce.Online/./src/modules/vinhuset-location-redirect/vinhuset-location-redirect.tsx?c764","webpack://Msdyn365.Commerce.Online/./lib/vinhuset-location-redirect/module-registration.js?887a","webpack://Msdyn365.Commerce.Online/external var \"React\"?0d3b","webpack://Msdyn365.Commerce.Online/external var \"ReactDOM\"?853b"],"sourcesContent":["/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as React from 'react';\r\n\r\nimport { IVinhusetLocationRedirectData } from './vinhuset-location-redirect.data';\r\nimport { IVinhusetLocationRedirectProps } from './vinhuset-location-redirect.props.autogenerated';\r\n\r\n/**\r\n *\r\n * VinhusetLocationRedirect component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass VinhusetLocationRedirect extends React.PureComponent> {\r\n public componentDidMount(): void {\r\n const {\r\n config: { disable, redirects },\r\n context,\r\n data: { accountInformation }\r\n } = this.props;\r\n\r\n if (disable) {\r\n return;\r\n }\r\n\r\n const location = accountInformation.result?.ExtensionProperties?.find(x => x.Key === 'LOCATION')?.Value?.StringValue;\r\n\r\n // Check if already in the correct location (or both are null)\r\n if (!location || location === context.request.channel?.InventLocation) {\r\n return;\r\n }\r\n\r\n // Get the redirect for the proper location for this user's warehouse\r\n const redirect = redirects?.find(x => x.warehouse === location);\r\n\r\n if (!redirect) {\r\n return;\r\n }\r\n\r\n // Get current path and site path\r\n const currentPath = context.request.url.requestUrl.pathname + context.request.url.requestUrl.search;\r\n const sitePath = context.request.sitePath;\r\n\r\n // Create the new path\r\n const basePath = redirect.redirectUrl.destinationUrl.split('?')[0];\r\n const newPath = `${basePath}${currentPath.substring(sitePath?.length || 0)}`;\r\n\r\n // Redirect to the new path\r\n window.location.replace(newPath);\r\n }\r\n\r\n public render(): JSX.Element | null {\r\n return null;\r\n }\r\n}\r\n\r\nexport default VinhusetLocationRedirect;\r\n","const binding = { modules: {}, dataActions: {} };\n\n const registerActionId = (actionPath) => {\n if (binding.dataActions[actionPath] &&\n binding.dataActions[actionPath].default &&\n binding.dataActions[actionPath].default.prototype &&\n binding.dataActions[actionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[actionPath].default.prototype.id] = binding.dataActions[actionPath];\n } else {\n Object.keys(binding.dataActions[actionPath] || {}).forEach(exportName => {\n if (binding.dataActions[actionPath][exportName] &&\n binding.dataActions[actionPath][exportName].prototype &&\n binding.dataActions[actionPath][exportName].prototype.Action) {\n binding.dataActions[binding.dataActions[actionPath][exportName].prototype.id] = binding.dataActions[actionPath][exportName];\n }\n })\n }\n };\n\n const registerSanitizedActionPath = (sanitizedActionPath, dataAction) => {\n if (process.env.NODE_ENV === 'development') {\n if (!dataAction.default) {\n throw new Error('Data action path does not have a default export');\n }\n if (!(dataAction.default.prototype.id && binding.dataActions[dataAction.default.prototype.id]) || !binding.dataActions[sanitizedActionPath]) {\n binding.dataActions[sanitizedActionPath] = dataAction;\n }\n } else {\n binding.dataActions[sanitizedActionPath] = dataAction;\n if (!binding.dataActions[sanitizedActionPath].default) {\n throw new Error('Data action path ' + sanitizedActionPath + ' does not have a default export');\n }\n binding.dataActions[sanitizedActionPath].default.prototype.RegistrationId = sanitizedActionPath;\n if (binding.dataActions[sanitizedActionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[sanitizedActionPath].default.prototype.id] = sanitizedActionPath;\n }\n }\n };\n \n\n (binding.modules['vinhuset-location-redirect'] = {\n c: () => require('partner/modules/vinhuset-location-redirect/vinhuset-location-redirect.tsx'),\n $type: 'contentModule',\n da: [{name:'accountInformation', path:'@msdyn365-commerce-modules/retail-actions/dist/lib/get-customer', runOn: 0}],\n \n iNM: false,\n ns: '__local__',\n n: 'vinhuset-location-redirect',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/vinhuset-location-redirect'\n });\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce-modules/retail-actions/dist/lib/get-customer';\n let dataAction = require('@msdyn365-commerce-modules/retail-actions/dist/lib/get-customer');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.dataActions = {\n ...window.__bindings__.dataActions || {},\n ...binding.dataActions\n };","module.exports = React;","module.exports = ReactDOM;"],"names":["VinhusetLocationRedirect","React","componentDidMount","_accountInformation$r","_context$request$chan","config","disable","redirects","context","data","accountInformation","this","props","location","result","ExtensionProperties","find","x","Key","Value","StringValue","request","channel","InventLocation","redirect","warehouse","currentPath","url","requestUrl","pathname","search","sitePath","newPath","redirectUrl","destinationUrl","split","substring","length","window","replace","render","binding","modules","dataActions","c","require","$type","da","name","path","runOn","iNM","ns","n","p","pdp","md","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","Error","prototype","RegistrationId","id","__bindings__","_objectSpread","module","exports","ReactDOM"],"sourceRoot":""}