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webpack://mattressfirm/./src/Utilities/get-utag-variant-id.ts?ea12","webpack://mattressfirm/./src/Utilities/get-view-port.tsx?4210","webpack://mattressfirm/./src/Utilities/mfrm-buybox-utils.ts?ef8b","webpack://mattressfirm/./src/Utilities/plp-url-utils.ts?728b","webpack://mattressfirm/./src/actions/get-sm-inventory-status.action.ts?cb72","webpack://mattressfirm/./src/actions/TryInStoreDataServiceEntities.g.ts?ea57","webpack://mattressfirm/./src/actions/TryInStoreDataActionExtension.g.ts?c8db","webpack://mattressfirm/./src/actions/get-try-in-store-info.action.ts?dff9","webpack://mattressfirm/./src/data-actions/buybox-get-all-variants-list.ts?6ad4","webpack://mattressfirm/./src/Utilities/get-eyebrow-message.tsx?2bcd","webpack://mattressfirm/./src/modules/mfrm-buybox/common/utilities/error-utilities.ts?bd84","webpack://mattressfirm/./src/modules/mfrm-buybox/common/buybox-components.tsx?bf31","webpack://mattressfirm/./src/modules/mfrm-buybox/components/mfrm-buybox-find-in-store.tsx?97b6","webpack://mattressfirm/./src/modules/mfrm-buybox/mfrm-buybox.tsx?cc50","webpack://mattressfirm/./src/modules/mfrm-store-selector/components/store-selector-location-line-item/date-time-helpers.ts?8535","webpack://mattressfirm/./src/themes/mattressfirm/views/components/addtocart/addtocart.component.tsx?5783"],"sourcesContent":["import { IAny, ICoreContext, IGeneric } from '@msdyn365-commerce/core';\r\nimport { IMFICLDeliveryScheduleParameters } from '../actions/CoreProductDataServiceEntities.g';\r\nimport getATPInventoryStatusAction, { GetATPInventoryStatusInput } from '../actions/get-sm-inventory-status.action';\r\n\r\nconst _getInventoryQuantity = async (\r\n request: IMFICLDeliveryScheduleParameters,\r\n context: ICoreContext>,\r\n isCached?: boolean\r\n) => {\r\n if (request) {\r\n const getATPInventoryStatusInput = new GetATPInventoryStatusInput(request, isCached);\r\n try {\r\n const result = await getATPInventoryStatusAction(getATPInventoryStatusInput, context.actionContext);\r\n if (result) {\r\n return result;\r\n }\r\n } catch (error) {\r\n console.log('Error', error);\r\n }\r\n }\r\n return null;\r\n};\r\n\r\nexport default _getInventoryQuantity;\r\n","import { getCategoryPathsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { IActionContext } from '@msdyn365-commerce/core-internal';\r\nexport const getUtagProductCategory = async (actionContext: IActionContext, channelId: number, catalogId: number = 0, RecordId: number) => {\r\n //context, channelId, catalogId, categoryPathLookups\r\n const categoryPathResults = await getCategoryPathsAsync(\r\n { callerContext: actionContext, queryResultSettings: {} },\r\n channelId,\r\n catalogId,\r\n [{ ProductId: RecordId }]\r\n );\r\n const categoryPath = categoryPathResults[0]?.CategoryPath?.[0] && categoryPathResults[0].CategoryPath[0];\r\n if (!categoryPath?.Segments?.length) {\r\n return [];\r\n }\r\n return [categoryPath.Segments[categoryPath.Segments.length - 1].CategoryName!];\r\n};\r\n","import { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport getAllProductVariants, { BuyboxGetDimensionVariantAvailabilityInput } from '../data-actions/buybox-get-all-variants-list';\r\nimport { IActionContext } from '@msdyn365-commerce/core-internal';\r\n\r\nexport const getUtagVariantId = async (\r\n MasterProductId: number,\r\n channelId: number,\r\n actionContext: IActionContext,\r\n RecordId: number,\r\n ItemId: string\r\n) => {\r\n if (MasterProductId && MasterProductId > 0) {\r\n const input = new BuyboxGetDimensionVariantAvailabilityInput(MasterProductId, channelId);\r\n const variantsResp: SimpleProduct[] = await getAllProductVariants(input, actionContext);\r\n for (let variantIter = 0; variantIter < variantsResp.length; variantIter++) {\r\n if (variantsResp[variantIter].RecordId === RecordId) {\r\n const ePropsVariant = variantsResp[variantIter].ExtensionProperties!;\r\n if (ePropsVariant?.length > 0) {\r\n for (let eIter = 0; eIter < ePropsVariant?.length; eIter++) {\r\n if (ePropsVariant[eIter].Key === 'RetailVariantId') {\r\n return [ePropsVariant[eIter].Value?.StringValue];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n const variantofId = `V000${ItemId}`;\r\n return [variantofId?.slice(0, -1)];\r\n};\r\n\r\nexport const getUtagRetailVariantIdAndRecId = async (\r\n MasterProductId: number,\r\n channelId: number,\r\n actionContext: IActionContext,\r\n RecordId: number,\r\n ItemId: string\r\n) => {\r\n if (MasterProductId && MasterProductId > 0) {\r\n const input = new BuyboxGetDimensionVariantAvailabilityInput(MasterProductId, channelId);\r\n const variantsResp: SimpleProduct[] = await getAllProductVariants(input, actionContext);\r\n for (let variantIter = 0; variantIter < variantsResp.length; variantIter++) {\r\n if (variantsResp[variantIter].RecordId === RecordId) {\r\n const ePropsVariant = variantsResp[variantIter].ExtensionProperties!;\r\n if (ePropsVariant?.length > 0) {\r\n for (let eIter = 0; eIter < ePropsVariant?.length; eIter++) {\r\n if (ePropsVariant[eIter].Key === 'RetailVariantId') {\r\n return { 'retailVariantId': ePropsVariant[eIter].Value?.StringValue, 'recordId': RecordId };\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n const variantofId = `V000${ItemId}`;\r\n return { 'retailVariantId': variantofId?.slice(0, -1), 'recordId': RecordId };\r\n};\r\n","import MsDyn365, { ICoreContext } from '@msdyn365-commerce/core';\r\nexport type GridSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\r\n\r\nconst _getViewPort = (context: ICoreContext): GridSize => {\r\n if (MsDyn365.isBrowser && window.innerWidth) {\r\n const gridSettings = context.request.gridSettings;\r\n if (gridSettings) {\r\n if (gridSettings.xs && window.innerWidth <= gridSettings.xs.w) {\r\n return 'xs';\r\n } else if (gridSettings.sm && window.innerWidth <= gridSettings.sm.w) {\r\n return 'sm';\r\n } else if (gridSettings.md && window.innerWidth <= gridSettings.md.w) {\r\n return 'md';\r\n } else if (gridSettings.lg && window.innerWidth <= gridSettings.lg.w) {\r\n return 'lg';\r\n } else {\r\n return 'xl';\r\n }\r\n }\r\n }\r\n return 'xs';\r\n};\r\n\r\nexport default _getViewPort;\r\n","import { IActionContext, ICoreContext } from '@msdyn365-commerce/core';\r\nimport { getActivePricesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport dayjs from 'dayjs';\r\nimport Cookies from 'universal-cookie';\r\nimport { IMFIATPInventoryStatusEntity, IMFIATPInventoryStatusResponse, IMFICartLine, IMFICLDeliveryScheduleParameters } from '../actions/CoreProductDataServiceEntities.g';\r\nimport { IBuyboxGetDimensionPricingActionData } from '../data-actions/buybox-get-dimension-pricing-action';\r\nimport { IBuyboxGetDimensionVariantAvailabilityActionData } from '../data-actions/buybox-get-dimension-variants-availability-action';\r\nimport { IBuyboxViewProps, IMFIATPInventoryStatusResponseEx } from '../modules/mfrm-buybox/mfrm-buybox';\r\nimport { IMfrmBuyboxProps } from '../modules/mfrm-buybox/mfrm-buybox.props.autogenerated';\r\nimport { IMfrmBuyBoxData } from '../modules/mfrm-buybox/mfrm-buybox.view';\r\nimport _getDeliveryByMessage from './get-delivery-by-message';\r\nimport _getEyebrowMessage from './get-eyebrow-message';\r\nimport _getInventoryQuantity from './get-inventory-quantity';\r\n// tslint:disable-next-line: max-line-length no-any\r\nexport const _coreProductATPCall = async (\r\n props: IBuyboxViewProps & IMfrmBuyboxProps,\r\n setCoreProductATPData: React.Dispatch,\r\n recordId: number,\r\n itemId: string | undefined,\r\n setATPCallMessage: React.Dispatch,\r\n setIsAtpCallReturned: React.Dispatch,\r\n isCached?: boolean\r\n) => {\r\n const { context } = props;\r\n const cookies = new Cookies();\r\n const zipcode = cookies.get('zip_code');\r\n if (zipcode === \"\" || zipcode === undefined) {\r\n return;\r\n }\r\n const itemLinesArray = [];\r\n if (props.data.product.result) {\r\n const itemLines: IMFICartLine = {\r\n ItemId: itemId,\r\n Quantity: 1,\r\n VariantRecordId: recordId?.toString()\r\n };\r\n\r\n itemLinesArray.push(itemLines);\r\n const currentDate = Date.now();\r\n const requestBody: IMFICLDeliveryScheduleParameters = {\r\n InventoryType: 'Delivery',\r\n Weeks: props.context.app.config.weeksPDPforATPCall,\r\n StoreId: '',\r\n Page: 'pdp',\r\n RequestedDate: dayjs(currentDate).format('MM/DD/YYYY'),\r\n ZipCode: zipcode,\r\n ItemLines: itemLinesArray\r\n };\r\n await _getDeliveryByMessage(requestBody, context, isCached)\r\n .then(result => {\r\n setIsAtpCallReturned(true);\r\n if (result !== undefined && result?.ATPInventoryData && result?.ATPInventoryData.length > 0) {\r\n setCoreProductATPData(result?.ATPInventoryData);\r\n } else {\r\n // VSI Customization - START\r\n setCoreProductATPData([]);\r\n // VSI Customization - End\r\n }\r\n setATPCallMessage(result?.Message);\r\n })\r\n .catch(e => {\r\n console.log('Error', e);\r\n });\r\n }\r\n};\r\n\r\nexport const _coreProductATPCallForInventoryStatus = async (\r\n props: IBuyboxViewProps & IMfrmBuyboxProps,\r\n recordId: number,\r\n itemId: string | undefined,\r\n allVariants: IBuyboxGetDimensionVariantAvailabilityActionData[],\r\n index: number\r\n) => {\r\n const { context } = props;\r\n // this commented code will removed when general data appeared\r\n const cookies = new Cookies();\r\n const zipcode = cookies.get('zip_code');\r\n if (zipcode === \"\" || zipcode === undefined) {\r\n return;\r\n }\r\n const itemLinesArray = [];\r\n if (props.data.product.result) {\r\n const itemLines: IMFICartLine = {\r\n ItemId: itemId,\r\n Quantity: 1,\r\n VariantRecordId: recordId?.toString()\r\n };\r\n itemLinesArray.push(itemLines);\r\n const currentDate = Date.now();\r\n const requestBody: IMFICLDeliveryScheduleParameters = {\r\n InventoryType: 'Delivery',\r\n Weeks: props.context.app.config.weeksPDPforATPCall,\r\n StoreId: '',\r\n Page: 'pdp',\r\n RequestedDate: dayjs(currentDate).format('MM/DD/YYYY'),\r\n ZipCode: zipcode, // '77047',\r\n ItemLines: itemLinesArray\r\n };\r\n const getInventoryQuantity = _getInventoryQuantity(requestBody, context);\r\n getInventoryQuantity.then((result) => {\r\n if (result !== undefined && result?.ATPInventoryStatusData && result?.ATPInventoryStatusData.length > 0) {\r\n const coreProductAtpData = result?.ATPInventoryStatusData;\r\n coreProductAtpData?.length && coreProductAtpData.map((item: IMFIATPInventoryStatusEntity) => {\r\n // TODO: remove console logs after testing\r\n if (item.Available === 'YES' && item.Quantity !== undefined && parseInt(item.Quantity, 10) > 0) {\r\n allVariants[index].isAvailable = true;\r\n return true;\r\n }\r\n allVariants[index].isAvailable = false;\r\n return false;\r\n });\r\n }\r\n }).catch((e) => {\r\n console.log('Error', e);\r\n });\r\n }\r\n};\r\n\r\nexport const _getActivePrices = async (\r\n pricingData: IBuyboxGetDimensionPricingActionData[],\r\n ctx: IActionContext\r\n): Promise => {\r\n const date = new Date();\r\n const productIds: number[] = [];\r\n for (let i = 0;i < pricingData.length;i++) {\r\n productIds.push(pricingData[i].productId);\r\n }\r\n await getActivePricesAsync(\r\n { callerContext: ctx },\r\n { ChannelId: ctx.requestContext.apiSettings.channelId, CatalogId: ctx.requestContext.apiSettings.catalogId },\r\n productIds,\r\n date,\r\n null,\r\n [],\r\n true\r\n ).then(dimPricesResult => {\r\n dimPricesResult?.map((item, index) => {\r\n pricingData[index].discountAmount = item.DiscountAmount;\r\n });\r\n });\r\n return pricingData;\r\n};\r\n\r\nexport const _smallParcelProductATPCallForInventoryStatus = async (\r\n props: IBuyboxViewProps & IMfrmBuyboxProps,\r\n recordId: number,\r\n itemId: string | undefined,\r\n // tslint:disable-next-line: no-any\r\n SetoutOfStockSmallParcelState: React.Dispatch,\r\n isCached?: boolean\r\n) => {\r\n const { context } = props;\r\n // this commented code will removed when general data appeared\r\n const cookies = new Cookies();\r\n const zipcode = cookies.get('zip_code');\r\n if (zipcode === \"\" || zipcode === undefined) {\r\n return;\r\n }\r\n const itemLinesArray = [];\r\n if (props.data.product.result) {\r\n const itemLines: IMFICartLine = {\r\n ItemId: itemId,\r\n Quantity: 1,\r\n VariantRecordId: recordId.toString()\r\n };\r\n itemLinesArray.push(itemLines);\r\n const currentDate = Date.now();\r\n const requestBody: IMFICLDeliveryScheduleParameters = {\r\n InventoryType: 'Delivery',\r\n Weeks: props.context.app.config.weeksPDPforATPCall,\r\n StoreId: '',\r\n Page: 'pdp',\r\n RequestedDate: dayjs(currentDate).format('MM/DD/YYYY'),\r\n ZipCode: zipcode, // '77047',\r\n ItemLines: itemLinesArray\r\n };\r\n await _getInventoryQuantity(requestBody, context, isCached)\r\n .then(result => {\r\n if (result !== undefined && result?.ATPInventoryStatusData && result?.ATPInventoryStatusData.length > 0) {\r\n const coreProductAtpData = result?.ATPInventoryStatusData;\r\n coreProductAtpData &&\r\n coreProductAtpData.length &&\r\n coreProductAtpData.map((item: IMFIATPInventoryStatusEntity) => {\r\n // TODO: remove console logs after testing\r\n if (item.Available === 'YES' && item.Quantity !== undefined && parseInt(item.Quantity, 10) > 0) {\r\n // allVariants[index].isAvailable = true;\r\n SetoutOfStockSmallParcelState(false);\r\n return true;\r\n } else {\r\n SetoutOfStockSmallParcelState(true);\r\n }\r\n // allVariants[index].isAvailable = false;\r\n return false;\r\n });\r\n }\r\n })\r\n .catch(e => {\r\n console.log('Error', e);\r\n });\r\n }\r\n};\r\n\r\nexport const _coreProductATPCallForInventoryStatusForAllVariants = async (\r\n props: IMfrmBuyboxProps,\r\n recordIds: number[],\r\n itemId: string | undefined,\r\n allVariants: IBuyboxGetDimensionVariantAvailabilityActionData[]\r\n): Promise => {\r\n const { context } = props;\r\n // this commented code will removed when general data appeared\r\n const cookies = new Cookies();\r\n const zipcode: any = cookies.get('zip_code');\r\n if (zipcode === '' || zipcode === undefined) {\r\n return null;\r\n }\r\n const itemLinesArray = [];\r\n if (props.data.product.result) {\r\n for (let ridIter = 0;ridIter < recordIds.length;ridIter++) {\r\n const itemLines: IMFICartLine = {\r\n ItemId: itemId,\r\n Quantity: 1,\r\n VariantRecordId: recordIds[ridIter].toString()\r\n };\r\n itemLinesArray.push(itemLines);\r\n }\r\n\r\n const currentDate = Date.now();\r\n const requestBody: IMFICLDeliveryScheduleParameters = {\r\n InventoryType: 'Delivery',\r\n Weeks: props.context.app.config.weeksPDPforATPCall,\r\n StoreId: '',\r\n Page: 'pdp',\r\n RequestedDate: dayjs(currentDate).format('MM/DD/YYYY'),\r\n ZipCode: zipcode, // '77047',\r\n ItemLines: itemLinesArray\r\n };\r\n\r\n const result: IMFIATPInventoryStatusResponse | null = await _getInventoryQuantity(requestBody, context, true);\r\n if (result !== undefined && result?.ATPInventoryStatusData && result?.ATPInventoryStatusData.length > 0) {\r\n const coreProductAtpData = result?.ATPInventoryStatusData;\r\n coreProductAtpData && coreProductAtpData.length && coreProductAtpData.map((item: IMFIATPInventoryStatusEntity) => {\r\n\r\n for (let iter = 0;iter < allVariants.length;iter++) {\r\n // TODO: remove console logs after testing\r\n if (item.Available === 'YES' && item.Quantity !== undefined && parseInt(item.Quantity, 10) > 0 && allVariants[iter].variantID.toString() === item.VariantRecordId) {\r\n allVariants[iter].isAvailable = true;\r\n break;\r\n }\r\n else if (item.Available === 'NO' && allVariants[iter].variantID.toString() === item.VariantRecordId) {\r\n allVariants[iter].isAvailable = false;\r\n break;\r\n }\r\n }\r\n });\r\n }\r\n const finalResult: IMFIATPInventoryStatusResponseEx = {\r\n ...result,\r\n zipCode: requestBody?.ZipCode\r\n };\r\n return finalResult;\r\n }\r\n return null;\r\n};\r\n\r\nexport const _smallParcelProductATPBooleanStatus = async (\r\n recordId: number,\r\n itemId: string | undefined,\r\n weeksPDPforATPCall: number | undefined,\r\n context: ICoreContext<{ [x: string]: any; }>\r\n // tslint:disable-next-line: no-any\r\n): Promise => {\r\n // this commented code will removed when general data appeared\r\n const cookies = new Cookies();\r\n const zipcode = cookies.get('zip_code');\r\n if (zipcode === \"\" || zipcode === undefined) {\r\n return false;\r\n }\r\n const itemLinesArray = [];\r\n const itemLines: IMFICartLine = {\r\n ItemId: itemId,\r\n Quantity: 1,\r\n VariantRecordId: recordId.toString()\r\n };\r\n itemLinesArray.push(itemLines);\r\n const currentDate = Date.now();\r\n const requestBody: IMFICLDeliveryScheduleParameters = {\r\n InventoryType: 'Delivery',\r\n Weeks: weeksPDPforATPCall ?? 6,\r\n StoreId: '',\r\n Page: 'pdp',\r\n RequestedDate: dayjs(currentDate).format('MM/DD/YYYY'),\r\n ZipCode: zipcode, // '77047',\r\n ItemLines: itemLinesArray\r\n };\r\n return _getInventoryQuantity(requestBody, context, true)\r\n .then(result => {\r\n if (result !== undefined && result?.ATPInventoryStatusData && result?.ATPInventoryStatusData.length > 0) {\r\n const coreProductAtpData = result?.ATPInventoryStatusData[0];\r\n if (coreProductAtpData.Available === 'YES' && coreProductAtpData.Quantity !== undefined && parseInt(coreProductAtpData.Quantity, 10) > 0) {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n } else {\r\n return false;\r\n }\r\n })\r\n .catch(e => {\r\n console.log('Error', e);\r\n return false;\r\n });\r\n};","import { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { IRequestContext } from '@msdyn365-commerce/core';\r\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\r\nexport interface IVirtualRefinersConfig {\r\n order: number;\r\n refinerName: string;\r\n enableForMattresses: boolean;\r\n enableForOtherCategories: boolean;\r\n allowDuplicate: boolean;\r\n}\r\n\r\n/**\r\n * This will create the canonicalURL as per 7924 requirement\r\n * @param requestContext\r\n * @returns string of canonical URL\r\n */\r\nexport const canonicalURL = (requestContext: IRequestContext): string => {\r\n const requestUrl = requestContext.url.requestUrl;\r\n const origin = requestUrl.origin;\r\n const path = requestUrl.pathname.toLowerCase();\r\n\r\n // separate out url parts split on forward / and remove first empty index\r\n let urlParts = path?.split('/').splice(1);\r\n\r\n // remove double values containing pipe sign\r\n if (path.match(/%7c/)) {\r\n urlParts = removePipeSignValue(urlParts);\r\n }\r\n\r\n // remove unwanted keywords from url\r\n urlParts = removeKeywords(urlParts, requestContext);\r\n\r\n const filteredPath = urlParts?.join('/');\r\n\r\n return `${origin}/${filteredPath}`;\r\n};\r\n\r\nexport const filteredURL = (requestContext: IRequestContext): string => {\r\n const requestUrl = requestContext.url.requestUrl;\r\n const path = requestUrl.pathname.toLowerCase();\r\n\r\n // separate out url parts split on forward / and remove first empty index\r\n let urlParts = path?.split('/').splice(1);\r\n\r\n // remove unwanted keywords from url\r\n urlParts = removeKeywords(urlParts, requestContext);\r\n\r\n const filteredPath = urlParts?.join('/');\r\n\r\n return `/${filteredPath}`;\r\n};\r\n\r\n/**\r\n * This will create the canonicalURL as per 7924 requirement\r\n * @param requestContext\r\n * @returns string of canonical URL\r\n */\r\nexport const canonicalURLWithoutBaseUrl = (requestContext: IRequestContext): string => {\r\n const requestUrl = requestContext.url.requestUrl;\r\n const path = requestUrl.pathname.toLowerCase();\r\n\r\n // separate out url parts split on forward / and remove first empty index\r\n let urlParts = path?.split('\\/').splice(1);\r\n\r\n // remove double values containing pipe sign\r\n if (path.match(/%7c/)) {\r\n urlParts = removePipeSignValue(urlParts);\r\n }\r\n\r\n // remove unwanted keywords from url\r\n urlParts = removeKeywords(urlParts, requestContext);\r\n\r\n return urlParts?.join('\\/');\r\n};\r\n\r\n/**\r\n * This will remove the Pipe sign value set from urlParts\r\n * @param urlParts\r\n * @returns\r\n */\r\nexport const removePipeSignValue = (urlParts: string[]) => {\r\n // urlParts.forEach((part, index) => {\r\n // const indexOfValue = urlParts.indexOf('%7c');\r\n // if (indexOfValue !== -1) {\r\n // urlParts.splice(indexOfValue, 1);\r\n // }\r\n // });\r\n\r\n if (urlParts !== undefined && urlParts.length > 0) {\r\n urlParts = urlParts.filter(urlPart => urlPart.indexOf('%7c') === -1);\r\n }\r\n\r\n return urlParts;\r\n};\r\n\r\n/**\r\n * This will remove the keywords from urlParts array which were received from\r\n * the app.settings.json/CMS Extensions\r\n * @param urlParts\r\n * @param requestContext\r\n * @returns urlParts array filtered\r\n */\r\nexport const removeKeywords = (urlParts: string[], requestContext: IRequestContext): string[] => {\r\n const removeKeywordFromUrl = requestContext.app.config.removeKeywordFromUrl;\r\n\r\n if (urlParts.length > 0 && removeKeywordFromUrl && removeKeywordFromUrl.length > 0) {\r\n const removeKeywordFromUrlArray: string[] = removeKeywordFromUrl?.trim().split(',');\r\n removeKeywordFromUrlArray?.length > 0 &&\r\n urlParts.forEach(_part => {\r\n removeKeywordFromUrlArray.forEach(removeKeyword => {\r\n const trimmedKeyword = removeKeyword.trim().toLowerCase();\r\n const indexOfValue = urlParts.indexOf(trimmedKeyword);\r\n if (trimmedKeyword.length > 0 && indexOfValue !== -1) {\r\n urlParts.splice(indexOfValue, 1);\r\n }\r\n });\r\n });\r\n }\r\n\r\n return urlParts;\r\n};\r\n\r\n/**\r\n * This will sort the Virtual refiner config based on order and return\r\n * only active virtual refiner configs based on isMattress category will\r\n * be returned\r\n * @param requestContext\r\n * @param isMattressesCategory boolean | undefined\r\n * @returns IVirtualRefinersConfig[] | undefined\r\n */\r\nexport const getSortedVirtualRefinerConfig = (\r\n requestContext: IRequestContext,\r\n isMattressesCategory: boolean | undefined\r\n): IVirtualRefinersConfig[] | undefined => {\r\n let appConfigSorted = getVirtualRefinerConfig(requestContext);\r\n\r\n // sort the config by provided config\r\n if (appConfigSorted) {\r\n if (isMattressesCategory === true) {\r\n appConfigSorted = appConfigSorted.filter(appConfig => {\r\n return appConfig.enableForMattresses;\r\n });\r\n } else if (isMattressesCategory === false) {\r\n appConfigSorted = appConfigSorted.filter(appConfig => {\r\n return appConfig.enableForOtherCategories;\r\n });\r\n }\r\n appConfigSorted.sort((a: IVirtualRefinersConfig, b: IVirtualRefinersConfig) => {\r\n return a.order - b.order;\r\n });\r\n }\r\n\r\n return appConfigSorted;\r\n};\r\n\r\n/**\r\n * Virtual refiner names from the app.settings.json will be returned which can be used\r\n * to filter out refiners data based upon active virtual refiners\r\n * @param requestContext\r\n * @param isMattressesCategory boolean | undefined\r\n * @returns string[]\r\n */\r\nexport const getVirtualRefinerNames = (requestContext: IRequestContext, isMattressesCategory: boolean | undefined): string[] => {\r\n const sortedVirtualRefinerConfig = getSortedVirtualRefinerConfig(requestContext, isMattressesCategory);\r\n\r\n const appConfigRefinerNames: string[] = [];\r\n\r\n sortedVirtualRefinerConfig &&\r\n sortedVirtualRefinerConfig.forEach(sortedConfig => {\r\n appConfigRefinerNames.push(sortedConfig.refinerName.trim().toLowerCase());\r\n });\r\n\r\n return appConfigRefinerNames;\r\n};\r\n\r\n/**\r\n * This will return the value of virtual refiner configuration\r\n * @param requestContext\r\n * @returns IVirtualRefinersConfig[] | undefined\r\n */\r\nexport const getVirtualRefinerConfig = (requestContext: IRequestContext): IVirtualRefinersConfig[] => {\r\n return requestContext.app.config.urlModifications;\r\n};\r\n\r\nexport async function getVirtualRefinerValues(\r\n requestContext: IRequestContext,\r\n virtualRefiners: IProductRefinerHierarchy[]\r\n): Promise {\r\n const virtualRefinerValues: ProductRefinerValue[] = [];\r\n if (virtualRefiners.length === 0) {\r\n return virtualRefinerValues;\r\n }\r\n const requestUrl = requestContext.url.requestUrl;\r\n // const origin = requestUrl.origin;\r\n const path = requestUrl.pathname;\r\n\r\n // separate out url parts split on forward / and remove first empty index\r\n let urlParts = path?.split('/').splice(1);\r\n\r\n // remove unwanted keywords from url\r\n urlParts = removeKeywords(urlParts, requestContext);\r\n\r\n // remove category id {categoryid}.c\r\n const categoryIdToken = requestContext.urlTokens.recordId;\r\n const categoryId = categoryIdToken ? `${categoryIdToken}.c` : undefined;\r\n\r\n if (categoryId) {\r\n urlParts.splice(-1);\r\n }\r\n\r\n // run loop for each url part and get values from refiners for further usage\r\n const finalizedUrlParts: string[] = [];\r\n urlParts.forEach(plainUrlPart => {\r\n const urlPart = decodeURIComponent(plainUrlPart);\r\n if (urlPart.indexOf('|') !== -1) {\r\n const splitOnPipeSign = urlPart?.split('|');\r\n const filteredParts = splitOnPipeSign.filter(part => part.length > 0);\r\n filteredParts.forEach(filteredPart => {\r\n finalizedUrlParts.push(filteredPart.toLowerCase().trim());\r\n });\r\n }\r\n finalizedUrlParts.push(urlPart);\r\n });\r\n finalizedUrlParts.forEach((urlPart) => {\r\n virtualRefiners.forEach((mainRefiner) => {\r\n mainRefiner.Values.forEach((refinerValue) => {\r\n const refinerValueKeyName = refinerValue.LeftValueBoundString?.toLowerCase().trim().split(' ')?.join('-').replace(/\\&/g, 'and').replace(regExSpecialChars(requestContext.app.config.canonicalUrlspecialCharIncludeList), '-');\r\n if (refinerValueKeyName && refinerValueKeyName === urlPart) {\r\n virtualRefinerValues.push(refinerValue);\r\n }\r\n });\r\n });\r\n });\r\n\r\n return virtualRefinerValues;\r\n}\r\n\r\n/**\r\n * For navigation menu links, it will remove keywords configured in global configurations from the navigation link\r\n * and clp link and return url path string\r\n * @param link\r\n * @param requestContext\r\n * @returns string\r\n */\r\nexport const navLinkKeywordRemoval = (link: string, requestContext: IRequestContext): string => {\r\n // Using the rest operator in case there is a weirdly formatted URL with multiple question marks.\r\n const [linkBase, ...linkParams] = link?.split('?');\r\n\r\n // Only apply to category links and product links, which end in .c or .p. Check that a keyword is configured.\r\n if (!linkBase.endsWith('.c') && !linkBase.endsWith('.p') || !requestContext.app.config) {\r\n return link;\r\n }\r\n\r\n // Separate out url parts split on forward /\r\n let urlParts = linkBase?.split('\\/');\r\n\r\n // Remove unwanted keywords from url\r\n urlParts = removeKeywords(urlParts, requestContext);\r\n\r\n // Glue the URL params back together\r\n const linkParam = linkParams.map(param => `?${param}`)?.join('');\r\n\r\n // Rebuild URL by joining with forward slash and appending any URL parameters\r\n const filteredLink = `${urlParts?.join('/')}${linkParam}`;\r\n return `${filteredLink}`;\r\n};\r\nexport const regExSpecialChars = (includeConfigList: string): RegExp => {\r\n let includeConfig = '';\r\n if (includeConfigList !== undefined && includeConfigList !== '') {\r\n includeConfig = includeConfigList?.trim().split(',')?.join('\\\\\\\\');\r\n includeConfig = includeConfig && includeConfig !== '' ? `\\\\\\\\${includeConfig}` : '';\r\n const pattern = `[^\\\\w\\\\&\\\\|${includeConfig}]`;\r\n // eslint-disable-next-line security/detect-non-literal-regexp\r\n return new RegExp(pattern, 'gi');\r\n } else {\r\n\r\n const pattern = `[^\\\\w\\\\&\\\\|]`;\r\n // eslint-disable-next-line security/detect-non-literal-regexp\r\n return new RegExp(pattern, 'gi');\r\n }\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\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { mFIATPInventoryStatusAsync } from './CoreProductDataActionExtension.g';\r\nimport { IMFIATPInventoryStatusResponse, IMFICLDeliveryScheduleParameters } from './CoreProductDataServiceEntities.g';\r\n\r\n/**\r\n * GetDeliveryMessage Input Action\r\n */\r\n\r\nexport class GetATPInventoryStatusInput implements Msdyn365.IActionInput {\r\n // Construct the input needed to run the action\r\n public input: IMFICLDeliveryScheduleParameters;\r\n public isCached?: boolean;\r\n constructor(input: IMFICLDeliveryScheduleParameters, isCached: boolean = true) {\r\n this.input = input;\r\n this.isCached = isCached;\r\n }\r\n\r\n // 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 = () => {\r\n const key = Array.prototype.map.call(this.input.ItemLines, (item) => { return item.VariantRecordId; }).sort().join(\",\");\r\n return `Get-Inventory-Status${this.input.ZipCode}-${this.input.ItemLines![0].ItemId}-${key}-${\r\n this.input?.Weeks\r\n }-${this.input?.RequestedDate}`;\r\n };\r\n // public getCacheKey = () => 'do';\r\n public getCacheObjectType = () => 'GetATPInventoryStatusResult';\r\n public dataCacheType = (): Msdyn365.CacheType => (this.isCached ? 'request' : 'none');\r\n}\r\n\r\n// Create a data model here or import one to capture the response of the action\r\n\r\n/**\r\n * Use this function to create the input required to make the action call\r\n */\r\n// const createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n// return new GetDeliveryMessageInput();\r\n// };\r\n\r\n/**\r\n * Use this function to call your action and process the results as needed\r\n */\r\nasync function getATPInventoryStatusAction(\r\n request: GetATPInventoryStatusInput,\r\n ctx: Msdyn365.IActionContext\r\n): Promise {\r\n if (request.input) {\r\n try {\r\n const result = await mFIATPInventoryStatusAsync({ callerContext: ctx }, request.input);\r\n if (result) {\r\n return result;\r\n }\r\n } catch (error) {\r\n console.log('Error', error);\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >getATPInventoryStatusAction,\r\n // Give your data action a unique id\r\n id: 'GetATPInventoryStatus'\r\n // input: createInput\r\n // Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\r\n});\r\n","// tslint:disable\r\nimport * as EntityClasses from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceModels.g';\r\nimport * as Entities from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n\r\n/**\r\n * MFITryInStore entity interface.\r\n */\r\nexport interface IMFITryInStore {\r\n ZipCode?: string;\r\n StoreId: string;\r\n Products?: string;\r\n Limit: number;\r\n Radius: number;\r\n ExtensionProperties?: Entities.CommerceProperty[];\r\n}\r\n\r\n/**\r\n * MFITryInStoreInfoResponse entity interface.\r\n */\r\nexport interface IMFITryInStoreInfoResponse {\r\n Status?: string;\r\n Message?: string;\r\n StoreId?: string;\r\n Inventory?: string[];\r\n}\r\n\r\n/**\r\n * MFITryInStore entity class.\r\n */\r\nexport class MFITryInStoreExtensionClass implements IMFITryInStore {\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public ZipCode: string;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public StoreId: string;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public Products: string;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public Limit: number;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public Radius: number;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public ExtensionProperties: Entities.CommerceProperty[];\r\n\r\n // Navigation properties names\r\n\r\n /**\r\n * Construct an object from odata response.\r\n * @param {any} odataObject The odata result object.\r\n */\r\n constructor(odataObject?: any) {\r\n odataObject = odataObject || {};\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.ZipCode = odataObject.ZipCode;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.StoreId = odataObject.StoreId;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.Products = odataObject.Products;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.Limit = odataObject.Limit;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.Radius = odataObject.Radius;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.ExtensionProperties = undefined;\r\n if (odataObject.ExtensionProperties) {\r\n this.ExtensionProperties = [];\r\n for (let i = 0; i < odataObject.ExtensionProperties.length; i++) {\r\n if (odataObject.ExtensionProperties[i]) {\r\n if (odataObject.ExtensionProperties[i]['@odata.type']) {\r\n let className: string = odataObject.ExtensionProperties[i]['@odata.type'];\r\n className = className.substr(className.lastIndexOf('.') + 1).concat('Class');\r\n if (EntityClasses[className]) {\r\n this.ExtensionProperties[i] = new EntityClasses[className](odataObject.ExtensionProperties[i]);\r\n }\r\n } else {\r\n this.ExtensionProperties[i] = new EntityClasses.CommercePropertyClass(odataObject.ExtensionProperties[i]);\r\n }\r\n } else {\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.ExtensionProperties[i] = undefined;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * MFITryInStoreInfoResponse entity class.\r\n */\r\nexport class MFITryInStoreInfoResponseExtensionClass implements IMFITryInStoreInfoResponse {\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public Status: string;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public Message: string;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public StoreId: string;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n public Inventory: string[];\r\n\r\n // Navigation properties names\r\n\r\n /**\r\n * Construct an object from odata response.\r\n * @param {any} odataObject The odata result object.\r\n */\r\n constructor(odataObject?: any) {\r\n odataObject = odataObject || {};\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.Status = odataObject.Status;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.Message = odataObject.Message;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.StoreId = odataObject.StoreId;\r\n\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.Inventory = undefined;\r\n if (odataObject.Inventory) {\r\n this.Inventory = [];\r\n for (let i = 0; i < odataObject.Inventory.length; i++) {\r\n if (odataObject.Inventory[i]) {\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.Inventory[i] = odataObject.Inventory[i];\r\n } else {\r\n // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n this.Inventory[i] = undefined;\r\n }\r\n }\r\n }\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 * THIS FILE IS AN AUTOGENERATED TYPESCRIPT PROXY EXTENSION.\r\n * TO USE THIS FILE, IT MUST BE ADDED TO A D365COMMERCE APPLICATION\r\n */\r\n// tslint:disable\r\nimport { AsyncResult, callActionOrExecute, DataServiceQuery, IContext, IDataServiceRequest } from '@msdyn365-commerce/retail-proxy';\r\n// @ts-ignore\r\nimport * as EntityClasses from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceModels.g';\r\nimport * as DataServiceEntities from './TryInStoreDataServiceEntities.g';\r\n\r\n// @ts-ignore\r\nfunction tryInStoresQuery(storeId?: string): DataServiceQuery {\r\n const key = storeId ? { StoreId: storeId } : null;\r\n return new DataServiceQuery('TryInStores', 'MFITryInStore', DataServiceEntities.MFITryInStoreExtensionClass, key);\r\n}\r\n\r\nexport function createMFIGetTryInStoreInfoInput(tryInStoreProductIDs: DataServiceEntities.IMFITryInStore): IDataServiceRequest {\r\n const query = tryInStoresQuery();\r\n return query.createDataServiceRequestForOperation(\r\n 'MFIGetTryInStoreInfo',\r\n true,\r\n DataServiceEntities.MFITryInStoreInfoResponseExtensionClass,\r\n 'false',\r\n { bypassCache: 'get', returnEntity: 'DataServiceEntities.IMFITryInStoreInfoResponse' },\r\n { tryInStoreProductIDs: tryInStoreProductIDs }\r\n );\r\n}\r\n\r\nexport function mFIGetTryInStoreInfoAsync(\r\n context: IContext,\r\n tryInStoreProductIDs: DataServiceEntities.IMFITryInStore\r\n): AsyncResult {\r\n const request = createMFIGetTryInStoreInfoInput(tryInStoreProductIDs);\r\n return callActionOrExecute(request, context.callerContext);\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\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { mFIGetTryInStoreInfoAsync } from './TryInStoreDataActionExtension.g';\r\nimport { IMFITryInStore, IMFITryInStoreInfoResponse } from './TryInStoreDataServiceEntities.g';\r\n\r\n/**\r\n * GetTryInStoreInfo Input Action\r\n */\r\n\r\nexport class GetTryInStoreInfoInput implements Msdyn365.IActionInput {\r\n // Construct the input needed to run the action\r\n public input: IMFITryInStore;\r\n constructor(input: IMFITryInStore) {\r\n this.input = input;\r\n }\r\n\r\n // 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 = () =>\r\n `Try-In-Store${this.input.StoreId}-${this.input.ZipCode}-${this.input.Radius}-${this.input.Limit}-${this.input.Products}`;\r\n public getCacheObjectType = () => 'GetTryInStoreInfo';\r\n public dataCacheType = (): Msdyn365.CacheType => 'request';\r\n}\r\n\r\n// Create a data model here or import one to capture the response of the action\r\n/**\r\n * Use this function to create the input required to make the action call\r\n */\r\n// const createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n// return new GetTryInStoreInfoInput();\r\n// };\r\n\r\n/**\r\n * Use this function to call your action and process the results as needed\r\n */\r\nasync function getTryInStoreAction(\r\n request: GetTryInStoreInfoInput,\r\n ctx: Msdyn365.IActionContext\r\n): Promise {\r\n if (request.input) {\r\n try {\r\n const result = await mFIGetTryInStoreInfoAsync({ callerContext: ctx }, request.input);\r\n if (result) {\r\n return result;\r\n }\r\n } catch (error) {\r\n console.log('Error', error);\r\n }\r\n }\r\n return {};\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >getTryInStoreAction,\r\n // Give your data action a unique id\r\n id: 'GetTryInStoreInfo'\r\n // input: createInput\r\n // 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. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\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\nimport { getByIdAsync, getVariantsByDimensionValuesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n\r\n// tslint:disable-next-line: completed-docs\r\nexport class BuyboxGetDimensionVariantAvailabilityInput implements IActionInput {\r\n public channelId: number;\r\n public productId: number;\r\n constructor(productId: number, channelId: number) {\r\n this.channelId = channelId;\r\n this.productId = productId;\r\n }\r\n public getCacheKey = () => `AllMFRMProductVariantIDs-${this.productId}`;\r\n public getCacheObjectType = () => 'AllMFRMProductVariantIDs';\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\nexport interface IBuyboxGetDimensionVariantAvailabilityActionData {\r\n variantID: number;\r\n dimensionRecordID: number;\r\n itemID: string;\r\n sizeValue: string;\r\n isAvailable: boolean;\r\n}\r\n\r\nconst createInput = (inputData: ICreateActionContext>): IActionInput => {\r\n if (inputData && inputData.requestContext && inputData.requestContext.query && inputData.requestContext.query.productId) {\r\n return new BuyboxGetDimensionVariantAvailabilityInput(\r\n +inputData.requestContext.query.productId,\r\n +inputData.requestContext.apiSettings.channelId\r\n );\r\n } else if (inputData && inputData.requestContext && inputData.requestContext.urlTokens && inputData.requestContext.urlTokens.itemId) {\r\n return new BuyboxGetDimensionVariantAvailabilityInput(\r\n +inputData.requestContext.urlTokens.itemId,\r\n +inputData.requestContext.apiSettings.channelId\r\n );\r\n } else if (inputData && inputData.config && inputData.config.productId) {\r\n return new BuyboxGetDimensionVariantAvailabilityInput(inputData.config.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\nexport async function getAllVariantsForProduct(\r\n input: BuyboxGetDimensionVariantAvailabilityInput,\r\n ctx: IActionContext\r\n): Promise {\r\n const productResponse = await getByIdAsync(\r\n { callerContext: ctx, queryResultSettings: { Paging: { Top: 1 } } },\r\n input.productId,\r\n input.channelId\r\n );\r\n const baseProduct = Array.isArray(productResponse) ? productResponse[0] : productResponse;\r\n try {\r\n return await getVariantsByDimensionValuesAsync(\r\n { callerContext: ctx, queryResultSettings: { Paging: { Top: 500 } } },\r\n baseProduct.MasterProductId || input.productId,\r\n input.channelId,\r\n []\r\n );\r\n } catch (error) {\r\n ctx.telemetry.exception(error);\r\n throw new Error('[IBuyboxGetDimensionPricingActionData]Unable to retieve data');\r\n }\r\n}\r\n\r\nexport default createObservableDataAction({\r\n action: >getAllVariantsForProduct,\r\n input: createInput\r\n});\r\n","import { IAny, ICoreContext, IGeneric } from '@msdyn365-commerce/core';\r\nimport { IMFIAvailablePromotionDescription, IMFIItem } from '../actions/EyebrowMessageDataServiceEntities.g';\r\nimport getEyebrowAction, { GetEyebrowMessageInput } from '../actions/get-eyebrow-message.action';\r\n\r\nconst _getEyebrowMessage = async (products: IMFIItem[], context: ICoreContext>, isCached?: boolean, pageType?: string) => {\r\n const priceGroupForAPICall = context.app && context.app.config.priceGroup;\r\n if (products?.length > 0 && priceGroupForAPICall) {\r\n const items: IMFIItem[] | undefined = [];\r\n products.map((item) => {\r\n const singleItem: IMFIItem = {\r\n ItemId: item.ItemId,\r\n DistinctProductVariant: item.DistinctProductVariant\r\n };\r\n items.push(singleItem);\r\n });\r\n\r\n const requestBody: IMFIAvailablePromotionDescription = {\r\n PriceGroup: priceGroupForAPICall,\r\n Items: items\r\n };\r\n const getEyebrowMessageInput = new GetEyebrowMessageInput(requestBody, pageType, isCached);\r\n try {\r\n const result = await getEyebrowAction(getEyebrowMessageInput, context.actionContext);\r\n if (result) {\r\n return result;\r\n }\r\n } catch (error) {\r\n console.log('Error', error);\r\n }\r\n }\r\n return null;\r\n};\r\n\r\nexport default _getEyebrowMessage;\r\n","import { IBuyboxCommonResources } from '@msdyn365-commerce-modules/buybox';\r\nimport { IAddToCartFailureResult } from '@msdyn365-commerce/components';\r\nimport { IAny, ICoreContext, IGeneric } from '@msdyn365-commerce/core';\r\nimport { ICartState } from '@msdyn365-commerce/global-state';\r\nimport { OrgUnitLocation, ProductAvailableQuantity, ProductDimension, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\n\r\nexport function getQuantityError(stockLeft: number | undefined, resources: IBuyboxCommonResources): string | undefined {\r\n if (!stockLeft || stockLeft <= 0) {\r\n return resources.errorMessageOutOfStock;\r\n } else if (stockLeft === 1) {\r\n return resources.errorMessageOutOfRangeOneLeft;\r\n } else {\r\n return resources.errorMessageOutOfRangeFormat.replace('{numLeft}', stockLeft.toString());\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:cyclomatic-complexity\r\nexport function getGenericError(\r\n result: IAddToCartFailureResult,\r\n cart: ICartState | undefined,\r\n resources: IBuyboxCommonResources,\r\n context: ICoreContext>,\r\n product: SimpleProduct | undefined,\r\n productAvailability: ProductAvailableQuantity | undefined,\r\n location: OrgUnitLocation | undefined)\r\n : string | undefined {\r\n if (result.failureReason === 'EMPTYINPUT') {\r\n return resources.addedToCartFailureMessage;\r\n } else if (result.failureReason === 'CARTACTIONFAILED') {\r\n if (result.cartActionResult && result.cartActionResult.substatus === 'MAXQUANTITY') {\r\n // get the quantity of the product in cart\r\n let elementFoundAt: number = -1;\r\n const productIdToFind = product?.RecordId;\r\n\r\n for (let i = 0; i < cart!.cart.CartLines!.length; i++) {\r\n if (cart!.cart.CartLines![i].ProductId === productIdToFind &&\r\n (cart!.cart.CartLines![i].DeliveryMode || '') === (location && context.actionContext.requestContext.channel?.PickupDeliveryModeCode || '') &&\r\n (cart!.cart.CartLines![i].FulfillmentStoreId || '') === (location?.OrgUnitNumber || '')) {\r\n elementFoundAt = i;\r\n\r\n break;\r\n }\r\n }\r\n\r\n let curQuantity: number = 0;\r\n\r\n if (elementFoundAt !== -1) {\r\n const cartLineToUpdate = { ...cart!.cart.CartLines![elementFoundAt] };\r\n curQuantity = cartLineToUpdate.Quantity || 0;\r\n }\r\n\r\n // get the quantity limit for the product\r\n const maxQuantityForCartLineItem = context.app.config.maxQuantityForCartLineItem;\r\n const availableQty = productAvailability?.AvailableQuantity;\r\n\r\n let quantityLimit: number;\r\n\r\n if (maxQuantityForCartLineItem === undefined && availableQty === undefined) {\r\n quantityLimit = 10;\r\n } else if (availableQty === undefined) {\r\n quantityLimit = maxQuantityForCartLineItem;\r\n } else if (maxQuantityForCartLineItem === undefined) {\r\n quantityLimit = availableQty;\r\n } else {\r\n quantityLimit = Math.min(maxQuantityForCartLineItem, availableQty);\r\n }\r\n\r\n return resources.maxQuantityLimitText.replace('{curQuantity}', curQuantity.toString()).replace('{maxQuantity}', quantityLimit.toString());\r\n } else if (result.cartActionResult && (result.cartActionResult.substatus === 'QUANTITYLIMITS' || result.cartActionResult.substatus === 'INVOICEINCART')) {\r\n return result.cartActionResult?.errorDetails?.LocalizedMessage;\r\n }\r\n\r\n return resources.addedToCartFailureMessage;\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\nexport function getConfigureErrors(result: ProductDimension[] | undefined, resources: IBuyboxCommonResources, isGiftCard?: Boolean): { [configureId: string]: string | undefined } {\r\n if (!result) {\r\n return {};\r\n }\r\n\r\n const dimensions: { [configureId: string]: string | undefined } = {};\r\n\r\n result.forEach(dimension => {\r\n dimensions[dimension.DimensionTypeValue] = getDimensionErrorString(dimension.DimensionTypeValue, resources, isGiftCard);\r\n });\r\n\r\n return dimensions;\r\n}\r\n\r\nexport function getDimensionErrorString(dimensionTypeValue: number, resources: IBuyboxCommonResources, isGiftCard?: Boolean): string {\r\n switch (dimensionTypeValue) {\r\n case 1: // ProductDimensionType.Color\r\n return resources.productDimensionTypeColorErrorMessage;\r\n case 2: // ProductDimensionType.Configuration\r\n return resources.productDimensionTypeConfigurationErrorMessage;\r\n case 3: // ProductDimensionType.Size\r\n return resources.productDimensionTypeSizeErrorMessage;\r\n case 4: // ProductDimensionType.Style\r\n return isGiftCard ? resources.productDimensionTypeAmountErrorMessage : resources.productDimensionTypeStyleErrorMessage;\r\n default:\r\n return '';\r\n }\r\n}","import { ArrayExtensions } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { Alert, Button, format, getPayloadObject, getTelemetryAttributes, getTelemetryObject, Heading, ITelemetryContent, Node, Quantity, TelemetryConstant } from '@msdyn365-commerce-modules/utilities';\r\nimport {\r\n AddToCartComponent, AddToOrderTemplateComponent, AddToWishlistComponent, IAddToCartFailureResult, IAddToCartResources, IAddToOrderTemplateDialogResources,\r\n IDuplicateItemsWhenAddingToOrderTemplateDialogResources, IItemAddedToOrderTemplateDialogResources, IOrderTemplateActionErrorResult, IOrderTemplateNameDialogResources, IWishlistActionErrorResult,\r\n PriceComponent, RatingComponent\r\n} from '@msdyn365-commerce/components';\r\nimport MSDyn365, { getUrlSync, IImageSettings } from '@msdyn365-commerce/core';\r\nimport { ICartActionResult } from '@msdyn365-commerce/global-state';\r\nimport * as React from 'react';\r\nimport { getConfigureErrors, getGenericError, getQuantityError } from './utilities/error-utilities';\r\n\r\nimport {\r\n IBuyboxAddToCartViewProps, IBuyboxAddToOrderTemplateViewProps, IBuyboxAddToWishlistViewProps, IBuyboxCallbacks, IBuyboxCommonData, IBuyboxCommonResources,\r\n IBuyboxErrorBlockProps, IBuyboxExtentedProps, IBuyboxKeyInPriceViewProps, IBuyboxProductQuantityViewProps, IBuyboxShopSimilarLookViewProps, IBuyboxState,\r\n IProductDetails, ShopSimiliarButtonType\r\n} from '@msdyn365-commerce-modules/buybox';\r\n\r\nexport function getBuyBoxInventoryLabel(props: IBuyboxExtentedProps, productDetails?: IProductDetails): React.ReactElement | undefined {\r\n const { typeName } = props;\r\n const productAvailableQuantity = props.data.productAvailableQuantity?.result ? props.data.productAvailableQuantity?.result : productDetails?.productAvailableQuantity!;\r\n\r\n const className = _getClassNamePrefix(typeName);\r\n if (!productAvailableQuantity || !productAvailableQuantity.length) {\r\n return undefined;\r\n }\r\n if (productAvailableQuantity &&\r\n productAvailableQuantity.length &&\r\n productAvailableQuantity[0].StockLevelLabel) {\r\n const inventoryClassName = productAvailableQuantity[0].StockLevelCode ?\r\n `${className}__inventory-label ${className}__inventory-code-${productAvailableQuantity[0].StockLevelCode.toLowerCase()}` :\r\n `${className}__inventory-label`;\r\n return (
{productAvailableQuantity[0].StockLevelLabel}
);\r\n }\r\n\r\n return undefined;\r\n\r\n}\r\n\r\nexport function getBuyboxProductTitle(props: IBuyboxExtentedProps, productDetails?: IProductDetails, brandName?: string): React.ReactElement | undefined {\r\n const {\r\n config: { titleHeadingTag = 'h1' },\r\n typeName\r\n } = props;\r\n const className = typeName && _getClassNamePrefix(typeName);\r\n\r\n const product = props.data.product?.result ? props.data.product.result : productDetails?.product!;\r\n const title = brandName ? `${brandName} ${product.Name}` : product.Name;\r\n return product && (\r\n \r\n );\r\n}\r\n\r\nexport function getBuyboxProductDescription(props: IBuyboxExtentedProps, productDetails?: IProductDetails): React.ReactElement | undefined {\r\n const { typeName } = props;\r\n const className = _getClassNamePrefix(typeName);\r\n const product = props.data.product?.result ? props.data.product?.result : productDetails?.product!;\r\n\r\n return product && (\r\n

{product.Description}

\r\n );\r\n}\r\n\r\nlet telemetryContent: ITelemetryContent;\r\n\r\n// tslint:disable-next-line:max-func-body-length\r\nexport function getBuyboxAddToCart(props: IBuyboxExtentedProps, state: IBuyboxState, callbacks: IBuyboxCallbacks,\r\n defaultMinimumKeyInPrice: number, defaultMaximumKeyInPrice: number, productDetails?: IProductDetails): IBuyboxAddToCartViewProps {\r\n const {\r\n id,\r\n typeName,\r\n context,\r\n resources,\r\n config: { minimumKeyInPrice, maximumKeyInPrice }\r\n } = props;\r\n\r\n const product = props.data?.product?.result ? props.data.product.result : productDetails?.product!;\r\n const cart = props.data?.cart?.result ? props.data.cart.result : productDetails?.cart!;\r\n const productAvailableQuantity = props.data?.productAvailableQuantity?.result ? props.data.productAvailableQuantity.result : productDetails?.productAvailableQuantity!;\r\n\r\n const {\r\n quantity,\r\n errorState: {\r\n configureErrors,\r\n quantityError,\r\n customAmountError,\r\n otherError,\r\n errorHost\r\n },\r\n selectedProduct,\r\n isUpdatingDimension,\r\n isUpdatingDeliveryOptions,\r\n isServiceItem,\r\n keyInPriceAmount\r\n } = state;\r\n\r\n const productAvailability = state.productAvailableQuantity ?\r\n state.productAvailableQuantity.ProductAvailableQuantity :\r\n productAvailableQuantity && productAvailableQuantity.length ?\r\n productAvailableQuantity[0].ProductAvailableQuantity : undefined;\r\n\r\n const onAddToCartFailed = (result: IAddToCartFailureResult) => {\r\n let quantityErrorForState: string | undefined;\r\n let customAmountErrorForState: string | undefined;\r\n let otherErrorForState: string | undefined = getGenericError(result, cart, resources, context, product, productAvailability, undefined);\r\n\r\n if (result?.failureReason === 'OUTOFSTOCK') {\r\n quantityErrorForState = result.failureReason === 'OUTOFSTOCK' ? getQuantityError(result.stockLeft, resources) : undefined;\r\n } else if (result && result.failureReason === 'CARTACTIONFAILED'\r\n && result.cartActionResult\r\n && (result.cartActionResult.substatus === 'MAXQUANTITY' || result.cartActionResult?.substatus === 'QUANTITYLIMITS')) {\r\n quantityErrorForState = getGenericError(result, cart, resources, context, product, productAvailability, undefined);\r\n otherErrorForState = undefined; // prevent error duplication in otherError and quantityError\r\n }\r\n\r\n if (result?.failureReason === 'INVALIDCUSTOMAMOUNT') {\r\n if (keyInPriceAmount === undefined || keyInPriceAmount < (minimumKeyInPrice || defaultMinimumKeyInPrice)) {\r\n const formatedAmountLimit = props.context.cultureFormatter?.formatCurrency(minimumKeyInPrice || defaultMinimumKeyInPrice);\r\n customAmountErrorForState = resources.invalidSmallCustomAmountText?.replace('{minAmount}', formatedAmountLimit);\r\n } else if (keyInPriceAmount > (maximumKeyInPrice || defaultMaximumKeyInPrice)) {\r\n const formatedAmountLimit = props.context.cultureFormatter?.formatCurrency(maximumKeyInPrice || defaultMaximumKeyInPrice);\r\n customAmountErrorForState = resources.invalidLargeCustomAmountText?.replace('{maxAmount}', formatedAmountLimit);\r\n }\r\n }\r\n\r\n callbacks.updateErrorState({\r\n errorHost: 'ADDTOCART',\r\n quantityError: quantityErrorForState,\r\n configureErrors: result?.failureReason === 'MISSINGDIMENSION' ? getConfigureErrors(result?.missingDimensions, resources, product?.IsGiftCard) : {},\r\n customAmountError: customAmountErrorForState,\r\n otherError: otherErrorForState\r\n });\r\n };\r\n\r\n const dialogStrings: IAddToCartResources = {\r\n goToCartText: resources.buyBoxGoToCartText,\r\n continueShoppingText: resources.buyBoxContinueShoppingText,\r\n headerItemOneText: resources.buyBoxSingleItemText,\r\n headerItemFormatText: resources.buyBoxMultiLineItemFormatText,\r\n headerMessageText: resources.buyBoxHeaderMessageText,\r\n freePriceText: resources.priceFree,\r\n originalPriceText: resources.originalPriceText,\r\n currentPriceText: resources.currentPriceText,\r\n addedQuantityText: resources.addedQuantityText,\r\n closeNotificationLabel: resources.closeNotificationLabel\r\n };\r\n\r\n const defaultImageSettings: IImageSettings = {\r\n viewports: {\r\n xs: { q: `w=240&h=240&m=6`, w: 0, h: 0 },\r\n lg: { q: `w=240&h=240&m=6`, w: 0, h: 0 },\r\n xl: { q: `w=240&h=240&m=6`, w: 0, h: 0 }\r\n },\r\n lazyload: true\r\n };\r\n\r\n const isLoading = typeName !== 'quickview' && props.data.productAvailableQuantity?.status === 'LOADING';\r\n if (isLoading) {\r\n callbacks.changeUpdatingDimension(false);\r\n }\r\n\r\n const isLoadingDeliveryOptions = typeName !== 'quickview' && props.data.deliveryOptions?.status === 'LOADING';\r\n if (isLoadingDeliveryOptions && callbacks.changeUpdatingDeliveryOptions) {\r\n callbacks.changeUpdatingDeliveryOptions(false);\r\n }\r\n\r\n telemetryContent = getTelemetryObject(props.context.request.telemetryPageName!, props.typeName, props.telemetry);\r\n\r\n // check if the product delivery mode is electronic\r\n const emailDeliveryModeCode = props.context.actionContext.requestContext.channel?.EmailDeliveryModeCode;\r\n const deliveryOptions = props.data.deliveryOptions?.result;\r\n const isEmailDelivery = ArrayExtensions.hasElements(deliveryOptions?.DeliveryOptions) && deliveryOptions!.DeliveryOptions[0].Code === emailDeliveryModeCode;\r\n const className = _getClassNamePrefix(typeName);\r\n\r\n const onItemAddedToCart = (result: ICartActionResult) => {\r\n if (typeName === 'quickview') {\r\n callbacks.changeModalOpen(false);\r\n }\r\n };\r\n\r\n return {\r\n ContainerProps: {\r\n className: `${className}__add-to-cart-container`\r\n },\r\n button: product && (\r\n \r\n ),\r\n errorBlock: (\r\n \r\n )\r\n };\r\n}\r\n\r\nexport function getBuyboxProductPrice(props: IBuyboxExtentedProps, state: IBuyboxState): React.ReactElement | undefined {\r\n const {\r\n id,\r\n typeName,\r\n context,\r\n resources\r\n } = props;\r\n\r\n return state.productPrice && (\r\n \r\n );\r\n}\r\n\r\nexport function getBuyboxProductRating(props: IBuyboxExtentedProps, productDetails?: IProductDetails): React.ReactElement | undefined {\r\n const {\r\n id,\r\n typeName,\r\n context,\r\n resources\r\n } = props;\r\n\r\n const ratingsSummary = props.data.ratingsSummary?.result ? props.data.ratingsSummary?.result : productDetails?.ratingsSummary!;\r\n\r\n const ratingComponent = ratingsSummary?.averageRating && (\r\n \r\n ) || undefined;\r\n\r\n return ratingsSummary && ratingComponent && (\r\n ratingComponent\r\n );\r\n}\r\n\r\nfunction generateAddToOrderTemplateDialogResources(resources: IBuyboxCommonResources): IAddToOrderTemplateDialogResources {\r\n return {\r\n addToOrderTemplateHeader: resources.addToOrderTemplateHeader,\r\n\r\n noOrderTemplatesMessage: resources.noOrderTemplatesMessage,\r\n noOrderTemplatesDescription: resources.noOrderTemplatesDescription,\r\n\r\n createAnOrderTemplateButtonText: resources.createAnOrderTemplateButtonText,\r\n createNewOrderTemplateButtonText: resources.createNewOrderTemplateButtonText,\r\n cancelOrderTemplateCreationButtonText: resources.cancelOrderTemplateCreationButtonText,\r\n\r\n selectTemplatesText: resources.selectTemplatesText,\r\n addToTemplateButtonText: resources.addToTemplateButtonText,\r\n lineItemsText: resources.lineItemsText\r\n };\r\n}\r\n\r\nfunction generateOrderTemplateNameDialogResources(resources: IBuyboxCommonResources): IOrderTemplateNameDialogResources {\r\n return {\r\n orderTemplateHeaderLabel: resources.createOrderTemplateHeader,\r\n orderTemplateTitleLabel: resources.orderTemplateTitle,\r\n orderTemplateNameAriaLabel: resources.orderTemplateNameAriaLabel,\r\n orderTemplateDescription: resources.createOrderTemplateDescription,\r\n\r\n defaultOrderTemplateName: resources.defaultOrderTemplateName,\r\n\r\n orderTemplateButtonLabel: resources.createOrderTemplateButtonText,\r\n orderTemplateCancelButtonLabel: resources.cancelNewOrderTemplateCreationButtonText\r\n };\r\n}\r\n\r\nfunction generateItemAddedToOrderTemplateDialogResources(resources: IBuyboxCommonResources): IItemAddedToOrderTemplateDialogResources {\r\n return {\r\n viewOrderTemplateButtonText: resources.viewOrderTemplateButtonText,\r\n continueShoppingButtonText: resources.continueShoppingButtonText,\r\n itemAddedToOrderTemplateHeaderItemOneText: resources.itemAddedToOrderTemplateHeaderItemOneText,\r\n itemAddedToOrderTemplateHeaderItemFormatText: resources.itemAddedToOrderTemplateHeaderItemFormatText,\r\n itemAddedToOrderTemplateHeaderMessageText: resources.itemAddedToOrderTemplateHeaderMessageText,\r\n freePriceText: resources.priceFree,\r\n originalPriceText: resources.originalPriceText,\r\n currentPriceText: resources.currentPriceText\r\n };\r\n}\r\n\r\nfunction generateDuplicateItemsWhenAddingToOrderTemplateDialogResources(resources: IBuyboxCommonResources): IDuplicateItemsWhenAddingToOrderTemplateDialogResources {\r\n return {\r\n duplicatedProductsHeader: resources.duplicatedProductsHeader,\r\n duplicatedProductsDescription: resources.duplicatedProductsDescription,\r\n updateQuantityButtonText: resources.updateQuantityButtonText,\r\n cancelDuplicateItemsButtonText: resources.cancelDuplicateItemsButtonText\r\n };\r\n}\r\n\r\nexport function getBuyboxProductAddToOrderTemplate(props: IBuyboxExtentedProps, state: IBuyboxState, callbacks: IBuyboxCallbacks): IBuyboxAddToOrderTemplateViewProps | undefined {\r\n const {\r\n id,\r\n typeName,\r\n context,\r\n data: {\r\n product: { result: product },\r\n orderTemplates: { result: orderTemplates },\r\n customerInformation: { result: customerInformation }\r\n },\r\n resources\r\n } = props;\r\n\r\n const\r\n {\r\n errorState: {\r\n configureErrors,\r\n quantityError,\r\n customAmountError,\r\n otherError,\r\n errorHost\r\n },\r\n quantity\r\n } = state;\r\n\r\n // If custom amount is selected, add-to-orderTemplate is disabled\r\n if (state.isCustomPriceSelected) {\r\n return undefined;\r\n }\r\n const className = _getClassNamePrefix(typeName);\r\n const onAddToOrderTemplateFailed = (result: IOrderTemplateActionErrorResult) => {\r\n callbacks.updateErrorState({\r\n errorHost: 'ORDER_TEMPLATE',\r\n configureErrors: result?.status === 'MISSING_DIMENSION' ? getConfigureErrors(result?.missingDimensions, resources, product?.IsGiftCard) : {}\r\n });\r\n };\r\n\r\n return {\r\n ContainerProps: {\r\n className: `${className}__add-to-order-template-container`\r\n },\r\n button: product && orderTemplates && (\r\n \r\n ),\r\n errorBlock: (\r\n \r\n )\r\n };\r\n}\r\n\r\nexport function getBuyboxProductAddToWishlist(props: IBuyboxExtentedProps, state: IBuyboxState, callbacks: IBuyboxCallbacks, productDetails?: IProductDetails): IBuyboxAddToWishlistViewProps | undefined {\r\n const {\r\n id,\r\n typeName,\r\n context,\r\n data: {\r\n wishlists: { result: wishlists }\r\n },\r\n resources\r\n } = props;\r\n\r\n const product = props.data.product?.result ? props.data.product?.result : productDetails?.product!;\r\n\r\n const\r\n {\r\n errorState: {\r\n configureErrors,\r\n quantityError,\r\n customAmountError,\r\n otherError,\r\n errorHost\r\n },\r\n selectedProduct\r\n } = state;\r\n\r\n // If custom amount is selected, add-to-wishlist is disabled\r\n if (state.isCustomPriceSelected) {\r\n return undefined;\r\n }\r\n\r\n const onAddToWishlistFailed = (result: IWishlistActionErrorResult) => {\r\n callbacks.updateErrorState({\r\n errorHost: 'WISHLIST',\r\n configureErrors: result?.status === 'MISSINGDIMENSION' ? getConfigureErrors(result?.missingDimensions, resources, product?.IsGiftCard) : {}\r\n });\r\n };\r\n const className = _getClassNamePrefix(typeName);\r\n\r\n return {\r\n ContainerProps: {\r\n className: `${className}__add-to-wishlist-container`\r\n },\r\n button: product && (\r\n \r\n ),\r\n errorBlock: (\r\n \r\n )\r\n };\r\n}\r\n\r\nexport function getBuyboxProductQuantity(props: IBuyboxExtentedProps, state: IBuyboxState, callbacks: IBuyboxCallbacks): IBuyboxProductQuantityViewProps {\r\n const {\r\n resources,\r\n typeName\r\n } = props;\r\n\r\n const\r\n {\r\n quantity,\r\n max,\r\n errorState: {\r\n quantityError\r\n }\r\n } = state;\r\n\r\n const onChange = (newValue: number) => {\r\n if (callbacks.updateQuantity) {\r\n callbacks.updateQuantity(newValue);\r\n }\r\n };\r\n const className = _getClassNamePrefix(typeName);\r\n\r\n return {\r\n ContainerProps: {\r\n className: `${className}__quantity`\r\n },\r\n LabelContainerProps: {\r\n tag: 'label',\r\n className: `${className}__product-quantity-label`,\r\n htmlFor: `${className}__product-quantity-input`\r\n },\r\n heading: (\r\n
{resources.productQuantityHeading}
\r\n ),\r\n errors: quantityError && (\r\n \r\n \r\n ),\r\n input: (\r\n \r\n )\r\n };\r\n}\r\n\r\nexport function getBuyboxShopSimilarButton(props: IBuyboxExtentedProps, buttonType: ShopSimiliarButtonType): IBuyboxShopSimilarLookViewProps {\r\n const {\r\n resources,\r\n context,\r\n data: {\r\n product: { result: product }\r\n },\r\n typeName\r\n } = props;\r\n\r\n const className = _getClassNamePrefix(typeName);\r\n const navigationUrl = (shopSimiliarButtonType: ShopSimiliarButtonType) => () => {\r\n const searchURL = getUrlSync('search', context?.actionContext);\r\n const separator = searchURL!.includes('?') ? '&' : '?';\r\n if (MSDyn365.isBrowser) {\r\n document.location.href = `${searchURL}${separator}productId=${product?.RecordId}&recommendation=${shopSimiliarButtonType}`;\r\n }\r\n };\r\n const telemetryText = buttonType === ShopSimiliarButtonType.Looks ? TelemetryConstant.ShopSimliarLooks : TelemetryConstant.ShopSimliarDescription;\r\n const payLoad = getPayloadObject('click', telemetryContent, telemetryText);\r\n const attribute = getTelemetryAttributes(telemetryContent, payLoad);\r\n const text = buttonType === ShopSimiliarButtonType.Looks ? resources.shopSimilarLooksText : resources.shopSimilarDescriptionText;\r\n\r\n return {\r\n ContainerProps: {\r\n className: `${className}__shopsimilar${buttonType}`\r\n },\r\n input: (\r\n \r\n {text}\r\n \r\n )\r\n };\r\n}\r\n\r\nexport function getBuyboxKeyInPrice(props: IBuyboxExtentedProps, state: IBuyboxState, callbacks: IBuyboxCallbacks): IBuyboxKeyInPriceViewProps {\r\n const {\r\n config,\r\n resources\r\n } = props;\r\n\r\n const\r\n {\r\n errorState: { }\r\n } = state;\r\n\r\n const className = _getClassNamePrefix(props.typeName);\r\n const onChange = (e: React.ChangeEvent) => {\r\n const value = e.currentTarget.value;\r\n callbacks.updateKeyInPrice(value.length ? Number(value) : parseFloat(value));\r\n };\r\n\r\n return {\r\n ContainerProps: {\r\n className: `${className}__key_in_price`\r\n },\r\n LabelContainerProps: {\r\n tag: 'label',\r\n className: `${className}__key_in_price-label`,\r\n htmlFor: `${className}__key_in_price`\r\n },\r\n heading: (\r\n
{resources.buyboxKeyInPriceLabelHeading}
\r\n ),\r\n input: (\r\n \r\n )\r\n };\r\n\r\n}\r\n\r\nexport const BuyboxErrorBlock: React.FC = ({ showError, configureErrors, quantityError, customAmountError, otherError, resources }) => {\r\n let errorMessages: (string | undefined)[] = [];\r\n\r\n errorMessages = Object.values(configureErrors).filter(message => message !== undefined);\r\n\r\n if (quantityError) {\r\n errorMessages.push(quantityError);\r\n }\r\n\r\n if (customAmountError) {\r\n errorMessages.push(customAmountError);\r\n }\r\n\r\n if (otherError) {\r\n errorMessages.push(otherError);\r\n }\r\n\r\n return (\r\n 0} color='danger' assertive={true} aria-label={resources.buyboxErrorMessageHeader} >\r\n \r\n {errorMessages.map((message, index) => {\r\n return (\r\n
{message}
\r\n );\r\n })}\r\n
\r\n );\r\n};\r\n\r\nexport function getQuantityLimitsMessages(props: IBuyboxExtentedProps, state: IBuyboxState): React.ReactElement | undefined {\r\n const {\r\n resources\r\n } = props;\r\n\r\n const\r\n {\r\n min,\r\n max\r\n } = state;\r\n\r\n if (!_isOrderQuantityLimitsFeatureEnabled(props)) {\r\n return undefined;\r\n }\r\n\r\n return (\r\n \r\n {_renderMaxLabel(max, resources.maxQuantityText)}\r\n {_renderMinLabel(min, resources.minQuantityText)}\r\n \r\n );\r\n}\r\n\r\nexport const RetailDefaultOrderQuantityLimitsFeatureName: string = 'Dynamics.AX.Application.RetailDefaultOrderQuantityLimitsFeature';\r\n\r\nconst _renderMaxLabel = (max: number | undefined, maxQuantityText: string, typeName?: string): React.ReactElement | undefined => {\r\n const className = _getClassNamePrefix(typeName ? typeName : '');\r\n if (max && max !== 0 && max !== Number.MAX_VALUE) {\r\n return (\r\n

\r\n {maxQuantityText?.replace('{max}', max.toString())}\r\n

\r\n );\r\n } else {\r\n return undefined;\r\n }\r\n};\r\n\r\nconst _renderMinLabel = (min: number | undefined, minQuantityText: string, typeName?: string): JSX.Element | undefined => {\r\n const className = _getClassNamePrefix(typeName ? typeName : '');\r\n if (min && min > 1) {\r\n return (\r\n

\r\n {minQuantityText?.replace('{min}', min.toString())}\r\n

\r\n );\r\n } else {\r\n return undefined;\r\n }\r\n};\r\n\r\nconst _isOrderQuantityLimitsFeatureEnabled = (props: IBuyboxExtentedProps): boolean | undefined => {\r\n const defaultOrderQuantityLimitsFeatureConfig = props.context?.request?.app?.platform?.enableDefaultOrderQuantityLimits;\r\n if (defaultOrderQuantityLimitsFeatureConfig === 'none') {\r\n return false;\r\n }\r\n\r\n if (defaultOrderQuantityLimitsFeatureConfig === 'all') {\r\n return true;\r\n }\r\n\r\n const customerInfo = props.data.customerInformation.result;\r\n return customerInfo &&\r\n ((defaultOrderQuantityLimitsFeatureConfig === 'b2b' && customerInfo.IsB2b) ||\r\n (defaultOrderQuantityLimitsFeatureConfig === 'b2c' && !customerInfo.IsB2b));\r\n};\r\n\r\nconst _getClassNamePrefix = (typeName: string | undefined): string => {\r\n return typeName?.toLowerCase() === 'quickview' ? 'ms-quickView' : 'ms-buybox';\r\n};\r\n","/* tslint:disable: no-duplicate-imports */\r\nimport { IBuyboxCallbacks, IBuyboxState } from '@msdyn365-commerce-modules/buybox';\r\nimport { NotificationsManager } from '@msdyn365-commerce-modules/notifications-core';\r\nimport { ArrayExtensions } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { getTelemetryObject, Heading, INodeProps, IPopupProps, Popup } from '@msdyn365-commerce-modules/utilities';\r\nimport { AddToCartBehavior, IAddToCartFailureResult, IAddToCartResources, ItemSuccessfullyAddedToCartNotification, PriceComponent } from '@msdyn365-commerce/components';\r\nimport MsDyn365, { getUrlSync, IImageSettings } from '@msdyn365-commerce/core';\r\nimport { DeliveryOption, OrgUnitLocation, ProductDimension } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport { IMfrmBuyboxData } from '../mfrm-buybox.data';\r\nimport { IMfrmBuyboxProps } from '../mfrm-buybox.props.autogenerated';\r\n\r\nimport { BuyboxErrorBlock } from '@msdyn365-commerce-modules/buybox';\r\nimport { getConfigureErrors, getGenericError } from '@msdyn365-commerce-modules/buybox';\r\n\r\nimport { ICartActionResult } from '@msdyn365-commerce/global-state';\r\n\r\nexport interface IFindInStoreFailureResult {\r\n missingDimensions?: ProductDimension[];\r\n}\r\n\r\nexport interface IBuyboxFindInStoreViewProps {\r\n storeSelector?: React.ReactNode;\r\n heading?: React.ReactNode;\r\n description?: React.ReactNode;\r\n errors?: React.ReactNode;\r\n button?: React.ReactNode;\r\n productPickupOptionList?: React.ReactNode;\r\n\r\n modal?: React.ReactNode;\r\n\r\n ContainerProps: INodeProps;\r\n\r\n openFindInStoreDialog(): Promise;\r\n}\r\n\r\n// tslint:disable-next-line:max-func-body-length\r\nexport function getBuyboxFindInStore(props: IMfrmBuyboxProps, state: IBuyboxState, callbacks: IBuyboxCallbacks): IBuyboxFindInStoreViewProps | undefined {\r\n const {\r\n data,\r\n slots: {\r\n storeSelector\r\n },\r\n resources: {\r\n priceFree,\r\n originalPriceText,\r\n currentPriceText,\r\n findInStoreHeaderText,\r\n findInStoreDescriptionText,\r\n findInStoreLinkText,\r\n buyBoxGoToCartText,\r\n buyBoxContinueShoppingText,\r\n buyBoxSingleItemText,\r\n buyBoxMultiLineItemFormatText,\r\n buyBoxHeaderMessageText\r\n /*descriptionTextToShowAllPickupOptions*/\r\n },\r\n context: {\r\n request: {\r\n channel: {\r\n PickupDeliveryModeCode\r\n } = { PickupDeliveryModeCode: undefined }\r\n }\r\n }\r\n } = props;\r\n const product = data?.product?.result;\r\n const price = data?.productPrice?.result;\r\n const storeSelectorStateManager = data?.storeSelectorStateManager?.result;\r\n const cart = data?.cart?.result;\r\n const deliveryOptions = data?.deliveryOptions?.result;\r\n const\r\n {\r\n errorState: {\r\n configureErrors,\r\n quantityError,\r\n otherError,\r\n errorHost\r\n },\r\n modalOpen,\r\n quantity\r\n } = state;\r\n\r\n const onClick = () => findInStoreOnClick(props, state, callbacks);\r\n\r\n if (!product || !storeSelectorStateManager || !ArrayExtensions.hasElements(storeSelector)) {\r\n return undefined;\r\n }\r\n\r\n // If no delivery options present on the product, or none of the delivery options\r\n // match the PickupDeliveryModeCode, that means the item cannot be used for BOPIS\r\n if (!deliveryOptions ||\r\n !deliveryOptions.DeliveryOptions ||\r\n !PickupDeliveryModeCode ||\r\n !deliveryOptions.DeliveryOptions.find((option: DeliveryOption) => option.Code === PickupDeliveryModeCode)) {\r\n return undefined;\r\n }\r\n\r\n const dialogStrings = {\r\n goToCartText: buyBoxGoToCartText,\r\n continueShoppingText: buyBoxContinueShoppingText,\r\n headerItemOneText: buyBoxSingleItemText,\r\n headerItemFormatText: buyBoxMultiLineItemFormatText,\r\n headerMessageText: buyBoxHeaderMessageText,\r\n freePriceText: priceFree,\r\n originalPriceText: originalPriceText,\r\n currentPriceText: currentPriceText\r\n };\r\n\r\n const priceComponent = price ? (\r\n ) : '';\r\n\r\n const defaultImageSettings: IImageSettings = {\r\n viewports: {\r\n xs: { q: `w=240&h=240&m=6`, w: 0, h: 0 },\r\n lg: { q: `w=240&h=240&m=6`, w: 0, h: 0 },\r\n xl: { q: `w=240&h=240&m=6`, w: 0, h: 0 }\r\n },\r\n lazyload: true\r\n };\r\n\r\n const popupProps: IPopupProps = {\r\n context: props.context,\r\n className: 'ms-buybox',\r\n id: props.id,\r\n typeName: props.typeName,\r\n data: { product: props.data.product?.result, price: props.data.productPrice?.result },\r\n dialogStrings: dialogStrings,\r\n imageSettings: defaultImageSettings,\r\n gridSettings: props.context.request.gridSettings,\r\n productQuantity: quantity,\r\n priceComponent: priceComponent,\r\n navigationUrl: getUrlSync('cart', props.context.actionContext),\r\n modalOpen: modalOpen,\r\n setModalOpen: callbacks.changeModalOpen\r\n };\r\n const renderModalPopup = ;\r\n\r\n return {\r\n ContainerProps: {\r\n className: 'ms-buybox__find-in-store'\r\n },\r\n\r\n storeSelector: storeSelector[0],\r\n\r\n openFindInStoreDialog: onClick,\r\n\r\n heading: (\r\n \r\n ),\r\n\r\n description: (\r\n

