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C1CT,EAAiBC,GAGrB,CACI,MAAMA,EAAa,2DACnBJ,EAAQE,YAAYE,GAAcQ,EAAQ,KAC1CT,EAAiBC,GAGrB,CACI,MAAMA,EAAa,2DACnBJ,EAAQE,YAAYE,GAAcQ,EAAQ,KAC1CT,EAAiBC,GAIzBS,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAab,QAAOc,EAAAA,EAAA,GACpBF,OAAOC,aAAab,SAAW,IAC/BD,EAAQC,SAGXY,OAAOC,aAAaE,mBAAqB,GACzCH,OAAOC,aAAaE,mBAA8B,UAACD,EAAA,GAC5Cf,EAAQE,iCC/EvBe,EAAOC,QAAUC,2BCAjBF,EAAOC,QAAUE","sources":["webpack://henrys-ecommerce/./src/actions/get-mfr-code.action.ts?e84d","webpack://henrys-ecommerce/./src/actions/get-product-promotions.action.ts?ea24","webpack://henrys-ecommerce/./src/common/utilities/createCanonicalUrl.ts?7ccf","webpack://henrys-ecommerce/./src/modules/category-page-summary/category-page-summary.action.ts?ff83","webpack://henrys-ecommerce/./src/modules/default-page-summary/default-page-summary.action.ts?c630","webpack://henrys-ecommerce/./src/modules/product-page-summary/product-page-summary.action.ts?e077","webpack://henrys-ecommerce/./lib/__local__/module-registration.js?8a42","webpack://henrys-ecommerce/external var \"React\"?0d3b","webpack://henrys-ecommerce/external var \"ReactDOM\"?853b"],"sourcesContent":["/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { getMfrCodeAsync } from './DataActionExtension.g';\r\nimport { IMfrCodeClass } from './DataServiceEntities.g';\r\n// @ts-ignore\r\nimport { getSelectedProductIdFromActionInput } from '@msdyn365-commerce-modules/retail-actions/dist/lib/utilities/utils';\r\n/**\r\n * GetMfrCode Input Action\r\n */\r\nexport class GetMfrCodeInput implements Msdyn365.IActionInput {\r\n public readonly productId: number;\r\n constructor(productId: number) {\r\n this.productId = productId;\r\n }\r\n\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `${this.productId}`;\r\n public getCacheObjectType = () => 'HEI-MfrCode';\r\n public dataCacheType = (): Msdyn365.CacheType => 'application';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IGetMfrCodeData {\r\n text: string;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n const productId = getSelectedProductIdFromActionInput(args);\r\n return new GetMfrCodeInput(+productId);\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function action(input: GetMfrCodeInput, ctx: Msdyn365.IActionContext): Promise {\r\n const response = await getMfrCodeAsync({ callerContext: ctx }, input.productId);\r\n return response;\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n // TODO: Give your data action a unique id\r\n id: 'GetMfrCode',\r\n input: createInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\r\n});\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { getSelectedProductIdFromActionInput } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { retailAction } from '@msdyn365-commerce/retail-proxy';\r\nimport { IProductPromotion } from './DataServiceEntities.g';\r\nimport { getProductPromotionsInput } from './DataActionExtension.g';\r\n\r\n/**\r\n * GetProductPromotions Input Action\r\n */\r\nexport class GetProductPromotionsInput implements Msdyn365.IActionInput {\r\n public readonly recordId: number;\r\n public readonly distinctProductVariantId: number;\r\n\r\n constructor(recordId: number, distinctProductVariantId: number) {\r\n this.recordId = recordId;\r\n this.distinctProductVariantId = distinctProductVariantId;\r\n }\r\n\r\n public getCacheKey = () => `${this.recordId}`;\r\n public getCacheObjectType = () => 'HEI-ProductPromotions';\r\n //public dataCacheType = (): Msdyn365.CacheType => 'application';\r\n public dataCacheType = (): Msdyn365.CacheType => 'none';\r\n}\r\n\r\nconst createInput = (context: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n const productId = getSelectedProductIdFromActionInput(context);\r\n if (productId) {\r\n return new GetProductPromotionsInput(+productId, +productId);\r\n } else {\r\n throw new Error('Unable to create GetProductInfoInput, no productId found on module config or query');\r\n }\r\n};\r\n\r\nasync function action(input: GetProductPromotionsInput, ctx: Msdyn365.IActionContext): Promise {\r\n var productPromotionsInput = getProductPromotionsInput({ Paging: { Top: 5 } }, input.recordId, input.distinctProductVariantId);\r\n return retailAction(productPromotionsInput, ctx);\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n id: 'hei-get-product-promotions',\r\n input: createInput\r\n // isBatched: true\r\n});\r\n","import { IActionContext } from '@msdyn365-commerce/core';\r\n\r\nexport const createCanonicalUrl = (context: IActionContext, paths: string[], page: string) => {\r\n const canonicalDomain = context.requestContext.canonicalDomain;\r\n const sitePath = context.requestContext.sitePath ?? '';\r\n\r\n const url = `https://${canonicalDomain}${sitePath}/${paths\r\n .map(p => toSlug(p))\r\n .filter(s => s.length > 0)\r\n .join('/')}/${page}`;\r\n return url;\r\n};\r\n\r\nconst toSlug = (text: string) => {\r\n const slug = text\r\n .toLowerCase()\r\n .replace(/[^A-Za-z\\u00C0-\\u017F0-9]/g, '-')\r\n .replace(/--+/g, '-')\r\n .replace(/^-/, '')\r\n .replace(/-$/, '');\r\n\r\n return slug;\r\n};\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\n/* eslint-disable no-duplicate-imports */\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n getFriendlyName,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICreateActionContext,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport {\r\n ArrayExtensions,\r\n buildCacheKeyWithUrlTokens,\r\n CategoriesInput,\r\n CurrentCategoryInput,\r\n getCategoriesHierarchy\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { ICategoryPageSummaryConfig } from './category-page-summary.props.autogenerated';\r\nimport { IDefaultPageSummaryConfig } from '@msdyn365-commerce-modules/page-summary';\r\nimport { IPageSummaryData } from '@msdyn365-commerce-modules/page-summary';\r\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { createCanonicalUrl } from '../../common/utilities/createCanonicalUrl';\r\n\r\n/**\r\n * Category Page Summary Input\r\n */\r\nexport class CategoryPageSummaryInput implements IActionInput {\r\n public requestContext: IRequestContext;\r\n\r\n public config: ICategoryPageSummaryConfig | IDefaultPageSummaryConfig;\r\n\r\n constructor(config: ICategoryPageSummaryConfig | IDefaultPageSummaryConfig, requestContext: IRequestContext) {\r\n this.config = config || {};\r\n this.requestContext = requestContext;\r\n }\r\n\r\n public getCacheObjectType = (): string => 'CategoryPageSummary';\r\n\r\n public getCacheKey = (): string =>\r\n `${buildCacheKeyWithUrlTokens(`CategoryPageSummary-${this.requestContext.locale}`, this.requestContext)}-${this.requestContext\r\n .locale ?? ''}`;\r\n\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\n\r\nconst createGetCurrentCategoryInput = (\r\n inputData: IActionContext,\r\n config?: ICategoryPageSummaryConfig | IDefaultPageSummaryConfig\r\n): CurrentCategoryInput => {\r\n if (inputData && inputData.requestContext) {\r\n let includeRootCategory: boolean | undefined;\r\n if (config) {\r\n includeRootCategory = (config as ICategoryPageSummaryConfig).includeRootCategory;\r\n }\r\n return new CurrentCategoryInput(inputData.requestContext, includeRootCategory);\r\n }\r\n\r\n throw new Error('Please specify categoryId query string in request.');\r\n};\r\n\r\nconst action = async (input: CategoryPageSummaryInput, context: IActionContext): Promise => {\r\n const { config } = input;\r\n let categoryHierarchy: CategoryHierarchy[] | null = null;\r\n try {\r\n const getCurrentCategoryInput = createGetCurrentCategoryInput(context, input.config);\r\n const fullCategoryHierarchy = await getCategoriesHierarchy(new CategoriesInput(context.requestContext, true, 1000), context);\r\n categoryHierarchy = findCategoryHierarchy(fullCategoryHierarchy, getCurrentCategoryInput.categoryId!);\r\n } catch {\r\n // Do nothing, if the action fails fallback to values defined in data\r\n }\r\n if (ArrayExtensions.hasElements(categoryHierarchy)) {\r\n const currentCategory = categoryHierarchy[0];\r\n\r\n const locale = context.requestContext.locale;\r\n let names = categoryHierarchy.map(c => getFriendlyName(locale, c.NameTranslations) ?? '').reverse();\r\n\r\n if (locale === 'fr-CA') {\r\n names = ['catégories', ...names];\r\n } else {\r\n names = ['categories', ...names];\r\n }\r\n\r\n let canonicalUrl = createCanonicalUrl(context, names, `${currentCategory.RecordId}.c`);\r\n\r\n const page = context.requestContext.url.requestUrl.searchParams?.get('page');\r\n if (page) {\r\n canonicalUrl = `${canonicalUrl}?page=${page}`;\r\n }\r\n\r\n const title = currentCategory.ExtensionProperties?.find(ep => ep.Key === 'l10nKeyword')?.Value?.StringValue ?? currentCategory.Name;\r\n\r\n return {\r\n title: `${title} | Henry\\'s`,\r\n description: currentCategory.ExtensionProperties?.find(ep => ep.Key === 'l10nDesc')?.Value?.StringValue,\r\n // keywords: currentCategory.ExtensionProperties?.find(ep => ep.Key === 'l10nKeyword')?.Value?.StringValue,\r\n sharingImageUrl: currentCategory.OfflineImage,\r\n canonicalUrl,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n\r\n // If the action fails fallback to values defined from data\r\n } else if (config) {\r\n return {\r\n title: config.title,\r\n sharingImageUrl: config.sharingImage && config.sharingImage.src,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n }\r\n return {};\r\n};\r\n\r\n/**\r\n * Finds the given category in the list of categories and returns an array with the info on where it's located.\r\n * @param categories - Categories list to search from.\r\n * @param categoryId - The category id to find.\r\n * @returns A list of categories starting from the given category id, ending up the root parent.\r\n */\r\nconst findCategoryHierarchy = (categories: CategoryHierarchy[], categoryId: number): CategoryHierarchy[] | null => {\r\n for (const category of categories) {\r\n if (category.RecordId === categoryId) {\r\n return [category];\r\n }\r\n\r\n if (ArrayExtensions.hasElements(category.Children)) {\r\n const innerCategoryHierarchy = findCategoryHierarchy(category.Children, categoryId);\r\n if (ArrayExtensions.hasElements(innerCategoryHierarchy)) {\r\n innerCategoryHierarchy.push(category);\r\n return innerCategoryHierarchy;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n};\r\n\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/page-summary/category-page-summary',\r\n action: >action,\r\n input: (args: ICreateActionContext) => {\r\n return new CategoryPageSummaryInput(args.config, args.requestContext);\r\n }\r\n});\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\n/* eslint-disable no-duplicate-imports */\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICreateActionContext,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport { buildCacheKeyWithUrlTokens, removeDomainQspFromUrl } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { IDefaultPageSummaryConfig } from './default-page-summary.props.autogenerated';\r\n\r\nexport interface IPageSummaryData {\r\n title?: string;\r\n description?: string;\r\n keywords?: string;\r\n sharingImageUrl?: string;\r\n canonicalUrl?: string;\r\n faviconUrl?: string;\r\n}\r\n\r\n/**\r\n * Page Summary Input\r\n */\r\nexport class PageSummaryInput implements IActionInput {\r\n public requestContext: IRequestContext;\r\n\r\n public config: IDefaultPageSummaryConfig;\r\n\r\n constructor(config: IDefaultPageSummaryConfig, requestContext: IRequestContext) {\r\n this.config = config || {};\r\n this.requestContext = requestContext;\r\n }\r\n\r\n public getCacheObjectType = (): string => 'PageSummary';\r\n\r\n public getCacheKey = (): string => `${buildCacheKeyWithUrlTokens('PageSummary', this.requestContext)}-${this.config.title}`;\r\n\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\n\r\nconst action = async (input: PageSummaryInput, context: IActionContext): Promise => {\r\n const { config } = input;\r\n return {\r\n title: config && config.title,\r\n description: config && config.description,\r\n keywords: config && config.keywords,\r\n sharingImageUrl: config && config.sharingImage && config.sharingImage.src,\r\n canonicalUrl:\r\n context.requestContext && context.requestContext.canonicalUrl\r\n ? removeDomainQspFromUrl(context.requestContext.canonicalUrl, context.requestContext)\r\n : undefined,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n};\r\n\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/page-summary/default-page-summary',\r\n action: >action,\r\n input: (args: ICreateActionContext) => {\r\n return new PageSummaryInput(args.config, args.requestContext);\r\n }\r\n});\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\n/* eslint-disable no-duplicate-imports */\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICommerceApiSettings,\r\n ICreateActionContext\r\n} from '@msdyn365-commerce/core';\r\nimport { getAttributeValuesAsync, getByIdAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport {\r\n buildCacheKey,\r\n generateImageUrl,\r\n getProductUrlSync,\r\n getSelectedProductIdFromActionInput\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { IPageSummaryData } from '@msdyn365-commerce-modules/page-summary';\r\nimport { IProductPageSummaryConfig } from './product-page-summary.props.autogenerated';\r\n\r\n/**\r\n * Product Page Summary Input\r\n */\r\nexport class ProductPageSummaryInput implements IActionInput {\r\n public apiSettings: ICommerceApiSettings;\r\n\r\n public config: IProductPageSummaryConfig;\r\n\r\n public productId: number;\r\n\r\n public locale: string;\r\n\r\n constructor(config: IProductPageSummaryConfig, apiSettings: ICommerceApiSettings, productId: number, locale: string) {\r\n this.config = config || {};\r\n this.apiSettings = apiSettings;\r\n this.productId = productId;\r\n this.locale = locale;\r\n }\r\n\r\n public getCacheObjectType = (): string => 'ProductPageSummary';\r\n\r\n public getCacheKey = (): string =>\r\n `${buildCacheKey('ProductPageSummary', this.apiSettings)}-${this.config.title}-${this.productId}-${this.locale}`;\r\n\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\nexport interface IProductPageSummary extends IPageSummaryData {\r\n price?: number;\r\n productId?: number;\r\n productBrand?: string;\r\n}\r\n\r\nconst createInput = (args: ICreateActionContext) => {\r\n const productId = getSelectedProductIdFromActionInput(args);\r\n\r\n if (productId) {\r\n return new ProductPageSummaryInput(\r\n args.config,\r\n args.requestContext.apiSettings,\r\n +productId,\r\n args.requestContext.locale\r\n );\r\n }\r\n throw new Error('Unable to create ProductPageSummaryAction input, no productId found on module config or query');\r\n};\r\n\r\n// Checks product attributes for the presence of brand attribute to extract the brand name for product metadata\r\nconst getProductBrand = async (\r\n context: IActionContext,\r\n recordId: number,\r\n channelId: number,\r\n catalogId: number\r\n): Promise => {\r\n const productAttributes = await getAttributeValuesAsync(\r\n { callerContext: context, queryResultSettings: {} },\r\n recordId,\r\n channelId,\r\n catalogId\r\n );\r\n\r\n for (const productAttribute of productAttributes) {\r\n if (productAttribute.Name === 'Brand') {\r\n return productAttribute.TextValue;\r\n }\r\n }\r\n return;\r\n};\r\n\r\nconst action = async (input: ProductPageSummaryInput, context: IActionContext): Promise => {\r\n const { config, productId, apiSettings } = input;\r\n let simpleProductData;\r\n try {\r\n simpleProductData = await getByIdAsync({ callerContext: context }, productId, apiSettings.channelId);\r\n } catch {\r\n // Do nothing, if there's an error we fall back to values defined from config\r\n }\r\n if (simpleProductData) {\r\n let productUrl: string | undefined;\r\n try {\r\n productUrl = getProductUrlSync(simpleProductData, context);\r\n const canonicalDomain = context.requestContext.canonicalDomain;\r\n if (productUrl && canonicalDomain) {\r\n productUrl = `https://${canonicalDomain}${productUrl}`.toLocaleLowerCase();\r\n } else {\r\n productUrl = undefined;\r\n }\r\n } catch {\r\n productUrl = undefined;\r\n }\r\n\r\n let productBrand = simpleProductData?.ExtensionProperties?.find(ep => ep.Key === 'Brand')?.Value?.StringValue;\r\n if (!productBrand) {\r\n try {\r\n productBrand = await getProductBrand(context, productId, apiSettings.channelId, apiSettings.catalogId);\r\n } catch {\r\n productBrand = undefined;\r\n }\r\n }\r\n\r\n return {\r\n title: simpleProductData.Name,\r\n description: simpleProductData.Description,\r\n sharingImageUrl: generateImageUrl(simpleProductData.PrimaryImageUrl, apiSettings),\r\n canonicalUrl: productUrl,\r\n faviconUrl: config && config.faviconUrl,\r\n productId: simpleProductData.RecordId,\r\n price: simpleProductData.AdjustedPrice,\r\n productBrand\r\n };\r\n\r\n // If the action fails fallback to values defined from config\r\n } else if (config) {\r\n return {\r\n title: config.title,\r\n description: config.description,\r\n sharingImageUrl: config.sharingImage && config.sharingImage.src,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n }\r\n return {};\r\n};\r\n\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/page-summary/product-page-summary',\r\n action: >action,\r\n input: createInput\r\n});\r\n","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 { \n const actionPath = 'actions/get-mfr-code.action';\n binding.dataActions[actionPath] = require('partner/actions/get-mfr-code.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'actions/get-product-promotions.action';\n binding.dataActions[actionPath] = require('partner/actions/get-product-promotions.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'modules/category-page-summary/category-page-summary.action';\n binding.dataActions[actionPath] = require('partner/modules/category-page-summary/category-page-summary.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'modules/default-page-summary/default-page-summary.action';\n binding.dataActions[actionPath] = require('partner/modules/default-page-summary/default-page-summary.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'modules/product-page-summary/product-page-summary.action';\n binding.dataActions[actionPath] = require('partner/modules/product-page-summary/product-page-summary.action');\n registerActionId(actionPath);\n }\n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.packageDataActions = {};\n window.__bindings__.packageDataActions['__local__'] = {\n ...binding.dataActions\n };","module.exports = React;","module.exports = ReactDOM;"],"names":["GetMfrCodeInput","constructor","productId","getCacheKey","this","getCacheObjectType","dataCacheType","Msdyn365","action","async","input","ctx","getMfrCodeAsync","callerContext","id","args","getSelectedProductIdFromActionInput","GetProductPromotionsInput","recordId","distinctProductVariantId","productPromotionsInput","getProductPromotionsInput","Paging","Top","retailAction","context","Error","createCanonicalUrl","paths","page","_context$requestConte","requestContext","canonicalDomain","sitePath","map","p","toSlug","filter","s","length","join","text","toLowerCase","replace","CategoryPageSummaryInput","config","_this$requestContext$","buildCacheKeyWithUrlTokens","locale","findCategoryHierarchy","categories","categoryId","category","RecordId","ArrayExtensions","hasElements","Children","innerCategoryHierarchy","push","createObservableDataAction","categoryHierarchy","getCurrentCategoryInput","createGetCurrentCategoryInput","inputData","includeRootCategory","CurrentCategoryInput","fullCategoryHierarchy","getCategoriesHierarchy","CategoriesInput","_unused","_currentCategory$Exte","_currentCategory$Exte2","_currentCategory$Exte3","currentCategory","names","c","_getFriendlyName","getFriendlyName","NameTranslations","reverse","canonicalUrl","url","requestUrl","searchParams","get","title","ExtensionProperties","find","ep","Key","Value","StringValue","Name","description","sharingImageUrl","OfflineImage","faviconUrl","sharingImage","src","PageSummaryInput","keywords","removeDomainQspFromUrl","undefined","ProductPageSummaryInput","apiSettings","buildCacheKey","simpleProductData","getByIdAsync","channelId","_simpleProductData","productUrl","getProductUrlSync","toLocaleLowerCase","_unused2","productBrand","catalogId","productAttributes","getAttributeValuesAsync","queryResultSettings","productAttribute","TextValue","getProductBrand","_unused3","Description","generateImageUrl","PrimaryImageUrl","price","AdjustedPrice","binding","modules","dataActions","registerActionId","actionPath","default","prototype","Object","keys","forEach","exportName","Action","require","window","__bindings__","_objectSpread","packageDataActions","module","exports","React","ReactDOM"],"sourceRoot":""}