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Y,eAIpF,KAAjB7E,GACG1Q,IAAAA,cAAA,OAAKoE,UAAU,yCAAyCoR,wBAAyB,CAAEC,OAAQ/E,MAE3F1Q,IAAAA,cAAAA,IAAAA,SAAA","sources":["webpack://mattressfirm/./src/Utilities/components/BVRatingSummary.tsx?6e2e","webpack://mattressfirm/./src/Utilities/get-block-message.tsx?29cd","webpack://mattressfirm/./src/Utilities/get-product-badge.tsx?635b","webpack://mattressfirm/./src/Utilities/one-year-from-now.ts?0f43","webpack://mattressfirm/./src/data-actions/get-address-from-zipcode.action.ts?d9c9","webpack://mattressfirm/./src/data-actions/get-attributes-for-selected-variant.ts?4859","webpack://mattressfirm/./src/modules/mfrm-buybox/components/buybox-devliery-by-message.tsx?ca39"],"sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\n\r\nexport const BVRatingSummary = ({\r\n itemId,\r\n onClick,\r\n variantId,\r\n hideReadReviewsButton\r\n}: {\r\n itemId: string | undefined;\r\n onClick?: () => void;\r\n variantId?: number | undefined;\r\n hideReadReviewsButton?: boolean\r\n}) => {\r\n const [dataBvProductIdAttr, setDataBvProductIdAttr] = useState(itemId);\r\n const wrapper = useRef(null);\r\n const interval = useRef(-1);\r\n const [numReviews, setNumReviews] = useState();\r\n\r\n useEffect(() => {\r\n setDataBvProductIdAttr(itemId);\r\n }, [itemId]);\r\n\r\n useEffect(() => {\r\n setDataBvProductIdAttr('bv-refresh');\r\n }, [variantId]);\r\n\r\n useEffect(() => {\r\n if (dataBvProductIdAttr === 'bv-refresh') {\r\n setDataBvProductIdAttr(itemId);\r\n }\r\n }, [dataBvProductIdAttr]);\r\n useEffect(() => {\r\n const pollInterval = window.setInterval(() => {\r\n const numReviewsHTML = wrapper.current?.querySelector('.bv_numReviews_text')?.innerHTML.match(/\\(([^)]+)\\)/)?.[1];\r\n if (numReviewsHTML) {\r\n setNumReviews(numReviewsHTML);\r\n clearInterval(pollInterval);\r\n }\r\n }, 0);\r\n });\r\n useEffect(() => {\r\n if (wrapper.current) {\r\n numReviews === '0' ? wrapper.current.style.display = 'none' : wrapper.current.style.display = 'flex';\r\n }\r\n }, [numReviews]);\r\n\r\n return (\r\n {\r\n if (hideReadReviewsButton) {\r\n interval.current = window.setInterval(() => {\r\n const button: Element | undefined = Array.from(document.querySelectorAll('.bv_button_buttonFull')).find((button) => {\r\n return button?.innerHTML === `Read ${numReviews} Reviews`;\r\n });\r\n if (button) {\r\n button.outerHTML = '';\r\n }\r\n });\r\n }\r\n }}\r\n onMouseLeave={() => {\r\n if (hideReadReviewsButton) {\r\n clearInterval(interval.current);\r\n }\r\n }}\r\n data-bv-show='rating_summary'\r\n data-bv-product-id={dataBvProductIdAttr}\r\n onClick={onClick}\r\n ref={wrapper}\r\n />\r\n );\r\n};\r\n","export interface IMfrmStatesValues {\r\n stateName: string;\r\n message: string;\r\n zipcodeMessage: string;\r\n hasStore:boolean;\r\n hideCheckoutState:boolean;\r\n}\r\n\r\nexport const getBlockZipCodeMessage = (stateName: string, blockStatesArray: IMfrmStatesValues[]) => {\r\n if (blockStatesArray) {\r\n return blockStatesArray.filter((blockstate: IMfrmStatesValues) => {\r\n return blockstate.stateName === stateName;\r\n });\r\n }\r\n return [];\r\n};\r\n","import { IImageSettings, Image, IRequestContext } from '@msdyn365-commerce/core';\r\nimport dayjs from 'dayjs';\r\nimport tz from 'dayjs/plugin/timezone';\r\nimport utc from 'dayjs/plugin/utc';\r\nimport isBetween from 'dayjs/plugin/isBetween';\r\ndayjs.extend(tz);\r\ndayjs.extend(utc);\r\ndayjs.extend(isBetween);\r\nimport React from 'react';\r\nimport { AttributeValue } from '@msdyn365-commerce/retail-proxy';\r\nconst format = 'M/D/YYYY H:m:s';\r\n\r\nexport interface IBadgeData {\r\n src: string;\r\n alt: string;\r\n start: dayjs.Dayjs;\r\n end: dayjs.Dayjs;\r\n}\r\n\r\nconst defaultImageSettings: IImageSettings = {\r\n viewports: {\r\n xs: { q: `m=6`, w: 0, h: 0 }\r\n },\r\n disableLazyLoad: true\r\n};\r\n\r\nexport const parseBadgeData = (badgeData: string, requestContext: IRequestContext): IBadgeData | undefined => {\r\n let dataSegments;\r\n let scheduleStart;\r\n let scheduleEnd;\r\n let badgeType;\r\n let parsedScheduleStart;\r\n let startDate;\r\n let startTime;\r\n let parsedScheduleEnd;\r\n let endDate;\r\n let endTime;\r\n\r\n try {\r\n // split the data into its segments\r\n dataSegments = badgeData.split('#');\r\n scheduleStart = dataSegments[0];\r\n scheduleEnd = dataSegments[1];\r\n badgeType = dataSegments[2];\r\n\r\n // parse schedule start\r\n parsedScheduleStart = scheduleStart.split('_');\r\n startDate = parsedScheduleStart[0];\r\n startTime = parsedScheduleStart[1];\r\n\r\n // parse schedule end\r\n parsedScheduleEnd = scheduleEnd.split('_');\r\n endDate = parsedScheduleEnd[0];\r\n endTime = parsedScheduleEnd[1];\r\n } catch (e) {\r\n return;\r\n }\r\n\r\n const startMoment = `${startDate} ${startTime?.replace(/-/g, \":\")}`;\r\n const endMoment = `${endDate} ${endTime?.replace(/-/g, \":\")}`;\r\n\r\n const startMomentFormatted = dayjs(startMoment?.replace(/-/g, \"/\"));\r\n const endMomentFormatted = dayjs(endMoment?.replace(/-/g, \"/\"));\r\n\r\n // check if schedule is valid\r\n if (!(startMomentFormatted.isValid() && endMomentFormatted.isValid())) {\r\n return;\r\n }\r\n\r\n // parse badge type and create image src\r\n const baseUrl = requestContext.apiSettings.baseImageUrl.substring(0, requestContext.apiSettings.baseImageUrl.length - 1);\r\n if (badgeType) {\r\n const removed$ = badgeType.substring(1, badgeType.length - 1);\r\n const parsedBadgeType = removed$?.replace(' ', '-').toLowerCase();\r\n\r\n // remove page name portion\r\n const altText = removed$.split('-')[0];\r\n\r\n const src = `${baseUrl}${parsedBadgeType}.png`;\r\n return {\r\n src: src,\r\n alt: altText,\r\n start: convertTimeZone(startMomentFormatted),\r\n end: convertTimeZone(endMomentFormatted)\r\n };\r\n } else {\r\n return;\r\n }\r\n};\r\n\r\n// convert given time to Central Time (CT)\r\nconst convertTimeZone = (time: dayjs.Dayjs): dayjs.Dayjs => {\r\n return dayjs(time.format(format), format).tz('America/Chicago').local();\r\n};\r\n\r\nexport const buildProductBadge = (parsedBadgeData: IBadgeData, requestContext: IRequestContext): JSX.Element | undefined => {\r\n // only build image if it is scheduled\r\n const isScheduled = dayjs().isBetween(parsedBadgeData.start, parsedBadgeData.end);\r\n\r\n if (isScheduled) {\r\n return (\r\n \r\n );\r\n }\r\n\r\n return undefined;\r\n};\r\n\r\nexport const renderProductBadge = (\r\n attributeName: string | undefined,\r\n requestContext: IRequestContext\r\n): JSX.Element | undefined => {\r\n const badgeData = attributeName;\r\n if (!badgeData) {\r\n return;\r\n }\r\n // split badge data into its separate badges\r\n const badges = badgeData.split(',');\r\n // parse badge data to get its schedule and image src\r\n const parsedBadges = badges.map(badge => parseBadgeData(badge, requestContext));\r\n\r\n // build product badge image components\r\n const finalizedBadges = parsedBadges.map(parsedBadge => parsedBadge && buildProductBadge(parsedBadge, requestContext));\r\n\r\n return finalizedBadges ? <>{finalizedBadges} : <>;\r\n};\r\n\r\nexport const renderProductBadgeByFilteringAttributes = (\r\n attributeName: string | undefined,\r\n attributes: AttributeValue[] | undefined,\r\n requestContext: IRequestContext\r\n): JSX.Element | undefined => {\r\n const badgeData =\r\n attributeName &&\r\n attributes?.find(\r\n currAttribute => currAttribute.Name && currAttribute.Name.toLowerCase().trim() === attributeName.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 => parseBadgeData(badge, requestContext));\r\n // build product badge image components\r\n const finalizedBadges = parsedBadges.map(parsedBadge => parsedBadge && buildProductBadge(parsedBadge, requestContext));\r\n\r\n return finalizedBadges && <>{finalizedBadges};\r\n};\r\n","export const oneYearFromNow = (): Date => {\r\n const now = new Date();\r\n return new Date(now.setFullYear(now.getFullYear() + 1));\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\n// tslint:disable-next-line: no-duplicate-imports\r\nimport { IActionContext } from '@msdyn365-commerce/core';\r\nimport { CacheType, ZipCodeInfo } from '@msdyn365-commerce/retail-proxy';\r\nimport { getAddressFromZipCodeAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\r\n\r\n/**\r\n * GetEyebrowMessage Input Action\r\n */\r\n\r\nexport class GetAddressByZipcodeInput implements Msdyn365.IActionInput {\r\n // Construct the input needed to run the action\r\n public country: string;\r\n public zipcode: string;\r\n\r\n constructor(country: string, zipcode: string) {\r\n this.country = country;\r\n this.zipcode = zipcode;\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 = () => `Get-Address-By-Zipcode-${this.zipcode}`;\r\n public getCacheObjectType = () => 'GetAddressByZipCode';\r\n public dataCacheType = (): CacheType => 'application';\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\r\n/**\r\n * Use this function to call your action and process the results as needed\r\n */\r\nasync function getAddressByZipcodeAction(input: GetAddressByZipcodeInput, ctx: IActionContext): Promise {\r\n const { zipcode, country } = input;\r\n const isValidZipcode = typeof zipcode === 'string' && zipcode?.trim()?.length === 5 && zipcode !== \"00000\";\r\n return isValidZipcode ? getAddressFromZipCodeAsync({ callerContext: ctx, queryResultSettings: { Paging: { Top: 1 } } }, country, zipcode) : null;\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >getAddressByZipcodeAction,\r\n // Give your data action a unique id\r\n id: 'GetAddressByZipcode'\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","import {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICreateActionContext,\r\n IGeneric\r\n} from '@msdyn365-commerce/core';\r\nimport { AttributeValue, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\n\r\nimport { getSelectedProductIdFromActionInput, getSelectedVariant, SelectedVariantInput } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { getAttributeValuesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\n\r\n/**\r\n * Chains getting the SelectedVariant with GetActivePrice\r\n */\r\nexport class AttributesForSelectedVariantInput implements IActionInput {\r\n public productId: number;\r\n public channelId: number;\r\n public catalogId: number;\r\n public selectedProduct: SimpleProduct | undefined;\r\n\r\n constructor(productId: number, channelId: number, selectedProduct?: SimpleProduct, catalogId?: number) {\r\n this.productId = productId;\r\n this.channelId = channelId;\r\n this.selectedProduct = selectedProduct;\r\n this.catalogId = catalogId || 0;\r\n }\r\n\r\n public getCacheKey = () => `AttributesForSelectedVariant`;\r\n public getCacheObjectType = () => 'ProductAttributeValue';\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\nexport const createAttributesForSelectedVariantInput = (\r\n inputData: ICreateActionContext>\r\n): AttributesForSelectedVariantInput => {\r\n const productId = getSelectedProductIdFromActionInput(inputData);\r\n if (productId) {\r\n return new AttributesForSelectedVariantInput(+productId, +inputData.requestContext.apiSettings.channelId);\r\n } else {\r\n throw new Error('Unable to create PriceForSelectedVariantInput, no productId found on module config or query');\r\n }\r\n};\r\n\r\n/**\r\n * Calls the Retail API a get a list of dimension values for a given product.\r\n */\r\nexport async function getAttributesForSelectedVariantAction(\r\n input: AttributesForSelectedVariantInput,\r\n ctx: IActionContext\r\n): Promise {\r\n // @ts-ignore: Promise vs. ObservablePromise typing conflict\r\n return Promise.resolve()\r\n .then(() => {\r\n const activeProduct: SimpleProduct | undefined = input.selectedProduct;\r\n\r\n if (!activeProduct) {\r\n const selectedVariantInput = new SelectedVariantInput(input.productId, input.channelId);\r\n\r\n return getSelectedVariant(selectedVariantInput, ctx);\r\n }\r\n\r\n return activeProduct;\r\n })\r\n .then((productResult: SimpleProduct | null) => {\r\n const activeProduct: SimpleProduct | undefined = productResult;\r\n\r\n if (activeProduct) {\r\n return getAttributeValuesAsync(\r\n { callerContext: ctx, queryResultSettings: {} },\r\n activeProduct.RecordId,\r\n input.channelId,\r\n input.catalogId\r\n );\r\n }\r\n\r\n return null;\r\n })\r\n .then((attributeValues: AttributeValue[] | null) => {\r\n const resultArray = attributeValues;\r\n if (resultArray) {\r\n return resultArray;\r\n }\r\n\r\n return [];\r\n })\r\n .catch((error: Error) => {\r\n ctx.trace(error.message);\r\n throw new Error(`[getPriceForSelectedVariantAction]Error executing action ${error.message}`);\r\n });\r\n}\r\n\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/product-info/get-attributes-for-selected-variant',\r\n action: >getAttributesForSelectedVariantAction,\r\n input: createAttributesForSelectedVariantInput\r\n});\r\n","import React from 'react';\r\nimport { Node } from '@msdyn365-commerce-modules/utilities';\r\n\r\nimport { IBuyboxViewPropsExtended } from '../types';\r\nimport { IBrandListData, IMfrmAtpMessage } from '../mfrm-buybox.view';\r\nimport Cookies from 'universal-cookie';\r\nimport getAddressByZipcodeAction, { GetAddressByZipcodeInput } from '../../../data-actions/get-address-from-zipcode.action';\r\nimport { getBlockZipCodeMessage } from '../../../Utilities/get-block-message';\r\nimport { oneYearFromNow } from '../../../Utilities/one-year-from-now';\r\nimport { ProductCompareBuyboxStateSharing } from '../../../actions/product-compare-buybox-state-sharing';\r\nimport { IMFIATPInventoryEntity } from '../../../actions/CoreProductDataServiceEntities.g';\r\nimport dayjs from 'dayjs';\r\nimport {\r\n _coreProductATPCall,\r\n _coreProductATPCallForInventoryStatus,\r\n _coreProductATPCallForInventoryStatusForAllVariants,\r\n _smallParcelProductATPCallForInventoryStatus\r\n} from '../../../Utilities/mfrm-buybox-utils';\r\n\r\nconst _setTime = (time: string | undefined) => {\r\n if (time) {\r\n const temp = time.split(' ');\r\n if (temp?.length > 0) {\r\n let newDatewithTime = dayjs(Date.now()).format('M/D/YYYY');\r\n newDatewithTime = `${newDatewithTime} ${temp[0]}:00 ${temp[1].toUpperCase()}`;\r\n return newDatewithTime;\r\n }\r\n }\r\n return '';\r\n};\r\n\r\nconst _getSoonestDeliveryDate = (coreProductATPData: IMFIATPInventoryEntity[]): string => {\r\n let deliveryByMessage = '';\r\n if (!coreProductATPData.length) {\r\n return deliveryByMessage;\r\n }\r\n for (let index = 0; index < coreProductATPData.length; index++) {\r\n const item = coreProductATPData[index];\r\n if (item.Available === 'YES' && item.ATPQuantity !== undefined && parseInt(item.ATPQuantity, 10) > 0) {\r\n const date = new Date();\r\n const today = dayjs(Date.now()).format('D M YY');\r\n const deliveryDate = dayjs(item.SlotDate).format('D M YY');\r\n const currHour = dayjs(Date.now()).format('H');\r\n if (today === deliveryDate) {\r\n deliveryByMessage =\r\n _setTime(item.StartTime) !== ''\r\n ? parseInt(dayjs(_setTime(item.StartTime)).format('H'), 10) < 14 && parseInt(currHour, 10) < 14\r\n ? `Delivery by Today ${dayjs(Date.now()).format('MMM D')} `\r\n : `Delivery by Tomorrow ${dayjs(date.setDate(date.getDate() + 1)).format('MMM D')} `\r\n : '';\r\n break;\r\n } else {\r\n deliveryByMessage = `Delivery by ${dayjs(item.SlotDate).format('MMM D')} `;\r\n break;\r\n }\r\n }\r\n }\r\n return deliveryByMessage;\r\n};\r\n\r\n// tslint:disable-next-line: max-line-length\r\nconst smallParcelATPInventoryStatusCall = async (\r\n props: IBuyboxViewPropsExtended,\r\n outOfStockSmallParcelState: boolean,\r\n SetoutOfStockSmallParcelState: React.Dispatch,\r\n recordId?: number,\r\n itemId?: string | undefined,\r\n zipCode?: any,\r\n prevZipCode?: any\r\n) => {\r\n const inventoryStatusData = props.state.batchedAtpInventoryStatusData?.ATPInventoryStatusData\r\n ? props.state.batchedAtpInventoryStatusData?.ATPInventoryStatusData\r\n : null;\r\n const selectedObj = inventoryStatusData\r\n ? inventoryStatusData?.find(item => item.VariantRecordId?.toString() === props.state.currentProduct?.RecordId?.toString())\r\n : null;\r\n if (prevZipCode && prevZipCode !== zipCode && zipCode.length === 5) {\r\n if (recordId && props.data.product.result?.MasterProductId) {\r\n await _smallParcelProductATPCallForInventoryStatus(props, recordId, itemId, SetoutOfStockSmallParcelState, true)\r\n .then()\r\n .catch();\r\n }\r\n } else {\r\n if (selectedObj) {\r\n const item = selectedObj;\r\n if (item.Available === 'YES' && item.Quantity !== undefined && parseInt(item.Quantity, 10) > 0) {\r\n if (outOfStockSmallParcelState !== false) {\r\n SetoutOfStockSmallParcelState(false);\r\n }\r\n } else {\r\n if (outOfStockSmallParcelState !== true) {\r\n if (\r\n !inventoryStatusData?.some(\r\n variant => variant.Available && variant.VariantRecordId !== props.state.currentProduct?.RecordId?.toString()\r\n )\r\n ) {\r\n SetoutOfStockSmallParcelState(true);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n};\r\n\r\nconst _getProductAttribute = (props: IBuyboxViewPropsExtended) => {\r\n const {\r\n data: { productSpecificationData },\r\n getProductType\r\n } = props;\r\n // shippingInformation product attribute value\r\n const shippingInformationSmall = productSpecificationData.result\r\n ?.find(attr => attr.Name?.trim() === props.context.app.config.smallParcelAttributeKey)\r\n ?.TextValue?.toLowerCase();\r\n\r\n return getProductType(shippingInformationSmall);\r\n};\r\n\r\n// tslint:enable\r\nconst _validateZipCode = (\r\n props: IBuyboxViewPropsExtended,\r\n zipcode: string,\r\n setErrorZipCode: React.Dispatch,\r\n setItemOutOfMarket: React.Dispatch,\r\n setNewZipCode: React.Dispatch,\r\n setIsValidZipCode: React.Dispatch,\r\n initial: boolean,\r\n setIsOOMZipCode: React.Dispatch,\r\n isItemOom: boolean\r\n) => {\r\n setErrorZipCode('');\r\n const getAddressByZipcodeInput = new GetAddressByZipcodeInput('USA', zipcode);\r\n getAddressByZipcodeAction(getAddressByZipcodeInput, props.context.actionContext)\r\n // getAddressFromZipCodeAsync({ callerContext: props.context.actionContext }, 'USA', zipcode)\r\n .then(addressByZipcode => {\r\n if (addressByZipcode?.length) {\r\n setIsValidZipCode(true);\r\n const productType = _getProductAttribute(props);\r\n if (productType === 'Small Parcel' || productType === 'Drop Ship' || productType === 'Core') {\r\n const stateObj = addressByZipcode[0];\r\n const blockedStates = props.context.app.config.blockedStates;\r\n let oomZipCode = false;\r\n if (blockedStates !== undefined && blockedStates !== null) {\r\n for (let bStateIter = 0; bStateIter < blockedStates.length; bStateIter++) {\r\n if (blockedStates[bStateIter].stateName === stateObj.StateId) {\r\n oomZipCode = true;\r\n }\r\n }\r\n }\r\n if (!oomZipCode) {\r\n props.context.actionContext.update(new ProductCompareBuyboxStateSharing(zipcode), { zipCode: zipcode });\r\n }\r\n setIsOOMZipCode(oomZipCode);\r\n const getMessageValue = getBlockZipCodeMessage(stateObj.StateId || '', props.context.app.config.blockedStates);\r\n if (getMessageValue?.length > 0) {\r\n setErrorZipCode(getMessageValue[0].zipcodeMessage?.replace('{zipcode}', zipcode));\r\n setItemOutOfMarket(true);\r\n } else {\r\n !isItemOom && setItemOutOfMarket(false);\r\n }\r\n } else {\r\n setItemOutOfMarket(false);\r\n }\r\n } else {\r\n const cookies = new Cookies();\r\n setItemOutOfMarket(false);\r\n setIsValidZipCode(false);\r\n if (!initial) {\r\n setErrorZipCode('Please enter a valid zip code. ');\r\n cookies.set(`zip_code`, '', { path: '/', expires: oneYearFromNow() });\r\n } else {\r\n cookies.set(`zip_code`, '', { path: '/', expires: oneYearFromNow() });\r\n }\r\n }\r\n })\r\n .catch(e => {\r\n console.log(e, 'Error');\r\n });\r\n};\r\n\r\n// tslint:disable-next-line: max-line-length no-any\r\nconst _updateZipCode = (\r\n newZipCode: string,\r\n setNewZipCode: React.Dispatch,\r\n props: IBuyboxViewPropsExtended,\r\n setErrorZipCode: React.Dispatch,\r\n setItemOutOfMarket: React.Dispatch,\r\n setIsZipCodeChnaged: React.Dispatch,\r\n setIsValidZipCode: React.Dispatch,\r\n setCoreProductATPData: React.Dispatch,\r\n setATPCallMessage: React.Dispatch,\r\n setIsOOMZipCode: React.Dispatch,\r\n setIsItemOom: React.Dispatch,\r\n isItemOom: boolean\r\n) => {\r\n if (newZipCode.length === 5) {\r\n setCoreProductATPData([]);\r\n setATPCallMessage('');\r\n props.setStatusATPCall(false);\r\n props.setATPCall(false);\r\n _validateZipCode(\r\n props,\r\n newZipCode,\r\n setErrorZipCode,\r\n setItemOutOfMarket,\r\n setNewZipCode,\r\n setIsValidZipCode,\r\n false,\r\n setIsOOMZipCode,\r\n isItemOom\r\n );\r\n const cookies = new Cookies();\r\n setNewZipCode(newZipCode);\r\n setIsZipCodeChnaged(true);\r\n setIsItemOom(false);\r\n cookies.set(`zip_code`, newZipCode, { path: '/', expires: oneYearFromNow() });\r\n return true;\r\n // VSI customization - START - 24789\r\n } else if (newZipCode.length < 5) {\r\n setErrorZipCode('Please enter a valid zip code. ');\r\n }\r\n // VSI customization - END - 24789\r\n return false;\r\n};\r\n\r\nexport const _deliveryMessage = (days: string) => {\r\n const date = new Date();\r\n const deliveryDate = date.setDate(date.getDate());\r\n let deliveryByMessage = '';\r\n deliveryByMessage = dayjs(deliveryDate).format('MMM D');\r\n let numberOfDays = parseInt(days, 10);\r\n let newDate = deliveryDate;\r\n let flag = true;\r\n while (numberOfDays > 0) {\r\n newDate = date.setDate(date.getDate() + 1);\r\n if (dayjs(newDate).format('d') !== '0' && dayjs(newDate).format('d') !== '6') {\r\n numberOfDays--;\r\n } else {\r\n flag = false;\r\n }\r\n }\r\n deliveryByMessage = flag && days === '1' ? `Tomorrow ${dayjs(Date.now()).format('MMM D')}` : dayjs(newDate).format('ddd MMM, D');\r\n return deliveryByMessage;\r\n};\r\n\r\nexport const BuyboxDeliveryByMessage = (props: {\r\n buyboxProps: IBuyboxViewPropsExtended;\r\n itemOutOfMarket: boolean;\r\n setItemOutOfMarket: React.Dispatch;\r\n SetoutOfStockSmallParcelState: React.Dispatch;\r\n outOfStockSmallParcelState: boolean;\r\n}): JSX.Element => {\r\n const { buyboxProps, itemOutOfMarket, setItemOutOfMarket, outOfStockSmallParcelState, SetoutOfStockSmallParcelState } = props;\r\n\r\n const {\r\n ATPDataFromBusiness,\r\n data: { productSpecificationData }\r\n } = buyboxProps;\r\n const prevZipCode = buyboxProps.state.batchedAtpInventoryStatusData?.zipCode;\r\n const cookies = new Cookies();\r\n const zipcode = cookies.get('zip_code');\r\n const productType = _getProductAttribute(buyboxProps);\r\n const [isZipCodeChnaged, setIsZipCodeChnaged] = React.useState(false);\r\n const [isValidZipCode, setIsValidZipCode] = React.useState(true);\r\n const [isOOMZipCode, setIsOOMZipCode] = React.useState(true);\r\n const [isItemOom, setIsItemOom] = React.useState(false);\r\n const [coreProductATPData, setCoreProductATPData] = React.useState(ATPDataFromBusiness);\r\n const [atpCallMessage, setATPCallMessage] = React.useState('');\r\n const [recordId, setRecordId] = React.useState(buyboxProps.data.product.result!.RecordId);\r\n const [itemId, setItemId] = React.useState(buyboxProps.data.product.result!.ItemId);\r\n const [isInput, setIsInput] = React.useState(false);\r\n const [isAtpCallReturned, setIsAtpCallReturned] = React.useState(false);\r\n const [newZipCode, setNewZipCode] = React.useState(zipcode !== undefined ? zipcode : '');\r\n const isCached = true;\r\n const {\r\n data: { storeSelectorState },\r\n state: { preferredStore }\r\n } = buyboxProps;\r\n let defaultError = '';\r\n\r\n if (storeSelectorState?.result?.prefferedStore?.Zip && storeSelectorState?.result?.prefferedStore?.Zip === newZipCode) {\r\n const getMessageValue = getBlockZipCodeMessage(\r\n storeSelectorState?.result?.prefferedStore?.State || '',\r\n buyboxProps.context.app.config.blockedStates\r\n );\r\n if (getMessageValue?.length > 0) {\r\n defaultError = getMessageValue[0].message;\r\n }\r\n }\r\n const [errorZipCode, setErrorZipCode] = React.useState(defaultError);\r\n\r\n // out of stock attribute value\r\n let outOfStock = productSpecificationData.result?.find(\r\n attr => attr.Name?.trim().toLowerCase() === buyboxProps.context.app.config.outOfStockProductKey?.trim().toLowerCase()\r\n )?.BooleanValue;\r\n\r\n //leadTime product attribute value\r\n let deliveryDays = productSpecificationData.result?.find(attr => attr.Name?.trim() === buyboxProps.context.app.config.leadTime)\r\n ?.TextValue;\r\n // eslint-disable-next-line prefer-const\r\n const { ecomAllVairantStockInfoConcatenated } = buyboxProps;\r\n if (ecomAllVairantStockInfoConcatenated && ecomAllVairantStockInfoConcatenated.length > 0) {\r\n for (let i = 0; i < buyboxProps.ecomAllVairantStockInfoConcatenated.length; i++) {\r\n const variantIdOOS = ecomAllVairantStockInfoConcatenated[i].split('|');\r\n if (variantIdOOS && variantIdOOS[0] === recordId.toString() && !!Number(variantIdOOS[1])) {\r\n outOfStock = true;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n let deliveryByMessage = '';\r\n let deliveryByMessageRange = '';\r\n let coreProductATPCall = false;\r\n // eslint-disable-next-line prefer-const\r\n if (buyboxProps.data.product.result!.RecordId !== recordId || buyboxProps.data.product.result!.ItemId !== itemId) {\r\n setRecordId(buyboxProps.data.product.result!.RecordId);\r\n setItemId(buyboxProps.data.product.result!.ItemId);\r\n }\r\n React.useEffect(() => {\r\n // TODO: Handle Promise in a appropriate way\r\n if (productType === 'Core' && !outOfStock) {\r\n isAtpCallReturned && setIsAtpCallReturned(false);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n buyboxProps.data.product.result?.MasterProductId &&\r\n _coreProductATPCall(\r\n buyboxProps,\r\n setCoreProductATPData,\r\n recordId,\r\n itemId,\r\n setATPCallMessage,\r\n setIsAtpCallReturned,\r\n isCached\r\n );\r\n }\r\n }, [itemOutOfMarket]);\r\n\r\n React.useEffect(() => {\r\n // TODO: Handle Promise in a appropriate way\r\n if (productType === 'Core' && !outOfStock) {\r\n isAtpCallReturned && setIsAtpCallReturned(false);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n buyboxProps.data.product.result?.MasterProductId &&\r\n _coreProductATPCall(\r\n buyboxProps,\r\n setCoreProductATPData,\r\n recordId,\r\n itemId,\r\n setATPCallMessage,\r\n setIsAtpCallReturned,\r\n isCached\r\n );\r\n } else if (productType === 'Small Parcel') {\r\n void smallParcelATPInventoryStatusCall(\r\n buyboxProps,\r\n outOfStockSmallParcelState,\r\n SetoutOfStockSmallParcelState,\r\n recordId,\r\n itemId,\r\n newZipCode,\r\n prevZipCode\r\n );\r\n }\r\n }, [recordId]);\r\n\r\n React.useEffect(() => {\r\n // TODO: Handle Promise in a appropriate way\r\n if (productType === 'Core' && !outOfStock) {\r\n isAtpCallReturned && setIsAtpCallReturned(false);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n buyboxProps.data.product.result?.MasterProductId &&\r\n _coreProductATPCall(\r\n buyboxProps,\r\n setCoreProductATPData,\r\n recordId,\r\n itemId,\r\n setATPCallMessage,\r\n setIsAtpCallReturned,\r\n isCached\r\n );\r\n } else if (productType === 'Small Parcel') {\r\n void smallParcelATPInventoryStatusCall(\r\n buyboxProps,\r\n outOfStockSmallParcelState,\r\n SetoutOfStockSmallParcelState,\r\n recordId,\r\n itemId,\r\n newZipCode,\r\n prevZipCode\r\n );\r\n }\r\n }, [preferredStore.OrgUnitNumber]);\r\n\r\n React.useEffect(() => {\r\n if (productType === 'Core' && zipcode?.length > 0 && !isOOMZipCode && !buyboxProps.ATPCall && !outOfStock) {\r\n isAtpCallReturned && setIsAtpCallReturned(false);\r\n buyboxProps.setATPCall(true);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n buyboxProps.data.product.result?.MasterProductId &&\r\n _coreProductATPCall(\r\n buyboxProps,\r\n setCoreProductATPData,\r\n recordId,\r\n itemId,\r\n setATPCallMessage,\r\n setIsAtpCallReturned,\r\n isCached\r\n );\r\n }\r\n setIsOOMZipCode(true);\r\n }, [isOOMZipCode]);\r\n\r\n React.useEffect(() => {\r\n setNewZipCode(zipcode ? zipcode : '');\r\n setCoreProductATPData([]);\r\n setATPCallMessage('');\r\n buyboxProps.setStatusATPCall(false);\r\n buyboxProps.setATPCall(false);\r\n _validateZipCode(\r\n buyboxProps,\r\n newZipCode,\r\n setErrorZipCode,\r\n setItemOutOfMarket,\r\n setNewZipCode,\r\n setIsValidZipCode,\r\n false,\r\n setIsOOMZipCode,\r\n isItemOom\r\n );\r\n setIsItemOom(false);\r\n setIsZipCodeChnaged(true);\r\n buyboxProps.setZipCode(zipcode);\r\n }, [zipcode]);\r\n\r\n React.useEffect(() => {\r\n if (productType === 'Core') {\r\n setItemOutOfMarket(isItemOom);\r\n }\r\n }, [isItemOom]);\r\n const firstUpdate = React.useRef(true);\r\n let initial = false;\r\n React.useEffect(() => {\r\n if (firstUpdate?.current) {\r\n firstUpdate.current = false;\r\n initial = true;\r\n }\r\n buyboxProps.data.product.result?.MasterProductId &&\r\n newZipCode &&\r\n _validateZipCode(\r\n buyboxProps,\r\n newZipCode,\r\n setErrorZipCode,\r\n setItemOutOfMarket,\r\n setNewZipCode,\r\n setIsValidZipCode,\r\n initial,\r\n setIsOOMZipCode,\r\n isItemOom\r\n );\r\n }, [productType]);\r\n\r\n /**\r\n * isMFICore = Yes, isParcelable = No, shippingInformation = Core\r\n * if Above Condtions are true then this is a Core Item\r\n * call ATP proxy and make delivery by message\r\n */\r\n if (productType === 'Drop Ship') {\r\n if (outOfStockSmallParcelState !== false) {\r\n SetoutOfStockSmallParcelState(false);\r\n }\r\n }\r\n if (productType === 'Core' && !outOfStock) {\r\n const messageItemOutOfMarket = buyboxProps.context.app.config.messageForItemOutOfMarket\r\n ? buyboxProps.context.app.config.messageForItemOutOfMarket?.replace('{zipcode}', zipcode)\r\n : '';\r\n // Core Product\r\n coreProductATPCall = true;\r\n // outOfStock = false;\r\n if (outOfStockSmallParcelState !== false) {\r\n SetoutOfStockSmallParcelState(false);\r\n }\r\n if (isZipCodeChnaged) {\r\n setIsZipCodeChnaged(false);\r\n }\r\n deliveryByMessage = coreProductATPData ? _getSoonestDeliveryDate(coreProductATPData) : '';\r\n if (deliveryByMessage === '') {\r\n if (ATPDataFromBusiness !== null && ATPDataFromBusiness !== undefined && !isAtpCallReturned) {\r\n deliveryByMessage = _getSoonestDeliveryDate(ATPDataFromBusiness);\r\n if (deliveryByMessage === undefined || deliveryByMessage === null || deliveryByMessage === '') {\r\n deliveryByMessage = `${buyboxProps.context.app.config.defaultDeliveryMessage} `;\r\n }\r\n }\r\n }\r\n // deliveryByMessage = deliveryMessage;\r\n const parsedMessage: IMfrmAtpMessage = atpCallMessage ? JSON.parse(`${atpCallMessage}`) : '';\r\n const noZipCodeGroup = buyboxProps.context.app.config.responseMessageForItemOutOfMarketZip?.replace('{zipcode}', zipcode);\r\n const outOfZone = buyboxProps.context.app.config.responseMessageForItemOutOfMarketOOZ;\r\n if (\r\n coreProductATPData?.length === 0 &&\r\n parsedMessage?.Message &&\r\n noZipCodeGroup &&\r\n outOfZone &&\r\n (parsedMessage?.Message?.toLowerCase() === outOfZone?.toLowerCase() ||\r\n parsedMessage?.Message?.toLowerCase() === noZipCodeGroup?.toLowerCase()) &&\r\n !itemOutOfMarket &&\r\n !isItemOom\r\n ) {\r\n setIsItemOom(true);\r\n setErrorZipCode(messageItemOutOfMarket);\r\n }\r\n\r\n if ((coreProductATPData?.length === 0 || deliveryByMessage === '') && isAtpCallReturned) {\r\n deliveryByMessage = itemOutOfMarket\r\n ? `Delivery `\r\n : buyboxProps.context.app.config.defaultDeliveryMessage\r\n ? `${buyboxProps.context.app.config.defaultDeliveryMessage?.trim()} `\r\n : '';\r\n }\r\n }\r\n /**\r\n * Check if no delivery days are found in product attribute then get it from site builder\r\n */\r\n if (\r\n (deliveryDays === '' || deliveryDays === undefined || deliveryDays === null) &&\r\n buyboxProps.context.app.config.brandList &&\r\n buyboxProps.context.app.config.brandList?.length > 0 &&\r\n !coreProductATPCall &&\r\n !outOfStockSmallParcelState\r\n ) {\r\n const brand =\r\n buyboxProps.context.app.config.brandBackofficeAttributePdp &&\r\n productSpecificationData.result\r\n ?.find(attr => attr.Name?.trim() === buyboxProps.context.app.config.brandBackofficeAttributePdp)\r\n ?.TextValue?.toLowerCase();\r\n if (brand) {\r\n buyboxProps.context.app.config.brandList?.map((brandList: IBrandListData) => {\r\n if (brandList?.brandName?.toLowerCase() === brand) {\r\n deliveryDays =\r\n brandList.brandLeadtime !== undefined && brandList.brandLeadtime !== '' && brandList.brandLeadtime !== null\r\n ? brandList.brandLeadtime\r\n : '';\r\n }\r\n });\r\n }\r\n }\r\n\r\n React.useEffect(() => {\r\n if (productType === 'Core' && ATPDataFromBusiness !== null && ATPDataFromBusiness !== undefined && !outOfStock) {\r\n deliveryByMessage = ATPDataFromBusiness ? _getSoonestDeliveryDate(ATPDataFromBusiness) : '';\r\n if (deliveryByMessage === undefined || deliveryByMessage === '') {\r\n deliveryByMessage = buyboxProps.context.app.config.defaultDeliveryMessage;\r\n }\r\n setCoreProductATPData(ATPDataFromBusiness);\r\n }\r\n }, [ATPDataFromBusiness]);\r\n\r\n /**\r\n * For Core item delivery message is empty and delivery days are found at any case then do following to get delivery by message\r\n */\r\n if (deliveryByMessage === '' && deliveryDays && deliveryDays !== '' && deliveryDays !== undefined) {\r\n const daysSpan = deliveryDays?.split('-');\r\n if (daysSpan && daysSpan[1] !== undefined && daysSpan.length) {\r\n daysSpan?.map((item: string, index: number) => {\r\n const date = new Date();\r\n const deliveryDate = date.setDate(date.getDate());\r\n if (parseInt(item, 10) > 0) {\r\n let numberOfDays = parseInt(item, 10);\r\n let newDate = deliveryDate;\r\n while (numberOfDays > 0) {\r\n newDate = date.setDate(date.getDate() + 1);\r\n if (dayjs(newDate).format('d') !== '0' && dayjs(newDate).format('d') !== '6') {\r\n numberOfDays--;\r\n }\r\n }\r\n deliveryByMessage = dayjs(newDate).format('MMM D');\r\n if (deliveryByMessageRange !== '') {\r\n deliveryByMessageRange = `${deliveryByMessageRange} to ${deliveryByMessage}`;\r\n } else {\r\n deliveryByMessageRange = deliveryByMessage;\r\n newDate = date.setDate(date.getDate() - parseInt(item[0], 10));\r\n }\r\n }\r\n });\r\n deliveryByMessage = deliveryByMessageRange;\r\n } else {\r\n deliveryByMessage = _deliveryMessage(deliveryDays);\r\n }\r\n }\r\n\r\n if (deliveryByMessage === '' || outOfStock) {\r\n return <>;\r\n }\r\n return (\r\n \r\n {isInput ? (\r\n <>\r\n {/* // VSI customization - START - 24789 */}\r\n \r\n {\r\n setNewZipCode(event.target.value);\r\n setErrorZipCode('');\r\n }}\r\n onKeyUp={e => {\r\n if (\r\n e.which === 13 &&\r\n _updateZipCode(\r\n newZipCode,\r\n setNewZipCode,\r\n buyboxProps,\r\n setErrorZipCode,\r\n setItemOutOfMarket,\r\n setIsZipCodeChnaged,\r\n setIsValidZipCode,\r\n setCoreProductATPData,\r\n setATPCallMessage,\r\n setIsOOMZipCode,\r\n setIsItemOom,\r\n isItemOom\r\n )\r\n ) {\r\n setIsInput(prevState => !prevState);\r\n }\r\n }}\r\n />\r\n \r\n Zip Code\r\n \r\n {\r\n if (\r\n _updateZipCode(\r\n newZipCode,\r\n setNewZipCode,\r\n buyboxProps,\r\n setErrorZipCode,\r\n setItemOutOfMarket,\r\n setIsZipCodeChnaged,\r\n setIsValidZipCode,\r\n setCoreProductATPData,\r\n setATPCallMessage,\r\n setIsOOMZipCode,\r\n setIsItemOom,\r\n isItemOom\r\n )\r\n ) {\r\n setIsInput(prevState => !prevState);\r\n }\r\n }}\r\n >\r\n Update\r\n \r\n \r\n {errorZipCode !== '' ? (\r\n {buyboxProps.resources.mfrmInvalidZipCode}\r\n ) : (\r\n <>\r\n )}\r\n {/* // VSI customization - END - 24789 */}\r\n \r\n ) : (\r\n <>\r\n {\r\n \r\n \r\n {initial ? (\r\n newZipCode && isValidZipCode\r\n ) : newZipCode ? (\r\n <>\r\n {errorZipCode ? (\r\n 'Delivery '\r\n ) : (\r\n <>\r\n {productType === 'Core' ? '' : buyboxProps.resources.deliveryBy} {deliveryByMessage}\r\n \r\n )}{' '}\r\n to\r\n \r\n ) : (\r\n 'To Check Availability'\r\n )}\r\n \r\n ) => {\r\n setIsInput(prevState => !prevState);\r\n setNewZipCode(newZipCode);\r\n event.preventDefault();\r\n // @ts-ignore\r\n if ('utag' in window) {\r\n event.preventDefault();\r\n // @ts-ignore\r\n // tslint:disable-next-line: object-literal-key-quotes\r\n utag.link({\r\n event: 'PDP-card-action',\r\n event_category: 'PDP Card Action',\r\n event_action: 'Change Zip-Code Click',\r\n enhanced_action: 'change_zipcode',\r\n event_label: 'Change Zip-Code PDP',\r\n event_noninteraction: 'false'\r\n });\r\n }\r\n }}\r\n >\r\n {initial ? newZipCode && isValidZipCode : newZipCode ? newZipCode : buyboxProps.resources.enterZipCode}\r\n \r\n \r\n }\r\n {errorZipCode !== '' ? (\r\n
\r\n ) : (\r\n <>\r\n )}\r\n \r\n )}\r\n \r\n );\r\n};\r\n"],"names":["BVRatingSummary","_ref","itemId","onClick","variantId","hideReadReviewsButton","dataBvProductIdAttr","setDataBvProductIdAttr","useState","wrapper","useRef","interval","numReviews","setNumReviews","useEffect","pollInterval","window","setInterval","_wrapper$current","numReviewsHTML","current","querySelector","innerHTML","match","clearInterval","style","display","React","onMouseEnter","button","Array","from","document","querySelectorAll","find","outerHTML","onMouseLeave","ref","getBlockZipCodeMessage","stateName","blockStatesArray","filter","blockstate","dayjs","tz","utc","isBetween","format","defaultImageSettings","viewports","xs","q","w","h","disableLazyLoad","parseBadgeData","badgeData","requestContext","_startTime","_endTime","dataSegments","scheduleStart","scheduleEnd","badgeType","parsedScheduleStart","startDate","startTime","parsedScheduleEnd","endDate","endTime","split","e","startMoment","replace","endMoment","startMomentFormatted","endMomentFormatted","isValid","baseUrl","apiSettings","baseImageUrl","substring","length","removed$","src","toLowerCase","alt","start","convertTimeZone","end","time","local","buildProductBadge","parsedBadgeData","Image","className","gridSettings","altText","title","imageSettings","renderProductBadge","attributeName","finalizedBadges","map","badge","parsedBadge","oneYearFromNow","now","Date","setFullYear","getFullYear","GetAddressByZipcodeInput","constructor","country","zipcode","getCacheKey","this","getCacheObjectType","dataCacheType","Msdyn365","action","async","input","ctx","_zipcode$trim","trim","getAddressFromZipCodeAsync","callerContext","queryResultSettings","Paging","Top","id","AttributesForSelectedVariantInput","productId","channelId","selectedProduct","catalogId","createAttributesForSelectedVariantInput","inputData","getSelectedProductIdFromActionInput","Error","getAttributesForSelectedVariantAction","Promise","resolve","then","activeProduct","selectedVariantInput","SelectedVariantInput","getSelectedVariant","productResult","getAttributeValuesAsync","RecordId","attributeValues","catch","error","trace","message","createObservableDataAction","_setTime","temp","newDatewithTime","toUpperCase","_getSoonestDeliveryDate","coreProductATPData","deliveryByMessage","index","item","Available","undefined","ATPQuantity","parseInt","date","today","deliveryDate","SlotDate","currHour","StartTime","setDate","getDate","smallParcelATPInventoryStatusCall","props","outOfStockSmallParcelState","SetoutOfStockSmallParcelState","recordId","zipCode","prevZipCode","_props$state$batchedA","_props$state$batchedA2","inventoryStatusData","state","batchedAtpInventoryStatusData","ATPInventoryStatusData","selectedObj","_item$VariantRecordId","_props$state$currentP","VariantRecordId","toString","currentProduct","_props$data$product$r","data","product","result","MasterProductId","_smallParcelProductATPCallForInventoryStatus","Quantity","some","variant","_props$state$currentP2","_getProductAttribute","_productSpecification","productSpecificationData","getProductType","attr","_attr$Name","Name","context","app","config","smallParcelAttributeKey","TextValue","_validateZipCode","setErrorZipCode","setItemOutOfMarket","setNewZipCode","setIsValidZipCode","initial","setIsOOMZipCode","isItemOom","getAddressByZipcodeInput","getAddressByZipcodeAction","actionContext","addressByZipcode","productType","stateObj","blockedStates","oomZipCode","bStateIter","StateId","update","ProductCompareBuyboxStateSharing","getMessageValue","_getMessageValue$0$zi","zipcodeMessage","cookies","Cookies","set","path","expires","console","log","_updateZipCode","newZipCode","setIsZipCodeChnaged","setCoreProductATPData","setATPCallMessage","setIsItemOom","setStatusATPCall","setATPCall","_deliveryMessage","days","numberOfDays","newDate","flag","BuyboxDeliveryByMessage","_buyboxProps$state$ba","_storeSelectorState$r","_storeSelectorState$r2","_productSpecification2","_productSpecification3","_buyboxProps$context$5","buyboxProps","itemOutOfMarket","ATPDataFromBusiness","get","isZipCodeChnaged","isValidZipCode","isOOMZipCode","atpCallMessage","setRecordId","setItemId","ItemId","isInput","setIsInput","isAtpCallReturned","setIsAtpCallReturned","isCached","storeSelectorState","preferredStore","defaultError","prefferedStore","Zip","_storeSelectorState$r3","State","errorZipCode","outOfStock","_attr$Name2","_buyboxProps$context$","outOfStockProductKey","BooleanValue","deliveryDays","_attr$Name3","leadTime","ecomAllVairantStockInfoConcatenated","i","variantIdOOS","Number","deliveryByMessageRange","coreProductATPCall","_buyboxProps$data$pro","_coreProductATPCall","_buyboxProps$data$pro2","_buyboxProps$data$pro3","OrgUnitNumber","_buyboxProps$data$pro4","ATPCall","setZipCode","firstUpdate","_buyboxProps$data$pro5","_buyboxProps$context$2","_buyboxProps$context$3","_parsedMessage$Messag","_parsedMessage$Messag2","messageItemOutOfMarket","messageForItemOutOfMarket","defaultDeliveryMessage","parsedMessage","JSON","parse","noZipCodeGroup","responseMessageForItemOutOfMarketZip","outOfZone","responseMessageForItemOutOfMarketOOZ","_buyboxProps$context$4","Message","brandList","_productSpecification4","brand","brandBackofficeAttributePdp","_attr$Name4","_buyboxProps$context$6","_brandList$brandName","brandName","brandLeadtime","_deliveryDays","daysSpan","Node","type","value","maxLength","autoFocus","onChange","event","target","onKeyUp","which","prevState","tag","role","resources","mfrmInvalidZipCode","deliveryBy","tabIndex","preventDefault","utag","link","event_category","event_action","enhanced_action","event_label","event_noninteraction","enterZipCode","dangerouslySetInnerHTML","__html"],"sourceRoot":""}