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,KACxCC,EAAW,EAAQ,IACnBC,EAAoB,EAAQ,IAC5BC,EAAW,EAAQ,IACnBxB,EAAW,EAAQ,IACnByB,EAAyB,EAAQ,IACjCC,EAAY,EAAQ,IACpBC,EAAqB,EAAQ,KAC7BC,EAAa,EAAQ,KAGzBP,EAA8B,SAAS,SAAUQ,EAAOC,EAAaC,GACnE,MAAO,CAGL,SAAeC,GACb,IAAIC,EAAIR,EAAuBtD,MAC3B+D,EAAUX,EAAkBS,QAAUG,EAAYT,EAAUM,EAAQH,GACxE,OAAOK,EAAUd,EAAKc,EAASF,EAAQC,GAAK,IAAIG,OAAOJ,GAAQH,GAAO7B,EAASiC,KAIjF,SAAUI,GACR,IAAIC,EAAKhB,EAASnD,MACdoE,EAAIvC,EAASqC,GACbG,EAAMT,EAAgBD,EAAaQ,EAAIC,GAE3C,GAAIC,EAAIC,KAAM,OAAOD,EAAIxD,MAEzB,IAAKsD,EAAGI,OAAQ,OAAOd,EAAWU,EAAIC,GAEtC,IAAII,EAAcL,EAAGM,QACrBN,EAAGO,UAAY,EAIf,IAHA,IAEIC,EAFAC,EAAI,GACJpC,EAAI,EAEgC,QAAhCmC,EAASlB,EAAWU,EAAIC,KAAc,CAC5C,IAAIS,EAAWhD,EAAS8C,EAAO,IAC/BC,EAAEpC,GAAKqC,EACU,KAAbA,IAAiBV,EAAGO,UAAYlB,EAAmBY,EAAGf,EAASc,EAAGO,WAAYF,IAClFhC,IAEF,OAAa,IAANA,EAAU,KAAOoC,S","sources":["webpack://bju-press/./src/modules/catalog-link-repairer/catalog-link-repairer.tsx?fc7c","webpack://bju-press/./lib/catalog-link-repairer/module-registration.js?9e97","webpack://bju-press/external var \"React\"?0d3b","webpack://bju-press/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/es.string.match.js?d557"],"sourcesContent":["//==============================================================================\r\n// This module is part 2 of helping restore catalog id. Combined with module catalog-cookie.\r\n//\r\n// Microsoft relies on URLs to keep track of the current catalog, which is fragile.\r\n// Links to My Account and hard-coded or relative internal links will cause\r\n// the catalog ID to be dropped.\r\n//\r\n// This module uses the saved cookie from the catalog-cookie module to repair links\r\n// used even if the URL isn't set.\r\n//==============================================================================\r\nimport * as React from 'react';\r\n\r\nimport { ICatalogLinkRepairerData } from './catalog-link-repairer.data';\r\nimport { ICatalogLinkRepairerProps } from './catalog-link-repairer.props.autogenerated';\r\n\r\n//==============================================================================\r\n// CONSTANTS\r\n//==============================================================================\r\nconst COOKIE_NAME = 'd365_catalog';\r\n\r\n//==============================================================================\r\n// CLASS\r\n//==============================================================================\r\nclass CatalogLinkRepairer extends React.PureComponent> {\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n public componentDidMount(): void {\r\n\r\n // Fix links that were generated before catalogManagement set the catalog\r\n // This isn't terribly reliable since links get generated at various times.\r\n // We can't fix links that don't appear until they are scrolled into view in this manner.\r\n // Another approach would be to add the catalog ID to the URL if it's not currently present, but that might not\r\n // do anything unless there is a page reload, which would be bad.\r\n const repairLinks = this.repairLinks.bind(this);\r\n\r\n // Defer the first execution to allow all first-pass render actions to complete\r\n setTimeout(repairLinks, 0);\r\n\r\n // Repeat the fix after a little while to allow (some) REST-based renders to complete\r\n setTimeout(repairLinks, 1500);\r\n }\r\n\r\n //----------------------------------------------------------\r\n // This module doesn't display anything, but render() is required\r\n //----------------------------------------------------------\r\n public render(): JSX.Element | null {\r\n return null;\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n private repairLinks() {\r\n\r\n const context = this.props.context.request;\r\n const urlId = context.query && context.query.catalogid;\r\n const cookieId = context.cookies.get(COOKIE_NAME);\r\n\r\n // If a catalog is set in the URL, there is no need for adjustments.\r\n // If a cookie with the catalog ID isn't set, there's nothing we can do.\r\n if (!urlId && cookieId.value) {\r\n\r\n // Not ideal React code. We should't be messing with the DOM directly. But this is a special case.\r\n const allLinks = Array.from(document.getElementsByTagName('a'));\r\n\r\n // Walk through all links\r\n allLinks.forEach(link => {\r\n\r\n // Parse the search query into a useful format\r\n const href = link.getAttribute('href');\r\n const query = href?.match(/^[^?#]+\\?([^#]+)/); // [full_url, query_string] | null\r\n const parsedQueries = Array.isArray(query) && new URLSearchParams(query[1]);\r\n\r\n // Check for a catalogid\r\n if (parsedQueries && parsedQueries.get('catalogid')) {\r\n\r\n // Update the catalogid from the cookie\r\n parsedQueries.set('catalogid', cookieId.value!);\r\n const newHref = href!.replace(query![1], parsedQueries.toString());\r\n link.setAttribute('href', newHref);\r\n }\r\n });\r\n }\r\n }\r\n}\r\n\r\nexport default CatalogLinkRepairer;\r\n","const binding = { modules: {}, dataActions: {} };\n\n (binding.modules['catalog-link-repairer'] = {\n c: () => require('partner/modules/catalog-link-repairer/catalog-link-repairer.tsx'),\n $type: 'contentModule',\n da: [],\n \n iNM: false,\n ns: '__local__',\n n: 'catalog-link-repairer',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/catalog-link-repairer'\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;","'use strict';\nvar call = require('../internals/function-call');\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar toLength = require('../internals/to-length');\nvar toString = require('../internals/to-string');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar getMethod = require('../internals/get-method');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\n// @@match logic\nfixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {\n return [\n // `String.prototype.match` method\n // https://tc39.es/ecma262/#sec-string.prototype.match\n function match(regexp) {\n var O = requireObjectCoercible(this);\n var matcher = isNullOrUndefined(regexp) ? undefined : getMethod(regexp, MATCH);\n return matcher ? call(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString(O));\n },\n // `RegExp.prototype[@@match]` method\n // https://tc39.es/ecma262/#sec-regexp.prototype-@@match\n function (string) {\n var rx = anObject(this);\n var S = toString(string);\n var res = maybeCallNative(nativeMatch, rx, S);\n\n if (res.done) return res.value;\n\n if (!rx.global) return regExpExec(rx, S);\n\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n var A = [];\n var n = 0;\n var result;\n while ((result = regExpExec(rx, S)) !== null) {\n var matchStr = toString(result[0]);\n A[n] = matchStr;\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n n++;\n }\n return n === 0 ? null : A;\n }\n ];\n});\n"],"names":["CatalogLinkRepairer","React","componentDidMount","repairLinks","this","bind","setTimeout","render","context","props","request","urlId","query","catalogid","cookieId","cookies","get","value","Array","from","document","getElementsByTagName","forEach","link","href","getAttribute","match","parsedQueries","isArray","URLSearchParams","set","newHref","replace","toString","setAttribute","binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","md","window","__bindings__","_objectSpread","module","exports","call","fixRegExpWellKnownSymbolLogic","anObject","isNullOrUndefined","toLength","requireObjectCoercible","getMethod","advanceStringIndex","regExpExec","MATCH","nativeMatch","maybeCallNative","regexp","O","matcher","undefined","RegExp","string","rx","S","res","done","global","fullUnicode","unicode","lastIndex","result","A","matchStr"],"sourceRoot":""}