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,kBAAwB,UAAUoC,KAAK,sBAAsBC,wBAAyB,CAAEC,OAAQX,MAWpGH,mBACJzE,EACAkC,EACAE,GAEA,OACIa,EAAAA,cAACc,EAAAA,GAAe,KACX/D,GAASiD,EAAAA,cAAAA,OAAAA,CAAM9E,KAAK,gBAAgB6F,QAAShE,IAC7CkC,GAAee,EAAAA,cAAAA,OAAAA,CAAM9E,KAAK,sBAAsB6F,QAAS9B,IACzDE,GAAmBa,EAAAA,cAAAA,OAAAA,CAAM9E,KAAK,gBAAgB6F,QAAS5B,IACxDa,EAAAA,cAAAA,OAAAA,CAAM9E,KAAK,eAAe6F,QAAQ,aAUtCJ,oBAAoB5D,EAA2B8D,GAC9C9D,IACDA,EAAQ,IAEZ,MAAMwF,EAAezF,KAAKoD,MAAM3D,OAChC,GAAIgG,GAAgBA,EAAaC,wBAC7B,OAAOzF,EAEX,MAAM0F,EAAY5B,GAAOA,EAAI6B,SAU7B,OATID,IACIA,EAAUE,kBACV5F,EAAQ,GAAG0F,EAAUE,kBAAkB5F,KAEvC0F,EAAUG,kBACV7F,EAAQ,GAAGA,IAAQ0F,EAAUG,oBAI9B7F,GAIf,8BCjMA8F,EAAOC,QAAU9C,2BCAjB6C,EAAOC,QAAUC","sources":["webpack://msdyn365.commerce.online/./lib/product-page-summary/module-registration.js?deb5","webpack://msdyn365.commerce.online/./src/modules/product-page-summary/product-page-summary.action.ts?9992","webpack://msdyn365.commerce.online/./src/modules/product-page-summary/product-page-summary.tsx?2924","webpack://msdyn365.commerce.online/external var \"React\"?0d3b","webpack://msdyn365.commerce.online/external var \"ReactDOM\"?853b"],"sourcesContent":["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['product-page-summary'] = {\n c: () => require('@msdyn365-commerce-modules/page-summary/dist/lib/modules/product-page-summary/product-page-summary'),\n $type: 'htmlHeadTagsModule',\n da: [{name:'productPageSummary', path:'@msdyn365-commerce-modules/page-summary/dist/lib/modules/product-page-summary/product-page-summary.action', runOn: 0}],\n \n iNM: true,\n ns: '@msdyn365-commerce-modules',\n n: 'product-page-summary',\n p: 'page-summary',\n \n pdp: '',\n \n \n md: 'node_modules/@msdyn365-commerce-modules/page-summary/dist/lib/modules/product-page-summary'\n });\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce-modules/page-summary/dist/lib/modules/product-page-summary/product-page-summary.action';\n let dataAction = require('@msdyn365-commerce-modules/page-summary/dist/lib/modules/product-page-summary/product-page-summary.action');\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 };","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\nimport { getAttributeValuesAsync, getByIdsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\nimport {\n ArrayExtensions,\n buildCacheKey,\n generateImageUrl,\n getProductUrlSync,\n getSelectedProductIdFromActionInput,\n QueryResultSettingsProxy,\n removeDomainQspFromUrl\n} from '@msdyn365-commerce-modules/retail-actions';\n\nimport { IPageSummaryData } from '../IPageSummaryData';\nimport { IProductPageSummaryConfig } from './product-page-summary.props.autogenerated';\n\n/**\n * Product Page Summary Input.\n */\nexport class ProductPageSummaryInput implements IActionInput {\n public apiSettings: ICommerceApiSettings;\n\n public config: IProductPageSummaryConfig;\n\n public productId: number;\n\n public catalogId?: number;\n\n public constructor(\n config: IProductPageSummaryConfig,\n apiSettings: ICommerceApiSettings,\n productId: number,\n requestContext?: IRequestContext\n ) {\n this.config = config || {};\n this.apiSettings = apiSettings;\n this.productId = productId;\n\n if (requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n public getCacheObjectType = (): string => 'ProductPageSummary';\n\n public getCacheKey = (): string =>\n `${buildCacheKey('ProductPageSummary', this.apiSettings)}-${this.config.title}-${this.productId}-${this.catalogId ?? 0}`;\n\n public dataCacheType = (): CacheType => 'application';\n}\n\nexport interface IProductPageSummary extends IPageSummaryData {\n price?: number;\n productId?: number;\n productBrand?: string;\n}\n\nconst createInput = (args: ICreateActionContext) => {\n const productId = getSelectedProductIdFromActionInput(args);\n\n if (productId) {\n return new ProductPageSummaryInput(\n args.config,\n args.requestContext.apiSettings,\n +productId,\n args.requestContext\n );\n }\n throw new Error('Unable to create ProductPageSummaryAction input, no productId found on module config or query');\n};\n\n// Checks product attributes for the presence of brand attribute to extract the brand name for product metadata\nconst getProductBrand = async (\n context: IActionContext,\n recordId: number,\n channelId: number,\n catalogId: number\n): Promise => {\n const productAttributes = await getAttributeValuesAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n },\n recordId,\n channelId,\n catalogId\n );\n for (const productAttribute of productAttributes) {\n if (productAttribute.Name === 'Brand') {\n return productAttribute.TextValue;\n }\n }\n return;\n};\n\nconst action = async (input: ProductPageSummaryInput, context: IActionContext): Promise => {\n const { config, productId, apiSettings } = input;\n let simpleProductsData: SimpleProduct[] | undefined;\n try {\n simpleProductsData = ArrayExtensions.validValues(\n await getByIdsAsync(\n {\n callerContext: context,\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\n },\n apiSettings.channelId,\n [productId],\n null,\n input.catalogId ?? 0\n )\n );\n } catch {\n // Do nothing, if there's an error we fall back to values defined from config\n }\n if (ArrayExtensions.hasElements(simpleProductsData)) {\n const simpleProductData = simpleProductsData[0];\n let productUrl: string | undefined;\n try {\n productUrl = getProductUrlSync(simpleProductData, context);\n const canonicalDomain = context.requestContext.canonicalDomain;\n if (productUrl && canonicalDomain) {\n productUrl = `https://${canonicalDomain}${productUrl}`.toLocaleLowerCase();\n productUrl = removeDomainQspFromUrl(productUrl, context.requestContext);\n } else {\n productUrl = undefined;\n }\n } catch {\n productUrl = undefined;\n }\n let productBrand: string | undefined;\n try {\n productBrand = await getProductBrand(context, productId, apiSettings.channelId, input.catalogId ?? 0);\n } catch {\n productBrand = undefined;\n }\n return {\n title: simpleProductData.Name,\n description: simpleProductData.Description,\n sharingImageUrl: generateImageUrl(simpleProductData.PrimaryImageUrl, apiSettings),\n canonicalUrl: productUrl,\n faviconUrl: config && config.faviconUrl,\n productId: simpleProductData.RecordId,\n price: simpleProductData.AdjustedPrice,\n productBrand\n };\n\n // If the action fails fallback to values defined from config\n } else if (config) {\n return {\n title: config.title,\n description: config.description,\n sharingImageUrl: config.sharingImage && config.sharingImage.src,\n faviconUrl: config && config.faviconUrl\n };\n }\n return {};\n};\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce-modules/page-summary/product-page-summary',\n action: >action,\n input: createInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { HtmlHeadInclude, IAny, IGeneric } from '@msdyn365-commerce/core';\nimport * as React from 'react';\n\nimport { IProductPageSummaryData } from './product-page-summary.data';\nimport { IProductPageSummaryProps } from './product-page-summary.props.autogenerated';\n\n/**\n *\n * ProductPageSummary component.\n * @extends {React.PureComponent}\n */\nclass ProductPageSummary extends React.PureComponent> {\n public render(): JSX.Element {\n if (this.props.data.productPageSummary.result === undefined) {\n throw new Error('PageSummaryData input to page-summary is undefined. Unable to generate page-summary');\n }\n let {\n data: {\n productPageSummary: {\n result: { title, description, keywords, sharingImageUrl, faviconUrl }\n }\n }\n } = this.props;\n\n const {\n config,\n context,\n data: {\n productPageSummary: {\n result: { canonicalUrl, productId, productBrand, price }\n }\n }\n } = this.props;\n\n // Product SEO metadata specific information - non-overridable\n const productName = title;\n const productDescription = description;\n const productImageUrl = sharingImageUrl;\n\n // Override values coming from data action if config values are provided\n title = config.title || title;\n description = config.description || description;\n keywords = config.keywords || keywords;\n sharingImageUrl = (config.sharingImage && config.sharingImage.src) || sharingImageUrl;\n faviconUrl = config.faviconUrl || faviconUrl;\n\n // Construct page title with suffix and prefix if provided from app settings\n const pageTitle = this._constructPageTitle(title, context && context.request && context.request.app);\n return (\n <>\n \n {pageTitle && {pageTitle}}\n {description && }\n {keywords && }\n {canonicalUrl && }\n {faviconUrl && }\n \n {this._renderProductMetadata(\n productName,\n productDescription,\n productImageUrl,\n canonicalUrl,\n productId,\n price,\n context.request.channel?.Currency,\n productBrand\n )}\n {!config.disableOgTags && this._renderOgTags(pageTitle, description, sharingImageUrl)}\n {!config.disableTwitterTags && this._renderTwitterTags(pageTitle, description, sharingImageUrl)}\n \n );\n }\n\n /**\n * Renders the facebook and other social media specific metadata tags.\n *\n * @param title Page title.\n * @param description Product description.\n * @param sharingImageUrl Primary product image url.\n */\n private _renderOgTags(title: string | undefined, description: string | undefined, sharingImageUrl: string | undefined): JSX.Element {\n return (\n \n {title && }\n {description && }\n {sharingImageUrl && }\n \n \n );\n }\n\n /**\n * Constructs and renders the JSON-LD tag used to output product specific metadata used by search engine crawlers.\n *\n * @param productName Product name.\n * @param description Product description.\n * @param sharingImageUrl Primary product image url.\n * @param canonicalUrl Product canonical url.\n * @param productId Master product id.\n * @param price Proudct price.\n * @param currencyCode Current channel currency code.\n * @param productBrand Product brand.\n */\n private _renderProductMetadata(\n productName: string | undefined,\n description: string | undefined,\n sharingImageUrl: string | undefined,\n canonicalUrl: string | undefined,\n productId: number | undefined,\n price: number | undefined,\n currencyCode: string | undefined,\n productBrand: string | undefined\n ): JSX.Element {\n // Construct the JSON-LD data that contains the product metadata information used by search enginge crawlers\n const productMetaData = JSON.stringify({\n '@context': 'http://schema.org',\n '@type': 'Product',\n name: productName,\n description,\n image: sharingImageUrl,\n sku: productId,\n brand: {\n '@type': 'Brand',\n name: productBrand\n },\n offers: {\n '@type': 'Offer',\n url: canonicalUrl,\n priceCurrency: currencyCode,\n price\n }\n });\n return (\n \n {/* eslint-disable-next-line react/no-danger -- Implementation is a copy.*/}\n