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AAWA,CAACwB,EAAsBrB,KAC3CA,GAAaA,EAAUsB,IAAIC,EAAAA,GAASC,MAAOH,IAGlCR,EAAWA,CAACY,EAAsBzB,KAC3CA,GAAaA,EAAUsB,IAAIC,EAAAA,GAASG,MAAOD,IAQlCb,EAAiBX,GAEnB,kFAAkF0B,KAAK1B,GAGrFS,EAAiBT,GACnB,8DAA8D0B,KAAK1B,uBC1B9E2B,EAAOC,QAAUvC,2BCAjBsC,EAAOC,QAAUC","sources":["webpack://Msdyn365.Commerce.Online/./lib/default-external-script/module-registration.js?996f","webpack://Msdyn365.Commerce.Online/./src/modules/default-external-script/default-external-script.tsx?2a33","webpack://Msdyn365.Commerce.Online/./src/utils/script-utils.ts?cb52","webpack://Msdyn365.Commerce.Online/external var \"React\"?0d3b","webpack://Msdyn365.Commerce.Online/external var \"ReactDOM\"?853b"],"sourcesContent":["const binding = { modules: {}, dataActions: {} };\n\n    (binding.modules['default-external-script'] = {\n        c: () => require('@msdyn365-commerce-modules/core-components/dist/lib/modules/default-external-script/default-external-script'),\n        $type: 'scriptModule',\n        da: [],\n        \n        iNM: true,\n        ns: '@msdyn365-commerce-modules',\n        n: 'default-external-script',\n        p: 'core-components',\n        \n        pdp: '',\n        \n        \n        md: 'node_modules/@msdyn365-commerce-modules/core-components/dist/lib/modules/default-external-script'\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    };","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { SDK_FRAGMENT_NAME, msdyn365Commerce } from '@msdyn365-commerce/core-internal';\nimport * as path from 'path';\nimport * as React from 'react';\nimport { isAbsoluteUrl, isRelativeUrl, logDebug, logError } from '../../utils/script-utils';\nimport { IDefaultExternalScriptProps } from './default-external-script.props.autogenerated';\n\n/**\n *\n * DefaultExternalScript component\n * @extends {React.PureComponent<IDefaultExternalScriptProps<{}>>}\n */\nclass DefaultExternalScript extends React.PureComponent<IDefaultExternalScriptProps<{}>> {\n    constructor(props: IDefaultExternalScriptProps<{}>) {\n        super(props);\n    }\n\n    public render(): JSX.Element | null {\n        const { config } = this.props;\n        logDebug(`Adding script tags for '${this.props.id}/${this.props.typeName}'`, this.props.telemetry);\n        let source = config.scriptSource;\n\n        let relativeBaseUrl: string = '';\n        // Construct the relative base url, i.e. the base url from which statics will be served\n        if (this.props.context) {\n            relativeBaseUrl += this.props.context.request.url.staticCdnUrl;\n            relativeBaseUrl += msdyn365Commerce.getEnvironmentVariable('SUBMISSIONID') || '';\n        }\n\n        if (isRelativeUrl(source)) {\n            // If the source is a relative URL prepend the relative base url to the resolved source url for the actual source\n            source = `${relativeBaseUrl}/${path.join(source)}`;\n        } else if (source === '' || !isAbsoluteUrl(source)) {\n            logError(\n                'Invalid external script - not a url. The external source is not an external or relative url, please use default-inline-script if you wish to load inline scripts',\n                this.props.telemetry\n            );\n            return null;\n        }\n        const scriptHtml = `<script src=\"${source}\" async=${!!config.async} defer=${!!config.defer} ></script>`;\n\n        return React.createElement(SDK_FRAGMENT_NAME, { key: this.props.id, dangerouslySetInnerHTML: { __html: scriptHtml } });\n    }\n}\n\nexport default DefaultExternalScript;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IInternalTelemetry, LogLevel } from '@msdyn365-commerce/telemetry-internal';\n\nexport const logDebug = (debugMessage: string, telemetry: IInternalTelemetry | undefined): void => {\n    telemetry && telemetry.log(LogLevel.Debug, debugMessage);\n};\n\nexport const logError = (errorMessage: string, telemetry: IInternalTelemetry | undefined): void => {\n    telemetry && telemetry.log(LogLevel.Error, errorMessage);\n};\n\n/**\n * Returns true if the given string matches an URL pattern\n *\n * @param source The string to check against\n */\nexport const isAbsoluteUrl = (source: string): boolean => {\n    // eslint-disable-next-line security/detect-unsafe-regex\n    return /^(http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?$/.test(source);\n};\n\nexport const isRelativeUrl = (source: string): boolean => {\n    return /^(?!www\\.|(?:http|ftp)s?:\\/\\/|[A-Za-z]:\\\\|\\/\\/).*(\\.js){1}$/.test(source);\n};\n","module.exports = React;","module.exports = ReactDOM;"],"names":["binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","md","window","__bindings__","_objectSpread","DefaultExternalScript","React","constructor","props","super","render","config","this","logDebug","id","typeName","telemetry","source","scriptSource","relativeBaseUrl","context","request","url","staticCdnUrl","msdyn365Commerce","getEnvironmentVariable","isRelativeUrl","path","isAbsoluteUrl","logError","scriptHtml","async","defer","SDK_FRAGMENT_NAME","key","dangerouslySetInnerHTML","__html","debugMessage","log","LogLevel","Debug","errorMessage","Error","test","module","exports","ReactDOM"],"sourceRoot":""}