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,EAAI,EAAQ,IACZC,EAAO,EAAQ,IACfC,EAAY,EAAQ,IACpBC,EAA6B,EAAQ,KACrCC,EAAU,EAAQ,KAClBC,EAAU,EAAQ,KAKtBL,EAAE,CAAEM,OAAQ,UAAWC,MAAM,EAAMC,OAJO,EAAQ,MAIgC,CAChFvL,WAAY,SAAoBwL,GAC9B,IAAIC,EAAItT,KACJuT,EAAaR,EAA2BS,EAAEF,GAC1C1S,EAAU2S,EAAW3S,QACrB6S,EAASF,EAAWE,OACpB7C,EAASoC,GAAQ,WACnB,IAAIU,EAAiBZ,EAAUQ,EAAE1S,SAC7B+S,EAAS,GACTC,EAAU,EACVC,EAAY,EAChBZ,EAAQI,GAAU,SAAUS,GAC1B,IAAIC,EAAQH,IACRI,GAAgB,EACpBH,IACAhB,EAAKa,EAAgBJ,EAAGQ,GAASjT,MAAK,SAAUwG,GAC1C2M,IACJA,GAAgB,EAChBL,EAAOI,GAAS,CAAEpH,OAAQ,YAAatF,MAAOA,KAC5CwM,GAAajT,EAAQ+S,OACtB,SAAUlS,GACPuS,IACJA,GAAgB,EAChBL,EAAOI,GAAS,CAAEpH,OAAQ,WAAYsH,OAAQxS,KAC5CoS,GAAajT,EAAQ+S,YAGzBE,GAAajT,EAAQ+S,MAGzB,OADI/C,EAAOnP,OAAOgS,EAAO7C,EAAOvJ,OACzBkM,EAAWO,0BCxCtB,EAAQ,yBCDRI,EAAOC,QAAUvF,2BCAjBsF,EAAOC,QAAUC","sources":["webpack://mattressfirm/./src/Utilities/constants.ts?8bdf","webpack://mattressfirm/./src/data-actions/get-attributes-for-selected-variant.ts?4859","webpack://mattressfirm/./src/data-actions/get-selected-variant.override.action.ts?02a3","webpack://mattressfirm/./src/data-actions/utilities/utils.ts?7452","webpack://mattressfirm/./src/modules/mfrm-buybox/list-page-state-buybox.ts?792c","webpack://mattressfirm/./src/modules/mfrm-product-page-summary/mfrm-product-page-summary.action.ts?7926","webpack://mattressfirm/./src/modules/mfrm-utag-data/mfrm-utag-data.tsx?9fcd","webpack://mattressfirm/./src/modules/mfrm-utag-data/mfrm-utag-data.props.autogenerated.ts?8d3d","webpack://mattressfirm/./src/modules/mfrm-utag-data/mfrm-utag-data.view.tsx?60c1","webpack://mattressfirm/./lib/mfrm-utag-data/module-registration.js?085c","webpack://mattressfirm/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/es.promise.all-settled.js?ad9a","webpack://mattressfirm/./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/esnext.promise.all-settled.js?b32a","webpack://mattressfirm/external var \"React\"?0d3b","webpack://mattressfirm/external var \"ReactDOM\"?853b"],"sourcesContent":["export const variantQueryStringName = 'variantid';","import {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICreateActionContext,\r\n IGeneric\r\n} from '@msdyn365-commerce/core';\r\nimport { AttributeValue, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\n\r\nimport { getSelectedProductIdFromActionInput, getSelectedVariant, SelectedVariantInput } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { getAttributeValuesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\n\r\n/**\r\n * Chains getting the SelectedVariant with GetActivePrice\r\n */\r\nexport class AttributesForSelectedVariantInput implements IActionInput {\r\n public productId: number;\r\n public channelId: number;\r\n public catalogId: number;\r\n public selectedProduct: SimpleProduct | undefined;\r\n\r\n constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, catalogId?: number) {\r\n this.productId = productId;\r\n this.channelId = channelId;\r\n this.selectedProduct = selectedProduct;\r\n this.catalogId = catalogId || 0;\r\n }\r\n\r\n public getCacheKey = () => `AttributesForSelectedVariant`;\r\n public getCacheObjectType = () => 'ProductAttributeValue';\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\nexport const createAttributesForSelectedVariantInput = (\r\n inputData: ICreateActionContext>\r\n): AttributesForSelectedVariantInput => {\r\n const productId = getSelectedProductIdFromActionInput(inputData);\r\n if (productId) {\r\n return new AttributesForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId);\r\n } else {\r\n throw new Error('Unable to create PriceForSelectedVariantInput, no productId found on module config or query');\r\n }\r\n};\r\n\r\n/**\r\n * Calls the Retail API a get a list of dimension values for a given product.\r\n */\r\nexport async function getAttributesForSelectedVariantAction(\r\n input: AttributesForSelectedVariantInput,\r\n ctx: IActionContext\r\n): Promise {\r\n // @ts-ignore: Promise vs. ObservablePromise typing conflict\r\n return Promise.resolve()\r\n .then(() => {\r\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\r\n\r\n if (!activeProduct) {\r\n const selectedVariantInput = new SelectedVariantInput(input.productId, input.channelId);\r\n\r\n return getSelectedVariant(selectedVariantInput, ctx);\r\n }\r\n\r\n return activeProduct;\r\n })\r\n .then((productResult: SimpleProduct | null) => {\r\n const activeProduct: SimpleProduct | undefined = productResult;\r\n\r\n if (activeProduct) {\r\n return getAttributeValuesAsync(\r\n { callerContext: ctx, queryResultSettings: {} },\r\n activeProduct.RecordId,\r\n input.channelId,\r\n input.catalogId\r\n );\r\n }\r\n\r\n return null;\r\n })\r\n .then((attributeValues: AttributeValue[] | null) => {\r\n const resultArray = attributeValues;\r\n if (resultArray) {\r\n return resultArray;\r\n }\r\n\r\n return [];\r\n })\r\n .catch((error: Error) => {\r\n ctx.trace(error.message);\r\n throw new Error(`[getPriceForSelectedVariantAction]Error executing action ${error.message}`);\r\n });\r\n}\r\n\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/product-info/get-attributes-for-selected-variant',\r\n action: >getAttributesForSelectedVariantAction,\r\n input: createAttributesForSelectedVariantInput\r\n});\r\n","import { generateProductImageUrl, getSelectedProductIdFromActionInput } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { ProductDimensionFull } from '@msdyn365-commerce/commerce-entities';\r\nimport MsDyn365, {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICreateActionContext,\r\n IGeneric\r\n} from '@msdyn365-commerce/core';\r\nimport {\r\n getByIdAsync,\r\n getDimensionValuesAsync,\r\n getVariantsByDimensionValuesAsync,\r\n searchByCriteriaAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport {\r\n AttributeValue,\r\n CommerceProperty,\r\n ProductDimension,\r\n ProductDimensionValue,\r\n ProductSearchCriteria,\r\n SimpleProduct\r\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { variantQueryStringName } from '../Utilities/constants';\r\nimport getAttributesForSelectedVariant, { AttributesForSelectedVariantInput } from './get-attributes-for-selected-variant';\r\nimport { getQueryParamsFromQueryByName } from './utilities/utils';\r\n// import { AttributesForSelectedVariantInput, getAttributesForSelectedVariantAction } from '@msdyn365-commerce-modules/product-specification/src/dataActions/get-attributes-for-selected-variant';\r\n\r\nexport interface IDefaultDimension {\r\n dimensionType: number;\r\n dimensionValue: string;\r\n}\r\n\r\nlet shouldDefaultSet: boolean = true;\r\n/**\r\n * Get selected variant action input class\r\n */\r\nexport class SelectedVariantInput implements IActionInput {\r\n public productId: number;\r\n public channelId: number;\r\n public matchingDimensionValues: ProductDimension[];\r\n\r\n constructor(productId: number, channelId: number, matchingDimensionValues?: ProductDimension[]) {\r\n this.productId = productId;\r\n this.channelId = channelId;\r\n this.matchingDimensionValues = matchingDimensionValues || [];\r\n }\r\n\r\n public getCacheKey = () => `SelectedVariant`;\r\n public getCacheObjectType = () => 'SimpleProduct';\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\n/**\r\n * CreateInput method for the getSelectedVariant data action\r\n * @param inputData The input data passed to the createInput method\r\n */\r\nconst createInput = (inputData: ICreateActionContext>): SelectedVariantInput => {\r\n const productId = getSelectedProductIdFromActionInput(inputData);\r\n if (productId) {\r\n return new SelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId, []);\r\n } else {\r\n throw new Error('Unable to create SelectedVariantInput, no productId found on module config or query');\r\n }\r\n};\r\n\r\n/**\r\n * Action method for the getSelectedVariant data aciton\r\n * @param input The action input class\r\n * @param ctx The action context\r\n */\r\n// tslint:disable-next-line:cyclomatic-complexity max-func-body-length\r\nasync function getSelectedVariantAction(input: SelectedVariantInput, ctx: IActionContext): Promise {\r\n //TODO: what is the use case for `matchingDimensionValues` to ever have values?\r\n // the `createInput` always passes an empty array to the input constructor. Where\r\n // else / how else is this getting called that would pass a populated array?\r\n const matchingDimensionValues = input.matchingDimensionValues ?? [];\r\n const variantId = ctx.requestContext.app.config.queryBasedVariantSelection\r\n ? getQueryParamsFromQueryByName(\r\n MsDyn365.isBrowser\r\n ? new URL(window.location.href.toString())\r\n : ctx.requestContext.url.requestUrl,\r\n variantQueryStringName)\r\n : undefined;\r\n let getByIdResponse;\r\n try {\r\n getByIdResponse = await getByIdAsync(\r\n { callerContext: ctx },\r\n matchingDimensionValues?.length === 0 && variantId && !Number.isNaN(Number(variantId))\r\n ? Number(variantId)\r\n : await getDefaultVariantId(input.productId, ctx) ?? input.productId,\r\n input.channelId);\r\n } catch (error) {\r\n console.log('[getByIdAsync Error calling API]', error);\r\n }\r\n // bellow cond will only be 1 if we have invalid variantid\r\n if (!getByIdResponse && variantId) {\r\n getByIdResponse = await getByIdAsync(\r\n { callerContext: ctx },\r\n input.productId,\r\n input.channelId);\r\n }\r\n\r\n // below condition will only be true if we have masterid in url and query\r\n if (getByIdResponse && !getByIdResponse?.MasterProductId) {\r\n getByIdResponse = await getByIdAsync(\r\n { callerContext: ctx },\r\n await getDefaultVariantId(getByIdResponse.RecordId, ctx) ?? input.productId,\r\n input.channelId);\r\n }\r\n\r\n const baseProduct: SimpleProduct = Array.isArray(getByIdResponse)\r\n ? getByIdResponse[0]\r\n : getByIdResponse;\r\n // Need to dereference this before editing it. Otherwise we might not\r\n // properly get the mobx events because if things aren't properly observable\r\n // they won't fire when you set them, and then if you don't deref the value in\r\n // the cache will match the value when you try to save it, so it won't detect any\r\n // changes there either\r\n let product: SimpleProduct | null = { ...baseProduct };\r\n const originalDimensionLength = product.Dimensions ? product.Dimensions.length : 0;\r\n\r\n if (product && product.RecordId > 0) {\r\n let baseProductHadUnmatchedDimension: boolean = false;\r\n\r\n product.Dimensions?.forEach(dimension => {\r\n const matchedTargetDimension = matchingDimensionValues.find(\r\n targetDimension => targetDimension.DimensionTypeValue === dimension.DimensionTypeValue\r\n );\r\n\r\n if (matchedTargetDimension) {\r\n dimension.DimensionValue = matchedTargetDimension?.DimensionValue;\r\n } else {\r\n baseProductHadUnmatchedDimension = true;\r\n }\r\n });\r\n\r\n const actionInput = new AttributesForSelectedVariantInput(\r\n product.RecordId,\r\n input.channelId,\r\n product\r\n );\r\n const productSpecificationData: AttributeValue[] = await getAttributesForSelectedVariant(actionInput, ctx)\r\n .catch((error: Error) => {\r\n error;\r\n }) || [];\r\n\r\n // check if default variant is given for product\r\n // const productSpecificationData: AttributeValue[] = await getAttributeValuesAsync({ callerContext: ctx, queryResultSettings: {} }, product.RecordId, input.channelId, 0);\r\n const defaultValues = productSpecificationData.find(data => data.Name?.toLowerCase().trim() === 'default variants')?.TextValue;\r\n const parsedDefaultData = defaultValues\r\n ? parseDefaultDimensionsData(defaultValues)\r\n : undefined;\r\n const productPreSelectionDimensions: ProductDimensionFull[] = [];\r\n\r\n //new - literally 10x faster!\r\n if (!product.MasterProductId) {\r\n // const now = (new Date()).valueOf()\r\n // console.time(`productPreSelectionDimensions${now}`);\r\n const asyncCalls = product.Dimensions?.map(async dimension => {\r\n const dimensionValues = await getDimensionValuesAsync(\r\n { callerContext: ctx, queryResultSettings: {} },\r\n product?.MasterProductId\r\n ? product.MasterProductId\r\n // @ts-ignore: nested in `if(product && product.RecordId > 0)`\r\n : product.RecordId,\r\n input.channelId,\r\n dimension.DimensionTypeValue,\r\n matchingDimensionValues.filter(value => value.DimensionTypeValue !== dimension.DimensionTypeValue),\r\n null\r\n );\r\n\r\n // if dimensionValues have a length of exactly one then we need to make\r\n // it as selected dimension for getting variant of the product\r\n if (dimensionValues.length === 1 && shouldDefaultSet) {\r\n dimension.DimensionValue = dimensionValues[0];\r\n } else {\r\n // search through default dimensions to find current dimension\r\n const defaultValueToFind = parsedDefaultData\r\n ?.find(defaultData => defaultData.dimensionType === dimension.DimensionTypeValue)\r\n ?.dimensionValue.toLowerCase()\r\n .trim();\r\n\r\n // look through all dimension values to find the default one\r\n const defaultDimension: ProductDimensionValue | undefined = dimensionValues.find(\r\n availableDimensionValue => availableDimensionValue.Value?.toLowerCase().trim() === defaultValueToFind || availableDimensionValue.DimensionId?.toLowerCase().trim() === defaultValueToFind\r\n );\r\n\r\n if (defaultDimension && shouldDefaultSet) {\r\n dimension.DimensionValue = defaultDimension;\r\n }\r\n }\r\n\r\n const fullDimension: ProductDimensionFull = {\r\n ...dimension,\r\n DimensionValues: dimensionValues\r\n };\r\n\r\n productPreSelectionDimensions.push(fullDimension);\r\n }) || [];\r\n\r\n await Promise.allSettled(asyncCalls);\r\n }\r\n //*/\r\n\r\n // if there is any selection in productPreSelectionDimensions array then get the variant\r\n if (productPreSelectionDimensions.length > 0) {\r\n const mappedDimensions = productPreSelectionDimensions\r\n .filter(dimension => dimension && dimension.DimensionValue)\r\n .map(dimension => {\r\n return {\r\n DimensionTypeValue: dimension.DimensionTypeValue,\r\n DimensionValue: dimension.DimensionValue,\r\n ExtensionProperties: dimension.ExtensionProperties\r\n };\r\n });\r\n //console.log(\"mappedDimensions: \",mappedDimensions)\r\n if (originalDimensionLength > 0 && originalDimensionLength === mappedDimensions.length) {\r\n const variants = await getVariantsByDimensionValuesAsync(\r\n { callerContext: ctx, queryResultSettings: {} },\r\n baseProduct.RecordId,\r\n input.channelId,\r\n mappedDimensions\r\n );\r\n if (variants && variants.length === 1) {\r\n //TODO: why is the `product` variable that has been built up through the rest of the code\r\n // being overwriten in the final steps?\r\n product = variants[0];\r\n }\r\n }\r\n }\r\n else if (productPreSelectionDimensions.length === 0 && !baseProductHadUnmatchedDimension && matchingDimensionValues.length > 0) {\r\n const variants = await getVariantsByDimensionValuesAsync(\r\n { callerContext: ctx, queryResultSettings: {} },\r\n baseProduct.RecordId,\r\n input.channelId,\r\n matchingDimensionValues\r\n );\r\n\r\n if (variants && variants.length > 0) {\r\n //TODO: why is the `product` variable that has been built up through the rest of the code\r\n // being overwriten in the final steps?\r\n product = variants[0];\r\n }\r\n }\r\n else {\r\n //TODO: what should happen here??\r\n //console.log(\"in 'else' for getVariantsByDimensionValuesAsync\")\r\n }\r\n\r\n const newImageUrl = generateProductImageUrl(product, ctx.requestContext.apiSettings);\r\n\r\n if (newImageUrl) {\r\n product.PrimaryImageUrl = newImageUrl;\r\n }\r\n }\r\n\r\n shouldDefaultSet = false;\r\n\r\n return product;\r\n}\r\n\r\nconst parseDefaultDimensionsData = (defaultValue: string): IDefaultDimension[] | undefined => {\r\n try {\r\n const defaultDimensions: IDefaultDimension[] = [];\r\n\r\n const splitDimensionTypes = defaultValue.split(',');\r\n splitDimensionTypes.forEach(dimensionData => {\r\n const [dimensionTypeString, dimensionValue] = dimensionData.split('_');\r\n const dimensionType = parseInt(dimensionTypeString, 10);\r\n defaultDimensions.push({\r\n dimensionType,\r\n dimensionValue\r\n });\r\n });\r\n\r\n return defaultDimensions;\r\n } catch (e) {\r\n console.log(e);\r\n }\r\n\r\n return undefined;\r\n};\r\n\r\nexport const getDefaultVariantId = async (masterId: number, context: IActionContext): Promise => {\r\n const productSearchCriteria: ProductSearchCriteria = {\r\n Ids: [masterId],\r\n Context: {\r\n ChannelId: +context.requestContext.apiSettings.channelId,\r\n CatalogId: +context.requestContext.apiSettings.catalogId\r\n },\r\n IncludeAttributes: true,\r\n SearchCondition: '*'\r\n };\r\n try {\r\n const productSearchResults = await searchByCriteriaAsync(\r\n { callerContext: context },\r\n productSearchCriteria\r\n );\r\n // If the ProductSearchResult API finds the products then populate the product image urls and return\r\n // otherwise if the API does not exist or does not return products proceed to the legacy flows for legacy/backward compatibility reasons\r\n context.telemetry.debug('Product search results returned', JSON.stringify(productSearchResults));\r\n if (productSearchResults.length > 0) {\r\n const defaultVariantId = productSearchResults[0]?.ExtensionProperties && productSearchResults[0]?.ExtensionProperties.find(\r\n (property: CommerceProperty) => property?.Key === \"Unbxd_DefaultVariantID\"\r\n )?.Value?.LongValue;\r\n return !defaultVariantId || defaultVariantId === 0 ? undefined : defaultVariantId;\r\n }\r\n return undefined;\r\n } catch (e) {\r\n // In case of an error fall back to legacy flow\r\n context.telemetry.error(`Error while getting productSearchResult: ${e}`);\r\n return undefined;\r\n }\r\n};\r\n\r\n/**\r\n * The complete getSelectedVariant data action\r\n */\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-selected-variant',\r\n action: >getSelectedVariantAction,\r\n input: createInput\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\nimport { IAny, ICommerceApiSettings, ICoreContext, ICreateActionContext, IGeneric, IRequestContext } from '@msdyn365-commerce/core';\r\nimport {\r\n AsyncResult, CartLine, CommerceListLine, ProductDimension,\r\n ProductDimensionType, ProductSearchResult, SimpleProduct\r\n} from '@msdyn365-commerce/retail-proxy';\r\n\r\nimport { ProductDetailsCriteria, InventoryLevels, ArrayExtensions } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { variantQueryStringName } from '../../Utilities/constants';\r\n// import { parseSearchData } from '@msdyn365-commerce-modules/retail-actions/src/utilities/input-data-parser';\r\n\r\nexport const wrapInResolvedAsyncResult = (input: T | null | undefined): AsyncResult => {\r\n return >{\r\n status: 'SUCCESS',\r\n result: input,\r\n metadata: {}\r\n };\r\n};\r\n\r\nexport const wrapInRejectedAsyncResult = (input: T | null | undefined): AsyncResult => {\r\n return >{\r\n status: 'FAILED',\r\n result: input,\r\n metadata: {}\r\n };\r\n};\r\n\r\n\r\n/**\r\n * Utility function to extract the active productId in the following priority:\r\n * First query param (productId), then UrlToken (itemId), then module config.\r\n * @param inputData - The Action Input data.\r\n * @returns Productid or undefined.\r\n */\r\nexport const getSelectedProductIdFromActionInput = (inputData: ICreateActionContext>): string | undefined => {\r\n const context = inputData.requestContext;\r\n const variantId = context.app.config.queryBasedVariantSelection ? getQueryParamsFromQueryByName(context.url.requestUrl, variantQueryStringName) : undefined;\r\n\r\n if (variantId) {\r\n return variantId;\r\n } else if (context.query?.productId) {\r\n return context.query.productId;\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Exsiting code.\r\n } else if (context.urlTokens && inputData.requestContext.urlTokens.itemId && inputData.requestContext.urlTokens.pageType === 'Product') {\r\n return context.urlTokens.itemId;\r\n } else if (inputData && inputData.config && inputData.config.productId) {\r\n return inputData.config.productId;\r\n }\r\n return undefined;\r\n};\r\n\r\nexport const getQueryParamsFromQueryByName = (inputUrl: URL, queryParamName: string) => {\r\n const urlWithIgnoredCase = new URL(inputUrl.toString().toLocaleLowerCase());\r\n const urlParameters = urlWithIgnoredCase.searchParams;\r\n const value = urlParameters.get(queryParamName.trim().toLocaleLowerCase());\r\n if (!value || Number.isNaN(Number(value))) {\r\n return undefined;\r\n }\r\n return value;\r\n};\r\n/**\r\n * Generates a Image URL based on data return from retail server.\r\n * @param imageUrl The image url returned by Retail Server.\r\n * @param ctx The request context.\r\n * @param apiSettings\r\n */\r\nexport const generateImageUrl = (imageUrl: string | undefined, apiSettings: ICommerceApiSettings): string | undefined => {\r\n if (imageUrl) {\r\n // Images hosted in CMS include schema\r\n if (imageUrl.startsWith('http')) {\r\n return imageUrl;\r\n }\r\n\r\n // Images hosted in Retail Server must be encoded and joined with the base image url\r\n return apiSettings.baseImageUrl + encodeURIComponent(imageUrl);\r\n }\r\n\r\n // D365Commerce.telemetry.warning(`Unable to generate a proper Image URL for Product: ${product.RecordId}`);\r\n return undefined;\r\n\r\n};\r\n\r\n/**\r\n * Represents app configuration for dimensions.\r\n */\r\nexport interface IDimensionsConfig {\r\n dimensionsAsSwatchType?: DimensionTypes[];\r\n dimensionsInProductCard?: DimensionTypes[];\r\n inventoryLevel?: InventoryLevels;\r\n dimensionToPreSelectInProductCard?: DimensionTypes;\r\n}\r\n\r\n/**\r\n * Represents app configuration for dimensions.\r\n */\r\nexport interface IDimensionsApp {\r\n config: IDimensionsConfig;\r\n}\r\n\r\n/**\r\n * Represents product dimension types.\r\n */\r\nexport enum DimensionTypes {\r\n none = 'none',\r\n color = 'color',\r\n configuration = 'configuration',\r\n size = 'size',\r\n style = 'style'\r\n}\r\n\r\n/**\r\n * Defines display configuration types.\r\n */\r\nexport enum DimensionSwatchDisplayTypes {\r\n default = 'default',\r\n productCard = 'productCard'\r\n}\r\n\r\n/**\r\n * Checks if rendering the particular dimensions is allowed.\r\n * @param dimensionType - Dimension to be displayed.\r\n * @param context - Core application context.\r\n * @param displayType - The swatch location, the component from which it comes from.\r\n * @returns Updates the state with new product page url.\r\n */\r\nexport const checkIfShouldDisplayAsSwatch = (\r\n dimensionType: DimensionTypes,\r\n context: ICoreContext,\r\n displayType: DimensionSwatchDisplayTypes = DimensionSwatchDisplayTypes.default): boolean => {\r\n\r\n // Additional checks for the product card since it has a separate config setting.\r\n if (displayType === DimensionSwatchDisplayTypes.productCard) {\r\n const dimensionsToDisplayOnProductCard = context.app.config.dimensionsInProductCard;\r\n if (!ArrayExtensions.hasElements(dimensionsToDisplayOnProductCard) ||\r\n dimensionsToDisplayOnProductCard.includes(DimensionTypes.none) ||\r\n !dimensionsToDisplayOnProductCard.includes(dimensionType)) {\r\n return false;\r\n }\r\n }\r\n\r\n const dimensionsToDisplayAsSwatch = context.app.config.dimensionsAsSwatchType;\r\n return ArrayExtensions.hasElements(dimensionsToDisplayAsSwatch) &&\r\n !dimensionsToDisplayAsSwatch.includes(DimensionTypes.none) &&\r\n dimensionsToDisplayAsSwatch.includes(dimensionType);\r\n};\r\n\r\n/**\r\n * Generates an image URL for a swatch.\r\n * @param imageUrl - The image url returned by Retail Server.\r\n * @param apiSettings - The request context.\r\n * @returns Full image url.\r\n */\r\nexport const generateSwatchImageUrl = (imageUrl: string, apiSettings: ICommerceApiSettings): string => {\r\n if (imageUrl.startsWith('http')) {\r\n return imageUrl;\r\n }\r\n\r\n return apiSettings.baseImageUrl + encodeURIComponent(imageUrl);\r\n};\r\n\r\n/**\r\n * Generates a Image URL for a product based on data return from retail server.\r\n * @param product The Product returned by Retail Server.\r\n * @param ctx The request context.\r\n * @param apiSettings\r\n */\r\nexport const generateProductImageUrl = (\r\n product: SimpleProduct | ProductSearchResult,\r\n apiSettings: ICommerceApiSettings\r\n): string | undefined => {\r\n return generateImageUrl(product.PrimaryImageUrl, apiSettings);\r\n};\r\n\r\n/**\r\n * Creates a CartLine object from the passed data.\r\n * @param product The product.\r\n * @param quantity The quantity.\r\n * @param catalogId The catalog.\r\n */\r\nexport const buildCartLine = (product: SimpleProduct, quantity?: number, catalogId?: number): CartLine => {\r\n return {\r\n CatalogId: catalogId || 0,\r\n Description: product.Description,\r\n\r\n // TODO: Investigate this value and what it represents\r\n EntryMethodTypeValue: 3,\r\n ItemId: product.ItemId,\r\n ProductId: product.RecordId,\r\n Quantity: quantity || 1,\r\n TrackingId: '',\r\n UnitOfMeasureSymbol: product.DefaultUnitOfMeasure\r\n };\r\n};\r\n\r\n/**\r\n * Creates a CommerceListLine (also know as WishlistLine) object from the passed data.\r\n * @param productId The RecordId of the Product to be added.\r\n * @param customerId The account number of the customer.\r\n * @param wishlistId The Id of the commerce list.\r\n */\r\nexport const buildWishlistLine = (productId: number, customerId: string, wishlistId: number): CommerceListLine => {\r\n return {\r\n CommerceListId: wishlistId,\r\n ProductId: productId,\r\n CustomerId: customerId\r\n };\r\n};\r\n\r\n/**\r\n * Utility function to prepare the product details criteria before getting full product:\r\n * @param inputData The Action Input data\r\n */\r\nexport const getProductDetailsCriteriaFromActionInput = (inputData: ICreateActionContext>): ProductDetailsCriteria => {\r\n if (inputData && inputData.config) {\r\n return {\r\n getPrice: !inputData.config.hidePrice,\r\n getRating: !inputData.config.hideRating\r\n };\r\n }\r\n return {\r\n getPrice: true,\r\n getRating: true\r\n };\r\n};\r\n\r\n/**\r\n * Transforms search text into the expected 'search terms' format, expected by refiner APIs.\r\n * @param searchText Free-form text used for searching for products or categories of products.\r\n */\r\nexport const ensureSearchTextIsFormedProperly = (searchText: string): string => {\r\n const prefix = searchText.startsWith('\\'') ? '' : '\\'';\r\n const suffix = searchText.endsWith('\\'') ? '' : '\\'';\r\n return `${prefix}${searchText}${suffix}`;\r\n};\r\n\r\nexport const ensureSafeSearchText = (searchText: string): string => {\r\n return searchText?.replace(/[^\\d\\sA-Za-z]+/g, '');\r\n};\r\n\r\nexport const buildCacheKey = (base: string, apiSettings: ICommerceApiSettings, locale?: string): string => {\r\n return `${base}-chanId:${apiSettings.channelId}-catId:${apiSettings.catalogId}${locale ? `-${locale}` : ''}`;\r\n};\r\n\r\nexport const buildCacheKeyWithUrlTokens = (base: string, requestContext: IRequestContext): string => {\r\n const urlTokens = requestContext.urlTokens;\r\n const defaultCacheKey = buildCacheKey(base, requestContext.apiSettings, requestContext.locale);\r\n return urlTokens ? `${defaultCacheKey}-${urlTokens.itemId}-${urlTokens.recordId}-${urlTokens.pageType}` : defaultCacheKey;\r\n};\r\n\r\n/**\r\n * Generates a key from set of arguments as inputs.\r\n *\r\n * @param args Argument list of pivots to generate key from.\r\n * @param handler Handler function for null/undefined values.\r\n */\r\n\r\ntype TKeyTypes = string | number | boolean | null | undefined;\r\ninterface IGenerateKeyOptions {\r\n separator?: string;\r\n handler?(input: null | undefined): string;\r\n}\r\nexport const generateKey = (args: TKeyTypes[], options?: IGenerateKeyOptions): string => {\r\n const { handler, separator }: IGenerateKeyOptions = { ...{ separator: '-', handler: undefined }, ...(options || {}) };\r\n return args\r\n .map(arg => {\r\n if (arg === null || arg === undefined) {\r\n if (handler) {\r\n return handler(arg);\r\n }\r\n }\r\n return arg;\r\n })\r\n .join(separator);\r\n};\r\n\r\n/**\r\n * Gets the fall back image url for a variant image.\r\n * @param itemId Item id of a product.\r\n * @param apiSettings Api setting from request context.\r\n */\r\nexport const getFallbackImageUrl = (itemId: string | undefined, apiSettings: ICommerceApiSettings): string | undefined => {\r\n if (!itemId) {\r\n return '';\r\n }\r\n\r\n const parsedItemId = itemId.trim().split(' ')[0];\r\n\r\n const productUrl = `Products/${parsedItemId}_000_001.png`;\r\n return generateImageUrl(productUrl, apiSettings);\r\n};\r\n\r\n/**\r\n * Converts retail proxy product dimension type to display dimension type.\r\n * @param productDimensionType - Product dimension type from retail proxy.\r\n * @returns Local dimension type.\r\n */\r\nexport const convertProductDimensionTypeToDimensionTypes = (productDimensionType: ProductDimensionType): DimensionTypes => {\r\n switch (productDimensionType) {\r\n case ProductDimensionType.Color:\r\n return DimensionTypes.color;\r\n case ProductDimensionType.Configuration:\r\n return DimensionTypes.configuration;\r\n case ProductDimensionType.Size:\r\n return DimensionTypes.size;\r\n case ProductDimensionType.Style:\r\n return DimensionTypes.style;\r\n default:\r\n return DimensionTypes.none;\r\n }\r\n};\r\n\r\n/**\r\n * Converts display dimension type to retail proxy product dimension type.\r\n * @param dimensionType - Local dimension type.\r\n * @returns Product dimension type from retail proxy.\r\n */\r\nexport const convertDimensionTypeToProductDimensionType = (dimensionType: DimensionTypes): ProductDimensionType => {\r\n switch (dimensionType) {\r\n case DimensionTypes.color:\r\n return ProductDimensionType.Color;\r\n case DimensionTypes.configuration:\r\n return ProductDimensionType.Configuration;\r\n case DimensionTypes.size:\r\n return ProductDimensionType.Size;\r\n case DimensionTypes.style:\r\n return ProductDimensionType.Style;\r\n default:\r\n return ProductDimensionType.None;\r\n }\r\n};\r\n\r\n/**\r\n * Sets dimensions to url.\r\n * @param inputUrl - Url to update.\r\n * @param productDimensions - Dimensions to set.\r\n */\r\nexport const setDimensionValuesToQuery = (inputUrl: URL, productDimensions: ProductDimension[]): void => {\r\n for (const dimension of productDimensions) {\r\n inputUrl.searchParams.set(\r\n convertProductDimensionTypeToDimensionTypes(dimension.DimensionTypeValue), dimension.DimensionValue?.Value ?? '');\r\n }\r\n\r\n window.history?.replaceState(window.history.state, '', inputUrl.toString()?.replace(inputUrl.host, window.location.host));\r\n};\r\n\r\n/**\r\n * Retrieves dimension value stored in url.\r\n * @param urlParameters - Url parameters.\r\n * @param productDimensionType - The dimension type to retrieve.\r\n * @returns Product dimension item.\r\n */\r\nconst parseDimensionFromUrl = (urlParameters: URLSearchParams, productDimensionType: ProductDimensionType): ProductDimension | undefined => {\r\n const localDimensionType = convertProductDimensionTypeToDimensionTypes(productDimensionType);\r\n const value = urlParameters.get(localDimensionType);\r\n if (!value) {\r\n return undefined;\r\n }\r\n return {\r\n DimensionTypeValue: productDimensionType,\r\n DimensionValue: {\r\n RecordId: 0,\r\n Value: value\r\n }\r\n };\r\n};\r\n\r\n/**\r\n * Retrieves all dimensions from URL.\r\n * @param urlParameters - Url parameters.\r\n * @returns Product dimensions stored in url.\r\n */\r\nconst parseDimensionsFromUrl = (urlParameters: URLSearchParams): ProductDimension[] => {\r\n const dimensionsToParse: ProductDimensionType[] = [\r\n ProductDimensionType.Color,\r\n ProductDimensionType.Configuration,\r\n ProductDimensionType.Size,\r\n ProductDimensionType.Style\r\n ];\r\n const parsedDimensions = dimensionsToParse.map(dimension => parseDimensionFromUrl(urlParameters, dimension));\r\n return ArrayExtensions.validValues(parsedDimensions);\r\n};\r\n\r\n/**\r\n * Utility function to extract the dimension values from input url querystring.\r\n * @param inputUrl - The request url.\r\n * @returns The selected dimension values.\r\n */\r\nexport const getDimensionValuesFromQuery = (inputUrl: URL): ProductDimension[] => {\r\n const urlWithIgnoredCase = new URL(inputUrl.toString().toLocaleLowerCase());\r\n const urlParameters = urlWithIgnoredCase.searchParams;\r\n const dimensions: ProductDimension[] = parseDimensionsFromUrl(urlParameters);\r\n return dimensions;\r\n};\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICreateActionContext,\r\n IGeneric\r\n} from '@msdyn365-commerce/core';\r\n/* tslint:disable: no-duplicate-imports */\r\nimport { observable } from 'mobx';\r\n\r\n\r\n/**\r\n * ListPageState class\r\n */\r\nexport class ListPageStateBuyBox {\r\n @observable public variantId: string | undefined = '';\r\n @observable public itemId: string | undefined = '';\r\n @observable public name: string | undefined = '';\r\n @observable public categoryName: string | undefined = '';\r\n @observable public productBrandName: string | undefined = '';\r\n @observable public price: string | undefined = '';\r\n @observable public productUrl: string | undefined = '';\r\n @observable public productImageUrl: string | undefined = '';\r\n @observable public productSize: string | undefined = '';\r\n}\r\n\r\n/**\r\n * ListPageStateInput - action input\r\n */\r\nexport class ListPageStateBuyBoxInput implements IActionInput {\r\n public getCacheKey = () => `ListPageStateBuyBox`;\r\n public getCacheObjectType = () => 'ListPageStateBuyBox';\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\nexport async function listPageStateAction(\r\n input: ListPageStateBuyBoxInput,\r\n ctx: IActionContext\r\n): Promise {\r\n return new ListPageStateBuyBox();\r\n}\r\n\r\n/**\r\n * create new input for create action\r\n */\r\nexport const createListPageInput = (\r\n inputData: ICreateActionContext>\r\n): IActionInput => {\r\n return new ListPageStateBuyBoxInput();\r\n};\r\n\r\n/**\r\n * ListPageState - create action\r\n */\r\nexport default createObservableDataAction({\r\n action: >listPageStateAction,\r\n input: createListPageInput\r\n});\r\n","/* eslint-disable no-duplicate-imports */\r\nimport { IPageSummaryData } from '@msdyn365-commerce-modules/page-summary';\r\nimport { buildCacheKey, generateImageUrl, getProductUrlSync, getSelectedProductIdFromActionInput, QueryResultSettingsProxy, removeDomainQspFromUrl } from '@msdyn365-commerce-modules/retail-actions';\r\nimport MsDyn365, {\r\n CacheType, createObservableDataAction, IAction, IActionContext, IActionInput,\r\n ICommerceApiSettings, ICreateActionContext, IRequestContext, getCatalogId\r\n} from '@msdyn365-commerce/core';\r\nimport { AttributeValue, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport { getAttributeValuesAsync, getByIdsAsync, getActivePricesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport getHtmlParserValue from '../../Utilities/get-html-parser-value';\r\nimport { IMfrmProductPageSummaryConfig } from './mfrm-product-page-summary.props.autogenerated';\r\nimport getSelectedVariant, { SelectedVariantInput } from '../../data-actions/get-selected-variant.override.action';\r\nimport { getQueryParamsFromQueryByName } from '../../data-actions/utilities/utils';\r\nimport { variantQueryStringName } from '../../Utilities/constants';\r\n//import { getAllVariantsForProduct, BuyboxGetDimensionVariantAvailabilityInput } from '../../data-actions/buybox-get-all-variants-list';\r\n\r\n/** Product Page Summary Input */\r\nexport class ProductPageSummaryInput implements IActionInput {\r\n public apiSettings: ICommerceApiSettings;\r\n public config: IMfrmProductPageSummaryConfig;\r\n public productId: number;\r\n public catalogId?: number;\r\n\r\n public constructor(config: IMfrmProductPageSummaryConfig, apiSettings: ICommerceApiSettings, productId: number, requestContext?: IRequestContext) {\r\n this.config = config || {};\r\n this.apiSettings = apiSettings;\r\n this.productId = productId;\r\n\r\n if (requestContext) {\r\n this.catalogId = getCatalogId(requestContext);\r\n }\r\n }\r\n\r\n public getCacheObjectType = (): string => 'ProductPageSummary';\r\n public getCacheKey = (): string => `${buildCacheKey('ProductPageSummary', this.apiSettings)}-${this.config.title}-${this.productId}-${this.catalogId ?? 0}`;\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\n//TODO: move to .data.ts\r\nexport interface IProductPageSummary extends IPageSummaryData {\r\n price?: number;\r\n variantId?: number;\r\n masterProductId?: number;\r\n productBrand?: string;\r\n priceValidUntil?: string;\r\n itemCondition?: string;\r\n isOutOfStockArray?: { key: string, value: string }[];\r\n gtinArray?: { key: string, value: string }[];\r\n}\r\n\r\n//NOTE: needed for `export default createObservableDataAction({})`\r\nconst createInput = (args: ICreateActionContext) => {\r\n const productId = getSelectedProductIdFromActionInput(args);\r\n\r\n if (productId) {\r\n return new ProductPageSummaryInput(args.config, args.requestContext.apiSettings, +productId, args.requestContext);\r\n } else {\r\n throw new Error('Unable to create ProductPageSummaryAction input, no productId found on module config or query');\r\n }\r\n\r\n};\r\n\r\n//TODO: move in a common utility file\r\nfunction _getAttributeByName(attributeValues: AttributeValue[] | undefined, keyValue: string) {\r\n return attributeValues && attributeValues.find(currAttribute => currAttribute.Name && currAttribute.Name.toLowerCase().trim() === keyValue.toLowerCase().trim());\r\n}\r\n\r\n//TODO: move to utility file\r\nfunction parseAttributeTextArray(text: string | string[] | undefined): { key: string, value: string }[] {\r\n const rtn: { key: string, value: string }[] = [];\r\n\r\n if (text !== undefined) {\r\n if (!(text instanceof Array)) {\r\n text = [text];\r\n }\r\n\r\n text.forEach(str => {\r\n str?.replace(/[\\[\\]\"\\s]/g, '').split(',').forEach(it => {\r\n const keyVal = it.split('|');\r\n rtn.push({\r\n key: keyVal[0],\r\n value: keyVal[1]\r\n });\r\n });\r\n });\r\n }\r\n\r\n return rtn;\r\n}\r\n\r\nconst action = async (input: ProductPageSummaryInput, context: IActionContext): Promise => {\r\n const {\r\n config,\r\n productId,\r\n apiSettings,\r\n apiSettings: {\r\n channelId\r\n }\r\n } = input;\r\n const url = MsDyn365.isBrowser\r\n ? new URL(window.location.href.toString())\r\n : context.requestContext.url.requestUrl;\r\n //TODO: move get variantId from url logic into utility file and use in `createInput` methode\r\n let variantId = Number(getQueryParamsFromQueryByName(url, variantQueryStringName)) || undefined;\r\n if (!variantId) {\r\n try {\r\n const input = new SelectedVariantInput(productId, channelId);\r\n const selectedVariant = await getSelectedVariant(input, context) || undefined;\r\n variantId = selectedVariant?.RecordId;\r\n if (!variantId) {\r\n throw new Error(`Error - Had to fallback to MasterProductId for SEO Schema at ${url}`);\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n variantId = productId;\r\n }\r\n }\r\n\r\n const byIdAsync = productId && getByIdsAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n },\r\n apiSettings.channelId,\r\n [productId],\r\n null,\r\n input.catalogId ?? 0\r\n ).catch(e => {\r\n // Do nothing, if there's an error we fall back to values defined from config\r\n console.error(\"Error while calling getByIdAsync: \", e);\r\n });\r\n const attributeValuesAsync = getAttributeValuesAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n },\r\n productId,\r\n apiSettings.channelId,\r\n apiSettings.catalogId\r\n ).catch(e => {\r\n // Do nothing, if error fall back to config values\r\n console.error(\"Error while calling getAttributeValuesAsync: \", e);\r\n });\r\n const activePricesAsync = getActivePricesAsync(\r\n { callerContext: context },\r\n {\r\n ChannelId: context.requestContext.apiSettings.channelId,\r\n CatalogId: context.requestContext.apiSettings.catalogId\r\n },\r\n [+variantId],\r\n new Date(),\r\n null,\r\n [],\r\n true\r\n ).catch(e => {\r\n // Do nothing, if error fall back to config values\r\n console.error(\"Error while calling getActivePricesAsync: \", e);\r\n });\r\n //wait for all async to resolve\r\n const asynValues = await Promise.allSettled([\r\n byIdAsync,\r\n attributeValuesAsync,\r\n activePricesAsync\r\n ]);\r\n\r\n //results from async calls\r\n const simpleProductsData = asynValues[0].status === \"fulfilled\" ? asynValues[0].value || undefined : undefined;\r\n const productAttributes = asynValues[1].status === \"fulfilled\" ? asynValues[1].value || undefined : undefined;\r\n const productActivePrices = asynValues[2].status === \"fulfilled\" ? asynValues[2].value || undefined : undefined;\r\n const productActivePrice = productActivePrices && productActivePrices[0];\r\n const simpleProductData: SimpleProduct | undefined = simpleProductsData && simpleProductsData[0];\r\n const itemCondition = 'NewCondition';\r\n\r\n const pageTitleAttribute = _getAttributeByName(productAttributes, 'pageTitle')?.TextValue;\r\n const pageTitle = pageTitleAttribute ? getHtmlParserValue(pageTitleAttribute) : '';\r\n\r\n const pageDescriptionAttribute = _getAttributeByName(productAttributes, 'pageDescription')?.TextValue;\r\n const pageDescription = pageDescriptionAttribute ? getHtmlParserValue(pageDescriptionAttribute) : '';\r\n\r\n const priceValidUntil = productActivePrice?.DiscountLines && productActivePrice.DiscountLines[0]?.ValidTo?.toISOString();\r\n\r\n const isOutOfStockArray = parseAttributeTextArray(\r\n ['EcomAllVariantOOSInfo1',\r\n 'EcomAllVariantOOSInfo2',\r\n 'EcomAllVariantOOSInfo3'\r\n ].map(attributeName => {\r\n return _getAttributeByName(productAttributes, attributeName)?.TextValue || '';\r\n })\r\n );\r\n\r\n const gtinArray = parseAttributeTextArray(\r\n ['EcomAllVariantWithGTIN1',\r\n 'EcomAllVariantWithGTIN2',\r\n 'EcomAllVariantWithGTIN3',\r\n 'EcomAllVariantWithGTIN4',\r\n 'EcomAllVariantWithGTIN5',\r\n 'EcomAllVariantWithGTIN6',\r\n 'EcomAllVariantWithGTIN7',\r\n 'EcomAllVariantWithGTIN8',\r\n 'EcomAllVariantWithGTIN9'\r\n ].map(attributeName => {\r\n return _getAttributeByName(productAttributes, attributeName)?.TextValue || '';\r\n })\r\n );\r\n\r\n if (simpleProductData) {\r\n let productUrl: string | undefined;\r\n let productBrand: string | undefined;\r\n\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 productUrl = removeDomainQspFromUrl(productUrl, context.requestContext);\r\n } else {\r\n productUrl = undefined;\r\n }\r\n } catch (e) {\r\n productUrl = undefined;\r\n }\r\n\r\n if (productAttributes) {\r\n productBrand = _getAttributeByName(productAttributes, 'Brand')?.TextValue; //getProductBrand(productAttributes);\r\n } else {\r\n productBrand = undefined;\r\n }\r\n\r\n return {\r\n title: pageTitle || simpleProductData.Name,\r\n description: pageDescription || simpleProductData.Description,\r\n sharingImageUrl: generateImageUrl(simpleProductData.PrimaryImageUrl, apiSettings),\r\n canonicalUrl: `${productUrl}?variantid=${variantId}`,\r\n faviconUrl: config && config.faviconUrl,\r\n variantId: variantId,\r\n masterProductId: simpleProductData.RecordId,\r\n price: productActivePrice?.CustomerContextualPrice,\r\n productBrand: productBrand,\r\n itemCondition: itemCondition,\r\n isOutOfStockArray: isOutOfStockArray,\r\n priceValidUntil: priceValidUntil,\r\n gtinArray: gtinArray\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: pageTitle || config.title,\r\n description: pageDescription || config.description,\r\n sharingImageUrl: config.sharingImage && config.sharingImage.src,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n } else {\r\n return {};\r\n }\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 * 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 React from 'react';\r\n\r\nimport { IMfrmUtagDataProps } from './mfrm-utag-data.props.autogenerated';\r\n\r\nexport interface IMfrmUtagDataViewProps extends IMfrmUtagDataProps<{}> {}\r\n\r\n/**\r\n *\r\n * MfrmUtagData component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass MfrmUtagData extends React.PureComponent> {\r\n public render(): JSX.Element | null {\r\n return this.props.renderView(this.props);\r\n }\r\n}\r\n\r\nexport default MfrmUtagData;\r\n","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. See License.txt in the project root for license information.\r\n * IMfrmUtagData scriptModule Interface Properties\r\n * THIS FILE IS AUTO-GENERATED - MANUAL MODIFICATIONS WILL BE LOST\r\n */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\nexport const enum pageType {\r\n home = 'home',\r\n product = 'product',\r\n category = 'category',\r\n search = 'search',\r\n content = 'content',\r\n shopping_guides = 'shopping_guides',\r\n brand = 'brand',\r\n holiday = 'holiday',\r\n sale = 'sale',\r\n checkout = 'checkout',\r\n confirmation = 'confirmation',\r\n cart = 'cart',\r\n orderconfirmation = 'orderconfirmation',\r\n error = 'error'\r\n}\r\n\r\nexport const enum pageContextType {\r\n product = 'product',\r\n search = 'search',\r\n content = 'content',\r\n storefront = 'storefront',\r\n cart = 'cart',\r\n sale = 'sale',\r\n checkout = 'checkout',\r\n orderconfirmation = 'orderconfirmation',\r\n error = 'error',\r\n compare = 'compare',\r\n myaccount = 'myaccount',\r\n haulaway = 'haulaway',\r\n orderhistory = 'orderhistory'\r\n}\r\n\r\nexport interface IMfrmUtagDataConfig {\r\n pageType?: pageType;\r\n pageContextType?: pageContextType;\r\n}\r\n\r\nexport interface IMfrmUtagDataProps extends Msdyn365.IModule {\r\n config: IMfrmUtagDataConfig;\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 { isNonceEnabled, SDK_FRAGMENT_NAME } from '@msdyn365-commerce/core-internal';\r\nimport * as React from 'react';\r\nimport { IMfrmUtagDataViewProps } from './mfrm-utag-data';\r\nimport { IMfrmUtagDataData } from './mfrm-utag-data.data';\r\nimport { IMfrmUtagDataProps, pageType as PageTypeOptions } from './mfrm-utag-data.props.autogenerated';\r\n\r\nexport default (props: IMfrmUtagDataProps) => {\r\n const source = getPageScript(props);\r\n const nonceToken = props.context && isNonceEnabled(props.context.request);\r\n const scriptHtml = ``;\r\n\r\n // tslint:disable-next-line: react-no-dangerous-html\r\n return React.createElement(SDK_FRAGMENT_NAME, { key: props.id, dangerouslySetInnerHTML: { __html: scriptHtml } });\r\n};\r\n\r\nconst getPageScript = (props: IMfrmUtagDataProps) => {\r\n // Build an array of utag data.\r\n const utag_extra = ['...utag_data', 'new_site: newSiteCookie'];\r\n\r\n // Append values to utag array.\r\n const pageTypeVars = getPageTypeVars(props);\r\n !!pageTypeVars && utag_extra.push(pageTypeVars);\r\n\r\n const pageContextTypeVars = getPageContextTypeVars(props);\r\n !!pageContextTypeVars && utag_extra.push(pageContextTypeVars);\r\n\r\n const productTypeVars = getProductTypeVars(props);\r\n !!productTypeVars && utag_extra.push(productTypeVars);\r\n\r\n const pageNameVars = getPageNameVars(props);\r\n !!pageNameVars && utag_extra.push(pageNameVars);\r\n\r\n // Merge values using a comma as glue.\r\n return `${getCookieFunction()}utag_data = { ${utag_extra.join(', ')} };`;\r\n};\r\n\r\nconst getPageTypeVars = (props: IMfrmUtagDataViewProps) => {\r\n const { pageType } = props.config;\r\n\r\n if (pageType) {\r\n if (pageType === PageTypeOptions.search) {\r\n return `page_type: 'search', search_term: '${getSearchTerm(props)}'`;\r\n } else {\r\n return `page_type: '${pageType.toLowerCase()}'`;\r\n }\r\n } else {\r\n return '';\r\n }\r\n};\r\n\r\nconst getPageNameVars = (props: IMfrmUtagDataProps) => {\r\n const reqUrl = props.context.request.url.requestUrl.toString()?.split('?')[0];\r\n\r\n var pageNameToReturn = (a : string | undefined) => {\r\n return a?.replace(/'/g, \"\\\\'\");\r\n };\r\n\r\n if (reqUrl.endsWith('.c')) {\r\n return `page_name: '${pageNameToReturn(props.data.categoryPageSummary?.result?.title)}'`;\r\n } else if (reqUrl.endsWith('.p')) {\r\n return `page_name: '${pageNameToReturn(props.data.productPageSummary?.result?.title)}'`;\r\n } else {\r\n return `page_name: '${pageNameToReturn(props.context.request.telemetryPageName)}'`;\r\n }\r\n};\r\n\r\nconst getPageContextTypeVars = (props: IMfrmUtagDataViewProps) => {\r\n const { pageContextType } = props.config;\r\n\r\n if (pageContextType) {\r\n return `page_context_type: '${pageContextType.toLowerCase()}'`;\r\n } else {\r\n return undefined;\r\n }\r\n};\r\n\r\nconst getProductTypeVars = (props: IMfrmUtagDataProps) => {\r\n const pageType = props.config.pageType?.toLocaleLowerCase();\r\n\r\n if (pageType === 'checkout' || pageType === 'cart' || pageType === 'product') {\r\n //product category\r\n const productData = props.data.listPageStateBuyBox?.result;\r\n const productName = productData?.name?.replace(/\\'/g, `'`);\r\n const productCategory = productData?.categoryName?.replace(/\\'/g, `'`);\r\n const productBrand = productData?.productBrandName?.replace(/\\'/g, ``);\r\n if (productData && productData.itemId) {\r\n return `product_id: ['${productData.itemId}'],\r\n product_name: ['${productName}'],\r\n product_category: ['${productCategory}'],\r\n product_discount: ['0.00'],\r\n product_brand: ['${productBrand}'],\r\n product_variant: ['${productData.variantId}'],\r\n product_price: ['${productData.price}'],\r\n product_url:['${productData.productUrl}'],\r\n product_image_url: ['${productData.productImageUrl}'],\r\n product_size:['${productData.productSize}']`;\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n return undefined;\r\n};\r\n\r\nconst getSearchTerm = (props: IMfrmUtagDataViewProps) => {\r\n return props.context.request.query?.q;\r\n};\r\n\r\nconst getCookieFunction = () => {\r\n // Build a cookie value getter in JS. We can't access the cookie data from this module.\r\n // Use the cookie values to set new_site and is_cart_active.\r\n return `\r\n let getCookieValue = (ck) => {\r\n let cookieValue,\r\n cookieKey = ck + '=',\r\n decodedCookie = decodeURIComponent(document.cookie),\r\n ca = decodedCookie.split(';');\r\n\r\n for (let i in ca)\r\n {\r\n // Trim left spaces\r\n let c = ca[i].replace(/^\\\\s+/, '');\r\n if (!!~c.indexOf(cookieKey)) {\r\n cookieValue = c.substring(cookieKey.length, c.length);\r\n }\r\n }\r\n\r\n return cookieValue;\r\n };\r\n\r\n var newSiteCookie = getCookieValue('d365_site') ? 'true' : 'false';\r\n var utag_data = typeof utag_data !== 'undefined' ? utag_data : {};\r\n const checkoutCheck = window.location.pathname.includes('checkout');\r\n const checkoutExpress = window.location.pathname.includes('paypal') || window.location.pathname.includes('applepay');\r\n var newCookies = getCookieValue('mfrm_basket_cookie');\r\n let basketNewObj = newCookies && JSON.parse(newCookies);\r\n\r\n var newCookiesProductUrl = getCookieValue('tealium_cart_products_url');\r\n var basketNewObjUrl = newCookiesProductUrl && JSON.parse(newCookiesProductUrl);\r\n\r\n var newCookiesProductData = getCookieValue('tealium_cart_products_details');\r\n var newCookiesProductDataObj = newCookiesProductData && JSON.parse(newCookiesProductData);\r\n\r\n var newCookiesProductQuantity = getCookieValue('tealium_cart_products_quantity');\r\n var newCookiesProductQuantityObj = newCookiesProductQuantity && JSON.parse(newCookiesProductQuantity);\r\n\r\n var newCookiesExpress = getCookieValue('express_funnel');\r\n var usaEpayErrorCookie = getCookieValue('tealium_usaEpay_error');\r\n var usaEpayErrorCookieObj = usaEpayErrorCookie && JSON.parse(usaEpayErrorCookie);\r\n var isUsaEpay = getCookieValue('is_usa_epay');\r\n var cardType = getCookieValue('temp_card_payment_info_for_order_confirmation')?.split(',')[0];\r\n utag_data.cart_product_id = newCookiesProductDataObj && newCookiesProductDataObj.productIDsArray;\r\n utag_data.cart_product_category = newCookiesProductDataObj && newCookiesProductDataObj.productCatgoryArray;\r\n utag_data.cart_product_name = newCookiesProductDataObj && newCookiesProductDataObj.productNameArray;\r\n utag_data.cart_product_brand = newCookiesProductDataObj && newCookiesProductDataObj.productBrandName;\r\n utag_data.cart_product_quantity = newCookiesProductQuantityObj && newCookiesProductQuantityObj.productQuantity;\r\n utag_data.cart_product_variant = newCookiesProductDataObj && newCookiesProductDataObj.variantRecord;\r\n utag_data.cart_product_size = newCookiesProductDataObj && newCookiesProductDataObj.productSize;\r\n utag_data.cart_product_price = newCookiesProductDataObj && newCookiesProductDataObj.cartProductPriceArray;\r\n utag_data.cart_url = basketNewObjUrl && basketNewObjUrl.cartUrl;\r\n utag_data.cart_product_image_url = basketNewObjUrl && basketNewObjUrl.productImageUrl;\r\n utag_data.cart_product_url = basketNewObjUrl && basketNewObjUrl.productURL;\r\n utag_data.cart_total_quantity = newCookiesProductQuantityObj && newCookiesProductQuantityObj.quantity;\r\n utag_data.cart_subtotal = newCookiesProductQuantityObj && newCookiesProductQuantityObj.subTotal;\r\n utag_data.core_item_flag = newCookiesProductQuantityObj && newCookiesProductQuantityObj.isCoreItem;\r\n utag_data.funnel_type = newCookiesProductQuantityObj && newCookiesProductQuantityObj.funnelType;\r\n\r\n if(checkoutExpress) {\r\n utag_data.funnel_type = newCookiesExpress;\r\n }\r\n\r\n if(checkoutCheck || checkoutExpress) {\r\n utag_data.page_name = 'customer info';\r\n utag_data.product_discount = newCookiesProductDataObj && newCookiesProductDataObj.productDiscountArray;\r\n utag_data.product_brand = newCookiesProductDataObj && newCookiesProductDataObj.productBrandName;\r\n utag_data.product_id = newCookiesProductDataObj && newCookiesProductDataObj.productIDsArray;\r\n utag_data.product_category = newCookiesProductDataObj && newCookiesProductDataObj.productCatgoryArray;\r\n utag_data.product_name = newCookiesProductDataObj && newCookiesProductDataObj.productNameArray;\r\n utag_data.product_quantity = newCookiesProductQuantityObj && newCookiesProductQuantityObj.productQuantity;\r\n utag_data.product_variant = newCookiesProductDataObj && newCookiesProductDataObj.variantRecord;\r\n utag_data.product_size = newCookiesProductDataObj && newCookiesProductDataObj.productSize;\r\n utag_data.product_price = newCookiesProductDataObj && newCookiesProductDataObj.productPriceArray;\r\n utag_data.product_image_url = basketNewObjUrl && basketNewObjUrl.productImageUrl;\r\n utag_data.product_url = basketNewObjUrl && basketNewObjUrl.productURL;\r\n }\r\n\r\n if(isUsaEpay === 'true') {\r\n utag_data.event_category = \"USAePay Errors\",\r\n utag_data.event_action = usaEpayErrorCookieObj && usaEpayErrorCookieObj.errorHeading?.replace(/[,!_-]/g, \"\").replace(/\\b(\\w)/g, (c) => c.toUpperCase());\r\n utag_data.event_label = 'card type: '+ cardType\r\n }\r\n\r\n utag_data.cart_product_image_url_1 = basketNewObjUrl && basketNewObjUrl.productImageUrl[0];\r\n utag_data.cart_product_image_url_2 = basketNewObjUrl && basketNewObjUrl.productImageUrl[1];\r\n utag_data.cart_product_image_url_3 = basketNewObjUrl && basketNewObjUrl.productImageUrl[2];\r\n\r\n utag_data.cart_product_name_1 = newCookiesProductDataObj && newCookiesProductDataObj.productNameArray[0];\r\n utag_data.cart_product_name_2 = newCookiesProductDataObj && newCookiesProductDataObj.productNameArray[1];\r\n utag_data.cart_product_name_3 = newCookiesProductDataObj && newCookiesProductDataObj.productNameArray[2];\r\n\r\n if(!basketNewObj || basketNewObj.cartDataInfo?.length === 0) {\r\n [\r\n 'cart_product_id',\r\n 'cart_product_category',\r\n 'cart_product_name',\r\n 'cart_product_brand',\r\n 'cart_product_price',\r\n 'cart_product_quantity',\r\n 'cart_product_variant',\r\n 'cart_product_size',\r\n 'cart_product_image_url',\r\n 'cart_product_url',\r\n 'cart_total_quantity',\r\n 'cart_subtotal',\r\n 'cart_product_name_1',\r\n 'cart_product_name_2',\r\n 'cart_product_name_3',\r\n 'cart_product_image_url_1',\r\n 'cart_product_image_url_2',\r\n 'cart_product_image_url_3',\r\n 'cart_url',\r\n 'core_item_flag',\r\n 'funnel_type'\r\n ].forEach(e => delete utag_data[e]);\r\n\r\n }\r\n utag_data.is_cart_active = (\r\n (basketCookie) => {\r\n let basketCookieObj = basketCookie && JSON.parse(basketCookie);\r\n if(basketCookieObj) {\r\n return basketCookieObj.cartDataInfo?.length > 0 ? \"true\" : \"false\";\r\n }\r\n\r\n return \"false\";\r\n })(getCookieValue('mfrm_basket_cookie'));\r\n `;\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 (binding.modules['mfrm-utag-data'] = {\n c: () => require('partner/modules/mfrm-utag-data/mfrm-utag-data.tsx'),\n $type: 'scriptModule',\n da: [{name:'categoryPageSummary', path:'modules/mfrm-category-page-summary/mfrm-category-page-summary.action', runOn: 0},{name:'listPageStateBuyBox', path:'modules/mfrm-buybox/list-page-state-buybox', runOn: 0},{name:'productPageSummary', path:'modules/mfrm-product-page-summary/mfrm-product-page-summary.action', runOn: 0}],\n \n iNM: false,\n ns: '__local__',\n n: 'mfrm-utag-data',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/mfrm-utag-data'\n });\n \n\n {\n const sanitizedActionPath = 'modules/mfrm-buybox/list-page-state-buybox';\n let dataAction = require('partner/modules/mfrm-buybox/list-page-state-buybox');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n {\n const sanitizedActionPath = 'modules/mfrm-category-page-summary/mfrm-category-page-summary.action';\n let dataAction = require('partner/modules/mfrm-category-page-summary/mfrm-category-page-summary.action');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n {\n const sanitizedActionPath = 'modules/mfrm-product-page-summary/mfrm-product-page-summary.action';\n let dataAction = require('partner/modules/mfrm-product-page-summary/mfrm-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 export const viewDictionary = {};\n viewDictionary['__local__|__local__|modules|mfrm-utag-data|mfrm-utag-data'] = {\n c: () => require('partner/modules/mfrm-utag-data/mfrm-utag-data.view.tsx'),\n cn: '__local__-__local__-mfrm-utag-data'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\nvar iterate = require('../internals/iterate');\nvar PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');\n\n// `Promise.allSettled` method\n// https://tc39.es/ecma262/#sec-promise.allsettled\n$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {\n allSettled: function allSettled(iterable) {\n var C = this;\n var capability = newPromiseCapabilityModule.f(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var promiseResolve = aCallable(C.resolve);\n var values = [];\n var counter = 0;\n var remaining = 1;\n iterate(iterable, function (promise) {\n var index = counter++;\n var alreadyCalled = false;\n remaining++;\n call(promiseResolve, C, promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = { status: 'fulfilled', value: value };\n --remaining || resolve(values);\n }, function (error) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = { status: 'rejected', reason: error };\n --remaining || resolve(values);\n });\n });\n --remaining || resolve(values);\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n","// TODO: Remove from `core-js@4`\nrequire('../modules/es.promise.all-settled.js');\n","module.exports = React;","module.exports = ReactDOM;"],"names":["variantQueryStringName","AttributesForSelectedVariantInput","constructor","productId","channelId","selectedProduct","catalogId","getCacheKey","getCacheObjectType","dataCacheType","this","createAttributesForSelectedVariantInput","inputData","getSelectedProductIdFromActionInput","requestContext","apiSettings","Error","async","getAttributesForSelectedVariantAction","input","ctx","Promise","resolve","then","activeProduct","selectedVariantInput","SelectedVariantInput","getSelectedVariant","productResult","getAttributeValuesAsync","callerContext","queryResultSettings","RecordId","attributeValues","catch","error","trace","message","createObservableDataAction","id","action","shouldDefaultSet","matchingDimensionValues","parseDefaultDimensionsData","defaultValue","defaultDimensions","split","forEach","dimensionData","dimensionTypeString","dimensionValue","dimensionType","parseInt","push","e","console","log","getDefaultVariantId","masterId","context","productSearchCriteria","Ids","Context","ChannelId","CatalogId","IncludeAttributes","SearchCondition","productSearchResults","searchByCriteriaAsync","telemetry","debug","JSON","stringify","length","defaultVariantId","ExtensionProperties","find","property","Key","Value","LongValue","undefined","variantId","app","config","queryBasedVariantSelection","getQueryParamsFromQueryByName","MsDyn365","URL","window","location","href","toString","url","requestUrl","getByIdResponse","getByIdAsync","Number","isNaN","MasterProductId","baseProduct","Array","isArray","product","originalDimensionLength","Dimensions","baseProductHadUnmatchedDimension","dimension","matchedTargetDimension","targetDimension","DimensionTypeValue","DimensionValue","actionInput","defaultValues","getAttributesForSelectedVariant","data","Name","toLowerCase","trim","TextValue","parsedDefaultData","productPreSelectionDimensions","asyncCalls","map","dimensionValues","getDimensionValuesAsync","filter","value","defaultValueToFind","defaultData","defaultDimension","availableDimensionValue","DimensionId","fullDimension","DimensionValues","allSettled","mappedDimensions","variants","getVariantsByDimensionValuesAsync","newImageUrl","generateProductImageUrl","PrimaryImageUrl","query","urlTokens","itemId","pageType","inputUrl","queryParamName","toLocaleLowerCase","searchParams","get","generateImageUrl","imageUrl","startsWith","baseImageUrl","encodeURIComponent","DimensionTypes","DimensionSwatchDisplayTypes","getFallbackImageUrl","parsedItemId","convertProductDimensionTypeToDimensionTypes","productDimensionType","ProductDimensionType","color","configuration","size","style","none","parseDimensionsFromUrl","urlParameters","parsedDimensions","localDimensionType","parseDimensionFromUrl","ArrayExtensions","getDimensionValuesFromQuery","ListPageStateBuyBox","name","categoryName","productBrandName","price","productUrl","productImageUrl","productSize","__decorate","observable","ListPageStateBuyBoxInput","listPageStateAction","createListPageInput","ProductPageSummaryInput","buildCacheKey","title","getCatalogId","_getAttributeByName","keyValue","currAttribute","parseAttributeTextArray","text","rtn","str","replace","it","keyVal","key","selectedVariant","byIdAsync","getByIdsAsync","QueryResultSettingsProxy","attributeValuesAsync","activePricesAsync","getActivePricesAsync","Date","asynValues","simpleProductsData","status","productAttributes","productActivePrices","productActivePrice","simpleProductData","pageTitleAttribute","pageTitle","getHtmlParserValue","pageDescriptionAttribute","pageDescription","priceValidUntil","DiscountLines","ValidTo","toISOString","isOutOfStockArray","attributeName","gtinArray","productBrand","getProductUrlSync","canonicalDomain","removeDomainQspFromUrl","description","Description","sharingImageUrl","canonicalUrl","faviconUrl","masterProductId","CustomerContextualPrice","itemCondition","sharingImage","src","args","MfrmUtagData","React","render","props","renderView","pageContextType","source","getPageScript","nonceToken","isNonceEnabled","request","scriptHtml","SDK_FRAGMENT_NAME","dangerouslySetInnerHTML","__html","utag_extra","pageTypeVars","getPageTypeVars","pageContextTypeVars","getPageContextTypeVars","productTypeVars","getProductTypeVars","pageNameVars","getPageNameVars","getCookieFunction","join","PageTypeOptions","getSearchTerm","reqUrl","pageNameToReturn","a","endsWith","categoryPageSummary","result","productPageSummary","telemetryPageName","productData","listPageStateBuyBox","productName","productCategory","q","binding","modules","dataActions","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","prototype","RegistrationId","c","require","$type","da","path","runOn","iNM","ns","n","p","pdp","md","__bindings__","viewDictionary","cn","$","call","aCallable","newPromiseCapabilityModule","perform","iterate","target","stat","forced","iterable","C","capability","f","reject","promiseResolve","values","counter","remaining","promise","index","alreadyCalled","reason","module","exports","ReactDOM"],"sourceRoot":""}