\r\n {findInStoreDescriptionText}\r\n

\r\n ),\r\n productPickupOptionList: null,\r\n errors: (\r\n \r\n ),\r\n\r\n button: (\r\n \r\n {findInStoreLinkText}\r\n \r\n ),\r\n\r\n modal: renderModalPopup\r\n };\r\n}\r\n\r\n// tslint:disable-next-line: max-func-body-length\r\nasync function findInStoreOnClick(props: IMfrmBuyboxProps, state: IBuyboxState, callbacks: IBuyboxCallbacks): Promise {\r\n const {\r\n data: {\r\n storeSelectorStateManager: { result: storeSelectorStateManager },\r\n cart: { result: cart },\r\n productAvailableQuantity: { result: productAvailableQuantity }\r\n },\r\n resources,\r\n context,\r\n modules\r\n } = props;\r\n\r\n const {\r\n selectedProduct,\r\n quantity\r\n } = state;\r\n\r\n let dataProduct = props.data.product.result;\r\n if (selectedProduct) {\r\n dataProduct = (await selectedProduct) || dataProduct;\r\n }\r\n\r\n if (!dataProduct || !storeSelectorStateManager) {\r\n return;\r\n }\r\n\r\n const product = dataProduct;\r\n\r\n const missingDimensions = product.Dimensions && product.Dimensions.filter((dimension: ProductDimension) => !(dimension.DimensionValue && dimension.DimensionValue.Value));\r\n\r\n let storeSelectorId: string = '';\r\n if (modules && Object.keys(modules).length > 0 && modules.storeSelector && modules.storeSelector.length > 0) {\r\n storeSelectorId = modules.storeSelector[0].id;\r\n }\r\n\r\n if (missingDimensions && missingDimensions.length > 0) {\r\n if (callbacks.updateErrorState) {\r\n callbacks.updateErrorState(\r\n {\r\n errorHost: 'FINDINSTORE',\r\n configureErrors: getConfigureErrors(missingDimensions, resources)\r\n }\r\n );\r\n }\r\n } else {\r\n storeSelectorStateManager.openDialog({\r\n product,\r\n id: storeSelectorId,\r\n deliveryOptions: undefined,\r\n onLocationSelected: (orgUnitLocation: OrgUnitLocation, deliveryMode: string) => {\r\n if (!cart) {\r\n return Promise.resolve();\r\n }\r\n\r\n const behavior = props.context?.app?.config?.addToCartBehavior;\r\n\r\n return cart.addProductToCart({ product: product, count: quantity, location: orgUnitLocation, deliveryMode: deliveryMode })\r\n .then((result: ICartActionResult) => {\r\n if (result.status === 'FAILED' && result.substatus === 'MAXQUANTITY') {\r\n callbacks.changeModalOpen(false);\r\n\r\n const productAvailability = state.productAvailableQuantity ?\r\n state.productAvailableQuantity.ProductAvailableQuantity :\r\n productAvailableQuantity && productAvailableQuantity.length ?\r\n productAvailableQuantity[0].ProductAvailableQuantity : undefined;\r\n\r\n const failureResult: IAddToCartFailureResult = { failureReason: 'CARTACTIONFAILED', cartActionResult: { status: result.status, substatus: result.substatus } };\r\n callbacks.updateErrorState({\r\n errorHost: 'ADDTOCART',\r\n configureErrors: {},\r\n otherError: getGenericError(failureResult, cart, resources, context, product, productAvailability, orgUnitLocation)\r\n });\r\n } else {\r\n callbacks.updateErrorState({\r\n configureErrors: {}\r\n });\r\n const navigationUrl = getUrlSync('cart', context.actionContext);\r\n if ((behavior === undefined || behavior === AddToCartBehavior.goToCart)) {\r\n if (result.status === 'SUCCESS' && navigationUrl && MsDyn365.isBrowser) {\r\n window.location.assign(navigationUrl);\r\n }\r\n } else if (behavior === AddToCartBehavior.showModal) {\r\n callbacks.changeModalOpen(true);\r\n } else if (behavior === AddToCartBehavior.showNotification) {\r\n const defaultImageSettings: IImageSettings = {\r\n viewports: {\r\n xs: { q: `w=240&h=240&m=6`, w: 0, h: 0 },\r\n lg: { q: `w=240&h=240&m=6`, w: 0, h: 0 },\r\n xl: { q: `w=240&h=240&m=6`, w: 0, h: 0 }\r\n },\r\n lazyload: true\r\n };\r\n const telemetryContent = getTelemetryObject(props.context.request.telemetryPageName!, props.friendlyName, props.telemetry);\r\n const dialogStrings: IAddToCartResources = {\r\n goToCartText: resources.buyBoxGoToCartText,\r\n continueShoppingText: resources.buyBoxContinueShoppingText,\r\n headerItemOneText: resources.buyBoxSingleItemText,\r\n headerItemFormatText: resources.buyBoxMultiLineItemFormatText,\r\n headerMessageText: resources.buyBoxHeaderMessageText,\r\n freePriceText: resources.priceFree,\r\n originalPriceText: resources.originalPriceText,\r\n currentPriceText: resources.currentPriceText,\r\n addedQuantityText: resources.addedQuantityText,\r\n closeNotificationLabel: resources.closeNotificationLabel\r\n };\r\n const notification = new ItemSuccessfullyAddedToCartNotification(\r\n props.context,\r\n dialogStrings,\r\n defaultImageSettings,\r\n props.context.request.gridSettings,\r\n product,\r\n props.data.productPrice?.result,\r\n quantity,\r\n navigationUrl,\r\n telemetryContent,\r\n props.id,\r\n props.typeName\r\n );\r\n NotificationsManager.instance().addNotification(notification);\r\n }\r\n }\r\n }).catch((error: Error) => {\r\n if (props.telemetry) {\r\n props.telemetry.exception(error);\r\n props.telemetry.debug('Unable to add product to cart');\r\n }\r\n return;\r\n });\r\n }\r\n }).catch((error: Error) => {\r\n if (props.telemetry) {\r\n props.telemetry.error(error.message);\r\n props.telemetry.debug('Unable to find in store');\r\n }\r\n return;\r\n });\r\n }\r\n\r\n return;\r\n}","import {\r\n getBuyboxProductConfigure,\r\n getBuyboxProductDescription,\r\n getBuyboxShopSimilarButton,\r\n IBuyboxAddToCartViewProps,\r\n IBuyboxAddToOrderTemplateViewProps,\r\n IBuyboxAddToWishlistViewProps,\r\n IBuyboxCallbacks,\r\n IBuyboxCommonData,\r\n IBuyboxExtentedProps,\r\n IBuyboxKeyInPriceViewProps,\r\n IBuyboxProductConfigureViewProps,\r\n IBuyboxProductQuantityViewProps,\r\n IBuyboxShopSimilarLookViewProps,\r\n IBuyboxState,\r\n IErrorState,\r\n ShopSimiliarButtonType\r\n} from '@msdyn365-commerce-modules/buybox';\r\nimport {\r\n FinitePromiseQueue,\r\n FinitePromiseQueueError,\r\n getDeliveryOptionsForSelectedVariant,\r\n GetDeliveryOptionsForSelectedVariantInput,\r\n getPriceForSelectedVariant,\r\n getProductPageUrlSync,\r\n getProductAvailabilitiesForSelectedVariant,\r\n IProductInventoryInformation,\r\n IPromiseQueue,\r\n PriceForSelectedVariantInput,\r\n ProductAvailabilitiesForSelectedVariantInput\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\nimport { IBuyboxGetDimensionVariantAvailabilityActionData } from '../../data-actions/buybox-get-dimension-variants-availability-action';\r\nimport { getTelemetryObject, IModuleProps, INodeProps, ITelemetryContent, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { format } from '@msdyn365-commerce-modules/utilities';\r\nimport { ProductDimensionFull } from '@msdyn365-commerce/commerce-entities';\r\nimport { RatingComponent } from '@msdyn365-commerce/components';\r\nimport MsDyn365, { getUrlSync, ICoreContext, RichTextComponent, Text } from '@msdyn365-commerce/core';\r\nimport {\r\n AsyncResult,\r\n CommerceProperty,\r\n ProductDeliveryOptions,\r\n ProductDimensionValue,\r\n ProductPrice,\r\n SimpleProduct,\r\n OrgUnitContact\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport { getAttributeValuesAsync, getDimensionValuesAsync, getVariantsByDimensionValuesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { AttributeValue, OrgUnitLocation, ReleasedProductType } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport classnames from 'classnames';\r\nimport { Popper, Tooltip, Rating } from 'mfcl';\r\nimport Info from 'mfcl/Icons/Info';\r\nimport dayjs from 'dayjs';\r\nimport * as React from 'react';\r\nimport Cookies from 'universal-cookie';\r\nimport _getViewPort from '../../Utilities/get-view-port';\r\nimport { addThrottledEvent } from '@msdyn365-commerce-modules/utilities';\r\nimport {\r\n IMFIATPInventoryEntity,\r\n IMFIATPInventoryStatusEntity,\r\n IMFIATPInventoryStatusResponse,\r\n IMFICartLine,\r\n IMFICLDeliveryScheduleParameters\r\n} from '../../actions/CoreProductDataServiceEntities.g';\r\nimport { IMFIItem, IMFIPromotion } from '../../actions/EyebrowMessageDataServiceEntities.g';\r\nimport getTryInStoreAction, { GetTryInStoreInfoInput } from '../../actions/get-try-in-store-info.action';\r\nimport { IMFITryInStore, IMFITryInStoreInfoResponse } from '../../actions/TryInStoreDataServiceEntities.g';\r\nimport getAllProductVariants, { BuyboxGetDimensionVariantAvailabilityInput } from '../../data-actions/buybox-get-all-variants-list';\r\nimport { IBuyboxGetDimensionPricingActionData } from '../../data-actions/buybox-get-dimension-pricing-action';\r\nimport { IStoreSelectorState } from '../../data-actions/store-selector-state';\r\nimport { fireAnalyticsLink } from '../../Utilities/analytics/clickTrack';\r\nimport { getBVAttributeValues } from '../../Utilities/get-bv-attributes';\r\nimport _getDeliveryByMessage from '../../Utilities/get-delivery-by-message';\r\nimport _getEyebrowMessage from '../../Utilities/get-eyebrow-message';\r\nimport _getInventoryQuantity from '../../Utilities/get-inventory-quantity';\r\nimport { buildProductBadge, parseBadgeData } from '../../Utilities/get-product-badge';\r\nimport { _coreProductATPCallForInventoryStatusForAllVariants, _getActivePrices } from '../../Utilities/mfrm-buybox-utils';\r\nimport { _getSoonestDeliveryDate } from '../../Utilities/product-search-result-utils';\r\nimport {\r\n getBuyboxAddToCart,\r\n getBuyBoxInventoryLabel,\r\n getBuyboxKeyInPrice,\r\n getBuyboxProductPrice,\r\n getBuyboxProductRating,\r\n getBuyboxProductTitle,\r\n getQuantityLimitsMessages\r\n} from './common/buybox-components';\r\nimport { getBuyboxFindInStore, IBuyboxFindInStoreViewProps } from './components/mfrm-buybox-find-in-store';\r\nimport { IMfrmBuyboxData } from './mfrm-buybox.data';\r\nimport { IMfrmBuyboxProps, IMfrmBuyboxResources } from './mfrm-buybox.props.autogenerated';\r\nimport { IVariantStockInfo } from './mfrm-buybox.view';\r\nimport { getTimeZoneAbbr, secondsToTime } from './../mfrm-store-selector/components/store-selector-location-line-item/date-time-helpers';\r\nimport { parseBrandName } from '../../Utilities/get-product-brand';\r\nimport { variantQueryStringName } from '../../Utilities/constants';\r\nimport { getZipCode } from '../../Utilities/get-zipcode';\r\nimport { BVRatingSummary } from '../../Utilities/components/BVRatingSummary';\r\nexport interface IBuyboxViewProps extends IMfrmBuyboxProps {\r\n state: IMFRMBuyBoxState;\r\n ModuleProps: IModuleProps;\r\n ProductInfoContainerProps: INodeProps;\r\n MediaGalleryContainerProps: INodeProps;\r\n callbacks: IBuyboxCallbacks;\r\n mediaGallery?: React.ReactNode;\r\n title?: React.ReactNode;\r\n description?: React.ReactNode;\r\n rating?: React.ReactNode;\r\n price?: React.ReactNode;\r\n addToOrderTemplate?: IBuyboxAddToOrderTemplateViewProps;\r\n addToWishlist?: IBuyboxAddToWishlistViewProps;\r\n max: number | undefined;\r\n addToCart: IBuyboxAddToCartViewProps;\r\n viewCartLink: string | undefined;\r\n showViewCartLink: boolean;\r\n findInStore?: IBuyboxFindInStoreViewProps;\r\n quantity?: IBuyboxProductQuantityViewProps;\r\n configure?: IBuyboxProductConfigureViewProps;\r\n inventoryLabel?: React.ReactNode;\r\n shopSimilarLook?: IBuyboxShopSimilarLookViewProps;\r\n shopSimilarDescription?: IBuyboxShopSimilarLookViewProps;\r\n quantityLimitsMessages: React.ReactNode;\r\n telemetryContent?: ITelemetryContent;\r\n keyInPrice?: IBuyboxKeyInPriceViewProps;\r\n storeSelectorState?: AsyncResult;\r\n updateDimension?: boolean;\r\n promotionalMessage?: string | undefined;\r\n adjustableItemset?: SimpleProduct;\r\n pillow?: SimpleProduct;\r\n protector?: SimpleProduct;\r\n isEyeBrowLoading?: boolean;\r\n isStoreLoading?: boolean;\r\n updateSuccessfulATC?(): void;\r\n getProductType(shippingInformation: string | undefined): string;\r\n setAllProductVariantsResult(result: IBuyboxGetDimensionVariantAvailabilityActionData[]): void;\r\n}\r\nexport interface IMFRMExtendCommonData extends IBuyboxCommonData {\r\n storeSelectorState?: AsyncResult;\r\n}\r\n// VSI Customization\r\nexport interface IMFRMBuyBoxState extends IBuyboxState {\r\n smallParcelATCallMade: boolean;\r\n StatusATPCall: boolean;\r\n ATPCall: boolean;\r\n recordId?: number;\r\n itemId?: string | undefined;\r\n masterProductId?: number | undefined;\r\n extensionProps: CommerceProperty[];\r\n eyebrowMessageResultState: IMFIPromotion[] | null;\r\n tryInStoresResults?: IMFITryInStoreInfoResponse | {};\r\n OrgUnitNumber?: string | undefined;\r\n deliveryMessage?: string;\r\n deliveryMessageATPResultState: IMFIATPInventoryEntity[] | null;\r\n inventoryStatusATPResultState: IMFIATPInventoryStatusEntity | null;\r\n successfulATC: boolean;\r\n currentProduct: SimpleProduct | undefined;\r\n currentProductDimensions: ProductDimensionFull[] | undefined;\r\n variantAvailibilityList: IBuyboxGetDimensionVariantAvailabilityActionData[];\r\n variantAvailibilityUpdating: boolean;\r\n batchedAtpInventoryStatusData: IMFIATPInventoryStatusResponseEx | null;\r\n variantIdForTracking: string;\r\n ecomAllVairantStockInfoConcatenated: string[];\r\n showViewCartLink: boolean;\r\n isStoreDetailsOpen: boolean;\r\n isDesktop: boolean;\r\n zipCode: string;\r\n isEyeBrowLoading: boolean;\r\n isStoreLoading: boolean;\r\n preferredStore: any;\r\n tealiumRecordIdFor: any;\r\n}\r\nexport interface IMFRMNetworkCallsState {\r\n smallParcelATCallMade: boolean;\r\n StatusATPCall: boolean;\r\n ATPCall: boolean;\r\n setSmallParcelATPCallMade(atpCallMade: boolean): void;\r\n setStatusATPCall(atpCallMade: boolean): void;\r\n setZipCode(zipCode: string): void;\r\n setATPCall(atpCallMade: boolean): void;\r\n}\r\n\r\nexport interface IMFIATPInventoryStatusResponseEx extends IMFIATPInventoryStatusResponse {\r\n zipCode?: string | undefined\r\n}\r\n\r\nexport interface IMFRMProductMExtensionPropsInfo {\r\n extensionProps?: CommerceProperty[];\r\n productBadges?: React.ReactNode | undefined;\r\n ratingComponent?: React.ReactNode | undefined;\r\n _renderTryInStore?: JSX.Element | null;\r\n _renderTryInStoreRedesign?: JSX.Element | null;\r\n eyeBrowMessage?: JSX.Element | null;\r\n deliveryMessage?: string;\r\n ATPDataFromBusiness?: IMFIATPInventoryEntity[] | null;\r\n ATPDataInventoryStausBusiness?: IMFIATPInventoryStatusEntity | null;\r\n ecomAllVairantStockInfoConcatenated: string[];\r\n customerSatisfactionScore?: JSX.Element;\r\n adjustableItem?: SimpleProduct;\r\n pillow?: SimpleProduct;\r\n protector?: SimpleProduct;\r\n}\r\n\r\nexport interface IExtendedSimpleProduct extends SimpleProduct {\r\n priceAfterDiscount?: number;\r\n price?: number;\r\n discount?: number;\r\n productSizeName?: string;\r\n}\r\n\r\nexport const getProductURLForUtag = (product: SimpleProduct | undefined, context: ICoreContext): string => {\r\n const productUrl = getProductPageUrlSync(product?.Name || '', product?.RecordId || 0, context?.actionContext, undefined);\r\n return `${context.request.url.requestUrl.origin}${productUrl}?variantid=${product?.RecordId}`;\r\n};\r\n\r\nexport const getProductSizeForUTag = (product: SimpleProduct | undefined): string | undefined => {\r\n //TODO remove magic numbers like 3 and use constant like DIMENSION_SIZE_TYPE\r\n return product?.Dimensions?.find(item => item.DimensionTypeValue === 3)?.DimensionValue?.Value?.toLowerCase();\r\n};\r\n\r\n\r\n/**\r\n * Buybox Module\r\n */\r\nclass Buybox extends React.PureComponent, IMFRMBuyBoxState> {\r\n private resizeThrottledEventHandler?: (event: Event) => void;\r\n /**\r\n * A queue of tasks of processing the changes in the dimensions.\r\n * Limit to two processes:\r\n * 1 - for the current process, which is under execution at the moment.\r\n * 2 - next process, which will process the latest version of data.\r\n * @remark Enqueueing new promises will discard the previous ones (except the one which is under processing).\r\n */\r\n //Constructor\r\n constructor(props: IMfrmBuyboxProps) {\r\n super(props);\r\n this.state = {\r\n errorState: {\r\n configureErrors: {}\r\n },\r\n quantity: 1,\r\n min: undefined,\r\n max: undefined,\r\n selectedProduct: undefined,\r\n productPrice: undefined,\r\n productDeliveryOptions: undefined,\r\n modalOpen: false,\r\n isUpdatingDimension: false,\r\n isUpdatingDeliveryOptions: false,\r\n smallParcelATCallMade: false,\r\n StatusATPCall: false,\r\n ATPCall: false,\r\n recordId: this.props.data.product.result?.RecordId,\r\n itemId: this.props.data.product.result?.ItemId,\r\n masterProductId: this.props.data.product.result?.MasterProductId,\r\n extensionProps: [],\r\n eyebrowMessageResultState: null,\r\n deliveryMessage: '',\r\n deliveryMessageATPResultState: null,\r\n inventoryStatusATPResultState: null,\r\n successfulATC: false,\r\n currentProduct: undefined,\r\n currentProductDimensions: undefined,\r\n variantAvailibilityList: [],\r\n variantAvailibilityUpdating: false,\r\n batchedAtpInventoryStatusData: null,\r\n variantIdForTracking: '',\r\n ecomAllVairantStockInfoConcatenated: [],\r\n showViewCartLink: false,\r\n isStoreDetailsOpen: false,\r\n isDesktop: false,\r\n zipCode: '',\r\n isEyeBrowLoading: true,\r\n isStoreLoading: true,\r\n preferredStore: {},\r\n tealiumRecordIdFor: ''\r\n };\r\n this.telemetryContent = getTelemetryObject(props.context.request.telemetryPageName!, props.friendlyName, props.telemetry);\r\n this.updateSuccessfulATC = this.updateSuccessfulATC.bind(this);\r\n this._setAllProductVariantsResult = this._setAllProductVariantsResult.bind(this);\r\n this.timer = null;\r\n this.wrapperRef = React.createRef();\r\n this.handleClickOutside = this.handleClickOutside.bind(this);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._updateUtagDataOnInitialLoad();\r\n }\r\n //React Lifecycle methods\r\n public async componentDidMount(): Promise {\r\n const {\r\n data: {\r\n product: { result: product },\r\n productPrice,\r\n cart: { result: cart }\r\n },\r\n context: {\r\n request: { }\r\n }\r\n } = this.props;\r\n if (MsDyn365.isBrowser) {\r\n this.updateViewPort(this.props.context);\r\n }\r\n document.addEventListener(\"mousedown\", this.handleClickOutside);\r\n // set availability list for all variants\r\n if (this.props.data.productSpecificationData.result?.length) {\r\n this.props.data.allVariants.result &&\r\n this._updateAvailbilityForVariantsUpdated(\r\n this.props.data.allVariants.result,\r\n this.props,\r\n this.props.data.productSpecificationData.result\r\n );\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n productPrice.then(async result => {\r\n this._updatePrice(result);\r\n });\r\n if (product) {\r\n // check if the product is service or not by product type\r\n const PRODUCTASSERVICE = 2 as ReleasedProductType.Service;\r\n\r\n if (product.ItemTypeValue === PRODUCTASSERVICE) {\r\n this.setState({ isServiceItem: true });\r\n }\r\n await this._updateQuantitiesInState(product);\r\n // VSI - Customization Start 48959\r\n if (product.MasterProductId) {\r\n await this._eyeBrowMessageAsyncFunc(true);\r\n }\r\n // VSI - Customization End 48959\r\n const canTryInStores = this._getProductSpecificationAttributeByKeyName('try in store');\r\n !canTryInStores && this.setState({ isStoreLoading: false });\r\n canTryInStores && (await this._tryInStoreAsyncCall());\r\n }\r\n if (\r\n this.props.data.product.result?.RecordId !== this.state.recordId ||\r\n this.props.data.product.result?.ItemId !== this.state.itemId\r\n ) {\r\n this.setState({\r\n recordId: this.props.data.product.result!.RecordId,\r\n masterProductId: this.props.data.product.result!.MasterProductId,\r\n itemId: this.props.data.product.result!.ItemId\r\n });\r\n }\r\n if (this.state.recordId && this.state.masterProductId && this.state.itemId) {\r\n this._setRecentlyViewProducts(this.state.recordId, this.state.masterProductId);\r\n }\r\n const newCartTotalItems = cart && cart.totalItemsInCart ? cart.totalItemsInCart : 0;\r\n if (newCartTotalItems && newCartTotalItems > 0) {\r\n this.setState({\r\n showViewCartLink: true\r\n });\r\n }\r\n else {\r\n this.setState({\r\n showViewCartLink: false\r\n });\r\n\r\n }\r\n const zipCode = getZipCode(this.props.context.actionContext);\r\n zipCode && this.setState({ zipCode: zipCode });\r\n\r\n const isSociEnabled = this.props.app.config.enableSociLocations || false;\r\n const preferredStore = isSociEnabled ? this._getSociPreferredStore() : this._getPreferredStore();\r\n (!preferredStore || Object.keys(preferredStore).length === 0) && this.setState({ isStoreLoading: false });\r\n preferredStore && this.setState({ preferredStore: preferredStore });\r\n }\r\n\r\n // tslint:disable-next-line: cyclomatic-complexity\r\n public async componentDidUpdate(prevProps: IMfrmBuyboxProps, prevState: IMFRMBuyBoxState): Promise {\r\n const {\r\n data: {\r\n product: { result: product },\r\n cart: { result: cart }\r\n }\r\n } = this.props;\r\n if (MsDyn365.isBrowser) {\r\n this.resizeThrottledEventHandler = addThrottledEvent(window, 'resize', () => this.updateViewPort(this.props.context));\r\n }\r\n prevState.selectedProduct?.then(selProd => {\r\n this.state.selectedProduct?.then(async currSelProd => {\r\n if (selProd?.RecordId !== currSelProd?.RecordId) {\r\n this.setState({ smallParcelATCallMade: false });\r\n }\r\n });\r\n });\r\n\r\n if (\r\n this.props.data.product.result?.RecordId !== this.state.recordId ||\r\n this.props.data.product.result?.ItemId !== this.state.itemId\r\n ) {\r\n this.setState(\r\n {\r\n currentProduct: this.props.data.product.result,\r\n recordId: this.props.data.product.result!.RecordId,\r\n masterProductId: this.props.data.product.result!.MasterProductId,\r\n itemId: this.props.data.product.result!.ItemId,\r\n StatusATPCall: false,\r\n ATPCall: false\r\n },\r\n async () => {\r\n this.state.recordId && this._setRecentlyViewProducts(this.state.recordId, this.state.masterProductId);\r\n // VSI - Customization Start 48959\r\n const allVariants = this.props?.data?.allVariants?.result ? this.props?.data?.allVariants?.result : [];\r\n await this.setDefaultOOSVariant(allVariants);\r\n await this._eyeBrowMessageAsyncFunc(true);\r\n // VSI - Customization End 48959\r\n }\r\n );\r\n }\r\n const canTryInStores = this._getProductSpecificationAttributeByKeyName('try in store');\r\n const isSociEnabled = this.props.app.config.enableSociLocations || false;\r\n if (canTryInStores) {\r\n if (isSociEnabled) {\r\n await this._tryInStoreAsyncCall();\r\n } else {\r\n const preferredStore = this._getPreferredStore();\r\n if (preferredStore?.OrgUnitNumber && this.state.OrgUnitNumber && this.state.OrgUnitNumber !== preferredStore.OrgUnitNumber) {\r\n await this._tryInStoreAsyncCall();\r\n }\r\n }\r\n }\r\n\r\n if (this.state.extensionProps.length <= 0 && this.props.data.product.result) {\r\n if (this.props.data.product?.result?.ExtensionProperties && this.props.data.product?.result?.ExtensionProperties.length >= 1) {\r\n this.setState({ extensionProps: this.props.data.product.result.ExtensionProperties });\r\n }\r\n }\r\n const newCartTotalItems = cart && cart.totalItemsInCart ? cart.totalItemsInCart : 0;\r\n if (newCartTotalItems && newCartTotalItems > 0) {\r\n this.setState({\r\n showViewCartLink: true\r\n });\r\n }\r\n else {\r\n this.setState({\r\n showViewCartLink: false\r\n });\r\n }\r\n\r\n if (this.state.tealiumRecordIdFor === '' || (this.props.data.product.result?.RecordId !== this.state.recordId)) {\r\n for (const element of this.state.ecomAllVairantStockInfoConcatenated) {\r\n const [recordId, isInStock] = element && element.split('|');\r\n if (product?.RecordId.toString() === recordId && isInStock === '0') {\r\n // product found that is in stock then no need to loop through other values\r\n await this._sendProductDataToTealium(this.props, product);\r\n break;\r\n } else if (product?.RecordId.toString() === recordId && isInStock === '1') {\r\n break;\r\n }\r\n }\r\n }\r\n const zipCode = getZipCode(this.props.context.actionContext);\r\n zipCode && zipCode !== this.state.zipCode && this.setState({ zipCode: zipCode });\r\n\r\n if (this.state.zipCode !== prevState.zipCode) {\r\n this.props.data.allVariants.result && this.props.data.productSpecificationData.result?.length &&\r\n this._updateAvailbilityForVariantsUpdated(\r\n this.props.data.allVariants.result,\r\n this.props,\r\n this.props.data.productSpecificationData.result\r\n );\r\n }\r\n }\r\n\r\n public async componentWillUnmount(): Promise {\r\n if (this.timer) {\r\n clearTimeout(this.timer);\r\n }\r\n document.removeEventListener(\"mousedown\", this.handleClickOutside);\r\n MsDyn365.isBrowser && window.removeEventListener('resize', this.resizeThrottledEventHandler!, false);\r\n }\r\n\r\n private updateViewPort = (context: ICoreContext): void => {\r\n const viewport = _getViewPort(context);\r\n if (viewport === 'lg' || viewport === 'xl') {\r\n this.setState({\r\n isDesktop: true\r\n });\r\n } else {\r\n this.setState({\r\n isDesktop: false\r\n });\r\n }\r\n };\r\n\r\n //Public methods\r\n public updateSuccessfulATC = (): void => {\r\n this.setState({ successfulATC: true });\r\n this.timer = setTimeout(() => {\r\n this.setState({ successfulATC: false });\r\n }, 4500);\r\n };\r\n\r\n public extendAllProductVariants(\r\n allProductVariants: SimpleProduct[] | undefined,\r\n prices: IBuyboxGetDimensionPricingActionData[]\r\n ): IExtendedSimpleProduct[] | undefined {\r\n let extendedAllProductVariants: IExtendedSimpleProduct[] | undefined =\r\n allProductVariants &&\r\n allProductVariants?.map(variant => {\r\n let extendedObj: IExtendedSimpleProduct = { ...variant };\r\n variant.Dimensions?.forEach(dimension => {\r\n if (dimension.DimensionTypeValue === 3) {\r\n extendedObj = { productSizeName: dimension.DimensionValue?.Value, ...variant };\r\n }\r\n });\r\n return extendedObj;\r\n });\r\n extendedAllProductVariants =\r\n extendedAllProductVariants &&\r\n extendedAllProductVariants.map(variant => {\r\n let extendedObj: IExtendedSimpleProduct = { ...variant };\r\n prices?.forEach(dimensionPrice => {\r\n if (dimensionPrice?.discountAmount && dimensionPrice?.name === variant?.productSizeName) {\r\n const priceAfterDiscount = Math.round(dimensionPrice?.price - dimensionPrice?.discountAmount);\r\n extendedObj = {\r\n discount: dimensionPrice?.discountAmount,\r\n price: dimensionPrice?.price,\r\n priceAfterDiscount: priceAfterDiscount,\r\n ...variant\r\n };\r\n }\r\n });\r\n return extendedObj;\r\n });\r\n return extendedAllProductVariants;\r\n }\r\n\r\n public handleClickOutside(event: any): void {\r\n if (this.wrapperRef && !this.wrapperRef.current?.contains(event.target)) {\r\n this.setState({ isStoreDetailsOpen: false });\r\n }\r\n\r\n }\r\n\r\n //Public async methods\r\n public async getNextInventoryProduct(\r\n product: SimpleProduct | undefined,\r\n productSpecificationData: AttributeValue[] | undefined,\r\n allProductVariants: IExtendedSimpleProduct[] | undefined,\r\n context: ICoreContext<{\r\n [x: string]: any;\r\n }>,\r\n variantAvailibilityList: IBuyboxGetDimensionVariantAvailabilityActionData[]\r\n ): Promise {\r\n const {\r\n app: {\r\n config: { smallParcelAttributeKey }\r\n }\r\n } = context;\r\n\r\n const smallParcelVariantsListObj = {};\r\n variantAvailibilityList?.forEach(obj => {\r\n const key = obj?.variantID;\r\n smallParcelVariantsListObj[key] = obj;\r\n });\r\n\r\n const shippingInformation = productSpecificationData\r\n ?.find(attr => attr.Name?.trim() === smallParcelAttributeKey)\r\n ?.TextValue?.toLowerCase();\r\n const productType = this._getProductType(shippingInformation).toLowerCase();\r\n let isProductFound = false;\r\n let inStockLowestPriceVariant;\r\n\r\n // to check that if current loaded variant is OOS or not\r\n for (const element of this.state.ecomAllVairantStockInfoConcatenated) {\r\n const [recordId, isInStock] = element && element.split('|');\r\n if (product?.RecordId.toString() === recordId && isInStock === '0') {\r\n // product found that is in stock then no need to loop through other values\r\n inStockLowestPriceVariant = product;\r\n isProductFound = true;\r\n break;\r\n } else if (product?.RecordId.toString() === recordId && isInStock === '1') {\r\n break;\r\n }\r\n }\r\n\r\n // if current loaded variant is OOS then check the others\r\n !isProductFound &&\r\n allProductVariants?.filter(variantObj => {\r\n if (!isProductFound) {\r\n for (const element of this.state.ecomAllVairantStockInfoConcatenated) {\r\n const [recordId, isInStock] = element && element.split('|');\r\n if (variantObj?.RecordId.toString() === recordId && isInStock === '0') {\r\n // product found that is in stock then no need to loop through other values\r\n const smallParcelProduct = smallParcelVariantsListObj[variantObj?.RecordId];\r\n if (productType === 'small parcel') {\r\n if (smallParcelProduct?.isAvailable === true &&\r\n variantObj?.RecordId === smallParcelProduct?.variantID) {\r\n inStockLowestPriceVariant = variantObj;\r\n isProductFound = true;\r\n break;\r\n }\r\n } else {\r\n inStockLowestPriceVariant = variantObj;\r\n isProductFound = true;\r\n break;\r\n }\r\n } else if (variantObj.RecordId.toString() === recordId) {\r\n // isInStock is 0 but record id is matched then no need to loop through other values\r\n break;\r\n }\r\n }\r\n }\r\n });\r\n return inStockLowestPriceVariant;\r\n }\r\n\r\n public async makeCoreProductDeliveryMessage(str: string): Promise {\r\n const {\r\n data: {\r\n productSpecificationData: { result: productSpecificationData }\r\n },\r\n context: {\r\n app: {\r\n config: { smallParcelAttributeKey }\r\n }\r\n }\r\n } = this.props;\r\n const outOfStock = productSpecificationData?.find(\r\n attr => attr.Name?.trim().toLowerCase() === this.props.context.app.config.outOfStockProductKey?.trim().toLowerCase()\r\n )?.BooleanValue;\r\n const shippingInformation = productSpecificationData\r\n ?.find(attr => attr.Name?.trim() === smallParcelAttributeKey)\r\n ?.TextValue?.toLowerCase();\r\n\r\n if (this._getProductType(shippingInformation).toLowerCase() === 'core' && !this.state.ATPCall && !outOfStock) {\r\n this.setState({ ATPCall: true });\r\n await this.getDeliverySlotFromATP(true);\r\n } else if (this._getProductType(shippingInformation).toLowerCase() === 'small parcel' && !outOfStock) {\r\n this.setState({ StatusATPCall: true });\r\n // await this.getInventoryStatusCall(true);\r\n const inventoryStatusData = this.state.batchedAtpInventoryStatusData?.ATPInventoryStatusData\r\n ? this.state.batchedAtpInventoryStatusData?.ATPInventoryStatusData\r\n : null;\r\n let selectedObj = inventoryStatusData\r\n ? inventoryStatusData?.find(item => item.VariantRecordId?.toString() === this.state.currentProduct?.RecordId?.toString())\r\n : null;\r\n selectedObj = selectedObj ? { ...selectedObj, zipCode: inventoryStatusData![0]?.zipCode } : null;\r\n this.setState({ inventoryStatusATPResultState: selectedObj });\r\n }\r\n }\r\n\r\n public async getVariantID(updatedProduct?: SimpleProduct | undefined): Promise {\r\n const {\r\n data: {\r\n product: { result: product }\r\n },\r\n context: { actionContext, request }\r\n } = this.props;\r\n const { RecordId, ItemId } = updatedProduct && updatedProduct !== undefined ? updatedProduct : product || {};\r\n let variantId: string | undefined;\r\n if (product?.MasterProductId && product?.MasterProductId > 0) {\r\n const input = new BuyboxGetDimensionVariantAvailabilityInput(product.MasterProductId, request.apiSettings.channelId);\r\n const variantsResp: SimpleProduct[] = await getAllProductVariants(input, actionContext);\r\n for (let variantIter = 0;variantIter < variantsResp.length;variantIter++) {\r\n if (variantsResp[variantIter].RecordId === RecordId) {\r\n const ePropsVariant = variantsResp[variantIter].ExtensionProperties!;\r\n if (ePropsVariant?.length > 0) {\r\n for (let eIter = 0;eIter < ePropsVariant?.length;eIter++) {\r\n if (ePropsVariant[eIter].Key === 'RetailVariantId') {\r\n variantId = ePropsVariant[eIter].Value?.StringValue;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n const variantofId = `V000${ItemId}`;\r\n variantId = variantofId?.slice(0, -1);\r\n }\r\n\r\n return variantId;\r\n }\r\n\r\n //Private methods\r\n private dimensionUpdateQueue: IPromiseQueue = new FinitePromiseQueue(2);\r\n private dimensions: { [id: number]: string } = {};\r\n private telemetryContent: ITelemetryContent;\r\n private timer: NodeJS.Timeout | null;\r\n private wrapperRef: React.RefObject;\r\n\r\n private buyboxCallbacks: IBuyboxCallbacks = {\r\n updateQuantity: (newQuantity: number): boolean => {\r\n const errorState = { ...this.state.errorState };\r\n errorState.quantityError = undefined;\r\n errorState.otherError = undefined;\r\n if (this.state.quantity !== newQuantity) {\r\n fireAnalyticsLink({\r\n eventName: 'PDP-card-action',\r\n eventCategory: 'PDP Card Action',\r\n eventAction: 'Change Quantity',\r\n eventLabel: 'Change Quantity PDP',\r\n eventNoninteraction: 'false',\r\n generalConfig: { enhanced_action: 'change_quantity' }\r\n });\r\n }\r\n\r\n this.setState({ quantity: newQuantity, errorState: errorState });\r\n return true;\r\n },\r\n updateErrorState: (newErrorState: IErrorState): void => {\r\n this.setState({ errorState: newErrorState });\r\n },\r\n updateSelectedProduct: (\r\n newSelectedProduct: Promise,\r\n newInventory: IProductInventoryInformation | undefined,\r\n newPrice: ProductPrice | undefined,\r\n newDeliveryOptions: ProductDeliveryOptions | undefined\r\n ): void => {\r\n this.setState({\r\n selectedProduct: newSelectedProduct,\r\n productAvailableQuantity: newInventory,\r\n productDeliveryOptions: newDeliveryOptions\r\n });\r\n this._updatePrice(newPrice);\r\n },\r\n dimensionSelectedAsync: (selectedDimensionId: number, selectedDimensionValueId: string): Promise => {\r\n this.dimensions[selectedDimensionId] = selectedDimensionValueId;\r\n return this.dimensionUpdateQueue\r\n .enqueue(() => {\r\n return this._updateDimensions();\r\n })\r\n .catch((reason: any) => {\r\n // tslint:disable-line:no-any\r\n // Ignore discarded processes.\r\n if (reason !== FinitePromiseQueueError.ProcessWasDiscardedFromTheQueue) {\r\n throw reason;\r\n }\r\n });\r\n },\r\n getDropdownName: (dimensionType: number, resources: IMfrmBuyboxResources): string => {\r\n return this._getDropdownName(dimensionType, resources);\r\n },\r\n changeModalOpen: (isModalOpen: boolean): void => {\r\n this.setState({ modalOpen: isModalOpen });\r\n },\r\n changeUpdatingDimension: (isUpdatingDimension: boolean): void => {\r\n this.setState({ isUpdatingDimension: isUpdatingDimension });\r\n },\r\n /**\r\n * Update isUpdatingDeliveryOptions state.\r\n *\r\n * @param isUpdatingDeliveryOptions - The status of updating delivery options.\r\n */\r\n changeUpdatingDeliveryOptions: (isUpdatingDeliveryOptions: boolean): void => {\r\n this.setState({ isUpdatingDeliveryOptions });\r\n },\r\n updateKeyInPrice: (customPrice: number): void => {\r\n // Remove custom amount error when updating the custom price\r\n const errorState = { ...this.state.errorState };\r\n errorState.customAmountError = undefined;\r\n\r\n this.setState({ isPriceKeyedIn: true, keyInPriceAmount: customPrice, errorState: errorState });\r\n this._updatePrice(this.state.productPrice, customPrice);\r\n }\r\n };\r\n\r\n private _updateURLWithoutReloading(product: SimpleProduct | undefined) {\r\n if (this.props.context.app.config.queryBasedVariantSelection) {\r\n try {\r\n if (MsDyn365.isBrowser) {\r\n const queryParamValue = variantQueryStringName;\r\n const masterId = product?.MasterProductId;\r\n const currUrl = window.location.href;\r\n const urlWithIgnoredCase = new URL(currUrl.toString().toLocaleLowerCase());\r\n if (masterId && currUrl.indexOf(`${masterId}.p`) !== -1) {\r\n if (urlWithIgnoredCase.searchParams.has(queryParamValue)) {\r\n if (urlWithIgnoredCase.searchParams.get(queryParamValue) === product?.RecordId?.toString()) {\r\n return;\r\n }\r\n }\r\n urlWithIgnoredCase.searchParams.set(queryParamValue, product?.RecordId.toString() || '');\r\n window.history.replaceState(window.history.state, '', urlWithIgnoredCase.toString().replace(urlWithIgnoredCase.host, window.location.host));\r\n } else if (masterId && currUrl.indexOf(`${masterId}.p`) === -1) {\r\n const productUrl = getProductPageUrlSync(\r\n product?.Name || '',\r\n masterId || 0,\r\n this.props.context && this.props.context.actionContext,\r\n undefined\r\n );\r\n if (urlWithIgnoredCase.searchParams.has(queryParamValue)) {\r\n if (urlWithIgnoredCase.searchParams.get(queryParamValue) === product?.RecordId?.toString()) {\r\n //pushstate only in this case, as here we need to update url with masterid\r\n window.history.pushState({}, '', urlWithIgnoredCase.search ? `${productUrl}${urlWithIgnoredCase.search}` : productUrl);\r\n return;\r\n }\r\n }\r\n urlWithIgnoredCase.searchParams.set(queryParamValue, product?.RecordId.toString() || '');\r\n window.history.pushState({}, '', urlWithIgnoredCase.search ? `${productUrl}${urlWithIgnoredCase.search}` : productUrl);\r\n }\r\n }\r\n } catch (error) {\r\n console.log('Error [_updateURLWithoutReloading]', error);\r\n }\r\n } else {\r\n const currUrl = window.location.href;\r\n let queryParams = '';\r\n if (currUrl.indexOf('?') !== -1) {\r\n queryParams = currUrl.split('?')[1];\r\n }\r\n const productUrl = getProductPageUrlSync(\r\n product?.Name || '',\r\n product?.RecordId || 0,\r\n this.props.context && this.props.context.actionContext,\r\n undefined\r\n );\r\n if (MsDyn365.isBrowser) {\r\n window.history.pushState({}, '', queryParams ? `${productUrl}?${queryParams}` : productUrl);\r\n }\r\n }\r\n }\r\n\r\n private _updateQueryParamVariantId = (variantId: Number | undefined) => {\r\n if (MsDyn365.isBrowser) {\r\n const currUrl = window.location.href;\r\n const urlWithIgnoredCase = new URL(currUrl.toString().toLocaleLowerCase());\r\n if (urlWithIgnoredCase.searchParams.has(variantQueryStringName)) {\r\n if (urlWithIgnoredCase.searchParams.get(variantQueryStringName) === variantId?.toString()) {\r\n return;\r\n }\r\n }\r\n // url is containing variantId\r\n urlWithIgnoredCase.searchParams.set(variantQueryStringName, variantId?.toString() || '');\r\n window.history.replaceState(window.history.state, '', urlWithIgnoredCase.toString().replace(urlWithIgnoredCase.host, window.location.host));\r\n // window.history.pushState({}, '', urlWithIgnoredCase.href);\r\n }\r\n };\r\n private _setAllProductVariantsResult(result: IBuyboxGetDimensionVariantAvailabilityActionData[]) {\r\n this.setState({ variantAvailibilityList: result });\r\n }\r\n\r\n /** Method for setting cookies for recently viewed products */\r\n private _setRecentlyViewProducts = (recordId: number, masterProductId: number | undefined): void => {\r\n const cookies = new Cookies();\r\n const date = new Date(); // Now\r\n date.setDate(date.getDate() + 30); // Set now + 30 days as the new date\r\n\r\n const product = {\r\n masterProductId: masterProductId,\r\n recordId: recordId,\r\n expiry: date\r\n };\r\n\r\n interface IRecentlyViewedProducts {\r\n masterProductId: number;\r\n recordId: number;\r\n expiry: number;\r\n }\r\n let inserted = false;\r\n\r\n let recentlyViewedProductsStored = cookies.get(`RecentlyViewedProducts`);\r\n if (masterProductId !== undefined) {\r\n if (recentlyViewedProductsStored === undefined || recentlyViewedProductsStored.length === 0) {\r\n const recentlyViewedProducts = [];\r\n recentlyViewedProducts.push(product);\r\n cookies.set(`RecentlyViewedProducts`, recentlyViewedProducts, { path: '/' });\r\n } else {\r\n recentlyViewedProductsStored?.map((item: IRecentlyViewedProducts, index: number) => {\r\n if (item.masterProductId === masterProductId) {\r\n recentlyViewedProductsStored?.splice(index, 1);\r\n recentlyViewedProductsStored = [product]?.concat(recentlyViewedProductsStored);\r\n cookies.set(`RecentlyViewedProducts`, recentlyViewedProductsStored, { path: '/' });\r\n inserted = true;\r\n }\r\n });\r\n\r\n if (!inserted) {\r\n if (recentlyViewedProductsStored.length >= 6) {\r\n recentlyViewedProductsStored?.splice(0, 1);\r\n recentlyViewedProductsStored = [product]?.concat(recentlyViewedProductsStored);\r\n cookies.set(`RecentlyViewedProducts`, recentlyViewedProductsStored, { path: '/' });\r\n } else {\r\n recentlyViewedProductsStored = [product]?.concat(recentlyViewedProductsStored);\r\n cookies.set(`RecentlyViewedProducts`, recentlyViewedProductsStored, { path: '/' });\r\n }\r\n inserted = false;\r\n }\r\n }\r\n }\r\n };\r\n private _setSmallParcelATPCallMade = (atpCallMade: boolean) => {\r\n this.setState({ smallParcelATCallMade: atpCallMade });\r\n };\r\n private _setStatusATPCall = (atpCallMade: boolean) => {\r\n this.setState({ StatusATPCall: atpCallMade });\r\n };\r\n private _setZipCode = (zipCode: string) => {\r\n this.setState({ zipCode: zipCode });\r\n };\r\n private _setATPCall = (atpCallMade: boolean) => {\r\n this.setState({ ATPCall: atpCallMade });\r\n };\r\n\r\n private _updatePrice(newPrice: ProductPrice | undefined, customPrice: number | undefined = this.state.keyInPriceAmount): void {\r\n if (this.state.isCustomPriceSelected && newPrice) {\r\n newPrice.CustomerContextualPrice = customPrice;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._updateUtagData(this.props.data?.product?.result, newPrice?.CustomerContextualPrice);\r\n this.setState({ productPrice: newPrice });\r\n }\r\n\r\n private _updateDimensionValue = (\r\n productDimensionFull: ProductDimensionFull,\r\n newValueId: string | undefined\r\n ): ProductDimensionValue | undefined => {\r\n if (newValueId && productDimensionFull.DimensionValues) {\r\n return productDimensionFull.DimensionValues.find(dimension => dimension.RecordId === +newValueId);\r\n }\r\n\r\n return undefined;\r\n };\r\n\r\n private _getDropdownName = (dimensionType: number, resources: IMfrmBuyboxResources): string => {\r\n const isGiftCard = this.props.data.product.result?.IsGiftCard;\r\n\r\n switch (dimensionType) {\r\n case 1: // ProductDimensionType.Color\r\n return resources.productDimensionTypeColor;\r\n case 2: // ProductDimensionType.Configuration\r\n return resources.productDimensionTypeConfiguration;\r\n case 3: // ProductDimensionType.Size\r\n return resources.productDimensionTypeSize;\r\n case 4: // ProductDimensionType.Style\r\n return isGiftCard ? resources.productDimensionTypeAmount : resources.productDimensionTypeStyle;\r\n default:\r\n return '';\r\n }\r\n };\r\n\r\n private _scrollToBVHosted = () => {\r\n if (MsDyn365.isBrowser) {\r\n const ratingSection = document?.getElementById('writeFirstReview');\r\n const isRatingReviewsLoaded = ratingSection?.getElementsByTagName('div')[0]?.getAttribute(\"data-bv-ready\");\r\n isRatingReviewsLoaded && ratingSection?.scrollIntoView({ behavior: 'smooth' });\r\n }\r\n };\r\n\r\n private _onHandleToggleAvailableStoreDetails = () => {\r\n this.setState({ isStoreDetailsOpen: !this.state.isStoreDetailsOpen });\r\n };\r\n\r\n private _getPreferredStore = (): OrgUnitLocation | undefined => {\r\n const props = this.props as IBuyboxExtentedProps & IBuyboxViewProps;\r\n const { storeSelectorState } = props;\r\n let preferredStore = (storeSelectorState && storeSelectorState.result && storeSelectorState.result.prefferedStore) || {};\r\n if (\r\n MsDyn365.isBrowser &&\r\n (!preferredStore.OrgUnitNumber || !preferredStore.Zip) &&\r\n localStorage.getItem('_mfrm__prefferedStore_')\r\n ) {\r\n preferredStore = JSON.parse(localStorage.getItem('_mfrm__prefferedStore_') || '');\r\n }\r\n return preferredStore || undefined;\r\n };\r\n private _getSociPreferredStore = (): any => {\r\n let preferredStore = {};\r\n if (MsDyn365.isBrowser && localStorage.getItem('_mfrm__prefferedStore_')) {\r\n preferredStore = JSON.parse(localStorage.getItem('_mfrm__prefferedStore_') || '');\r\n } else {\r\n preferredStore = {};\r\n }\r\n return preferredStore;\r\n };\r\n\r\n private _getProductSpecificationAttributeByKeyName = (attrName: string): boolean | undefined => {\r\n return (\r\n this.props.data.productSpecificationData &&\r\n this.props.data.productSpecificationData.result?.find(attr => attr.Name?.trim().toLowerCase() === attrName.trim().toLowerCase())\r\n ?.BooleanValue\r\n );\r\n };\r\n\r\n private _getProductType = (shippingInformation: string | undefined): string => {\r\n if (shippingInformation && shippingInformation.toLowerCase() === 'delivery') {\r\n return 'Core';\r\n }\r\n if (shippingInformation && shippingInformation.toLowerCase() === 'parcel') {\r\n return 'Small Parcel';\r\n }\r\n if (shippingInformation && shippingInformation.toLowerCase() === 'drop ship') {\r\n return 'Drop Ship';\r\n }\r\n return '';\r\n };\r\n\r\n private _updateUtagDataOnInitialLoad = async () => {\r\n const productprice = await this.props.data.productPrice;\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.props.data.product.then(product => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.props.data.categoryPaths.then(category => {\r\n const allCategoriesArr = category;\r\n const categoryObj = allCategoriesArr && allCategoriesArr[allCategoriesArr?.length - 1];\r\n const categoryName: string | undefined = categoryObj ? `${categoryObj?.Name}` : undefined;\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.props.data.productSpecificationData.then(productAttribute => {\r\n const fallBackBrandAttribute = 'BRAND';\r\n const attribute = this.props.context.app.config.brandBackofficeAttributePdp || fallBackBrandAttribute;\r\n const attributes = this.props.data.productSpecificationData?.result;\r\n let productBrandName =\r\n attributes &&\r\n attributes.find(\r\n currAttribute =>\r\n currAttribute.Name && currAttribute.Name.toLowerCase().trim() === attribute.toLowerCase().trim()\r\n )?.TextValue;\r\n productBrandName = productBrandName ? `${productBrandName}` : undefined;\r\n const productSize = product?.Dimensions?.find(item => item.DimensionTypeValue === 3)?.DimensionValue?.Value?.toLowerCase();\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.props.data.listPageStateBuyBox\r\n .then(item => {\r\n item.itemId = product.ItemId;\r\n item.variantId = this._getVariantIDOnLoad();\r\n item.name = product.Name;\r\n item.categoryName = categoryName;\r\n item.productBrandName = productBrandName;\r\n item.price = productprice.CustomerContextualPrice ? productprice.CustomerContextualPrice.toString() : product.BasePrice.toString();\r\n item.productUrl = getProductURLForUtag(product, this.props.context);\r\n item.productImageUrl = `${product?.PrimaryImageUrl}`;\r\n item.productSize = productSize;\r\n })\r\n .catch(err => {\r\n console.log(err, 'stateSharingBuyboxError');\r\n });\r\n });\r\n });\r\n });\r\n };\r\n\r\n private _getVariantIDOnLoad = (): string | undefined => {\r\n const {\r\n data: {\r\n product: { result: product }\r\n }\r\n } = this.props;\r\n const { RecordId, ItemId } = product || {};\r\n let variantId: string | undefined;\r\n const variantsResp: SimpleProduct[] | undefined = this.props.data.allProductVariants?.result;\r\n if (variantsResp) {\r\n for (let variantIter = 0;variantIter < variantsResp.length;variantIter++) {\r\n if (variantsResp[variantIter].RecordId === RecordId) {\r\n const ePropsVariant = variantsResp[variantIter].ExtensionProperties!;\r\n if (ePropsVariant?.length > 0) {\r\n for (let eIter = 0;eIter < ePropsVariant?.length;eIter++) {\r\n if (ePropsVariant[eIter].Key === 'RetailVariantId') {\r\n variantId = ePropsVariant[eIter].Value?.StringValue;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n const variantofId = `V000${ItemId}`;\r\n variantId = variantofId?.slice(0, -1);\r\n }\r\n return variantId;\r\n };\r\n\r\n private _getProductAttributeUpdated = (productSpecificationData: AttributeValue[], props: IMfrmBuyboxProps) => {\r\n // shippingInformation product attribute value\r\n const shippingInformationSmall = productSpecificationData\r\n .find(attr => attr.Name?.trim() === props.context.app.config.smallParcelAttributeKey)\r\n ?.TextValue?.toLowerCase();\r\n\r\n return this._getProductType(shippingInformationSmall);\r\n };\r\n\r\n //private async methods\r\n // tslint:disable-next-line: max-line-length\r\n private _updateAvailbilityForVariantsUpdated = async (\r\n allVariants: IBuyboxGetDimensionVariantAvailabilityActionData[],\r\n props: IMfrmBuyboxProps,\r\n productSpecificationData: AttributeValue[]\r\n ) => {\r\n const variantsResult: IBuyboxGetDimensionVariantAvailabilityActionData[] = allVariants;\r\n const availableVariantIDs: number[] = [];\r\n const itemId = props?.data?.product?.result?.ItemId;\r\n const {\r\n context: {\r\n app: {\r\n config: {\r\n eComAllVariantsOOSMultiAttr,\r\n ecomAllVairantStockInfoKey,\r\n ecomAllVairantStockInfoKey1,\r\n ecomAllVairantStockInfoKey2,\r\n ecomAllVairantStockInfoKey3\r\n }\r\n }\r\n }\r\n } = this.props;\r\n let count = 0;\r\n if (this.state.masterProductId) {\r\n //calling this to get masterProductAttribute data when PDP is loading from variantId\r\n productSpecificationData = await getAttributeValuesAsync(\r\n { callerContext: props.context.actionContext, queryResultSettings: {} },\r\n this.state.masterProductId,\r\n props.context.request.apiSettings.channelId,\r\n 0\r\n );\r\n }\r\n let ecomAllVairantStockInfoConcatenated: any[] = [];\r\n // for backward compatiblity\r\n if (!eComAllVariantsOOSMultiAttr || eComAllVariantsOOSMultiAttr === undefined) {\r\n try {\r\n const eComJsonData = productSpecificationData.find(attr => attr.Name?.trim() === ecomAllVairantStockInfoKey)?.TextValue;\r\n const newAllVariantStockInfo = eComJsonData && JSON.parse(eComJsonData);\r\n ecomAllVairantStockInfoConcatenated = [\r\n ...ecomAllVairantStockInfoConcatenated,\r\n ...newAllVariantStockInfo.VariantList.map(\r\n (item: IVariantStockInfo) => `${item.VariantRecID}|${item.OutOfStock ? '1' : '0'}`\r\n )\r\n ];\r\n } catch (error) {\r\n this.telemetryContent.telemetry?.error(`Error ${error} [OOS Checking] ecomAllVairantStockInfoKey`);\r\n console.log(`Error ${error} [OOS Checking] ecomAllVairantStockInfoKey`);\r\n }\r\n } else {\r\n const ecomVairantStockInfoKey1 = ecomAllVairantStockInfoKey1 ? ecomAllVairantStockInfoKey1 : 'EcomAllVariantOOSInfo1';\r\n const ecomVairantStockInfoKey2 = ecomAllVairantStockInfoKey2 ? ecomAllVairantStockInfoKey2 : 'EcomAllVariantOOSInfo2';\r\n const ecomVairantStockInfoKey3 = ecomAllVairantStockInfoKey3 ? ecomAllVairantStockInfoKey3 : 'EcomAllVariantOOSInfo3';\r\n const ecomAllVairantStockInfo1 = productSpecificationData.find(attr => attr.Name?.trim() === ecomVairantStockInfoKey1)\r\n ?.TextValue;\r\n const ecomAllVairantStockInfo2 = productSpecificationData.find(attr => attr.Name?.trim() === ecomVairantStockInfoKey2)\r\n ?.TextValue;\r\n const ecomAllVairantStockInfo3 = productSpecificationData.find(attr => attr.Name?.trim() === ecomVairantStockInfoKey3)\r\n ?.TextValue;\r\n\r\n if (ecomAllVairantStockInfo1) {\r\n try {\r\n ecomAllVairantStockInfoConcatenated = [...ecomAllVairantStockInfoConcatenated, ...JSON.parse(ecomAllVairantStockInfo1)];\r\n } catch (error) {\r\n this.telemetryContent.telemetry?.error(`Error ${error} [OOS Checking] ecomAllVairantStockInfoKey1`);\r\n console.log(`Error ${error} [OOS Checking] ecomAllVairantStockInfoKey1`);\r\n }\r\n }\r\n if (ecomAllVairantStockInfo2) {\r\n try {\r\n ecomAllVairantStockInfoConcatenated = [...ecomAllVairantStockInfoConcatenated, ...JSON.parse(ecomAllVairantStockInfo2)];\r\n } catch (error) {\r\n this.telemetryContent.telemetry?.error(`Error ${error} [OOS Checking] ecomAllVairantStockInfoKey2`);\r\n console.log(`Error ${error} [OOS Checking] ecomAllVairantStockInfoKey2`);\r\n }\r\n }\r\n if (ecomAllVairantStockInfo3) {\r\n try {\r\n ecomAllVairantStockInfoConcatenated = [...ecomAllVairantStockInfoConcatenated, ...JSON.parse(ecomAllVairantStockInfo3)];\r\n } catch (error) {\r\n this.telemetryContent.telemetry?.error(`Error ${error} [OOS Checking] ecomAllVairantStockInfoKey3`);\r\n console.log(`Error ${error} [OOS Checking] ecomAllVairantStockInfoKey3`);\r\n }\r\n }\r\n }\r\n this.setState({ ecomAllVairantStockInfoConcatenated });\r\n variantsResult &&\r\n variantsResult.forEach(async variant => {\r\n // get specfication data for each variant\r\n count++;\r\n if (!productSpecificationData) {\r\n return;\r\n }\r\n let outOfStockBoolean = null;\r\n for (let i = 0;i < ecomAllVairantStockInfoConcatenated.length;i++) {\r\n if (\r\n ecomAllVairantStockInfoConcatenated &&\r\n ecomAllVairantStockInfoConcatenated[i].split('|')[0] === variant.variantID.toString()\r\n ) {\r\n outOfStockBoolean = !!Number(ecomAllVairantStockInfoConcatenated[i].split('|')[1]);\r\n break;\r\n }\r\n }\r\n outOfStockBoolean ? (variant.isAvailable = false) : (variant.isAvailable = true);\r\n if (outOfStockBoolean === null || outOfStockBoolean === undefined) {\r\n variant.isAvailable = false;\r\n }\r\n // get product type for each\r\n const productType = this._getProductAttributeUpdated(productSpecificationData, props);\r\n // set availability for each\r\n if (productType === 'Core') {\r\n if (outOfStockBoolean) {\r\n variant.isAvailable = false;\r\n } else {\r\n variant.isAvailable = true;\r\n }\r\n } else if (productType === 'Small Parcel') {\r\n if (outOfStockBoolean) {\r\n variant.isAvailable = false;\r\n } else {\r\n // tslint:disable: no-floating-promises\r\n availableVariantIDs.push(variant.variantID);\r\n variant.isAvailable = false;\r\n }\r\n }\r\n else if (productType === 'Drop Ship') {\r\n if (outOfStockBoolean) {\r\n variant.isAvailable = false;\r\n } else {\r\n variant.isAvailable = true;\r\n }\r\n }\r\n // update the state\r\n if (availableVariantIDs.length > 0 && count === variantsResult.length) {\r\n const batchedAtp = await _coreProductATPCallForInventoryStatusForAllVariants(\r\n props,\r\n availableVariantIDs,\r\n itemId,\r\n variantsResult\r\n );\r\n this.setState({ batchedAtpInventoryStatusData: batchedAtp });\r\n await this.setDefaultOOSVariant(variantsResult);\r\n } else if (count === variantsResult.length) {\r\n await this.setDefaultOOSVariant(variantsResult);\r\n }\r\n\r\n this.setState({ variantAvailibilityList: variantsResult });\r\n });\r\n };\r\n\r\n private _updateUtagData = async (updatedProduct: SimpleProduct | undefined, updatedPrice?: number) => {\r\n const variantId = await this.getVariantID(updatedProduct);\r\n const price = await this.props.data.productPrice;\r\n const finalPrice = updatedPrice ? updatedPrice : price?.CustomerContextualPrice;\r\n try {\r\n // @ts-ignore\r\n if (utag.data) {\r\n // @ts-ignore\r\n utag.data = {\r\n // @ts-ignore\r\n ...utag.data,\r\n product_price: [`${finalPrice}`],\r\n product_variant: [`${variantId}`],\r\n product_url: [getProductURLForUtag(updatedProduct, this.props.context)],\r\n product_image_url: [`${updatedProduct?.PrimaryImageUrl}`],\r\n product_size: [getProductSizeForUTag(updatedProduct)]\r\n };\r\n }\r\n // @ts-ignore\r\n if (utag_data) {\r\n // @ts-ignore\r\n utag_data = {\r\n // @ts-ignore\r\n ...utag_data,\r\n product_price: [`${finalPrice}`],\r\n product_variant: [`${variantId}`],\r\n product_url: [getProductURLForUtag(updatedProduct, this.props.context)],\r\n product_image_url: [`${updatedProduct?.PrimaryImageUrl}`],\r\n product_size: [getProductSizeForUTag(updatedProduct)]\r\n };\r\n }\r\n } catch (error) {\r\n console.log(error, '[utag_data not found]');\r\n }\r\n };\r\n\r\n private _sendProductDataToTealium = async (props: IMfrmBuyboxProps, product: SimpleProduct | undefined) => {\r\n const {\r\n data: {\r\n productSpecificationData: { result: productSpecificationData },\r\n productPrice,\r\n categoryPaths\r\n },\r\n context: {\r\n request: { }\r\n },\r\n app: {\r\n config: { brandBackofficeAttributePdp }\r\n }\r\n } = props;\r\n this.setState({ tealiumRecordIdFor: product?.RecordId.toString() });\r\n const allCategoriesArr = categoryPaths?.result;\r\n const categoryObj = allCategoriesArr && allCategoriesArr[allCategoriesArr?.length - 1];\r\n const categoryName: string | undefined = categoryObj ? `${categoryObj?.Name}` : undefined;\r\n const fallBackBrandAttribute = 'VENDOR BRAND';\r\n const attribute = brandBackofficeAttributePdp || fallBackBrandAttribute;\r\n let productBrandName =\r\n productSpecificationData &&\r\n productSpecificationData?.find(\r\n currAttribute => currAttribute.Name && currAttribute.Name.toLowerCase().trim() === attribute.toLowerCase().trim()\r\n )?.TextValue;\r\n productBrandName = productBrandName ? `${productBrandName}` : undefined;\r\n const variantsResp = await this.getVariantID();\r\n void productPrice.then(async result => {\r\n // @ts-ignore\r\n if (utag) {\r\n const { ItemId, Name } = product || {};\r\n // @ts-ignore\r\n // tslint:disable-next-line: object-literal-key-quotes\r\n utag.link({\r\n event: 'product-detail-view',\r\n event_category: 'ecommerce',\r\n event_action: 'product detail view',\r\n enhanced_action: 'detail',\r\n event_label: `${ItemId}:${Name}`,\r\n event_noninteraction: 'true',\r\n product_id: [`${ItemId}`],\r\n product_name: [`${Name}`],\r\n product_category: [categoryName],\r\n product_brand: [productBrandName],\r\n product_variant: [variantsResp],\r\n product_price: [`${result?.CustomerContextualPrice}`],\r\n product_url: [getProductURLForUtag(product, this.props.context)],\r\n product_image_url: [`${product?.PrimaryImageUrl}`],\r\n product_size: [getProductSizeForUTag(product)]\r\n });\r\n }\r\n });\r\n // VSI - Customization Start - 47480\r\n this.setState({ variantIdForTracking: variantsResp ? variantsResp : '' });\r\n // VSI - Customization End - 47480\r\n };\r\n\r\n private async setDefaultOOSVariant(\r\n variantAvailibilityList: IBuyboxGetDimensionVariantAvailabilityActionData[],\r\n updatedProductSpecificationData?: AttributeValue[] | undefined\r\n ) {\r\n if (variantAvailibilityList?.length > 0) {\r\n const {\r\n data: {\r\n product: { result: product },\r\n allProductVariants: { result: allProductVariants },\r\n productSpecificationData: { result: productSpecificationData },\r\n productDimensions: { result: productDimensions },\r\n dimensionPrices: { result: dimensionPrices }\r\n },\r\n context: {\r\n actionContext,\r\n request: {\r\n apiSettings: { channelId }\r\n }\r\n }\r\n } = this.props;\r\n const prodSpecficationData = updatedProductSpecificationData ? updatedProductSpecificationData : productSpecificationData;\r\n\r\n // VSI - Customization Start 42852\r\n const prices: IBuyboxGetDimensionPricingActionData[] | undefined =\r\n dimensionPrices && (await _getActivePrices(dimensionPrices, actionContext));\r\n let extendedAllProductVariants: IExtendedSimpleProduct[] | undefined =\r\n prices && prices[0].discountAmount ? this.extendAllProductVariants(allProductVariants, prices) : allProductVariants;\r\n extendedAllProductVariants =\r\n extendedAllProductVariants &&\r\n extendedAllProductVariants.sort(\r\n (a, b) =>\r\n (a?.priceAfterDiscount ? a?.priceAfterDiscount : a?.Price) -\r\n (b?.priceAfterDiscount ? b?.priceAfterDiscount : b?.Price)\r\n );\r\n const updatedProduct = await this.getNextInventoryProduct(\r\n product,\r\n prodSpecficationData,\r\n extendedAllProductVariants,\r\n this.props.context,\r\n this.state.variantAvailibilityList ?? variantAvailibilityList\r\n );\r\n if (updatedProduct && updatedProduct.Dimensions && updatedProduct.Dimensions.length > 0) {\r\n const dimensions: ProductDimensionFull[] = [];\r\n for (const dimension of updatedProduct.Dimensions) {\r\n const dimensionValues = await getDimensionValuesAsync(\r\n { callerContext: actionContext, queryResultSettings: {} },\r\n updatedProduct.MasterProductId ? updatedProduct.MasterProductId : updatedProduct.RecordId,\r\n channelId,\r\n dimension.DimensionTypeValue,\r\n [],\r\n null\r\n );\r\n const fullDimension = {\r\n ...dimension,\r\n DimensionValues: dimensionValues\r\n };\r\n dimensions.push(fullDimension);\r\n }\r\n this.setState({\r\n currentProduct: updatedProduct,\r\n currentProductDimensions: dimensions\r\n });\r\n // updated Product is a different product than product in props\r\n if (product?.RecordId !== updatedProduct?.RecordId) {\r\n await this._updateDimensions(updatedProduct, dimensions);\r\n await this._updateUtagData(updatedProduct);\r\n } else {\r\n this._updateURLWithoutReloading(updatedProduct);\r\n }\r\n } else {\r\n console.log('updated product doesnt have dimesions=>');\r\n this.setState({\r\n currentProduct: product,\r\n currentProductDimensions: productDimensions\r\n });\r\n this._updateURLWithoutReloading(product);\r\n await this._sendProductDataToTealium(this.props, product);\r\n }\r\n }\r\n }\r\n\r\n private async _isOrderQuantityLimitsFeatureEnabled(): Promise {\r\n const defaultOrderQuantityLimitsFeatureConfig = this.props.context?.request?.app?.platform?.enableDefaultOrderQuantityLimits;\r\n if (defaultOrderQuantityLimitsFeatureConfig === 'none') {\r\n return false;\r\n }\r\n\r\n if (defaultOrderQuantityLimitsFeatureConfig === 'all') {\r\n return true;\r\n }\r\n let customerInfo;\r\n try {\r\n customerInfo = await this.props.data.customerInformation;\r\n } catch (error) {\r\n // this.props.telemetry.information(error);\r\n this.props.telemetry.debug('Unable to receive Customer Information. May be user is not authorized');\r\n return false;\r\n }\r\n\r\n return (\r\n customerInfo &&\r\n ((defaultOrderQuantityLimitsFeatureConfig === 'b2b' && customerInfo.IsB2b) ||\r\n (defaultOrderQuantityLimitsFeatureConfig === 'b2c' && !customerInfo.IsB2b))\r\n );\r\n }\r\n\r\n private async _updateQuantitiesInState(product: SimpleProduct): Promise {\r\n const isOrderQuantityLimitsFeatureEnabled = await this._isOrderQuantityLimitsFeatureEnabled();\r\n if (isOrderQuantityLimitsFeatureEnabled && product) {\r\n this.setState({\r\n quantity: product.Behavior?.DefaultQuantity || 1,\r\n min: product.Behavior?.MinimumQuantity || 1,\r\n // If max by feature in default order settings is not defined then use max from site settings or default max 10.\r\n max:\r\n product.Behavior?.MaximumQuantity && product.Behavior?.MaximumQuantity > 0\r\n ? product.Behavior?.MaximumQuantity\r\n : this.props.context.app.config.maxQuantityForCartLineItem || 10\r\n });\r\n } else {\r\n this.setState({\r\n min: 1,\r\n max: this.props.context.app.config.maxQuantityForCartLineItem || 10\r\n });\r\n }\r\n }\r\n\r\n private async _updateVariantIDForTracking(): Promise {\r\n const variantId = await this.getVariantID();\r\n this.setState({ variantIdForTracking: variantId ? variantId : '' });\r\n }\r\n\r\n private _eyeBrowMessageAsyncFunc = async (isCached: boolean): Promise => {\r\n const {\r\n context,\r\n data: {\r\n product: { result }\r\n }\r\n } = this.props;\r\n const priceGroupForAPICall = context.app.config.priceGroup;\r\n if (priceGroupForAPICall) {\r\n const productIdsArray: IMFIItem[] | undefined = [];\r\n const eyebrowMessageObj: IMFIItem = {\r\n ItemId: result?.ItemId === undefined ? '' : result?.ItemId,\r\n DistinctProductVariant: result?.RecordId?.toString()\r\n };\r\n productIdsArray.push(eyebrowMessageObj);\r\n if (productIdsArray && productIdsArray.length > 0) {\r\n const eyebrowMessageResult = _getEyebrowMessage(productIdsArray, context, isCached, 'pdp');\r\n eyebrowMessageResult\r\n ?.then((data: IMFIPromotion[] | null) => {\r\n this.setState({ eyebrowMessageResultState: data, isEyeBrowLoading: false });\r\n })\r\n .catch(e => {\r\n this.setState({ isEyeBrowLoading: false });\r\n console.log('Error', e);\r\n });\r\n }\r\n } else {\r\n this.setState({ isEyeBrowLoading: false });\r\n }\r\n };\r\n\r\n private getDeliverySlotFromATP = async (isCached: boolean): Promise => {\r\n const itemLinesArray = [];\r\n const {\r\n data: {\r\n product: { result: product }\r\n },\r\n context: {\r\n app: {\r\n config: { weeksPDPforATPCall }\r\n }\r\n }\r\n } = this.props;\r\n const cookies = new Cookies();\r\n const zipcode = cookies.get('zip_code');\r\n if (product) {\r\n const itemLines: IMFICartLine = {\r\n ItemId: product.ItemId,\r\n Quantity: 1,\r\n VariantRecordId: product.RecordId.toString()\r\n };\r\n itemLinesArray.push(itemLines);\r\n const currentDate = Date.now();\r\n const requestBody: IMFICLDeliveryScheduleParameters = {\r\n InventoryType: 'Delivery',\r\n Weeks: weeksPDPforATPCall,\r\n StoreId: '',\r\n Page: 'pdp',\r\n RequestedDate: dayjs(currentDate).format('MM/DD/YYYY'),\r\n ZipCode: zipcode,\r\n ItemLines: itemLinesArray\r\n };\r\n _getDeliveryByMessage(requestBody, this.props.context, isCached)\r\n .then(result => {\r\n if (result !== undefined && result?.ATPInventoryData) {\r\n // setCoreProductATPData(result?.ATPInventoryData);\r\n this.setState({\r\n deliveryMessageATPResultState: result?.ATPInventoryData\r\n });\r\n }\r\n })\r\n .catch(e => {\r\n console.log('Error', e);\r\n });\r\n }\r\n };\r\n\r\n private _tryInStoreAsyncCall = async () => {\r\n const {\r\n context: { actionContext, app },\r\n data: {\r\n product: { result: product }\r\n }\r\n } = this.props;\r\n // VSI Customization - Start\r\n const isSociEnabled = this.props.app.config.enableSociLocations || false;\r\n const preferredStore = this.state.preferredStore;\r\n\r\n // Todo: Zip code is being modified as we are not getting proper zip code.. It will be reverted back as it get modified/validate from backoffice\r\n const zipCodeModified = preferredStore && (!isSociEnabled ? preferredStore.Zip?.split('-')[0] : preferredStore?.Zip);\r\n const projectMetaSoci = isSociEnabled && preferredStore?.project_meta ? JSON.parse(preferredStore?.project_meta) : '';\r\n const sociStore = projectMetaSoci ? projectMetaSoci['Corporate ID'] : '';\r\n const sociStoreID = sociStore && (sociStore?.length > 6 ? sociStore : `000000${sociStore}`?.slice(-6));\r\n const StoreId = isSociEnabled ? sociStoreID : preferredStore?.OrgUnitNumber!;\r\n if (StoreId && zipCodeModified && product?.ItemId?.toString()) {\r\n const tryInStoreProductIDs: IMFITryInStore = {\r\n ZipCode: zipCodeModified,\r\n StoreId: isSociEnabled ? sociStoreID : preferredStore?.OrgUnitNumber!,\r\n Products: product?.ItemId?.toString(),\r\n Limit: app.config.tryInStoreLimit || 10,\r\n Radius: app.config.tryInStoreLookupRadius || 50\r\n };\r\n const getTryInStoreInfoInput = new GetTryInStoreInfoInput(tryInStoreProductIDs);\r\n try {\r\n const response = await getTryInStoreAction(getTryInStoreInfoInput, actionContext);\r\n this.setState({\r\n tryInStoresResults: response,\r\n OrgUnitNumber: isSociEnabled ? sociStoreID : preferredStore && preferredStore.OrgUnitNumber ? preferredStore.OrgUnitNumber : '0',\r\n isStoreLoading: false\r\n });\r\n } catch (error) {\r\n this.setState({ isStoreLoading: false });\r\n console.log(error);\r\n }\r\n }\r\n };\r\n // tslint:disable-next-line:max-func-body-length\r\n private _updateDimensions = async (updatedProduct?: SimpleProduct, dimensions?: ProductDimensionFull[] | undefined): Promise => {\r\n const {\r\n data: {\r\n product: { result: prevProduct },\r\n productDimensions: { result: dimensionsArr }\r\n },\r\n context: {\r\n actionContext,\r\n request: {\r\n apiSettings: { channelId }\r\n }\r\n }\r\n } = this.props;\r\n const product = updatedProduct ? updatedProduct : prevProduct;\r\n const productDimensions = dimensions ? dimensions : dimensionsArr;\r\n if (!product || !productDimensions) {\r\n return;\r\n }\r\n\r\n const dimensionsToUpdate: { [id: number]: string } = { ...this.dimensions };\r\n // this._setSmallParcelATPCallMade(true);\r\n this.setState({ isUpdatingDimension: true, isUpdatingDeliveryOptions: true });\r\n // Step 1: Clear error state to display relevant errors\r\n if (this.state.errorState.otherError || this.state.errorState.quantityError) {\r\n const clearErrorState = { ...this.state.errorState };\r\n clearErrorState.otherError = undefined;\r\n if (this.state.errorState.errorHost === 'ADDTOCART') {\r\n clearErrorState.quantityError = undefined;\r\n clearErrorState.errorHost = undefined;\r\n }\r\n this.setState({ errorState: clearErrorState });\r\n }\r\n\r\n // Step 2: Clear any errors indicating the dimension wasn't selected\r\n for (const key of Object.keys(dimensionsToUpdate)) {\r\n if (this.state.errorState.configureErrors[key]) {\r\n const errorState = { ...this.state.errorState };\r\n errorState.configureErrors[key] = undefined;\r\n\r\n this.setState({ errorState: errorState });\r\n }\r\n }\r\n\r\n // Step 3, Build the actually selected dimensions, prioritizing the information in state\r\n // over the information in data\r\n const nextProductDimensions: ProductDimensionFull[] = [];\r\n const mappedDimensions =\r\n productDimensions?.length > 0\r\n ? productDimensions\r\n ?.map(dimension => {\r\n const obj = dimension && {\r\n DimensionTypeValue: dimension.DimensionTypeValue,\r\n DimensionValue:\r\n this._updateDimensionValue(dimension, dimensionsToUpdate[dimension.DimensionTypeValue]) ??\r\n dimension.DimensionValue ?? product.Dimensions?.find(dim => dim.DimensionTypeValue === dimension.DimensionTypeValue)?.DimensionValue,\r\n ExtensionProperties: dimension.ExtensionProperties,\r\n DimensionValues: dimension.DimensionValues\r\n };\r\n nextProductDimensions.push(obj);\r\n return (\r\n dimension && {\r\n DimensionTypeValue: dimension.DimensionTypeValue,\r\n DimensionValue:\r\n this._updateDimensionValue(dimension, dimensionsToUpdate[dimension.DimensionTypeValue]) ??\r\n dimension.DimensionValue ?? product.Dimensions?.find(dim => dim.DimensionTypeValue === dimension.DimensionTypeValue)?.DimensionValue,\r\n ExtensionProperties: dimension.ExtensionProperties\r\n }\r\n );\r\n })\r\n .filter(dimension => {\r\n return dimension?.DimensionValue;\r\n })\r\n : [];\r\n const variants = getVariantsByDimensionValuesAsync(\r\n { callerContext: actionContext, queryResultSettings: {} },\r\n product.MasterProductId ? product.MasterProductId : product.RecordId,\r\n channelId,\r\n mappedDimensions\r\n );\r\n\r\n // Step 4. Use these dimensions hydrate the product. Wrap this in a promise\r\n // so that places like add to cart can await it\r\n const selectedProduct = await variants;\r\n this.props.context.app.config.queryBasedVariantSelection && this._updateQueryParamVariantId(selectedProduct[0]?.RecordId);\r\n\r\n this.setState({ selectedProduct: variants[0] });\r\n const variantProduct = selectedProduct[0];\r\n\r\n if (variantProduct) {\r\n // Step 5. Use these dimensions hydrate the inventory. Wrap this in a promise\r\n // so that places like add to cart can await it\r\n const newAvailableQuantity = await getProductAvailabilitiesForSelectedVariant(\r\n new ProductAvailabilitiesForSelectedVariantInput(variantProduct.RecordId, channelId),\r\n actionContext\r\n );\r\n\r\n const isCustompriceSelected =\r\n variantProduct &&\r\n variantProduct.Dimensions &&\r\n variantProduct.Dimensions.find(\r\n dimension =>\r\n dimension.DimensionTypeValue === 4 && dimension.DimensionValue && dimension.DimensionValue.Value === 'Custom'\r\n );\r\n if (isCustompriceSelected) {\r\n this.setState({ isCustomPriceSelected: true });\r\n } else {\r\n // Remove custom amount error when unselect the custom amount\r\n const errorState = { ...this.state.errorState };\r\n errorState.customAmountError = undefined;\r\n\r\n this.setState({ isCustomPriceSelected: false, isPriceKeyedIn: false, errorState: errorState });\r\n }\r\n\r\n if (newAvailableQuantity?.length) {\r\n this.setState({ productAvailableQuantity: newAvailableQuantity[0] });\r\n } else {\r\n this.setState({ productAvailableQuantity: undefined });\r\n }\r\n\r\n // Step 6. Use these dimensions hydrate the product price.\r\n const newPrice = await getPriceForSelectedVariant(\r\n new PriceForSelectedVariantInput(variantProduct.RecordId, channelId),\r\n actionContext\r\n );\r\n\r\n if (newPrice) {\r\n this._updatePrice(newPrice);\r\n }\r\n\r\n // const RetailMulitplePickupMFeatureState = this.props.data.featureState.result?.find(featureState => featureState.Name === 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature');\r\n // Step 7. Use these dimensions hydrate the product delivery options.\r\n const newDeliveryOptions = await getDeliveryOptionsForSelectedVariant(\r\n new GetDeliveryOptionsForSelectedVariantInput(\r\n variantProduct.RecordId,\r\n channelId,\r\n undefined,\r\n undefined\r\n // RetailMulitplePickupMFeatureState?.IsEnabled\r\n ),\r\n actionContext\r\n );\r\n\r\n if (newDeliveryOptions) {\r\n this.setState({ productDeliveryOptions: newDeliveryOptions });\r\n }\r\n this.setState({\r\n currentProduct: variantProduct,\r\n currentProductDimensions: nextProductDimensions\r\n });\r\n await this._updateQuantitiesInState(variantProduct);\r\n await this.makeCoreProductDeliveryMessage('ATP update dimnesions');\r\n // VSI - Customization Start - 47480\r\n await this._updateVariantIDForTracking();\r\n // VSI - Customization End - 47480\r\n // VSI - Customization Start - 27818\r\n // VSI - Customization End - 27818\r\n // VSI - Customization Start - 42674\r\n this._updateURLWithoutReloading(variantProduct);\r\n // VSI - Customization End - 42674\r\n }\r\n };\r\n // Render()\r\n public render(): JSX.Element | null {\r\n const {\r\n slots: { mediaGallery },\r\n data: {\r\n product: { result: product },\r\n productSpecificationData: { result: productSpecificationData },\r\n selectedFoundation: { result: adjustableItem },\r\n completeYourBedPillow: { result: pillow },\r\n completeYourBedProtector: { result: protector }\r\n },\r\n config: { className = '' },\r\n app: { config: { brandBackofficeAttributePdp } }\r\n } = this.props;\r\n const { max } = this.state;\r\n if (!product) {\r\n this.props.context.telemetry.error('Product content is empty, module wont render');\r\n return null;\r\n }\r\n const props = (this.props as unknown) as IBuyboxExtentedProps;\r\n const defaultMinimumKeyInPrice = 10;\r\n const defaultMaximumKeyInPrice = 100;\r\n const brandName = parseBrandName(productSpecificationData, brandBackofficeAttributePdp) || '';\r\n const viewProps: IBuyboxViewProps & IMFRMNetworkCallsState & IMFRMProductMExtensionPropsInfo = {\r\n ...(this.props as IMfrmBuyboxProps),\r\n state: this.state,\r\n mediaGallery: mediaGallery?.length > 0 ? mediaGallery[0] : undefined,\r\n ModuleProps: {\r\n moduleProps: this.props,\r\n className: classnames('ms-buybox', className)\r\n },\r\n ProductInfoContainerProps: {\r\n className: 'ms-buybox__content'\r\n },\r\n MediaGalleryContainerProps: {\r\n className: 'ms-buybox__media-gallery'\r\n },\r\n telemetryContent: this.telemetryContent,\r\n callbacks: this.buyboxCallbacks,\r\n title: getBuyboxProductTitle(props, undefined, brandName),\r\n description: getBuyboxProductDescription(props),\r\n configure: getBuyboxProductConfigure(props, this.state, this.buyboxCallbacks),\r\n findInStore: getBuyboxFindInStore(this.props, this.state, this.buyboxCallbacks),\r\n price: getBuyboxProductPrice(props, this.state),\r\n addToCart: getBuyboxAddToCart(props, this.state, this.buyboxCallbacks, defaultMinimumKeyInPrice, defaultMaximumKeyInPrice),\r\n viewCartLink: getUrlSync('cart', props.context.actionContext),\r\n rating: !props.context.app.config.hideRating && getBuyboxProductRating(props),\r\n quantity: undefined,\r\n inventoryLabel: getBuyBoxInventoryLabel(props),\r\n shopSimilarLook:\r\n this.props.config.enableShopSimilarLooks && !product.IsGiftCard\r\n ? getBuyboxShopSimilarButton(props, ShopSimiliarButtonType.Looks)\r\n : undefined,\r\n shopSimilarDescription:\r\n this.props.config.enableShopSimilarDescription && !product.IsGiftCard\r\n ? getBuyboxShopSimilarButton(props, ShopSimiliarButtonType.Description)\r\n : undefined,\r\n keyInPrice:\r\n this.props.config.enableKeyInPrice && this.state.isCustomPriceSelected\r\n ? getBuyboxKeyInPrice(props, this.state, this.buyboxCallbacks)\r\n : undefined,\r\n quantityLimitsMessages: getQuantityLimitsMessages(props, this.state),\r\n max: max,\r\n smallParcelATCallMade: this.state.smallParcelATCallMade,\r\n setSmallParcelATPCallMade: this._setSmallParcelATPCallMade,\r\n StatusATPCall: this.state.StatusATPCall,\r\n setStatusATPCall: this._setStatusATPCall,\r\n setZipCode: this._setZipCode,\r\n ATPCall: this.state.ATPCall,\r\n setATPCall: this._setATPCall,\r\n extensionProps: this.state.extensionProps,\r\n productBadges:\r\n props.app.config.productBadgeAttribute &&\r\n this.props.data.productSpecificationData?.result?.length &&\r\n this._getProductBadges(),\r\n ratingComponent: !props.context.app.config?.hideRating && (this.props.config.showBVRatings ? : this._getBuyboxProductRating()),\r\n _renderTryInStoreRedesign: this._renderTryInStoreRedesign(),\r\n _renderTryInStore: this._renderTryInStore(),\r\n eyeBrowMessage: product && this._renderEyeBrowMessage(),\r\n promotionalMessage: this.state?.eyebrowMessageResultState?.[0]?.EyeBrows?.[0].Description?.split(\"|\")[1],\r\n deliveryMessage: this.state.deliveryMessage,\r\n ATPDataFromBusiness: this.state.deliveryMessageATPResultState,\r\n updateDimension: this.state.isUpdatingDimension,\r\n showViewCartLink: this.state.showViewCartLink,\r\n updateSuccessfulATC: this.updateSuccessfulATC,\r\n getProductType: this._getProductType,\r\n setAllProductVariantsResult: this._setAllProductVariantsResult,\r\n ecomAllVairantStockInfoConcatenated: this.state.ecomAllVairantStockInfoConcatenated,\r\n customerSatisfactionScore: this._renderCSATScore(),\r\n adjustableItem,\r\n pillow,\r\n protector\r\n };\r\n return this.props.renderView(viewProps) as React.ReactElement;\r\n }\r\n\r\n //other methods that return JSX.Element\r\n // tslint:disable-next-line: cyclomatic-complexity\r\n private _getBuyboxProductRating = (): React.ReactElement | undefined => {\r\n const {\r\n id,\r\n typeName,\r\n context,\r\n data: {\r\n productSpecificationData: { result: productSpecification }\r\n },\r\n resources\r\n } = this.props;\r\n const averageRating = getBVAttributeValues(productSpecification, 'BVAverageOverallRating');\r\n const reviewsCount = getBVAttributeValues(productSpecification, 'BVTotalReviewCount');\r\n const ratingComponent = (\r\n \r\n {productSpecification && (averageRating || reviewsCount) ? (\r\n \r\n ) : (\r\n <>\r\n \r\n Write the first review\r\n \r\n )}\r\n \r\n );\r\n return productSpecification && ratingComponent && ratingComponent;\r\n };\r\n\r\n private _renderTryInStore = (): JSX.Element | null => {\r\n const {\r\n resources: { availableInStoresText, notAvailableInStoresText, onlineOnlyProductsText },\r\n context: {\r\n app: { config }\r\n }\r\n } = this.props;\r\n // VSI Customization - Start\r\n const preferredStore = this._getPreferredStore();\r\n // VSI Customization - END\r\n const isOnlineOnly = this._getProductSpecificationAttributeByKeyName(config?.onlineOnlyBackOfficeAttribute);\r\n const storeName: string | undefined =\r\n (preferredStore && preferredStore.ExtensionProperties?.find(x => x.Key === 'Yext_Store_Name')?.Value?.StringValue) ||\r\n (preferredStore && preferredStore.OrgUnitName);\r\n const storeNameWithState = `${storeName}, ${preferredStore?.State}`;\r\n const availableStoreText = storeName && availableInStoresText.replace('{storeName}', `${storeNameWithState}`);\r\n const notAvailableStoreText = storeName && notAvailableInStoresText.replace('{storeName}', `${storeNameWithState}`);\r\n const canTryInStores = this._getProductSpecificationAttributeByKeyName('try in store');\r\n const onHandleFindPreferredStore = async (): Promise => {\r\n const {\r\n data: {\r\n storeSelectorStateManager: { result: storeSelectorStateManager }\r\n },\r\n modules\r\n } = this.props;\r\n if (!storeSelectorStateManager) {\r\n return;\r\n }\r\n let storeSelectorId: string = '';\r\n if (modules && Object.keys(modules).length > 0 && modules.mfrmStoreSelector && modules.mfrmStoreSelector.length > 0) {\r\n storeSelectorId = modules.mfrmStoreSelector[0].id;\r\n }\r\n MsDyn365.isBrowser && document.body.classList.add('modal-store-locator-toggle-pdp');\r\n storeSelectorStateManager\r\n ?.openDialog({\r\n id: storeSelectorId,\r\n showMapViewLink: false,\r\n onLocationSelected: () => {\r\n return Promise.resolve();\r\n }\r\n })\r\n .catch((error: Error) => {\r\n if (this.props.telemetry) {\r\n this.props.telemetry.error(error.message);\r\n this.props.telemetry.debug('Unable to set preferred store');\r\n }\r\n return;\r\n });\r\n };\r\n\r\n const { Inventory, Status } = { ...this.state.tryInStoresResults };\r\n if (Status === 'Success' && canTryInStores) {\r\n return (\r\n \r\n {Inventory?.length !== 0 && }\r\n {Inventory?.length === 0 && }\r\n \r\n );\r\n } else if (!canTryInStores && isOnlineOnly) {\r\n return (\r\n \r\n {}\r\n \r\n );\r\n } else {\r\n return null;\r\n }\r\n };\r\n\r\n private _renderStoreHours = (location: OrgUnitLocation): JSX.Element | null => {\r\n const isClosedToday = location.ExtensionProperties?.find(x => x.Key === 'Yext_Today_IsClosed')?.Value?.BooleanValue;\r\n const isClosed = location.ExtensionProperties?.find(x => x.Key === 'Yext_Is_Store_Closed')?.Value?.BooleanValue;\r\n const startTime = location.ExtensionProperties?.find(x => x.Key === 'Yext_Today_OpenFrom')?.Value?.IntegerValue;\r\n const endTime = location.ExtensionProperties?.find(x => x.Key === 'Yext_Today_OpenTo')?.Value?.IntegerValue;\r\n const timeZone = location.ExtensionProperties?.find(x => x.Key === 'Channel_TimeZone_InfoId')?.Value?.StringValue;\r\n const timeZoneAbbr = getTimeZoneAbbr(timeZone);\r\n const { storeHoursClosedText, storeCloseAtHours, storeOpenAtHours } = this.props.resources;\r\n if (isClosedToday && isClosedToday !== null) {\r\n return (\r\n Today: {storeHoursClosedText}\r\n );\r\n } else if (startTime !== null || endTime !== null) {\r\n return (\r\n \r\n Today: {!isClosed\r\n ? `${storeCloseAtHours} ${secondsToTime(endTime)} ${timeZoneAbbr}`\r\n : `${storeOpenAtHours} ${secondsToTime(startTime)} ${timeZoneAbbr}`}\r\n \r\n );\r\n } else {\r\n return null;\r\n }\r\n };\r\n\r\n private _renderTryInStoreRedesign = (): JSX.Element | null => {\r\n const {\r\n resources: { availableInStoresTextV2, notAvailableInStoresTextV2, viewStoreDetailsText, changeStoreText },\r\n context: {\r\n app: { config }\r\n }\r\n } = this.props;\r\n // VSI Customization - Start\r\n const isSociEnabled = this.props.app.config.enableSociLocations;\r\n const preferredStore = this._getPreferredStore();\r\n const sociPrefferedStore = this._getSociPreferredStore();\r\n\r\n // VSI Customization - END\r\n const isOnlineOnly = this._getProductSpecificationAttributeByKeyName(config?.onlineOnlyBackOfficeAttribute);\r\n // eslint-disable-next-line\r\n const sociStoreName = isSociEnabled && sociPrefferedStore?.name || '';\r\n const storeName: string | undefined = preferredStore && ((preferredStore.ExtensionProperties?.find(x => x.Key === 'Yext_Store_Name')?.Value?.StringValue) || preferredStore?.OrgUnitName);\r\n const storeNameWithState = isSociEnabled ? `${sociStoreName}, ${sociPrefferedStore?.state}` : `${storeName}, ${preferredStore?.State}`;\r\n const canTryInStores = this._getProductSpecificationAttributeByKeyName('try in store');\r\n const onHandleFindPreferredStore = async (): Promise => {\r\n const {\r\n data: {\r\n storeSelectorStateManager: { result: storeSelectorStateManager }\r\n },\r\n modules\r\n } = this.props;\r\n if (!storeSelectorStateManager) {\r\n return;\r\n }\r\n let storeSelectorId: string = '';\r\n if (modules && Object.keys(modules).length > 0 && modules.mfrmStoreSelector && modules.mfrmStoreSelector.length > 0) {\r\n storeSelectorId = modules.mfrmStoreSelector[0].id;\r\n }\r\n MsDyn365.isBrowser && document.body.classList.add('modal-store-locator-toggle-pdp');\r\n this.setState({ isStoreDetailsOpen: false });\r\n storeSelectorStateManager\r\n ?.openDialog({\r\n id: storeSelectorId,\r\n showMapViewLink: false,\r\n onLocationSelected: () => {\r\n return Promise.resolve();\r\n }\r\n })\r\n .catch((error: Error) => {\r\n if (this.props.telemetry) {\r\n this.props.telemetry.error(error.message);\r\n this.props.telemetry.debug('Unable to set preferred store');\r\n }\r\n return;\r\n });\r\n };\r\n\r\n const { Inventory, Status } = { ...this.state.tryInStoresResults };\r\n if (Status === 'Success' && canTryInStores && Inventory?.length !== 0) {\r\n const { isStoreDetailsOpen } = this.state;\r\n const storeLocatorContext = preferredStore && preferredStore.Contacts ? preferredStore.Contacts.find(url => url.ContactTypeValue === 3) : undefined;\r\n const extractPhoneNumber = (contacts: OrgUnitContact[] | undefined): string | undefined => {\r\n if (!contacts) {\r\n return undefined;\r\n }\r\n const allPhoneContacts = contacts.filter(contact => contact.ContactTypeValue === 1 && !contact.IsPrivate);\r\n if (allPhoneContacts && allPhoneContacts.length > 0) {\r\n const primaryPhoneContact = allPhoneContacts.find(contact => contact.IsPrimary);\r\n if (primaryPhoneContact) {\r\n return primaryPhoneContact.Locator;\r\n }\r\n return allPhoneContacts[0].Locator;\r\n }\r\n return undefined;\r\n };\r\n const storeLocatorUrl: string | undefined = storeLocatorContext\r\n ? storeLocatorContext.Locator\r\n : `https://bing.com/maps/default.aspx?where1=${preferredStore?.Address}`;\r\n const sociStoreLocatorUrl: string | undefined = sociPrefferedStore?.website_url || '';\r\n const storeAddressLine1: string | undefined = isSociEnabled && sociPrefferedStore ? sociPrefferedStore.address1 : preferredStore?.Street;\r\n const storeAddressLine2: string | undefined = isSociEnabled && sociPrefferedStore ? sociPrefferedStore.address2 : `${preferredStore?.City}, ${preferredStore?.State} ${preferredStore?.Zip}`;\r\n\r\n // VSI Customization - ends\r\n const phoneNumber: string | undefined = isSociEnabled ? sociPrefferedStore?.phone : extractPhoneNumber(preferredStore?.Contacts);\r\n if (!isStoreDetailsOpen) {\r\n return (\r\n \r\n \r\n \r\n {availableInStoresTextV2}\r\n \r\n {storeNameWithState}\r\n \r\n \r\n \r\n );\r\n } else {\r\n return (\r\n \r\n \r\n \r\n \r\n {availableInStoresTextV2}\r\n {storeNameWithState}\r\n \r\n \r\n \r\n \r\n {isSociEnabled && sociPrefferedStore ? \r\n {storeAddressLine1}\r\n {storeAddressLine2}\r\n {sociPrefferedStore && {`${sociPrefferedStore.city}, ${sociPrefferedStore.state} ${sociPrefferedStore.postalcode}`}}\r\n :\r\n \r\n {storeAddressLine1}\r\n {storeAddressLine2}\r\n \r\n }\r\n {phoneNumber && {phoneNumber}}\r\n {!isSociEnabled && this._renderStoreHours(preferredStore!)}\r\n \r\n {viewStoreDetailsText}\r\n {changeStoreText}\r\n \r\n \r\n \r\n \r\n );\r\n }\r\n } else if (Status === 'Success' && canTryInStores && Inventory?.length === 0) {\r\n return (\r\n \r\n \r\n \r\n {notAvailableInStoresTextV2}\r\n \r\n {storeNameWithState}\r\n \r\n \r\n \r\n \r\n );\r\n } else if (storeName && !canTryInStores && isOnlineOnly) {\r\n // displaying not available to Try-In store as per ADO #64278\r\n return (\r\n \r\n \r\n \r\n {notAvailableInStoresTextV2}\r\n \r\n {storeNameWithState}\r\n \r\n \r\n \r\n \r\n );\r\n } else {\r\n return null;\r\n }\r\n };\r\n\r\n private _getProductBadges = (): JSX.Element | undefined => {\r\n // find the configured backend attribute\r\n const {\r\n context: { request },\r\n data: { productSpecificationData },\r\n app: {\r\n config: { productBadgeAttribute: attribute }\r\n }\r\n } = this.props;\r\n const badgeData =\r\n attribute &&\r\n productSpecificationData.result?.find(\r\n currAttribute => currAttribute.Name && currAttribute.Name.toLowerCase().trim() === attribute.toLowerCase().trim()\r\n )?.TextValue;\r\n if (!badgeData) {\r\n return;\r\n }\r\n\r\n // split badge data into its separate badges\r\n const badges = badgeData?.split(',');\r\n\r\n // parse badge data to get its schedule and image src\r\n const parsedBadges = badges?.map((badge: string) => parseBadgeData(badge, request));\r\n\r\n // build product badge image components\r\n // tslint:disable-next-line: no-any\r\n const finalizedBadges =\r\n parsedBadges && parsedBadges.map((parsedBadge: any) => parsedBadge && buildProductBadge(parsedBadge, request));\r\n return finalizedBadges && <>{finalizedBadges};\r\n };\r\n\r\n // tslint:disable-next-line: cyclomatic-complexity\r\n private _renderEyeBrowMessage = (): JSX.Element | undefined => {\r\n const {\r\n config: { targetAudienceGroup }\r\n } = this.props;\r\n // VSI Customization - START - 24659\r\n const trackingEyebrow = (message: string): void => {\r\n // @ts-ignore\r\n if (utag) {\r\n // @ts-ignore\r\n // tslint:disable-next-line: object-literal-key-quotes\r\n utag.link({ 'event': 'pdp-eyebrow-messages', 'event_category': 'pdp eyebrow message', 'event_action': 'eyebrow message click', 'event_label': `${message}`, 'event_noninteraction': 'false' });\r\n }\r\n };\r\n // VSI Customization - END - 24659\r\n /* VSI-Customization -- START Eyebrow message will render based on targetAudienceGroup config */\r\n const { eyebrowMessageResultState } = { ...this.state };\r\n let eyebrowMessage: string = '';\r\n if (eyebrowMessageResultState && eyebrowMessageResultState.length > 0) {\r\n if (\r\n eyebrowMessageResultState[0].EyeBrows &&\r\n eyebrowMessageResultState[0].EyeBrows.length &&\r\n eyebrowMessageResultState[0].EyeBrows.length > 0\r\n ) {\r\n // if value configured then match the audeinece group and return that message\r\n // if targetAudienceGroup not found return empty string (default 902 line #)\r\n if (targetAudienceGroup) {\r\n for (const eyebrow of eyebrowMessageResultState[0].EyeBrows) {\r\n const description = eyebrow.Description?.split('|')[2]?.toLowerCase();\r\n if (description === targetAudienceGroup.toLowerCase()) {\r\n eyebrowMessage = eyebrow?.Description!;\r\n break;\r\n }\r\n }\r\n // If no value configured then show the first EyebrowMessage without audienceGroup\r\n } else {\r\n for (const eyebrow of eyebrowMessageResultState[0].EyeBrows) {\r\n if (eyebrow.Description?.split('|').length === 2) {\r\n eyebrowMessage = eyebrow?.Description;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /* VSI-Customization -- END */\r\n let splitMessage: string[] = [];\r\n let emptyClassName;\r\n let emptyClassNameButton;\r\n if (eyebrowMessage !== '') {\r\n splitMessage = eyebrowMessage?.split('|');\r\n if (splitMessage[1] === '' || splitMessage[1] === undefined) {\r\n emptyClassName = 'mfrm-eyebrow--empty';\r\n emptyClassNameButton = 'no-click';\r\n }\r\n }\r\n if (!eyebrowMessage) {\r\n return;\r\n }\r\n return (\r\n <>\r\n {/* // VSI Customization - START - 24659 */}\r\n {splitMessage && splitMessage?.length > 0 && (\r\n trackingEyebrow(splitMessage[1] ? splitMessage[1] : '')}\r\n role='button'\r\n >\r\n {/* // VSI Customization - END - 24659 */}\r\n }\r\n triggerClass={`mfrm-eyebrow__button ${emptyClassNameButton}`}\r\n contentClass={`mfrm-eyebrow__content ${emptyClassName}`}\r\n position={'bottom-end'}\r\n offsetY={10}\r\n outline='shadow'\r\n // @ts-ignore\r\n tooltipContent={splitMessage[1] && splitMessage[1] !== '' && }\r\n />\r\n \r\n )}\r\n \r\n );\r\n };\r\n\r\n private _renderCSATScore = (): JSX.Element => {\r\n const {\r\n data: { productSpecificationData },\r\n config\r\n } = this.props;\r\n const isDesktop = this.state.isDesktop;\r\n let unitsReturned: string | number | undefined = productSpecificationData?.result?.find(attr => attr.Name?.toLowerCase() === 'units_returned')?.TextValue;\r\n let unitsSold: string | number | undefined = productSpecificationData?.result?.find(attr => attr.Name?.toLowerCase() === 'units_sold')?.TextValue;\r\n if (!unitsSold || unitsSold === \"0\" || Number.isNaN(unitsSold)) { return <>; }\r\n unitsReturned = Number(unitsReturned);\r\n unitsReturned = Number.isNaN(unitsReturned) ? 0 : unitsReturned;\r\n unitsSold = Number(unitsSold);\r\n const unitsNotReturend = unitsSold - unitsReturned;\r\n const avgRating = (unitsNotReturend * 5) / unitsSold;\r\n const perNotReturned: number = Math.round(100 - (Number(unitsReturned) / Number(unitsSold)) * 100);\r\n return (\r\n \r\n {config.cSatRatingHeadingText && config.cSatRatingHeadingText.replace('{perNotReturned}', `${perNotReturned}%`)}\r\n }\r\n position=\"bottom-left\"\r\n hover={isDesktop}\r\n >\r\n
\r\n \r\n {config.cSatRatingPopoverText && config.cSatRatingPopoverText.replace('{unitsNotReturend}', unitsNotReturend.toLocaleString()).replace('{unitsSold}', unitsSold.toLocaleString())}\r\n \r\n \r\n \r\n
\r\n {`${perNotReturned}%`}\r\n {`(${(unitsNotReturend).toLocaleString()})`}\r\n
\r\n
\r\n
\r\n \r\n
\r\n );\r\n };\r\n\r\n}\r\n\r\nexport default Buybox;","/*---------------------------------------------------------------------------------------------\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\n\r\nimport { RegularStoreHours } from '@msdyn365-commerce/retail-proxy';\r\nimport get from 'lodash/get';\r\nimport { IStoreSelectorLocationLineItemResources } from '.';\r\n\r\nexport interface IHoursDisplayInfo {\r\n startDayShort: string;\r\n startDayFull: string;\r\n endDayShort?: string;\r\n endDayFull?: string;\r\n timeRange: string;\r\n}\r\n\r\nexport interface IHoursInfo {\r\n isClosed: boolean;\r\n openTime?: number;\r\n closeTime?: number;\r\n}\r\n\r\ntype DayType = 'MON' | 'TUE' | 'WED' | 'THU' | 'FRI' | 'SAT' | 'SUN';\r\n\r\nexport const secondsToTime = (seconds: number | undefined): string | undefined => {\r\n if (seconds === undefined) {\r\n return undefined;\r\n } else {\r\n let hours = Math.floor(seconds / (60 * 60));\r\n const ampm = hours >= 12 ? 'pm' : 'am';\r\n hours = hours % 12;\r\n hours = hours ? hours : 12;\r\n const divisorForMinutes = seconds % (60 * 60);\r\n const minutes =\r\n Math.floor(divisorForMinutes / 60) < 10 ? `0${Math.floor(divisorForMinutes / 60)}` : Math.floor(divisorForMinutes / 60);\r\n return `${hours}:${minutes} ${ampm}`;\r\n }\r\n};\r\n\r\nexport const getTimeZoneAbbr = (timeZone: string | undefined): string | undefined => {\r\n switch (timeZone) {\r\n case 'EASTERN STANDARD TIME':\r\n return 'EST';\r\n case 'EASTERN DAYLIGHT TIME':\r\n return 'EDT';\r\n case 'CENTRAL STANDARD TIME':\r\n return 'CST';\r\n case 'CENTRAL DAYLIGHT TIME':\r\n return 'CDT';\r\n case 'MOUNTAIN STANDARD TIME':\r\n return 'MST';\r\n case 'MOUNTAIN DAYLIGHT TIME':\r\n return 'MDT';\r\n case 'PACIFIC STANDARD TIME':\r\n return 'PST';\r\n case 'PACIFIC DAYLIGHT TIME':\r\n return 'PDT';\r\n default: // any other than USA TimeZone:\r\n return timeZone;\r\n }\r\n};\r\nconst getShortTimeString = (day: DayType, resources: IStoreSelectorLocationLineItemResources): string => {\r\n switch (day) {\r\n case 'MON':\r\n return resources.days.monday;\r\n case 'TUE':\r\n return resources.days.tuesday;\r\n case 'WED':\r\n return resources.days.wednesday;\r\n case 'THU':\r\n return resources.days.thursday;\r\n case 'FRI':\r\n return resources.days.friday;\r\n case 'SAT':\r\n return resources.days.saturday;\r\n default: // case 'SUN':\r\n return resources.days.sunday;\r\n }\r\n};\r\n\r\nconst getFullTimeString = (day: DayType, resources: IStoreSelectorLocationLineItemResources): string => {\r\n switch (day) {\r\n case 'MON':\r\n return resources.days.mondayFull;\r\n case 'TUE':\r\n return resources.days.tuesdayFull;\r\n case 'WED':\r\n return resources.days.wednesdayFull;\r\n case 'THU':\r\n return resources.days.thursdayFull;\r\n case 'FRI':\r\n return resources.days.fridayFull;\r\n case 'SAT':\r\n return resources.days.saturdayFull;\r\n default: // case 'SUN':\r\n return resources.days.sundayFull;\r\n }\r\n};\r\n\r\nconst buildHoursDisplayInfo = (startDay: DayType, endDay: DayType, hoursInfo: string, resources: IStoreSelectorLocationLineItemResources): IHoursDisplayInfo => {\r\n return {\r\n startDayShort: getShortTimeString(startDay, resources),\r\n startDayFull: getFullTimeString(startDay, resources),\r\n endDayShort: startDay !== endDay ? getShortTimeString(endDay, resources) : undefined,\r\n endDayFull: startDay !== endDay ? getFullTimeString(endDay, resources) : undefined,\r\n timeRange: hoursInfo\r\n };\r\n};\r\n\r\nconst shouldMergeLines = (firstLine: IHoursInfo, secondLine: IHoursInfo): boolean => {\r\n if (firstLine.isClosed && secondLine.isClosed) {\r\n return true;\r\n }\r\n\r\n if (!firstLine.isClosed && !secondLine.isClosed) {\r\n return firstLine.openTime === secondLine.openTime && firstLine.closeTime === secondLine.closeTime;\r\n }\r\n\r\n return false;\r\n};\r\n\r\nexport const getStoreHoursData = (storeHours: RegularStoreHours, dateForLookup: string): IHoursInfo => {\r\n return {\r\n isClosed: get(storeHours, `IsClosedOn${dateForLookup}`, false),\r\n openTime: get(storeHours, `${dateForLookup}OpenTime`, undefined),\r\n closeTime: get(storeHours, `${dateForLookup}CloseTime`, undefined)\r\n };\r\n};\r\n\r\nconst buildStoreHoursString = (hoursInfo: IHoursInfo, resources: IStoreSelectorLocationLineItemResources): string => {\r\n if (hoursInfo.isClosed) {\r\n return resources.closedText;\r\n } else {\r\n const openFrom: string | undefined = secondsToTime(hoursInfo.openTime);\r\n const openTo: string | undefined = secondsToTime(hoursInfo.closeTime);\r\n\r\n return `${openFrom}–${openTo}`;\r\n }\r\n};\r\n\r\nexport const buildStoreHours = (storeHours: RegularStoreHours, resources: IStoreSelectorLocationLineItemResources): IHoursDisplayInfo[] => {\r\n const storeHoursList: IHoursDisplayInfo[] = [];\r\n\r\n const mondayHours = getStoreHoursData(storeHours, 'Monday');\r\n const tuesdayHours = getStoreHoursData(storeHours, 'Tuesday');\r\n const wednesdayHours = getStoreHoursData(storeHours, 'Wednesday');\r\n const thursdayHours = getStoreHoursData(storeHours, 'Thursday');\r\n const fridayHours = getStoreHoursData(storeHours, 'Friday');\r\n const saturdayHours = getStoreHoursData(storeHours, 'Saturday');\r\n const sundayHours = getStoreHoursData(storeHours, 'Sunday');\r\n\r\n let periodStart: DayType = 'MON';\r\n let periodEnd: DayType = 'MON';\r\n\r\n if (!shouldMergeLines(mondayHours, tuesdayHours)) {\r\n storeHoursList.push(buildHoursDisplayInfo(periodStart, periodEnd, buildStoreHoursString(mondayHours, resources), resources));\r\n\r\n periodStart = 'TUE';\r\n }\r\n periodEnd = 'TUE';\r\n\r\n if (!shouldMergeLines(tuesdayHours, wednesdayHours)) {\r\n storeHoursList.push(buildHoursDisplayInfo(periodStart, periodEnd, buildStoreHoursString(tuesdayHours, resources), resources));\r\n\r\n periodStart = 'WED';\r\n }\r\n periodEnd = 'WED';\r\n\r\n if (!shouldMergeLines(wednesdayHours, thursdayHours)) {\r\n storeHoursList.push(buildHoursDisplayInfo(periodStart, periodEnd, buildStoreHoursString(wednesdayHours, resources), resources));\r\n\r\n periodStart = 'THU';\r\n }\r\n periodEnd = 'THU';\r\n\r\n if (!shouldMergeLines(thursdayHours, fridayHours)) {\r\n storeHoursList.push(buildHoursDisplayInfo(periodStart, periodEnd, buildStoreHoursString(thursdayHours, resources), resources));\r\n\r\n periodStart = 'FRI';\r\n }\r\n periodEnd = 'FRI';\r\n\r\n if (!shouldMergeLines(fridayHours, saturdayHours)) {\r\n storeHoursList.push(buildHoursDisplayInfo(periodStart, periodEnd, buildStoreHoursString(fridayHours, resources), resources));\r\n\r\n periodStart = 'SAT';\r\n }\r\n periodEnd = 'SAT';\r\n\r\n if (!shouldMergeLines(saturdayHours, sundayHours)) {\r\n storeHoursList.push(buildHoursDisplayInfo(periodStart, periodEnd, buildStoreHoursString(saturdayHours, resources), resources));\r\n\r\n periodStart = 'SUN';\r\n }\r\n periodEnd = 'SUN';\r\n\r\n storeHoursList.push(buildHoursDisplayInfo(periodStart, periodEnd, buildStoreHoursString(sundayHours, resources), resources));\r\n\r\n return storeHoursList;\r\n};\r\n","import classnames from 'classnames';\r\nimport React, { useState } from 'react';\r\n\r\nimport {\r\n getPayloadObject,\r\n getTelemetryAttributes,\r\n IPopupProps,\r\n ITelemetryContent,\r\n Popup,\r\n onTelemetryClick,\r\n getTelemetryObject\r\n} from '@msdyn365-commerce-modules/utilities';\r\nimport { PriceComponent } from '@msdyn365-commerce/components';\r\nimport MsDyn365, {\r\n IComponent,\r\n IComponentProps,\r\n IGridSettings,\r\n IImageSettings,\r\n msdyn365Commerce,\r\n TelemetryEvent\r\n} from '@msdyn365-commerce/core';\r\nimport { getCartState, ICartActionResult } from '@msdyn365-commerce/global-state';\r\nimport { CommerceProperty, ProductAvailableQuantity, ProductDimension, ProductPrice, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport { navLinkKeywordRemoval } from '../../../../../Utilities/plp-url-utils';\r\nimport { getProductURLForUtag, getProductSizeForUTag } from '../../../../../modules/mfrm-buybox/mfrm-buybox';\r\nimport { getAttributeValuesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { getUtagProductCategory } from '../../../../../Utilities/get-utag-product-category';\r\nimport { getUtagVariantId } from '../../../../../Utilities/get-utag-variant-id';\r\nexport interface IAddToCartComponentProps extends IComponentProps<{ product: SimpleProduct; price?: ProductPrice }> {\r\n className?: string;\r\n addToCartText: string;\r\n addToCartProductsText: string;\r\n outOfStockText: string;\r\n disabled?: boolean;\r\n quantity?: number;\r\n navigationUrl?: string;\r\n productAvailability?: ProductAvailableQuantity;\r\n getSelectedProduct?: Promise;\r\n imageSettings?: IImageSettings;\r\n gridSettings?: IGridSettings;\r\n isLoading?: boolean;\r\n isUpdatingDimension?: boolean;\r\n isLoadingDeliveryOptions?: boolean;\r\n isUpdatingDeliveryOptions?: boolean;\r\n isAddServiceItemToCart?: boolean;\r\n isAddEmailDeliveryItemToCart?: boolean;\r\n isPriceKeyedIn?: boolean;\r\n customPriceAmount?: number;\r\n isOrderQuantityLimitsFeatureEnabled?: boolean;\r\n productIdPrefix?: string;\r\n dialogStrings?: {\r\n goToCartText: string;\r\n continueShoppingText: string;\r\n headerItemOneText: string;\r\n headerItemFormatText: string;\r\n headerMessageText: string;\r\n freePriceText: string;\r\n originalPriceText: string;\r\n currentPriceText: string;\r\n };\r\n telemetryContent?: ITelemetryContent;\r\n\r\n isCustomPriceSelected?: boolean;\r\n maximumKeyInPrice?: number;\r\n minimumKeyInPrice?: number;\r\n defaultMaximumKeyInPrice?: number;\r\n defaultMinimumKeyInPrice?: number;\r\n /** VSI Customization - Start */\r\n outOfStockBooleanValue?: boolean;\r\n outOfStockSmallParcel?: boolean;\r\n mfrmOutOfStockCustomText?: string;\r\n mfrmContinueShoppingText?: string;\r\n mfrmOutOfStockSmallParcell?: boolean;\r\n mfrmAddToCartDisableByState?: boolean;\r\n mfrmContinueShoppingLink?: IMfrmCategoryPath;\r\n itemOutOfMarket?: boolean;\r\n variantOutOfStock?: boolean;\r\n extensionProps?: CommerceProperty[];\r\n allProductVariants?: SimpleProduct[];\r\n productCategoryName?: string | undefined;\r\n productBrand?: string | undefined;\r\n successfulATC?: boolean;\r\n variantIdForTracking?: string;\r\n adjustableItem?: any;\r\n pillow?: any;\r\n protector?: any;\r\n updateSuccessfulATC?(): void;\r\n /** VSI Customization - End */\r\n onAdd?(result: ICartActionResult): void;\r\n onError?(result: IAddToCartFailureResult): void;\r\n changeUpdatingDimension?(isUpdatingDimension: boolean): void;\r\n changeUpdatingDeliveryOptions?(isUpdatingDeliveryOptions: boolean): void;\r\n allVariantOOS: boolean;\r\n}\r\n\r\n/** VSI Customization - Start */\r\nexport interface IMfrmCategoryPath {\r\n Name?: string;\r\n Url?: string;\r\n}\r\n\r\nexport interface IMfrmAtpObject {\r\n itemId: string;\r\n recordId: string;\r\n date: string;\r\n zipCode: string;\r\n weeks: number;\r\n}\r\n/** VSI Customization - End */\r\n\r\nexport declare type ICartActionFailureReason =\r\n | 'EMPTYINPUT'\r\n | 'MISSINGDIMENSION'\r\n | 'OUTOFSTOCK'\r\n | 'CARTACTIONFAILED'\r\n | 'INVALIDCUSTOMAMOUNT';\r\nexport interface IAddToCartFailureResult {\r\n failureReason: ICartActionFailureReason;\r\n\r\n stockLeft?: number;\r\n cartActionResult?: ICartActionResult;\r\n missingDimensions?: ProductDimension[];\r\n}\r\n\r\nexport interface IAddtoCartComponent extends IComponent {\r\n onClick(): (event: React.MouseEvent, props: IAddToCartComponentProps) => void;\r\n}\r\n\r\nexport interface UTAGAdjBaseAddToCart {\r\n event: string;\r\n enhanced_action: string;\r\n event_category: string;\r\n event_action: string;\r\n event_label: string;\r\n event_noninteraction: string;\r\n product_id: string[];\r\n product_name: string[];\r\n product_price: string[]\r\n product_quantity: string[];\r\n product_url: string[];\r\n product_image_url: string[];\r\n product_size: (string | undefined)[];\r\n product_list_name: string[];\r\n product_list_position: string[];\r\n product_brand?: string[];\r\n product_category?: string[];\r\n product_variant?: (string | undefined)[];\r\n}\r\nexport interface UTAGCompleteYourBedPillowAddToCart {\r\n event: string;\r\n enhanced_action: string;\r\n event_category: string;\r\n event_action: string;\r\n event_label: string;\r\n event_noninteraction: string;\r\n product_id: string[];\r\n product_name: string[];\r\n product_price: string[]\r\n product_quantity: string[];\r\n product_url: string[];\r\n product_image_url: string[];\r\n product_size: (string | undefined)[];\r\n product_brand?: string[];\r\n product_category?: string[];\r\n product_variant?: (string | undefined)[];\r\n}\r\n// tslint:disable: no-any\r\nconst onClick = async (\r\n _event: React.MouseEvent,\r\n props: IAddToCartComponentProps,\r\n setDisabled: (disabled: boolean) => void,\r\n openModal: (opened: boolean) => void,\r\n setSuccess: () => void\r\n): Promise => {\r\n const telemetryContent = getTelemetryObject('Product Details Page', props.telemetryContent?.moduleName!, props.telemetryContent?.telemetry!);\r\n const payLoad = getPayloadObject('click', telemetryContent, 'Add to Cart', '');\r\n onTelemetryClick(telemetryContent, payLoad, 'Add to Cart')();\r\n const cartError = addToCartError(props);\r\n let productToAdd = props.data.product;\r\n const productBrand = `${props.productBrand}`;\r\n const productPrice = props.data.price;\r\n const productCategory = `${props.productCategoryName}`;\r\n // @ts-ignore\r\n if (utag) {\r\n // @ts-ignore\r\n // tslint:disable-next-line: object-literal-key-quotes\r\n utag.link({\r\n event: 'add-to-cart',\r\n enhanced_action: 'add',\r\n event_category: 'ecommerce',\r\n event_action: 'add to cart',\r\n event_label: `${productToAdd?.ItemId}: ${productToAdd?.Name}`,\r\n event_noninteraction: 'false',\r\n product_id: [`${productToAdd?.ItemId}`],\r\n product_name: [`${productToAdd?.Name}`],\r\n product_category: [productCategory],\r\n product_brand: [productBrand],\r\n product_variant: [`${props?.variantIdForTracking}`],\r\n product_price: [`${productPrice?.CustomerContextualPrice}`],\r\n product_quantity: [`${props.quantity}`],\r\n product_url: [`${getProductURLForUtag(productToAdd, props.context)}`],\r\n product_image_url: [`${productToAdd?.PrimaryImageUrl}`],\r\n product_size: [getProductSizeForUTag(productToAdd)]\r\n });\r\n if (props?.adjustableItem?.foundation) {\r\n const { ItemId, Name, CustomerContextualPrice, PrimaryImageUrl, Dimensions, RecordId, MasterProductId } = props.adjustableItem.foundation;\r\n const listPosition = props.adjustableItem.listPosition;\r\n const productSpecificationData = await getAttributeValuesAsync(\r\n { callerContext: props.context.actionContext, queryResultSettings: {} },\r\n RecordId,\r\n props.context.request.apiSettings.channelId,\r\n props.context.request.apiSettings.catalogId || 0\r\n );\r\n\r\n\r\n const dimension = Dimensions?.find((Dimension: { DimensionTypeValue: number }) => Dimension.DimensionTypeValue === 3);\r\n const product_size = dimension?.DimensionValue?.Value;\r\n\r\n const utag_obj: UTAGAdjBaseAddToCart = {\r\n event: 'add-to-cart',\r\n enhanced_action: 'add',\r\n event_category: 'ecommerce',\r\n event_action: 'add to cart',\r\n event_label: `${ItemId}: ${Name}`,\r\n event_noninteraction: 'false',\r\n product_id: [`${ItemId}`],\r\n product_category: await getUtagProductCategory(\r\n props.context.actionContext,\r\n props.context.request.apiSettings.channelId,\r\n props.context.request.apiSettings.catalogId,\r\n RecordId\r\n ),\r\n product_name: [`${Name}`],\r\n product_price: [`${CustomerContextualPrice}`],\r\n product_quantity: ['1'],\r\n product_url: [getProductURLForUtag(props.adjustableItem.foundation, props.context)],\r\n product_image_url: [`${PrimaryImageUrl}`],\r\n product_size: [\r\n product_size\r\n ],\r\n product_list_name: ['PDP Add Base/Foundation'],\r\n product_list_position: [`${listPosition}`],\r\n product_variant: (MasterProductId && ItemId) ? await getUtagVariantId(MasterProductId, props.context.request.apiSettings.channelId, props.context.actionContext, RecordId, ItemId) : undefined\r\n };\r\n\r\n\r\n const brand = productSpecificationData.find(e => e.Name === 'Brand')?.TextValue;\r\n if (brand) {\r\n utag_obj.product_brand = [brand];\r\n }\r\n\r\n // @ts-ignore\r\n utag.link(utag_obj);\r\n }\r\n if (props?.pillow?.pillow) {\r\n const { ItemId, Name, CustomerContextualPrice, PrimaryImageUrl, Dimensions, RecordId, MasterProductId } = props.pillow.pillow;\r\n const productSpecificationData = await getAttributeValuesAsync(\r\n { callerContext: props.context.actionContext, queryResultSettings: {} },\r\n RecordId,\r\n props.context.request.apiSettings.channelId,\r\n props.context.request.apiSettings.catalogId || 0\r\n );\r\n const dimension = Dimensions?.find((Dimension: { DimensionTypeValue: number }) => Dimension.DimensionTypeValue === 3);\r\n const product_size = dimension?.DimensionValue?.Value;\r\n const utag_obj: UTAGCompleteYourBedPillowAddToCart = {\r\n event: 'add-to-cart',\r\n enhanced_action: 'add',\r\n event_category: 'ecommerce',\r\n event_action: 'add to cart',\r\n event_label: `${ItemId}: ${Name}`,\r\n event_noninteraction: 'false',\r\n product_id: [`${ItemId}`],\r\n product_category: await getUtagProductCategory(\r\n props.context.actionContext,\r\n props.context.request.apiSettings.channelId,\r\n props.context.request.apiSettings.catalogId,\r\n RecordId\r\n ),\r\n product_name: [`${Name}`],\r\n product_price: [`${CustomerContextualPrice}`],\r\n product_quantity: ['1'],\r\n product_url: [getProductURLForUtag(props.pillow.pillow, props.context)],\r\n product_image_url: [`${PrimaryImageUrl}`],\r\n product_size: [\r\n product_size\r\n ],\r\n product_variant: (MasterProductId && ItemId) ? await getUtagVariantId(MasterProductId, props.context.request.apiSettings.channelId, props.context.actionContext, RecordId, ItemId) : undefined\r\n };\r\n const brand = productSpecificationData.find(e => e.Name === 'Brand')?.TextValue;\r\n if (brand) {\r\n utag_obj.product_brand = [brand];\r\n }\r\n // @ts-ignore\r\n utag.link(utag_obj);\r\n }\r\n if (props?.protector?.protector) {\r\n const { ItemId, Name, CustomerContextualPrice, PrimaryImageUrl, Dimensions, RecordId, MasterProductId } = props.protector.protector;\r\n const productSpecificationData = await getAttributeValuesAsync(\r\n { callerContext: props.context.actionContext, queryResultSettings: {} },\r\n RecordId,\r\n props.context.request.apiSettings.channelId,\r\n props.context.request.apiSettings.catalogId || 0\r\n );\r\n const dimension = Dimensions?.find((Dimension: { DimensionTypeValue: number }) => Dimension.DimensionTypeValue === 3);\r\n const product_size = dimension?.DimensionValue?.Value;\r\n const utag_obj: UTAGCompleteYourBedPillowAddToCart = {\r\n event: 'add-to-cart',\r\n enhanced_action: 'add',\r\n event_category: 'ecommerce',\r\n event_action: 'add to cart',\r\n event_label: `${ItemId}: ${Name}`,\r\n event_noninteraction: 'false',\r\n product_id: [`${ItemId}`],\r\n product_category: await getUtagProductCategory(\r\n props.context.actionContext,\r\n props.context.request.apiSettings.channelId,\r\n props.context.request.apiSettings.catalogId,\r\n RecordId\r\n ),\r\n product_name: [`${Name}`],\r\n product_price: [`${CustomerContextualPrice}`],\r\n product_quantity: ['1'],\r\n product_url: [getProductURLForUtag(props.protector.protector, props.context)],\r\n product_image_url: [`${PrimaryImageUrl}`],\r\n product_size: [\r\n product_size\r\n ],\r\n product_variant: (MasterProductId && ItemId) ? await getUtagVariantId(MasterProductId, props.context.request.apiSettings.channelId, props.context.actionContext, RecordId, ItemId) : undefined\r\n };\r\n const brand = productSpecificationData.find(e => e.Name === 'Brand')?.TextValue;\r\n if (brand) {\r\n utag_obj.product_brand = [brand];\r\n }\r\n // @ts-ignore\r\n utag.link(utag_obj);\r\n }\r\n\r\n }\r\n if (cartError) {\r\n propagateError(props, cartError);\r\n return;\r\n }\r\n if (!(props.getSelectedProduct === undefined)) {\r\n productToAdd = (await props.getSelectedProduct) || props.data.product;\r\n // if props.getSelectedProduct has master product, than take it from data.product\r\n if (!productToAdd?.MasterProductId) {\r\n productToAdd = props.data.product;\r\n }\r\n }\r\n\r\n const productsToAdd: any = [\r\n {\r\n product: productToAdd,\r\n count: props.quantity,\r\n availableQuantity: props.productAvailability?.AvailableQuantity,\r\n additionalProperties: { orderQuantityLimitsFeatureIsEnabled: props.isOrderQuantityLimitsFeatureEnabled },\r\n enableStockCheck: props.context.app.config.enableStockCheck,\r\n isPriceKeyedIn: props.isPriceKeyedIn,\r\n customPrice: props.customPriceAmount,\r\n isAddEmailDeliveryItemToCart: props.isAddEmailDeliveryItemToCart\r\n }, ...(props.adjustableItem?.foundation ? [{\r\n product: props.adjustableItem?.foundation,\r\n count: props.quantity\r\n }] : []), ...(props.pillow?.pillow ? [{\r\n product: props.pillow?.pillow,\r\n count: props.quantity\r\n }] : []), ...(props.protector?.protector ? [{\r\n product: props.protector?.protector,\r\n count: props.quantity\r\n }] : [])\r\n ];\r\n const cartState = await getCartState(props.context.actionContext);\r\n // VSI CUSTOMIZATION - starts\r\n // Add product separately clear and the delivery information on retail server, so GetDeliveryOptions charge calculation works correctly\r\n const cart = cartState.cart;\r\n await cartState.clearCartLinesDeliveryInformation({ cart });\r\n // VSI CUSTOMIZATION - ends\r\n await cartState\r\n .addProductsToCart(productsToAdd)\r\n .then(result => {\r\n if (result.status === 'SUCCESS') {\r\n if (props.dialogStrings && props.context.app.config.addToCartBehavior === 'showModal') {\r\n setDisabled(false);\r\n openModal(true);\r\n } else if (\r\n MsDyn365.isBrowser &&\r\n props.navigationUrl &&\r\n (props.context.app.config.addToCartBehavior === undefined || props.context.app.config.addToCartBehavior === 'goToCart')\r\n ) {\r\n // MsDyn365.isBrowser && window.location.assign(props.navigationUrl);\r\n if (MsDyn365.isBrowser) {\r\n window.location.href = props.navigationUrl;\r\n }\r\n // VSI CUSTOMIZATION - starts\r\n setDisabled(true);\r\n // VSI CUSTOMIZATION - ends\r\n }\r\n propagateResult(props, result);\r\n setSuccess();\r\n } else {\r\n propagateError(props, { failureReason: 'CARTACTIONFAILED', cartActionResult: result });\r\n setDisabled(false);\r\n }\r\n })\r\n .catch(error => console.log('error[addProductToCart]', error));\r\n};\r\n\r\nconst AddToCartComponentActions = {\r\n onClick: onClick\r\n};\r\n\r\n// tslint:disable: cyclomatic-complexity\r\n// tslint:disable: max-func-body-length\r\n// tslint:disable: react-no-dangerous-html\r\nconst AddToCart: React.FC = (props: IAddToCartComponentProps) => {\r\n const [disabled, setDisabled] = useState(false);\r\n const [modalOpen, setModalOpen] = useState(false);\r\n\r\n const onClickHandler = async (event: React.MouseEvent) => {\r\n const setSuccess = props.updateSuccessfulATC ? props.updateSuccessfulATC : () => null;\r\n await AddToCartComponentActions.onClick(event, props, setDisabled, setModalOpen, setSuccess);\r\n };\r\n\r\n const priceComponent = props.data.price ? (\r\n \r\n ) : (\r\n ''\r\n );\r\n\r\n const popupProps: IPopupProps = {\r\n context: props.context,\r\n className: 'msc-add-to-cart',\r\n id: props.id,\r\n typeName: props.typeName,\r\n data: { product: props.data.product, price: props.data.price },\r\n dialogStrings: props.dialogStrings,\r\n imageSettings: props.imageSettings,\r\n gridSettings: props.context.request?.gridSettings,\r\n productQuantity: props.quantity !== undefined ? props.quantity : 1,\r\n priceComponent: priceComponent,\r\n navigationUrl: props.navigationUrl,\r\n modalOpen: modalOpen,\r\n setModalOpen: setModalOpen,\r\n telemetryContent: props.telemetryContent\r\n };\r\n\r\n const renderModalPopup = ;\r\n const label = getLinkText(props);\r\n const payload = getPayloadObject(TelemetryEvent.AddToCart, props.telemetryContent!, label, '');\r\n const attributes = getTelemetryAttributes(props.telemetryContent!, payload);\r\n\r\n // Todo: bug#22002 - Will be resolved later on - temp fix\r\n // const classToApply = props.mfrmOutOfStockSmallParcell ? 'out-of-stock msc-add-to-cart' : 'msc-add-to-cart';\r\n const classToApply = 'msc-add-to-cart';\r\n const OOMClass = props.itemOutOfMarket || props.variantOutOfStock || props.mfrmOutOfStockSmallParcell || props.allVariantOOS ? 'out-of-market disabled' : '';\r\n let disabledSmallParcel = false;\r\n // tslint:disable-next-line: max-line-length\r\n\r\n if (\r\n (props.disabled !== undefined ? props.disabled : false) ||\r\n disabled ||\r\n isIntermediateState(props) ||\r\n shouldShowOutOfStock(props, false) ||\r\n (props.mfrmAddToCartDisableByState !== undefined ? props.mfrmAddToCartDisableByState : false) ||\r\n props.itemOutOfMarket ||\r\n props.variantOutOfStock\r\n ) {\r\n disabledSmallParcel = true;\r\n }\r\n\r\n return (\r\n
\r\n {renderModalPopup}\r\n \r\n {props.mfrmOutOfStockSmallParcell || props.allVariantOOS ? props.mfrmOutOfStockCustomText : label}\r\n \r\n {props.mfrmOutOfStockSmallParcell && (\r\n \r\n {props.mfrmContinueShoppingText}\r\n \r\n )}\r\n {/** VSI Customization - End */}\r\n
\r\n );\r\n};\r\n\r\n// Set default props\r\nAddToCart.defaultProps = {\r\n quantity: 1\r\n};\r\n\r\nexport const getLinkText = (props: IAddToCartComponentProps): string => {\r\n if (props.itemOutOfMarket || props.variantOutOfStock) {\r\n return 'Item not available';\r\n }\r\n let productToAdd = props.data.product;\r\n if (!(props.getSelectedProduct === undefined)) {\r\n props.getSelectedProduct.\r\n then((product) => {\r\n productToAdd = product || props.data.product;\r\n }).\r\n catch((err) => console.log(err));\r\n // if props.getSelectedProduct has master product, than take it from data.product\r\n if (!productToAdd?.MasterProductId) {\r\n productToAdd = props.data.product;\r\n }\r\n }\r\n const getCount = [productToAdd, ...(props.adjustableItem.foundation ? [props.adjustableItem.foundation] : []), ...(props.pillow?.pillow ? [props.pillow.pillow] : []), ...(props.protector?.protector ? [props.protector.protector] : [])].length;\r\n return shouldShowOutOfStock(props, false) ? props.outOfStockText : (getCount > 1 ? props.addToCartProductsText?.replace('{itemcount}', getCount.toString()) : props.addToCartText);\r\n};\r\n\r\nconst addToCartError = (props: IAddToCartComponentProps): IAddToCartFailureResult | undefined => {\r\n const {\r\n data,\r\n productAvailability,\r\n isCustomPriceSelected,\r\n customPriceAmount,\r\n maximumKeyInPrice,\r\n minimumKeyInPrice,\r\n defaultMaximumKeyInPrice = 100,\r\n defaultMinimumKeyInPrice = 10\r\n } = props;\r\n\r\n if (!data || !data.product.RecordId) {\r\n // No product exists, won't be able to add to cart\r\n return { failureReason: 'EMPTYINPUT' };\r\n }\r\n\r\n if (data.product?.Dimensions) {\r\n const missingDimensions = data.product.Dimensions.filter(\r\n dimension => !(dimension.DimensionValue && dimension.DimensionValue?.Value)\r\n );\r\n\r\n if (missingDimensions?.length > 0) {\r\n // At least one dimension with no value exists on the product, won't be able to add to cart\r\n return { failureReason: 'MISSINGDIMENSION', missingDimensions: missingDimensions };\r\n }\r\n }\r\n\r\n if (shouldShowOutOfStock(props, true)) {\r\n const availableQuantity = (productAvailability && productAvailability.AvailableQuantity) || 0;\r\n const stockLeft = Math.max(availableQuantity, 0);\r\n\r\n return { failureReason: 'OUTOFSTOCK', stockLeft: stockLeft };\r\n }\r\n\r\n // When Custom price is selected, if there is no keyed-in price or keyed-in price is out of limit, should return error.\r\n if (\r\n isCustomPriceSelected &&\r\n (!customPriceAmount ||\r\n customPriceAmount > (maximumKeyInPrice || defaultMaximumKeyInPrice) ||\r\n customPriceAmount < (minimumKeyInPrice || defaultMinimumKeyInPrice))\r\n ) {\r\n return { failureReason: 'INVALIDCUSTOMAMOUNT' };\r\n }\r\n\r\n // Only allow adding to cart if not showing out of stock\r\n return undefined;\r\n};\r\n\r\nconst shouldShowOutOfStock = (props: IAddToCartComponentProps, includeCurrentQuantity: boolean): boolean => {\r\n if (\r\n props.context.app.config.enableStockCheck === undefined ||\r\n props.context.app.config.enableStockCheck === false ||\r\n props.isLoading ||\r\n props.isUpdatingDimension ||\r\n props.isAddServiceItemToCart\r\n ) {\r\n // Out of stock turn off, don't bother showing out of stock\r\n return false;\r\n }\r\n\r\n if (!props.data || !props.data.product.RecordId) {\r\n // No product exists, don't bother showing out of stock\r\n return false;\r\n }\r\n\r\n if (props.data.product?.Dimensions) {\r\n if (props.data.product.Dimensions?.find(dimension => !(dimension.DimensionValue && dimension.DimensionValue.Value))) {\r\n // At least one dimension with no value exists on the product, so also don't show out of stock\r\n return false;\r\n }\r\n }\r\n const includedQuantityNumber = includeCurrentQuantity && props.quantity ? props.quantity : 1;\r\n\r\n return props.productAvailability &&\r\n props.productAvailability.AvailableQuantity !== undefined &&\r\n props.productAvailability.AvailableQuantity >= includedQuantityNumber\r\n ? false\r\n : true;\r\n};\r\n\r\nconst isIntermediateState = (props: IAddToCartComponentProps): boolean => {\r\n if (props.data.product?.Dimensions) {\r\n if (props.data.product.Dimensions?.find(dimension => !(dimension.DimensionValue && dimension.DimensionValue.Value))) {\r\n // At least one dimension with no value exists on the product, so also not in intermediate state\r\n /** VSI Customization - Start */\r\n return true;\r\n /** VSI Customization - End */\r\n }\r\n }\r\n\r\n if (!props.isLoading && !props.isUpdatingDimension) {\r\n return false;\r\n }\r\n\r\n return true;\r\n};\r\n\r\nconst propagateResult = (props: IAddToCartComponentProps, result: ICartActionResult): void => {\r\n if (props.onAdd) {\r\n props.onAdd(result);\r\n }\r\n};\r\n\r\nconst propagateError = (props: IAddToCartComponentProps, result: IAddToCartFailureResult): void => {\r\n if (props.onError) {\r\n props.onError(result);\r\n }\r\n};\r\n\r\nexport const AddToCartComponent: React.FunctionComponent = msdyn365Commerce.createComponentOverride<\r\n // @ts-ignore\r\n IAddtoCartComponent\r\n>('AddToCart', { component: AddToCart, ...AddToCartComponentActions });\r\n\r\nexport default AddToCartComponent;\r\n"],"names":["async","request","context","isCached","getATPInventoryStatusInput","GetATPInventoryStatusInput","result","getATPInventoryStatusAction","actionContext","error","console","log","getUtagProductCategory","channelId","catalogId","RecordId","categoryPathResults","getCategoryPathsAsync","callerContext","queryResultSettings","ProductId","categoryPath","CategoryPath","Segments","length","CategoryName","getUtagVariantId","MasterProductId","ItemId","input","BuyboxGetDimensionVariantAvailabilityInput","variantsResp","getAllProductVariants","variantIter","ePropsVariant","ExtensionProperties","eIter","Key","Value","StringValue","variantofId","slice","MsDyn365","window","innerWidth","gridSettings","xs","w","sm","md","lg","_coreProductATPCall","props","setCoreProductATPData","recordId","itemId","setATPCallMessage","setIsAtpCallReturned","zipcode","Cookies","get","undefined","itemLinesArray","data","product","itemLines","Quantity","VariantRecordId","toString","push","currentDate","Date","now","requestBody","InventoryType","Weeks","app","config","weeksPDPforATPCall","StoreId","Page","RequestedDate","dayjs","format","ZipCode","ItemLines","_getDeliveryByMessage","then","ATPInventoryData","Message","catch","e","_getActivePrices","pricingData","ctx","date","productIds","i","productId","getActivePricesAsync","ChannelId","requestContext","apiSettings","CatalogId","dimPricesResult","map","item","index","discountAmount","DiscountAmount","_smallParcelProductATPCallForInventoryStatus","SetoutOfStockSmallParcelState","_getInventoryQuantity","ATPInventoryStatusData","coreProductAtpData","Available","parseInt","_coreProductATPCallForInventoryStatusForAllVariants","recordIds","allVariants","ridIter","iter","variantID","isAvailable","zipCode","_smallParcelProductATPBooleanStatus","canonicalURL","requestUrl","url","origin","path","pathname","toLowerCase","urlParts","split","splice","match","removePipeSignValue","removeKeywords","filteredPath","join","filteredURL","filter","urlPart","indexOf","removeKeywordFromUrl","removeKeywordFromUrlArray","trim","forEach","_part","removeKeyword","trimmedKeyword","indexOfValue","getSortedVirtualRefinerConfig","isMattressesCategory","appConfigSorted","getVirtualRefinerConfig","appConfig","enableForMattresses","enableForOtherCategories","sort","a","b","order","getVirtualRefinerNames","sortedVirtualRefinerConfig","appConfigRefinerNames","sortedConfig","refinerName","urlModifications","getVirtualRefinerValues","virtualRefiners","virtualRefinerValues","categoryIdToken","urlTokens","finalizedUrlParts","plainUrlPart","decodeURIComponent","part","filteredPart","mainRefiner","Values","refinerValue","refinerValueKeyName","LeftValueBoundString","replace","regExSpecialChars","canonicalUrlspecialCharIncludeList","navLinkKeywordRemoval","link","linkBase","linkParams","endsWith","linkParam","param","filteredLink","includeConfigList","includeConfig","pattern","RegExp","constructor","getCacheKey","key","Array","prototype","call","this","getCacheObjectType","dataCacheType","Msdyn365","action","mFIATPInventoryStatusAsync","id","MFITryInStoreExtensionClass","odataObject","Products","Limit","Radius","className","substr","lastIndexOf","concat","EntityClasses","MFITryInStoreInfoResponseExtensionClass","Status","Inventory","createMFIGetTryInStoreInfoInput","tryInStoreProductIDs","storeId","DataServiceQuery","DataServiceEntities","tryInStoresQuery","createDataServiceRequestForOperation","bypassCache","returnEntity","GetTryInStoreInfoInput","callActionOrExecute","mFIGetTryInStoreInfoAsync","getAllVariantsForProduct","productResponse","getByIdAsync","Paging","Top","baseProduct","isArray","getVariantsByDimensionValuesAsync","telemetry","exception","Error","createObservableDataAction","inputData","query","products","pageType","priceGroupForAPICall","priceGroup","items","singleItem","DistinctProductVariant","PriceGroup","Items","getEyebrowMessageInput","GetEyebrowMessageInput","getEyebrowAction","getGenericError","cart","resources","productAvailability","location","failureReason","addedToCartFailureMessage","cartActionResult","substatus","elementFoundAt","productIdToFind","CartLines","DeliveryMode","channel","PickupDeliveryModeCode","FulfillmentStoreId","OrgUnitNumber","curQuantity","maxQuantityForCartLineItem","availableQty","AvailableQuantity","quantityLimit","Math","min","maxQuantityLimitText","errorDetails","LocalizedMessage","getConfigureErrors","isGiftCard","dimensions","dimension","DimensionTypeValue","dimensionTypeValue","productDimensionTypeColorErrorMessage","productDimensionTypeConfigurationErrorMessage","productDimensionTypeSizeErrorMessage","productDimensionTypeAmountErrorMessage","productDimensionTypeStyleErrorMessage","getDimensionErrorString","getBuyBoxInventoryLabel","productDetails","typeName","productAvailableQuantity","_getClassNamePrefix","StockLevelLabel","inventoryClassName","StockLevelCode","React","getBuyboxProductTitle","brandName","titleHeadingTag","title","Name","Heading","headingTag","text","telemetryContent","getBuyboxAddToCart","state","callbacks","defaultMinimumKeyInPrice","defaultMaximumKeyInPrice","minimumKeyInPrice","maximumKeyInPrice","quantity","errorState","configureErrors","quantityError","customAmountError","otherError","errorHost","selectedProduct","isUpdatingDimension","isUpdatingDeliveryOptions","isServiceItem","keyInPriceAmount","ProductAvailableQuantity","dialogStrings","goToCartText","buyBoxGoToCartText","continueShoppingText","buyBoxContinueShoppingText","headerItemOneText","buyBoxSingleItemText","headerItemFormatText","buyBoxMultiLineItemFormatText","headerMessageText","buyBoxHeaderMessageText","freePriceText","priceFree","originalPriceText","currentPriceText","addedQuantityText","closeNotificationLabel","isLoading","status","changeUpdatingDimension","isLoadingDeliveryOptions","deliveryOptions","changeUpdatingDeliveryOptions","getTelemetryObject","telemetryPageName","emailDeliveryModeCode","EmailDeliveryModeCode","isEmailDelivery","ArrayExtensions","DeliveryOptions","Code","ContainerProps","button","AddToCartComponent","addToCartText","outOfStockText","navigationUrl","getUrlSync","price","productPrice","onError","quantityErrorForState","customAmountErrorForState","otherErrorForState","stockLeft","errorMessageOutOfStock","errorMessageOutOfRangeOneLeft","errorMessageOutOfRangeFormat","getQuantityError","formatedAmountLimit","cultureFormatter","formatCurrency","invalidSmallCustomAmountText","invalidLargeCustomAmountText","updateErrorState","missingDimensions","IsGiftCard","getSelectedProduct","imageSettings","viewports","q","h","xl","lazyload","isAddServiceItemToCart","isPriceKeyedIn","customPriceAmount","isCustomPriceSelected","isOrderQuantityLimitsFeatureEnabled","_isOrderQuantityLimitsFeatureEnabled","isAddEmailDeliveryItemToCart","onAdd","changeModalOpen","isNavigationToCartPageDisabled","errorBlock","BuyboxErrorBlock","showError","getBuyboxProductPrice","PriceComponent","getBuyboxProductRating","ratingsSummary","ratingComponent","averageRating","RatingComponent","avgRating","readOnly","ariaLabel","averageRatingAriaLabel","ratingCount","reviewsCount","getBuyboxKeyInPrice","LabelContainerProps","tag","htmlFor","heading","buyboxKeyInPriceLabelHeading","type","onChange","value","currentTarget","updateKeyInPrice","Number","parseFloat","max","errorMessages","Object","values","message","Alert","isOpen","color","assertive","buyboxErrorMessageHeader","getQuantityLimitsMessages","Node","_renderMaxLabel","maxQuantityText","_renderMinLabel","minQuantityText","MAX_VALUE","defaultOrderQuantityLimitsFeatureConfig","platform","enableDefaultOrderQuantityLimits","customerInfo","customerInformation","IsB2b","getBuyboxFindInStore","slots","storeSelector","findInStoreHeaderText","findInStoreDescriptionText","findInStoreLinkText","storeSelectorStateManager","modalOpen","onClick","modules","dataProduct","Dimensions","DimensionValue","storeSelectorId","keys","openDialog","onLocationSelected","orgUnitLocation","deliveryMode","Promise","resolve","behavior","addToCartBehavior","addProductToCart","count","failureResult","AddToCartBehavior","assign","defaultImageSettings","friendlyName","notification","ItemSuccessfullyAddedToCartNotification","NotificationsManager","addNotification","debug","findInStoreOnClick","find","option","priceComponent","popupProps","productQuantity","setModalOpen","renderModalPopup","Popup","openFindInStoreDialog","description","productPickupOptionList","errors","disabled","modal","getProductURLForUtag","productUrl","getProductPageUrlSync","getProductSizeForUTag","Buybox","super","updateViewPort","viewport","_getViewPort","setState","isDesktop","updateSuccessfulATC","successfulATC","timer","setTimeout","dimensionUpdateQueue","FinitePromiseQueue","buyboxCallbacks","updateQuantity","newQuantity","fireAnalyticsLink","eventName","eventCategory","eventAction","eventLabel","eventNoninteraction","generalConfig","enhanced_action","newErrorState","updateSelectedProduct","newSelectedProduct","newInventory","newPrice","newDeliveryOptions","productDeliveryOptions","_updatePrice","dimensionSelectedAsync","selectedDimensionId","selectedDimensionValueId","enqueue","_updateDimensions","reason","FinitePromiseQueueError","getDropdownName","dimensionType","_getDropdownName","isModalOpen","customPrice","_updateQueryParamVariantId","variantId","currUrl","href","urlWithIgnoredCase","URL","toLocaleLowerCase","searchParams","has","variantQueryStringName","set","history","replaceState","host","_setRecentlyViewProducts","masterProductId","cookies","setDate","getDate","expiry","inserted","recentlyViewedProductsStored","recentlyViewedProducts","_setSmallParcelATPCallMade","atpCallMade","smallParcelATCallMade","_setStatusATPCall","StatusATPCall","_setZipCode","_setATPCall","ATPCall","_updateDimensionValue","productDimensionFull","newValueId","DimensionValues","productDimensionTypeColor","productDimensionTypeConfiguration","productDimensionTypeSize","productDimensionTypeAmount","productDimensionTypeStyle","_scrollToBVHosted","ratingSection","document","getElementById","getElementsByTagName","getAttribute","scrollIntoView","_onHandleToggleAvailableStoreDetails","isStoreDetailsOpen","_getPreferredStore","storeSelectorState","preferredStore","prefferedStore","Zip","localStorage","getItem","JSON","parse","_getSociPreferredStore","_getProductSpecificationAttributeByKeyName","attrName","productSpecificationData","attr","BooleanValue","_getProductType","shippingInformation","_updateUtagDataOnInitialLoad","productprice","categoryPaths","category","allCategoriesArr","categoryObj","categoryName","productAttribute","attribute","brandBackofficeAttributePdp","attributes","productBrandName","currAttribute","TextValue","productSize","listPageStateBuyBox","_getVariantIDOnLoad","name","CustomerContextualPrice","BasePrice","productImageUrl","PrimaryImageUrl","err","allProductVariants","_getProductAttributeUpdated","shippingInformationSmall","smallParcelAttributeKey","_updateAvailbilityForVariantsUpdated","variantsResult","availableVariantIDs","eComAllVariantsOOSMultiAttr","ecomAllVairantStockInfoKey","ecomAllVairantStockInfoKey1","ecomAllVairantStockInfoKey2","ecomAllVairantStockInfoKey3","getAttributeValuesAsync","ecomAllVairantStockInfoConcatenated","ecomVairantStockInfoKey1","ecomVairantStockInfoKey2","ecomVairantStockInfoKey3","ecomAllVairantStockInfo1","ecomAllVairantStockInfo2","ecomAllVairantStockInfo3","eComJsonData","newAllVariantStockInfo","VariantList","VariantRecID","OutOfStock","outOfStockBoolean","variant","productType","batchedAtp","batchedAtpInventoryStatusData","setDefaultOOSVariant","variantAvailibilityList","_updateUtagData","updatedProduct","updatedPrice","getVariantID","finalPrice","utag","product_price","product_variant","product_url","product_image_url","product_size","utag_data","_sendProductDataToTealium","tealiumRecordIdFor","event","event_category","event_action","event_label","event_noninteraction","product_id","product_name","product_category","product_brand","variantIdForTracking","_eyeBrowMessageAsyncFunc","productIdsArray","eyebrowMessageObj","eyebrowMessageResult","_getEyebrowMessage","eyebrowMessageResultState","isEyeBrowLoading","getDeliverySlotFromATP","deliveryMessageATPResultState","_tryInStoreAsyncCall","isSociEnabled","enableSociLocations","zipCodeModified","projectMetaSoci","project_meta","sociStore","sociStoreID","tryInStoreLimit","tryInStoreLookupRadius","getTryInStoreInfoInput","response","getTryInStoreAction","tryInStoresResults","isStoreLoading","prevProduct","productDimensions","dimensionsArr","dimensionsToUpdate","clearErrorState","nextProductDimensions","mappedDimensions","obj","dim","variants","queryBasedVariantSelection","variantProduct","newAvailableQuantity","getProductAvailabilitiesForSelectedVariant","ProductAvailabilitiesForSelectedVariantInput","getPriceForSelectedVariant","PriceForSelectedVariantInput","getDeliveryOptionsForSelectedVariant","GetDeliveryOptionsForSelectedVariantInput","currentProduct","currentProductDimensions","_updateQuantitiesInState","makeCoreProductDeliveryMessage","_updateVariantIDForTracking","_updateURLWithoutReloading","_getBuyboxProductRating","productSpecification","getBVAttributeValues","role","_renderTryInStore","availableInStoresText","notAvailableInStoresText","onlineOnlyProductsText","isOnlineOnly","onlineOnlyBackOfficeAttribute","storeName","x","OrgUnitName","storeNameWithState","State","availableStoreText","notAvailableStoreText","canTryInStores","onHandleFindPreferredStore","mfrmStoreSelector","body","classList","add","showMapViewLink","Text","_renderStoreHours","isClosedToday","isClosed","startTime","IntegerValue","endTime","timeZone","timeZoneAbbr","getTimeZoneAbbr","storeHoursClosedText","storeCloseAtHours","storeOpenAtHours","secondsToTime","_renderTryInStoreRedesign","availableInStoresTextV2","notAvailableInStoresTextV2","viewStoreDetailsText","changeStoreText","sociPrefferedStore","sociStoreName","storeLocatorContext","Contacts","ContactTypeValue","extractPhoneNumber","contacts","allPhoneContacts","contact","IsPrivate","primaryPhoneContact","IsPrimary","Locator","storeLocatorUrl","Address","sociStoreLocatorUrl","website_url","storeAddressLine1","address1","Street","storeAddressLine2","address2","City","phoneNumber","phone","ref","wrapperRef","tabIndex","city","postalcode","target","_getProductBadges","productBadgeAttribute","badgeData","badges","parsedBadges","badge","parseBadgeData","finalizedBadges","parsedBadge","buildProductBadge","_renderEyeBrowMessage","targetAudienceGroup","eyebrowMessage","EyeBrows","eyebrow","Description","emptyClassName","emptyClassNameButton","splitMessage","trackingEyebrow","Popper","trigger","RichTextComponent","triggerClass","contentClass","position","offsetY","outline","tooltipContent","_renderCSATScore","unitsReturned","unitsSold","isNaN","unitsNotReturend","perNotReturned","round","cSatRatingHeadingText","Tooltip","Info","height","width","hover","cSatRatingPopoverText","toLocaleString","Rating","defaultValue","precision","extensionProps","deliveryMessage","inventoryStatusATPResultState","variantAvailibilityUpdating","showViewCartLink","bind","_setAllProductVariantsResult","handleClickOutside","addEventListener","PRODUCTASSERVICE","ItemTypeValue","newCartTotalItems","totalItemsInCart","getZipCode","prevProps","prevState","resizeThrottledEventHandler","addThrottledEvent","selProd","currSelProd","element","isInStock","clearTimeout","removeEventListener","extendAllProductVariants","prices","extendedAllProductVariants","extendedObj","productSizeName","dimensionPrice","priceAfterDiscount","discount","current","contains","smallParcelVariantsListObj","inStockLowestPriceVariant","isProductFound","variantObj","smallParcelProduct","str","outOfStock","outOfStockProductKey","inventoryStatusData","selectedObj","queryParamValue","masterId","pushState","search","queryParams","updatedProductSpecificationData","dimensionPrices","prodSpecficationData","Price","getNextInventoryProduct","dimensionValues","getDimensionValuesAsync","fullDimension","Behavior","DefaultQuantity","MinimumQuantity","MaximumQuantity","render","mediaGallery","selectedFoundation","adjustableItem","completeYourBedPillow","pillow","completeYourBedProtector","protector","parseBrandName","viewProps","ModuleProps","moduleProps","classnames","ProductInfoContainerProps","MediaGalleryContainerProps","getBuyboxProductDescription","configure","getBuyboxProductConfigure","findInStore","addToCart","viewCartLink","rating","hideRating","inventoryLabel","shopSimilarLook","enableShopSimilarLooks","getBuyboxShopSimilarButton","ShopSimiliarButtonType","shopSimilarDescription","enableShopSimilarDescription","keyInPrice","enableKeyInPrice","quantityLimitsMessages","setSmallParcelATPCallMade","setStatusATPCall","setZipCode","setATPCall","productBadges","showBVRatings","BVRatingSummary","eyeBrowMessage","promotionalMessage","ATPDataFromBusiness","updateDimension","getProductType","setAllProductVariantsResult","customerSatisfactionScore","renderView","seconds","hours","floor","ampm","divisorForMinutes","minutes","AddToCartComponentActions","_event","setDisabled","openModal","setSuccess","moduleName","payLoad","getPayloadObject","onTelemetryClick","cartError","addToCartError","productToAdd","productBrand","productCategory","productCategoryName","product_quantity","foundation","listPosition","Dimension","utag_obj","product_list_name","product_list_position","brand","propagateError","productsToAdd","availableQuantity","additionalProperties","orderQuantityLimitsFeatureIsEnabled","enableStockCheck","cartState","getCartState","clearCartLinesDeliveryInformation","addProductsToCart","propagateResult","AddToCart","useState","label","getLinkText","payload","TelemetryEvent","getTelemetryAttributes","OOMClass","itemOutOfMarket","variantOutOfStock","mfrmOutOfStockSmallParcell","allVariantOOS","disabledSmallParcel","isIntermediateState","shouldShowOutOfStock","mfrmAddToCartDisableByState","mfrmOutOfStockCustomText","mfrmContinueShoppingLink","Url","mfrmContinueShoppingText","defaultProps","getCount","addToCartProductsText","includeCurrentQuantity","includedQuantityNumber","msdyn365Commerce","component"],"sourceRoot":""}