{"version":3,"sources":["webpack:///src/utils/script-utils.ts?9534","webpack:///src/modules/default-external-script/default-external-script.tsx?203d","webpack:///external \"React\"?c481","webpack:///external \"ReactDOM\"?4b2d","webpack:///./lib/default-external-script/module-registration.js?996f"],"names":["logDebug","debugMessage","telemetry","log","LogLevel","Debug","logError","errorMessage","Error","isAbsoluteUrl","source","test","isRelativeUrl","DefaultExternalScript","React","constructor","props","super","render","config","this","id","typeName","scriptSource","relativeBaseUrl","context","request","url","staticCdnUrl","msdyn365Commerce","getEnvironmentVariable","path","scriptHtml","async","defer","SDK_FRAGMENT_NAME","key","dangerouslySetInnerHTML","__html","module","exports","ReactDOM","binding","modules","dataActions","c","require","$type","da","iNM","ns","n","p","pdp","md","window","__bindings__","_objectSpread"],"mappings":";8PAOO,MAAMA,EAAWA,CAACC,EAAsBC,KAC3CA,GAAaA,EAAUC,IAAIC,IAASC,MAAOJ,IAGlCK,EAAWA,CAACC,EAAsBL,KAC3CA,GAAaA,EAAUC,IAAIC,IAASI,MAAOD,IAQlCE,EAAiBC,GAEnB,kFAAkFC,KAAKD,GAGrFE,EAAiBF,GACnB,8DAA8DC,KAAKD,I,kCC1B9E,2DAgBA,MAAMG,UAA8BC,gBAChCC,YAAYC,GACRC,MAAMD,GAGHE,SACH,MAAM,OAAEC,GAAWC,KAAKJ,MACxBhB,YAAS,2BAA2BoB,KAAKJ,MAAMK,MAAMD,KAAKJ,MAAMM,YAAaF,KAAKJ,MAAMd,WACxF,IAAIQ,EAASS,EAAOI,aAEhBC,EAA0B,GAO9B,GALIJ,KAAKJ,MAAMS,UACXD,GAAmBJ,KAAKJ,MAAMS,QAAQC,QAAQC,IAAIC,aAClDJ,GAAmBK,IAAiBC,uBAAuB,iBAAmB,IAG9ElB,YAAcF,GAEdA,EAAS,GAAGc,KAAmBO,OAAUrB,UACtC,GAAe,KAAXA,IAAkBD,YAAcC,GAKvC,OAJAJ,YACI,mKACAc,KAAKJ,MAAMd,WAER,KAEX,MAAM8B,EAAa,gBAAgBtB,cAAmBS,EAAOc,iBAAiBd,EAAOe,oBAErF,OAAOpB,gBAAoBqB,IAAmB,CAAEC,IAAKhB,KAAKJ,MAAMK,GAAIgB,wBAAyB,CAAEC,OAAQN,MAIhGnB,a,mBCjDf0B,EAAOC,QAAU1B,O,mBCAjByB,EAAOC,QAAUC,U,8mBCAjB,MAAMC,EAAU,CAAEC,QAAS,GAAIC,YAAa,IAEvCF,EAAQC,QAAQ,2BAA6B,CAC1CE,EAAGA,IAAMC,EAAQ,QACjBC,MAAO,eACPC,GAAI,GAEJC,KAAK,EACLC,GAAI,6BACJC,EAAG,0BACHC,EAAG,kBAEHC,IAAK,GAGLC,GAAI,oGAKRC,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAab,QAAOc,IAAA,GACpBF,OAAOC,aAAab,SAAW,IAC/BD,EAAQC,SAGXY,OAAOC,aAAaZ,YAAWa,IAAA,GAC5BF,OAAOC,aAAaZ,aAAe,IACnCF,EAAQE,e","file":"static/js/81.020ab86070b766cf5251.chunk.js","sourcesContent":["/*!\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","/*!\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>}\n */\nclass DefaultExternalScript extends React.PureComponent> {\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 = ``;\n\n return React.createElement(SDK_FRAGMENT_NAME, { key: this.props.id, dangerouslySetInnerHTML: { __html: scriptHtml } });\n }\n}\n\nexport default DefaultExternalScript;\n","module.exports = React;","module.exports = ReactDOM;","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 };"],"sourceRoot":""}