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SAAW,IAC/BD,EAAQC,SAGXY,OAAOC,aAAaZ,YAAWa,EAAAA,EAAA,GAC5BF,OAAOC,aAAaZ,aAAe,IACnCF,EAAQE,c,mBC5BnBc,EAAOC,QAAU5C,Q","sources":["webpack://bju-press/../../src/Interfaces/ITelemetry.ts?ffdd","webpack://bju-press/./src/modules/catalog-cookie/catalog-cookie.tsx?22fd","webpack://bju-press/./lib/catalog-cookie/module-registration.js?f16a","webpack://bju-press/external var \"React\"?0d3b"],"sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nexport enum LogLevel {\n /**\n * For information that's typically valuable only for debugging. These messages may contain sensitive application data and so shouldn't be enabled in a production environment. Disabled by default.\n */\n Trace = 'trace',\n /**\n * For information that may be useful in development and debugging. Example: Entering method Configure with flag set to true. Enable Debug level logs in production only when troubleshooting, due to the high volume of logs.\n */\n Debug = 'debug',\n /**\n * For tracking the general flow of the app. These logs typically have some long-term value. Example: Request received for path /api/todo\n */\n Information = 'information',\n /**\n * For abnormal or unexpected events in the app flow.\n * These may include errors or other conditions that don't cause the app to stop but might need to be investigated. Handled exceptions are a common place to use the Warning log level. Example: FileNotFoundException for file quotes.txt.\n */\n Warning = 'warning',\n /**\n * For errors and exceptions that cannot be handled.\n * These messages indicate a failure in the current activity or operation (such as the current HTTP request), not an app-wide failure. Example log message: Cannot insert record due to duplicate key violation.\n */\n Error = 'error',\n /**\n * For failures that require immediate attention. Examples: data loss scenarios, out of disk space.\n */\n Critical = 'critical',\n None = 'none'\n}\n\n/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\n/**\n * Holds optional parameters for log statements\n */\nexport type TelemetryLogOptions = {\n /**\n * Holds any arguments that are meant for placeholders in the message template\n */\n values?: unknown[];\n\n /**\n * Array of custom tags to add to log\n */\n customTags?: string[];\n\n /**\n * Exception that can be attached to the log\n */\n exception?: Error;\n};\n\n\n/**\n * Interface exposing methods for trace logging, telemetry event logging, and data attribute rendering\n * @property trace {Function} - Logs the given message at a Trace level\n * @property debug {Function} - Logs the given message at a Debug level\n * @property information {Function} - Logs the given message at a Information level\n * @property warning {Function} - Logs the given message at a Warning level\n * @property error {Function} - Logs the given message at a Error level\n * @property critical {Function} - Logs the given message at a Critical level\n * @property exception {Function} - Logs the given error object\n */\nexport interface ITelemetry {\n /**\n * Logs a structured message at the given log level, with optional custom tags and/or an exception\n * @param logLevel LogLevel of the message\n * @param messageTemplate String to log, denoting placeholders with {placeholder}\n * @param logOptions Contains arguments to replace placeholders, custom tags for log, and optional error object\n */\n log(logLevel: LogLevel, messageTemplate: string, logOptions?: TelemetryLogOptions): void;\n\n}\n","//==============================================================================\r\n// This module helps persist the currently active catalog.\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 saves the current catalog into a session cookie so it will be\r\n// used even if the URL isn't set.\r\n//==============================================================================\r\nimport * as React from 'react';\r\n\r\nimport { ICatalogCookieData } from './catalog-cookie.data';\r\nimport { ICatalogCookieProps } from './catalog-cookie.props.autogenerated';\r\nimport { LogLevel } from '@msdyn365-commerce/retail-proxy/dist/interfaces/ITelemetry';\r\n\r\n//==============================================================================\r\n// CONSTANTS\r\n//==============================================================================\r\nconst COOKIE_NAME = 'd365_catalog';\r\n\r\ndeclare var ___initialData___: any;\r\n\r\n//==============================================================================\r\n// CLASS\r\n//==============================================================================\r\nclass CatalogCookie extends React.PureComponent> {\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n constructor(props: ICatalogCookieProps) {\r\n super(props);\r\n\r\n // Even if this is basically the first module on the page and occurs during SSR, it won't catch everything\r\n this.catalogManagement();\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 catalogManagement() {\r\n const context = this.props.context.request;\r\n\r\n // AI logging test. It seems only warning and above makes it to AI (as exceptions).\r\n const log = (msg: string) => this.props.context.telemetry.log(LogLevel.Warning, msg, {values: []});\r\n\r\n // Only do something if the user is logged in\r\n if (context.user && (context.user.isB2b || context.user.isOBORequest)) {\r\n\r\n // Attempt to get catalog values from both the cookie and URL\r\n const cookieId = context.cookies.get(COOKIE_NAME); // This may even work on the server\r\n const urlId = context.query && context.query.catalogid; // This should work on the server\r\n\r\n // If catalog is in the URL, that takes precedence. Update the cookie.\r\n if (urlId) {\r\n log(`Set catalog from URL: ${urlId}`);\r\n context.cookies.set(COOKIE_NAME, urlId); // Hopefully this will default to a session cookie\r\n context.user.catalogId = urlId;\r\n }\r\n // If no URL is set and the cookie is set, use that\r\n else if (cookieId?.value) {\r\n log(`Set catalog from cookie: ${urlId}`);\r\n context.user.catalogId = cookieId.value;\r\n }\r\n else if (context.user.catalogId && Number(context.user.catalogId) > 0) {\r\n log(`Catalog already set: ${context.user.catalogId}`);\r\n }\r\n else {\r\n log(`Unable to set catalog ID`);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default CatalogCookie;\r\n","const binding = { modules: {}, dataActions: {} };\n\n (binding.modules['catalog-cookie'] = {\n c: () => require('partner/modules/catalog-cookie/catalog-cookie.tsx'),\n $type: 'scriptModule',\n da: [],\n \n iNM: false,\n ns: '__local__',\n n: 'catalog-cookie',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/catalog-cookie'\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;"],"names":["LogLevel","COOKIE_NAME","CatalogCookie","React","constructor","props","super","this","catalogManagement","render","context","request","log","msg","telemetry","Warning","values","user","isB2b","isOBORequest","cookieId","cookies","get","urlId","query","catalogid","set","catalogId","value","Number","binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","md","window","__bindings__","_objectSpread","module","exports"],"sourceRoot":""}