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QAC/B,GAAGA,GAAWA,EAAQrY,SAAS,eAAgB,CAC3C,MAAMsY,EAAWD,EAAQzS,MAAM,gBAC/B,IAAG0S,MAAAA,OAAQ,EAARA,EAAUpkB,QAAS,EAElB,OADAmkB,EAAUC,EAAS,GACZD,EAGf,OAAOA,GAK3B,MAAO","sources":["webpack://mattressfirm/./src/Utilities/analytics/fullStoryTrack.ts?965d","webpack://mattressfirm/./src/Utilities/cart-utils.ts?6ba1","webpack://mattressfirm/./src/Utilities/checkout-utils.ts?958e","webpack://mattressfirm/./src/Utilities/constants.ts?8bdf","webpack://mattressfirm/./src/Utilities/doRetryCallBack.ts?72a9","webpack://mattressfirm/./src/Utilities/emtpyChecker.ts?e2f5","webpack://mattressfirm/./src/Utilities/enum.ts?dc36","webpack://mattressfirm/./src/Utilities/fallbackImageUrl.ts?ace7","webpack://mattressfirm/./src/Utilities/get-product-brand.tsx?2b65","webpack://mattressfirm/./src/Utilities/getDeliveryMod.ts?1a84","webpack://mattressfirm/./src/Utilities/getDeliveryService.tsx?918e","webpack://mattressfirm/./src/actions/get-mfrm-products-category-paths.action.ts?dc81","webpack://mattressfirm/./src/actions/get-recycle-fee-checkout.action.ts?9366","webpack://mattressfirm/./src/actions/get-sm-inventory-status.action.ts?cb72","webpack://mattressfirm/./src/common/cookies/cookie-utils.ts?68f7","webpack://mattressfirm/./src/data-actions/checkout-skeleton.action.ts?78fb","webpack://mattressfirm/./src/data-actions/mfi-atp-inventory.action.ts?2cbf","webpack://mattressfirm/./src/data-actions/utilities/utils.ts?7452","webpack://mattressfirm/./src/modules/mfrm-checkout-delivery-options/utils/mfrm-delivery-option-utils.ts?cbd4"],"sourcesContent":["import { Cart, CartLine, DataValidationFailure } from '@msdyn365-commerce/retail-proxy';\r\nimport { ICartProductPrice } from '../cart-utils';\r\n\r\nexport interface IDataValidationErrors {\r\n CorrelationId?: string;\r\n ErrorResourceId?: string;\r\n LocalizedMessage?: string;\r\n ValidationResults?: DataValidationFailure[];\r\n}\r\n\r\nconst callFS = (name?: string, detailsObject?: any) => {\r\n try {\r\n // If FS doesn't exist in the global scope, set as false.\r\n const FS = global.hasOwnProperty('FS') ? global['FS'] : false;\r\n FS && FS.event(name, detailsObject);\r\n } catch (e) {\r\n console.log('FS View Errors', e);\r\n }\r\n};\r\nexport const eventFullStoryAPISuccess = async (name?: string, pathName?: string, objToCall?: Cart) => {\r\n const detailsObject = {\r\n pathName,\r\n status: 'success'\r\n };\r\n callFS(name, detailsObject);\r\n};\r\n\r\nexport const eventFullStoryPriceMismatch = async (name?: string, pathName?: string, objToCall?: ICartProductPrice[], cartLines?: CartLine[] | undefined , tradeIds?: number[] ) => {\r\n const PdpPriceArrays: string[] = [];\r\n const idsArrays: string[] = [];\r\n const cartPriceArrays: string[] = [];\r\n const tradeLines = tradeIds && tradeIds.length > 0 ? true : false;\r\n objToCall?.forEach((items) => {\r\n PdpPriceArrays.push(`${items.price}`);\r\n idsArrays.push(`${items.variantRecordId}`);\r\n const checkCartPrice = cartLines?.find((lines) => lines.ProductId === items.variantRecordId)?.Price;\r\n if(checkCartPrice){\r\n cartPriceArrays.push(`${checkCartPrice}`);\r\n }\r\n });\r\n const detailsObject = {\r\n pathName,\r\n id: idsArrays?.toString(),\r\n pdp_price: PdpPriceArrays?.toString(),\r\n cart_price: cartPriceArrays?.toString(),\r\n ...(tradeLines && {tradeAgreement: \"trade agreement is missing\"})\r\n };\r\n callFS(name, detailsObject);\r\n};\r\n\r\nexport const eventFullStoryFailAPI = async (\r\n name?: string,\r\n pathName?: string,\r\n objToCall?: {\r\n error: {\r\n data?: IDataValidationErrors;\r\n message?: string;\r\n statusCode?: number;\r\n };\r\n }\r\n) => {\r\n const detailsObject = {\r\n pathName,\r\n status: objToCall?.error?.statusCode,\r\n message: objToCall?.error?.message,\r\n correlationId: objToCall?.error?.data?.CorrelationId,\r\n validationError: objToCall?.error?.data?.ValidationResults?.[0]?.ErrorContext\r\n };\r\n callFS(name, detailsObject);\r\n};\r\n","import MsDyn365 from '@msdyn365-commerce/core';\r\nimport {IProductDetails,IProductBonusItems, IProductBonusWithBrandName } from '../modules/mfrm-cart/mfrm-cart';\r\nimport {IMFIBonusItemsResponse, IMFIGetBonusCouponsDetailsResponse} from '../actions/BonusItemDataServiceEntities.g';\r\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { setCookie } from '../common/cookies/cookie-utils';\r\nimport { MFRMProductTypes } from './enum';\r\n\r\nexport interface IMFRMDateGroupedProducts {\r\n dateStr: string;\r\n days?: string;\r\n productVariantRecordIds: number[];\r\n productItemIds: string[];\r\n productsType: string;\r\n}\r\n\r\nexport interface IExpressFlow {\r\n paymentEdit: boolean\r\n}\r\n\r\nexport interface ICartProductPrice {\r\n variantRecordId?: number;\r\n price?: number;\r\n}\r\n\r\n/** interface for parcel inventory details */\r\nexport interface IParcelInventoryDetails {\r\n itemId: string | undefined;\r\n location: string | undefined;\r\n productId: string | undefined;\r\n quantity: string | undefined;\r\n}\r\n\r\nconst getSetLocalStorage = (key: string, getSet: string, valueToSet?: any, returnType?: any) => {\r\n if (MsDyn365.isBrowser) {\r\n switch (getSet) {\r\n case 'set':\r\n return localStorage.setItem(key, JSON.stringify(valueToSet || returnType));\r\n case 'get':\r\n return JSON.parse(localStorage.getItem(key) || '[]');\r\n default:\r\n return returnType;\r\n }\r\n } else {\r\n return returnType;\r\n }\r\n};\r\n\r\nexport const getSetProductData = (getSet: string, products?: IProductDetails[]) => {\r\n products?.length && products.length > 0 && setCoreProductCookie(products); // Set cookie if it has core products\r\n return getSetLocalStorage('product_details', getSet, products, []);\r\n};\r\n\r\n// Following function sets cookie to check if cart has core item; Cookie is needed to access it on server side for skeleton on checkout\r\nconst setCoreProductCookie = (products: IProductDetails[]) => {\r\n for (const psp of products) {\r\n if (psp.typeOfProduct.toLowerCase().trim() === MFRMProductTypes.core) {\r\n setCookie('has-core-product', true);\r\n return;\r\n }\r\n }\r\n setCookie('has-core-product', false);\r\n};\r\n\r\nexport const getSetProductSpec = (getSet: string, products?: IProductDetails[]) => {\r\n return getSetLocalStorage('product_specification', getSet, products, []);\r\n};\r\n\r\nexport const getSetPromoCodeApplyList = (getSet: string) => {\r\n return getSetLocalStorage('promo_code_apply_list', getSet, [], []);\r\n};\r\n\r\nexport const getSetPromoCode = (getSet: string) => {\r\n return getSetLocalStorage('promoCode', getSet, [], []);\r\n};\r\n\r\nexport const getSetGrandTotal = (getSet: string, total?: string) => {\r\n return getSetLocalStorage('grand_total', getSet, total, 0);\r\n};\r\n\r\nexport const getSetBonusItemProd = (getSet: string, globalBonusItems?: IMFIBonusItemsResponse[])=>{\r\n return getSetLocalStorage('BonusItemProduct', getSet, globalBonusItems, []);\r\n};\r\n\r\nexport const getSetSelectedBonasItem = (getSet: string, bonusItemArray?: IProductBonusItems[]) => {\r\n return getSetLocalStorage('selectedBonasItems', getSet, bonusItemArray, []);\r\n};\r\n\r\nexport const getSetBonusCouponDetail = (getSet: string, getCoupons?: IMFIGetBonusCouponsDetailsResponse[])=>{\r\n return getSetLocalStorage('bonusCouponsDetail', getSet, getCoupons, []);\r\n};\r\n\r\nexport const getSetPrevBonasModalState = (getSet: string, previousBonasModal?: IProductBonusItems[]) => {\r\n return getSetLocalStorage('previousBonasModalState', getSet, previousBonasModal, []);\r\n};\r\n\r\nexport const getSetBonusItemBrandName = (getSet: string, bonusItemsBrandName?: IProductBonusWithBrandName[]) => {\r\n return getSetLocalStorage('bonusItmesWithBrand', getSet, bonusItemsBrandName, []);\r\n};\r\n\r\nexport const getSetDateGroupedProducts = (getSet: string, products?: IMFRMDateGroupedProducts[]) => {\r\n return getSetLocalStorage('date_grouped_products', getSet, products, []);\r\n};\r\n\r\nexport const getSetExpressFlow = (getSet: string, express?: IExpressFlow) => {\r\n return getSetLocalStorage('express_flow', getSet, express, []);\r\n};\r\nexport const getSetWmapCartLines = (getSet: string, products?: { product: SimpleProduct, count: number }[]) => {\r\n return getSetLocalStorage('wmapCartLines', getSet, products, []);\r\n};\r\n\r\nexport const getSetCartProductPrice = (getSet: string, priceDetails?: ICartProductPrice[]) => {\r\n return getSetLocalStorage('cart_product_price', getSet, priceDetails, []);\r\n};\r\nexport const getSetParcelInventoryData = (getSet: string, details?: IParcelInventoryDetails[]) => {\r\n return getSetLocalStorage('parcel_inventory_details', getSet, details, []);\r\n};","import { IMFIATPInventoryDynamicEntity, IMFIATPInventoryEntity, IMFIATPInventoryStatusEntity, IMFICartLine } from '../actions/CoreProductDataServiceEntities.g';\r\nimport { IProductDetails, IRevenueDetails } from '../modules/mfrm-cart/mfrm-cart';\r\nimport { getSetParcelInventoryData, getSetProductData, IParcelInventoryDetails, getSetCartProductPrice, ICartProductPrice } from './cart-utils';\r\nimport { ICartState } from '@msdyn365-commerce/global-state';\r\nimport MsDyn365, { IActionContext, IAny, ICoreContext, IGeneric } from '@msdyn365-commerce/core';\r\nimport { AttributeValue, CartLine, CategoryPathResult, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport { atpInventoryDoRetry, cartOperationDoRetry, getInventoryQuantityInternal, updateCartLineInternal } from './doRetryCallBack';\r\nimport Cookies from 'universal-cookie';\r\nimport mfiAtpInventoryAction, { MfiAtpInventoryInput } from '../data-actions/mfi-atp-inventory.action';\r\nimport dayjs from 'dayjs';\r\nimport { ICheckoutViewProps } from '../themes/mattressfirm/views/checkout.view';\r\nimport { IProductWithAttribute } from '../data-actions/get-product-attributes-cartlines';\r\nimport { parseBrandName } from './get-product-brand';\r\nimport { IBrandListData } from '../modules/mfrm-buybox/mfrm-buybox.view';\r\nimport { urlFallBackImage } from './fallbackImageUrl';\r\nimport { GetCategoryPathsInput, getProductsCategoryPathsAction } from '../actions/get-mfrm-products-category-paths.action';\r\nimport { ICheckoutResources } from '../themes/mattressfirm/definition-extensions/checkout.ext.props.autogenerated';\r\nimport { IMfrmCartResources } from '../modules/mfrm-cart/mfrm-cart.props.autogenerated';\r\nimport _getInventoryQuantity from './get-inventory-quantity';\r\nimport { eventFullStoryPriceMismatch } from './analytics/fullStoryTrack';\r\nimport { IUsaEpayErrorMessage } from '../themes/mattressfirm/custom-components/mfrm-guided-card';\r\nimport { _getDeliveryService } from './getDeliveryService';\r\nimport { _getModOfDelivery } from './getDeliveryMod';\r\nimport { INodeProps } from '@msdyn365-commerce-modules/utilities';\r\nimport { set } from 'mobx';\r\nimport { IMfrmAddress } from '../modules/mfrm-checkout-shipping-address';\r\nimport { GetRecycleFeeCheckoutInput } from '../actions/get-recycle-fee-checkout.action';\r\nimport { DeliveryModes, MFRMProductTypes, coreItemShippingType } from './enum';\r\nimport { IErrorCaseForDeliveryDate } from '../modules/mfrm-checkout-delivery-options';\r\nimport { getDeliveryMessageForProduct } from '../modules/mfrm-checkout-delivery-options/utils/mfrm-delivery-option-utils';\r\nimport { CheckoutSkeletonInput } from '../data-actions/checkout-skeleton.action';\r\nimport { IMfrmCheckoutShippingAddressData } from '../modules/mfrm-checkout-shipping-address';\r\nimport { IMfrmCheckoutDeliveryOptionsData } from '../modules/mfrm-checkout-delivery-options';\r\n\r\nexport interface IUpdatedCartDetails {\r\n cartState: ICartState;\r\n updatedCartLines: CartLine[] | undefined\r\n}\r\nexport interface IDetailsCategoryWithDetails {\r\n productsCategories: CategoryPathResult[],\r\n newProductDetails: IProductDetails[],\r\n}\r\nexport interface IAtpSlotsDetails {\r\n selectedSlotNotExist?: boolean;\r\n isNotAvailable?: boolean;\r\n isbackOrdered?: boolean;\r\n}\r\n\r\nexport const _isAllSmallParcel = (): boolean => {\r\n let isAllParcel = true;\r\n const productspecificationsDetails: IProductDetails[] = getSetProductData('get');\r\n const { core, dropShip } = MFRMProductTypes;\r\n\r\n productspecificationsDetails?.forEach(product => {\r\n const productType = product.typeOfProduct?.toLowerCase();\r\n if (productType === core || productType === dropShip) {\r\n isAllParcel = false;\r\n }\r\n });\r\n return isAllParcel;\r\n};\r\n\r\nexport const validateZipCode = (zipcode: string) => {\r\n return /^\\d{5}$/.test(zipcode);\r\n};\r\n\r\nexport const _isExpressFlow = (context: ICoreContext>) => {\r\n const currentUrl = MsDyn365.isBrowser && window.location.pathname?.substring(1);\r\n const applepayExpressUrl: string = context.app.config.expressApplePayCheckouturl || 'applepay-express';\r\n const paypalExpressUrl: string = context.app.expressCheckouturl || 'paypal-express';\r\n return paypalExpressUrl === currentUrl || applepayExpressUrl === currentUrl ? true : false;\r\n};\r\n\r\nexport const _isAllNonCoreItems = (): boolean => {\r\n let isAllParcel = true;\r\n const productspecificationsDetails: IProductDetails[] = getSetProductData('get');\r\n\r\n productspecificationsDetails?.forEach(product => {\r\n const productType = product.typeOfProduct?.toLowerCase();\r\n if (productType === MFRMProductTypes.core) {\r\n isAllParcel = false;\r\n }\r\n });\r\n return isAllParcel;\r\n};\r\n\r\n// Update CartLines on Saving customer info with new location OR If customer saved shipping info or there is an error on checkout redirecting to payment step again, call updateCartlines to add warehouse details for tax calculation\r\n// datePicker indicates if this function is called on changing date manually by User\r\nexport const _updateCartLinesWithWarehouseId = async (\r\n actionContext: IActionContext,\r\n checkoutCartState: ICartState,\r\n dynamicInventoryData: IMFIATPInventoryDynamicEntity[],\r\n selectedTimeSlot: string,\r\n dropShipDefaultWarehouseId: string,\r\n datePicker?: boolean,\r\n _getUpdatedCart?: boolean // To updateAttribute in cartlines, there is already UpdateCartLines api call so we'll just get UpdatedCart from here to use it in payload to update attribute and warehouse ID simultaneously\r\n): Promise => {\r\n const cartState = checkoutCartState;\r\n const currentCartLines = cartState?.cart.CartLines;\r\n const { core, smallParcel, dropShip } = MFRMProductTypes;\r\n // Get warehouseId for CORE from selected slot data\r\n\r\n let selectedAtpSlot: IMFIATPInventoryEntity | undefined;\r\n if (dynamicInventoryData && dynamicInventoryData.length > 0) {\r\n selectedAtpSlot = dynamicInventoryData[0].ATPSlots?.find(atpSlot => {\r\n const startAndEndTimeOfSlot = `${atpSlot.StartTime} - ${atpSlot.EndTime}`;\r\n return selectedTimeSlot === startAndEndTimeOfSlot?.toLowerCase()?.trim();\r\n });\r\n }\r\n const coreProductWarehouseId = selectedAtpSlot?.Location1 || '';\r\n\r\n const productspecificationsDetails: IProductDetails[] = getSetProductData('get');\r\n\r\n // Case datePicker: Check if new date slot has same locationId, dont callUpdateCartLines\r\n let isSameWareHouseForCore = false;\r\n let isSameWareHouseForParcel = false;\r\n const updatedCartLines = currentCartLines?.map(cartLine => {\r\n // Set warehouse ID for DropShip products\r\n const cartLineProductSpesifications = productspecificationsDetails.find(product => product.ItemId === cartLine.ItemId && product.VariantRecordId === cartLine.ProductId);\r\n const typeOfProduct = cartLineProductSpesifications?.typeOfProduct?.toLowerCase() || '';\r\n\r\n const smallParcelWarehouseId = cartLineProductSpesifications?.InventLocationId || '';\r\n\r\n if (typeOfProduct === dropShip && !datePicker) {\r\n if (!cartLine.WarehouseId) {\r\n // cartLine.FulfillmentStoreId = dropShipDefaultWarehouseId;\r\n cartLine.WarehouseId = dropShipDefaultWarehouseId;\r\n }\r\n } else if (typeOfProduct === core|| !typeOfProduct) {\r\n if (datePicker && !isSameWareHouseForCore && cartLine.WarehouseId === coreProductWarehouseId) {\r\n isSameWareHouseForCore = true;\r\n } else {\r\n // cartLine.FulfillmentStoreId = coreProductWarehouseId;\r\n cartLine.WarehouseId = coreProductWarehouseId;\r\n }\r\n } else if (typeOfProduct === smallParcel) {\r\n if (datePicker && !isSameWareHouseForParcel && cartLine.WarehouseId === smallParcelWarehouseId) {\r\n isSameWareHouseForParcel = true;\r\n }\r\n // cartLine.FulfillmentStoreId = smallParcelWarehouseId;\r\n cartLine.WarehouseId = smallParcelWarehouseId;\r\n }\r\n // Set warehouse ID for Core products\r\n return cartLine;\r\n });\r\n\r\n if (_getUpdatedCart) {\r\n return {\r\n cartState: cartState,\r\n updatedCartLines: updatedCartLines\r\n };\r\n\r\n } else {\r\n if (!isSameWareHouseForCore || !isSameWareHouseForParcel) {\r\n await cartOperationDoRetry(() => updateCartLineInternal(cartState?.cart, updatedCartLines ? updatedCartLines : [], actionContext, 'update ware house ID'), cartState).then(() => {\r\n });\r\n }\r\n return undefined;\r\n }\r\n};\r\n\r\n/**\r\n * VSI Customization - check small parcel out of stock and get the exact location for fedx-ground/small parcel.\r\n * ticket - 95174 Start.\r\n*/\r\nexport const checkSmallParcelOutOfStock = async (zipCode: string, detailsProduct: IProductDetails[], cartLines: CartLine[] | undefined, context: ICoreContext>): Promise => {\r\n const date = new Date();\r\n const currentDate = date.setDate(date.getDate());\r\n const tempProducts: { ItemId: string; Quantity: number; VariantRecordId: string }[] = [];\r\n cartLines?.forEach((item: CartLine) => {\r\n const parcelDetails = detailsProduct?.find((prod) => item.ProductId === prod.VariantRecordId);\r\n if (parcelDetails?.typeOfProduct?.toLowerCase() === MFRMProductTypes.smallParcel && !parcelDetails?.outOfStockSmallParcel) {\r\n tempProducts.push({\r\n ItemId: item.ItemId ? item.ItemId : parcelDetails.ItemId,\r\n Quantity: item.Quantity!,\r\n VariantRecordId: item?.ProductId?.toString()!\r\n });\r\n }\r\n });\r\n if (tempProducts?.length) {\r\n const requestBody = {\r\n InventoryType: DeliveryModes.core,\r\n StoreId: '',\r\n Weeks: context.app && context.app.config.weeksPDPforATPCall,\r\n RequestedDate: dayjs(currentDate).format('MM/DD/YYYY'),\r\n ZipCode: zipCode, // '77047',\r\n ItemLines: tempProducts,\r\n NoOfPriorityDC: context.app.config.NoOfPriorityDC ? context.app.config.NoOfPriorityDC : 0\r\n };\r\n const resultData = await atpInventoryDoRetry(() => getInventoryQuantityInternal(requestBody, context, false, 'delivery module for set invent location'));\r\n const parcelInventoryData: IParcelInventoryDetails[] = [];\r\n resultData?.result?.ATPInventoryStatusData?.forEach((items: IMFIATPInventoryStatusEntity) => {\r\n // redirect to cart when any item location is null\r\n if (!items.Location) {\r\n window.location.href = `${window.location.origin}/cart`;\r\n }\r\n const inventoryDetails = { itemId: items.ItemId, location: items.Location, productId: items.VariantRecordId, quantity: items.Quantity };\r\n parcelInventoryData.push(inventoryDetails);\r\n });\r\n getSetParcelInventoryData('set', parcelInventoryData);\r\n return resultData?.result?.ATPInventoryStatusData;\r\n } else {\r\n return undefined;\r\n }\r\n};\r\n\r\n/**\r\n * VSI Customization - On submit order check selected Delivery slot is available or not API call.\r\n * ticket - 85300 Start.\r\n*/\r\nexport const _checkATPSlotsAvailable = async (props: ICheckoutViewProps): Promise => {\r\n const { app: config, context } = props;\r\n const itemLinesArray: IMFICartLine[] = [];\r\n const cookies = new Cookies();\r\n const zipcode = cookies.get('zip_code');\r\n const productSpecification = getSetProductData('get');\r\n let selectedSlotNotExist = true;\r\n let isNotAvailable = true;\r\n if (productSpecification && productSpecification.length > 0) {\r\n productSpecification.map((product: IProductDetails) => {\r\n if (product.typeOfProduct?.toLowerCase().trim() === MFRMProductTypes.core) {\r\n const itemLines: IMFICartLine = {\r\n ItemId: product.ItemId,\r\n Quantity: product.Quantity,\r\n VariantRecordId: product.VariantRecordId.toString()\r\n };\r\n itemLinesArray.push(itemLines);\r\n }\r\n });\r\n const selectedATPDate = props.data.selectedATPSlotInfo.result?.selectedATPSlotInfo?.Date;\r\n\r\n const date = new Date();\r\n let currentDate = date.setDate(date.getDate());\r\n const currHour = date.getHours();\r\n if (currHour >= 14) {\r\n currentDate = date.setDate(date.getDate() + 1);\r\n }\r\n const requestBody = {\r\n inventoryType: DeliveryModes.core,\r\n weeks: config.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\r\n try {\r\n const mfiInventoryInput = new MfiAtpInventoryInput(\r\n requestBody.inventoryType,\r\n requestBody.weeks,\r\n requestBody.storeId,\r\n requestBody.page,\r\n requestBody.requestedDate,\r\n requestBody.zipCode,\r\n requestBody.itemLines\r\n );\r\n const ATPSlots = await mfiAtpInventoryAction(mfiInventoryInput, context.actionContext);\r\n if (ATPSlots && ATPSlots.ATPInventoryDynamicData && ATPSlots.ATPInventoryDynamicData.length > 0) {\r\n ATPSlots.ATPInventoryDynamicData.map((singleDate: IMFIATPInventoryDynamicEntity) => {\r\n if (singleDate.AvailableSlots === 'YES') {\r\n isNotAvailable = false;\r\n if (selectedATPDate && singleDate.Date?.includes(selectedATPDate)) {\r\n selectedSlotNotExist = false;\r\n }\r\n }\r\n });\r\n }\r\n } catch (error) {\r\n // @ts-ignore\r\n props.telemetry.warning(error);\r\n props.telemetry.debug('Unable to mFIATPInventoryDynamicAsync for slots');\r\n }\r\n return { selectedSlotNotExist, isNotAvailable };\r\n } else {\r\n return { selectedSlotNotExist, isNotAvailable };\r\n }\r\n};\r\n\r\n/** * VSI Customization - Call Full story custom event for check price mismatch details.\r\n * ticket - 95129 End. */\r\ntype PriceCheck = (cartPrice?: number, productPrice?: number) => boolean;\r\nconst priceCheck: PriceCheck = (cartPrice, productPrice) => {\r\n return Math.abs((cartPrice || 0) - (productPrice || 0)) >= 0.01;\r\n};\r\n\r\nexport const priceMismatchFSEvent = (cartLinesData: CartLine[] | undefined) => {\r\n const getCartProductPriceArray = getSetCartProductPrice('get');\r\n const missingTradeIds: number[] = [];\r\n cartLinesData?.forEach((line) => {\r\n const getAgreementLines = line.PriceLines?.find((item) => item['@odata.type'].includes('TradeAgreementPriceLine'));\r\n if (!getAgreementLines) {\r\n missingTradeIds.push(line.ProductId!);\r\n }\r\n });\r\n const getDiffernce = getCartProductPriceArray?.filter((details: ICartProductPrice) => cartLinesData?.some(itemProduct => details.variantRecordId === itemProduct.ProductId && priceCheck(details.price, itemProduct.Price))\r\n );\r\n if (getDiffernce.length > 0 || missingTradeIds.length > 0) {\r\n void eventFullStoryPriceMismatch('order_health price_mismatch_details', 'on click checkout', getDiffernce, cartLinesData, missingTradeIds);\r\n }\r\n};\r\n\r\n/**\r\n * VSI Customization - On submit order check selected Delivery slot is available or not API call.\r\n * ticket - 85300 End.\r\n*/\r\nexport const _addDefaultDays = (days: number) => {\r\n const date = new Date();\r\n const deliveryDate = date.setDate(date.getDate());\r\n let deliveryDateFormatted = '';\r\n deliveryDateFormatted = dayjs(deliveryDate).format('YYYY-MM-DDTHH:mm:ss');\r\n let newDate;\r\n while (days > 0) {\r\n newDate = date.setDate(date.getDate() + 1);\r\n if (dayjs(newDate).format('d') !== '0' && dayjs(newDate).format('d') !== '6') {\r\n days--;\r\n }\r\n }\r\n deliveryDateFormatted = dayjs(newDate).format('YYYY-MM-DDTHH:mm:ss');\r\n return deliveryDateFormatted;\r\n};\r\n\r\n/**\r\n * VSI Customization - create attribute with pre-define objects values.\r\n*/\r\nexport const AttributeCreate = (ecomName: string, value: string | undefined) => {\r\n const preDefine = {\r\n '@odata.type': '#Microsoft.Dynamics.Commerce.Runtime.DataModel.AttributeTextValue',\r\n Name: '',\r\n ExtensionProperties: [],\r\n TextValue: '',\r\n TextValueTranslations: []\r\n };\r\n const source = { Name: ecomName, TextValue: value };\r\n const returnedObject = Object.assign(preDefine, source);\r\n return returnedObject;\r\n};\r\n\r\n/**\r\n * VSI Customization - get product attribute.\r\n*/\r\nexport const getCheckoutAttributeByName = (attributeValues: AttributeValue[] | undefined, keyValue: string): AttributeValue | undefined => {\r\n return attributeValues && attributeValues.find(currAttribute => currAttribute.Name && currAttribute.Name?.toLowerCase()?.trim() === keyValue?.toLowerCase()?.trim());\r\n};\r\n\r\n\r\n/**\r\n * VSI Customization - get product brand lead time.\r\n*/\r\nexport const getBrandLeadTime = (brandList: IBrandListData[], brandName: string | undefined) => {\r\n return brandList && brandName && brandList?.find(list => list.brandName === brandName)?.brandLeadtime;\r\n};\r\n\r\n\r\n/**\r\n * VSI Customization - send Lead ime Or Brand lead time then get the delivery date and request delivery date.\r\n*/\r\nexport const generateDeliveryDate = (leadTimeVal: string, brandLeadTime: string) => {\r\n const timeValue = leadTimeVal || brandLeadTime;\r\n let date = new Date();\r\n const daysSpan = timeValue?.split('-');\r\n let deliveryByMessage = '';\r\n let deliveryByMessageRange: string = '';\r\n const currentYear = dayjs().year();\r\n const deliveryDate = date.setDate(date.getDate());\r\n daysSpan?.map((item: string, index: number) => {\r\n if (parseInt(item, 10) > 0) {\r\n let numberOfDays = parseInt(item, 10);\r\n let newDate = deliveryDate;\r\n date = new Date();\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} - ${deliveryByMessage}`;\r\n } else {\r\n deliveryByMessageRange = deliveryByMessage;\r\n newDate = date.setDate(date.getDate() - parseInt(item[0], 10));\r\n }\r\n } else {\r\n let singleDays = parseInt(timeValue, 10);\r\n let newDate = deliveryDate;\r\n let flag = true;\r\n while (singleDays > 0) {\r\n newDate = date.setDate(date.getDate() + 1);\r\n if (dayjs(newDate).format('d') !== '0' && dayjs(newDate).format('d') !== '6') {\r\n singleDays--;\r\n } else {\r\n flag = false;\r\n }\r\n }\r\n deliveryByMessage = flag && timeValue === '1' ? `${dayjs(date.setDate(date.getDate())).format('MMM D')}` : dayjs(newDate).format('ddd, MMM D');\r\n }\r\n });\r\n deliveryByMessage = deliveryByMessageRange;\r\n const findDate = deliveryByMessage?.split('-');\r\n if (findDate?.length > 1) {\r\n const getDate = dayjs(`${findDate[1]} ${currentYear}`).format('MM/DD/YYYY');\r\n const fullDate = `${getDate} 12:00:00 AM`;\r\n const formatDeliveryDate = dayjs(fullDate).format('YYYY-MM-DDTHH:mm:ss');\r\n return { fullDate, formatDeliveryDate };\r\n } else {\r\n const getDate = dayjs(`${date[0]} ${currentYear}`).format('MM/DD/YYYY');\r\n const fullDate = `${getDate} 12:00:00 AM`;\r\n const formatDeliveryDate = dayjs(fullDate).format('YYYY-MM-DDTHH:mm:ss');\r\n return { fullDate, formatDeliveryDate };\r\n }\r\n};\r\n\r\n/**\r\n * VSI Customization - send the product and get variant type.\r\n*/\r\nconst getVariant = (product: SimpleProduct | undefined) => {\r\n if (!product) {\r\n return '';\r\n }\r\n let dimensionValueCustom = '';\r\n product.Dimensions?.map((item, index) => {\r\n if (item.DimensionValue?.Value !== 'Prime') {\r\n if (index === 0) {\r\n dimensionValueCustom += item.DimensionValue?.Value!;\r\n }\r\n else {\r\n dimensionValueCustom += ' , ' + `${item.DimensionValue?.Value!}`;\r\n }\r\n }\r\n });\r\n return dimensionValueCustom;\r\n};\r\n\r\n/**\r\n * VSI Customization - get product details with updated categories values which using for revenue categories.\r\n*/\r\nexport const getProductsCategoryPath = async (\r\n context: ICoreContext>,\r\n products: SimpleProduct[] | undefined,\r\n productDetailsData: IProductDetails[],\r\n resources: ICheckoutResources | IMfrmCartResources,\r\n checkout: boolean\r\n): Promise => {\r\n const {\r\n request: {\r\n apiSettings: { catalogId }\r\n },\r\n app: {\r\n config: { revenueCategory, otherRevenueDetail }\r\n }\r\n } = context;\r\n const getProductIdArray: number[] = [];\r\n products?.forEach((items: SimpleProduct) => getProductIdArray.push(items.RecordId));\r\n const productsCategories = await getProductsCategoryPathsAction(\r\n new GetCategoryPathsInput(context.request, catalogId, getProductIdArray),\r\n context.actionContext\r\n );\r\n const revenueCategoryConfig = revenueCategory;\r\n const newProductDetails = productDetailsData?.map(item => {\r\n const checkCategory = productsCategories.find(data => data.ProductId === item.VariantRecordId);\r\n const getSegments = checkCategory && checkCategory.CategoryPath && checkCategory.CategoryPath;\r\n let stopProccess = false;\r\n getSegments?.forEach(path => {\r\n path &&\r\n path.Segments &&\r\n path.Segments?.forEach(itemName => {\r\n const checkExist = revenueCategoryConfig?.find(\r\n (revenueItemName: IRevenueDetails) =>\r\n itemName?.CategoryName?.toLowerCase()?.trim() === revenueItemName?.CategoryName?.toLowerCase()?.trim()\r\n );\r\n if (checkExist) {\r\n stopProccess = true;\r\n item.revenueCategory = checkExist?.Name;\r\n item.categoryName = checkExist?.CategoryName;\r\n } else {\r\n if (\r\n itemName?.CategoryName === resources.mattresses ||\r\n itemName?.CategoryName === resources.adjustableBases ||\r\n itemName?.CategoryName === resources.boxSprings ||\r\n itemName?.CategoryName === resources.pillows ||\r\n itemName?.CategoryName === resources.babyAndKids\r\n ) {\r\n item.categoryName = itemName?.CategoryName;\r\n }\r\n if (!stopProccess) {\r\n item.revenueCategory = otherRevenueDetail;\r\n }\r\n }\r\n });\r\n });\r\n return item;\r\n });\r\n return { productsCategories, newProductDetails };\r\n};\r\n\r\n/**\r\n * VSI Customization - create product detaisl with attribute data.\r\n * use this utility to get product details and speicfication from local storage\r\n * this will be called on cart and checkout both. So, updated values will be stored\r\n*/\r\nexport const getProuductDetailsHandler = (\r\n context: ICoreContext>,\r\n cartLine: CartLine,\r\n attribute: IProductWithAttribute | undefined,\r\n products: SimpleProduct[] | undefined\r\n) => {\r\n const {\r\n actionContext,\r\n app: {\r\n config: { brandList, outOfStockProductKey, leadTime, brandBackofficeAttributePdp, placeholderImageName, collection, productType }\r\n }\r\n } = context;\r\n const productTypeInformation = getCheckoutAttributeByName(attribute?.attributeValue, 'shippingInformation')?.TextValue || '';\r\n const getProduct = products?.find(prod => prod.RecordId === cartLine.ProductId);\r\n const typeOfProduct = productTypeInformation?.toLowerCase()?.trim() === coreItemShippingType ? MFRMProductTypes.core : productTypeInformation;\r\n const brandName = parseBrandName(attribute?.attributeValue, brandBackofficeAttributePdp, attribute?.productId) || '';\r\n const VariantRecordId = attribute?.productId!;\r\n const categoryName = attribute?.categoryName;\r\n const name = attribute?.Name || '';\r\n const ItemId = cartLine.ItemId || '';\r\n const Quantity = cartLine.Quantity!;\r\n const outOfStock = getCheckoutAttributeByName(attribute?.attributeValue, outOfStockProductKey)?.TextValue ? true : false;\r\n const leadTimeVal = getCheckoutAttributeByName(attribute?.attributeValue, leadTime)?.TextValue || '';\r\n const brandLeadTime = getBrandLeadTime(brandList, brandName) || '';\r\n const getDeliveryDateDetails = generateDeliveryDate(leadTimeVal, brandLeadTime);\r\n const brandAndProductName = brandName ? `${brandName} ${name}` : name;\r\n const productCollection = getCheckoutAttributeByName(attribute?.attributeValue, collection)?.TextValue || '';\r\n // product type attribute from getAttributeValues and storing in product details and specification\r\n const productTypeAttribute = getCheckoutAttributeByName(attribute?.attributeValue, productType)?.TextValue || '';\r\n const variantType = `${getVariant(getProduct)\r\n ?.toString()\r\n ?.replace(/,/g, '')}`;\r\n const imageFallBackUrl = urlFallBackImage(String(placeholderImageName), cartLine.ItemId, actionContext.requestContext) || '';\r\n const imagePrimary: string = attribute?.PrimaryImageUrl !== undefined ? attribute?.PrimaryImageUrl : '';\r\n const MasterProductId = getProduct?.MasterProductId;\r\n const sharedValues = {\r\n typeOfProduct,\r\n outOfStock,\r\n Quantity,\r\n ItemId,\r\n VariantRecordId,\r\n zipCodeError: false,\r\n leadTimeVal,\r\n brandLeadTime,\r\n collection: productCollection,\r\n outOfStockSmallParcel: false,\r\n variantType,\r\n quantityMessage: false,\r\n brandName,\r\n name: brandAndProductName,\r\n productTypeAttribute\r\n };\r\n const productDetailsData = {\r\n ...sharedValues,\r\n brandAndProductName,\r\n categoryName,\r\n primaryImageUrl: '',\r\n fallbackImageUrl: '',\r\n DeliveryDate: getDeliveryDateDetails?.formatDeliveryDate,\r\n RequestedDeliveryDate: getDeliveryDateDetails?.fullDate\r\n };\r\n const productSepcification = {\r\n ...sharedValues,\r\n ProducName: name,\r\n MasterProductId,\r\n primaryImageUrl: imagePrimary,\r\n fallbackImageUrl: imageFallBackUrl\r\n };\r\n const getDetailsProducts = { productDetailsData, productSepcification };\r\n return getDetailsProducts;\r\n};\r\n/**\r\n * VSI Customization - to extract params from URL\r\n*/\r\nexport const urlParam = (name: string) => {\r\n // eslint-disable-next-line security/detect-non-literal-regexp\r\n const results = new RegExp(`[\\?&]${name}=([^&#]*)`).exec(window.location.href);\r\n return results?.[1] || 0;\r\n};\r\n\r\n// get USaEpay error details to show fallback error message on checkout\r\nexport const getUsaEpayErrorDetails = (errorCode: string, usaEpayErrorMessages: IUsaEpayErrorMessage[]) => {\r\n return usaEpayErrorMessages?.find((item: IUsaEpayErrorMessage) => item?.errorCode?.includes(errorCode?.trim()) && !item?.exclude) || usaEpayErrorMessages?.find((item: IUsaEpayErrorMessage) => item?.markAsDefault && !item?.exclude);\r\n};\r\n\r\n// Following function is used in all checkout module to verify delivery service against each cartline\r\nexport const _verifyDeliverService = async (productId: number, context: ICoreContext<{ [x: string]: any; }>) => {\r\n const servicesFromConfigurations = context.request.app.config.deliveryServices;\r\n const getArrayDeliveryService = await _getDeliveryService(servicesFromConfigurations);\r\n const get = getArrayDeliveryService.find((item) => item === productId);\r\n if (get) {\r\n return \"Delivery\";\r\n } else {\r\n return '';\r\n }\r\n};\r\n\r\n/**\r\n * VSI Customization - wrapper for update the exact delivery mode in cart object key.\r\n */\r\nexport const _addDeliveryMode = async (cartLinesData: CartLine[], productAttributes: IProductWithAttribute[], context: ICoreContext<{ [x: string]: any; }>): Promise => {\r\n const {\r\n app: {\r\n config: {\r\n deliveryMessageManagementValues\r\n }\r\n }\r\n } = context;\r\n const generaCartLines: CartLine[] = [];\r\n await Promise.all(cartLinesData.map(async (elem: CartLine) => {\r\n try {\r\n const attributesList = productAttributes?.find((items) => items.productId === elem.ProductId)?.attributeValue;\r\n const getMode = attributesList?.find((attribute) => attribute.Name === 'shippingInformation')?.TextValue;\r\n elem.DeliveryMode = getMode ? _getModOfDelivery(getMode, deliveryMessageManagementValues) : await _verifyDeliverService(elem.ProductId!, context);\r\n // and response need to be added into final response array\r\n generaCartLines.push(elem);\r\n } catch (error) {\r\n console.log(`error${error}`);\r\n }\r\n }));\r\n return generaCartLines; // return without waiting for process of\r\n};\r\n/**\r\n * Checkout Page Overlay Modal.\r\n */\r\nexport interface ICheckoutPageOverlayModal {\r\n modal: INodeProps;\r\n}\r\n// utility to be used with financing offers on checkout to show end date\r\nexport const extractMonthAndDate = (dateString: string | undefined): string | undefined => {\r\n if (!dateString) {\r\n return undefined;\r\n }\r\n // match the date string against a regular expression to extract the month and date\r\n const match = dateString.match(/(\\d{1,2})\\/(\\d{1,2})\\/(\\d{2,4})/);\r\n if (!match) {\r\n return undefined;\r\n }\r\n const month = match[1].padStart(2, '0');\r\n const date = match[2].padStart(2, '0');\r\n return `${month}/${date}`;\r\n};\r\n\r\n// utility to set address on checkout\r\nexport const setAddress = (addUpdateAddress: IMfrmAddress, email?: string, firstName?: string, lastName?: string, emailMeCheckbox?: boolean, phone?: string, address?: string, apt?: string) => {\r\n set(addUpdateAddress, {\r\n Email: email ?? '',\r\n FirstName: firstName ?? '',\r\n LastName: lastName ?? '',\r\n EmailMeCheckbox: emailMeCheckbox ?? false,\r\n Phone: phone,\r\n Address: address,\r\n APT: apt\r\n });\r\n};\r\n\r\n// Following function updates tax on checkout page by updating state action GetRecycleFeeCheckoutInput; This function is called everytime after UpdateCartLine API call\r\nexport const _updateCheckoutTax = async (\r\n context: ICoreContext<{\r\n [x: string]: any;\r\n }>,\r\n cartState: ICartState\r\n) => {\r\n const {\r\n app: { config }\r\n } = context;\r\n const { RecycleFeeAttribute } = config;\r\n const recycleFeeAttributeValue = RecycleFeeAttribute?.trim().toLowerCase();\r\n const extentionArray = cartState.cart.ExtensionProperties;\r\n const fee = extentionArray?.find((item) => item.Key?.trim().toLowerCase() === recycleFeeAttributeValue)?.Value?.DecimalValue!;\r\n context.actionContext.update(new GetRecycleFeeCheckoutInput(), { recycleFee: Number(fee), tax: Number(cartState.cart?.TaxAmount) });\r\n};\r\n\r\n\r\n/**\r\n * VSI Customization - create delivery service re-useable attribute.\r\n*/\r\nexport const getServiceItemsAttributes = (isWillCall: boolean , willCallDeliveryDate: string , InventLocation: string | undefined) => {\r\n const AttributesArray = [];\r\n const ecomDeliverySetDate = willCallDeliveryDate?.slice(0, -6);\r\n const dayjsEcomDateDelivery = dayjs(ecomDeliverySetDate).format('YYYY-MM-DDTHH:mm:ss');\r\n const deliveryDateError: IErrorCaseForDeliveryDate = {\r\n case: 'ATP Slots Found && selected TimeSLot length ===0 && Product is a service id',\r\n line: 621,\r\n value: dayjsEcomDateDelivery\r\n };\r\n const deliveryDateErrorWillCall: IErrorCaseForDeliveryDate = {\r\n case: 'Slots found and else part and is a service product',\r\n line: 1585,\r\n value: dayjsEcomDateDelivery\r\n };\r\n const ecomDeliveryDate = AttributeCreate(\r\n 'Ecom_DeliveryDate',\r\n dayjsEcomDateDelivery ? dayjsEcomDateDelivery : JSON.stringify(deliveryDateError)\r\n );\r\n const ecomDeliveryDatewillCall = AttributeCreate(\r\n 'Ecom_DeliveryDate',\r\n dayjsEcomDateDelivery ? dayjsEcomDateDelivery : JSON.stringify(deliveryDateErrorWillCall)\r\n );\r\n const ecomDSDeliveryScheduleStatus = AttributeCreate('Ecom_DSDeliveryScheduleStatus' , 'Open');\r\n const ecomInventLocationId = AttributeCreate( 'Ecom_InventLocationId', InventLocation);\r\n if(isWillCall) {\r\n AttributesArray.push(ecomDeliveryDatewillCall, ecomDSDeliveryScheduleStatus, ecomInventLocationId);\r\n } else {\r\n AttributesArray.push(ecomDeliveryDate, ecomDSDeliveryScheduleStatus, ecomInventLocationId);\r\n }\r\n return AttributesArray;\r\n};\r\n\r\n/**\r\n * VSI Customization - create core re-useable attribute.\r\n*/\r\nexport const getCoreProductAttributes = (isWillCall: boolean, willCallDeliveryDate: string , InventLocation: string | undefined) => {\r\n // core items attributes\r\n const AttributesArray = [];\r\n const ecomDeliverySetDate = willCallDeliveryDate?.slice(0, -6);\r\n const dayjsEcomDateDelivery = dayjs(ecomDeliverySetDate).format('YYYY-MM-DDTHH:mm:ss');\r\n const deliveryDateError: IErrorCaseForDeliveryDate = {\r\n case: 'ATP Slots Found && selected time slot selectedTimeSlot length = 0 && Delivery Item in a will call case',\r\n line: 659,\r\n value: dayjsEcomDateDelivery\r\n };\r\n const ecomDeliveryDate = AttributeCreate(\r\n 'Ecom_DeliveryDate',\r\n dayjsEcomDateDelivery ? dayjsEcomDateDelivery : JSON.stringify(deliveryDateError)\r\n );\r\n const deliveryDateErrorWillCall: IErrorCaseForDeliveryDate = {\r\n case: 'Slots found and else part and is a Core product',\r\n line: 1623,\r\n value: dayjsEcomDateDelivery\r\n };\r\n const ecomDeliveryDateWillCall = AttributeCreate(\r\n 'Ecom_DeliveryDate',\r\n dayjsEcomDateDelivery ? dayjsEcomDateDelivery : JSON.stringify(deliveryDateErrorWillCall)\r\n );\r\n const ecomDSDeliveryScheduleStatus = AttributeCreate('Ecom_DSDeliveryScheduleStatus' , 'Open');\r\n const ecomInventLocationId = AttributeCreate( 'Ecom_InventLocationId', InventLocation);\r\n if(isWillCall) {\r\n AttributesArray.push(ecomDeliveryDateWillCall, ecomDSDeliveryScheduleStatus, ecomInventLocationId);\r\n } else {\r\n AttributesArray.push(ecomDeliveryDate, ecomDSDeliveryScheduleStatus, ecomInventLocationId);\r\n }\r\n return AttributesArray;\r\n};\r\n\r\n/**\r\n * VSI Customization - create parcel re-useable attribute.\r\n*/\r\nexport const getParcelProductAttributes = (productDetails: IProductDetails, isWillCall: boolean, deliveryMsg: { shippingInformation: string; MOD: string; }[] | undefined, daysParcel: number | undefined ) => {\r\n // parcel items attributes\r\n const AttributesArray = [];\r\n const defaultDaysParcel = daysParcel && daysParcel > 0 && _addDefaultDays(daysParcel);\r\n const getModDelivery = _getModOfDelivery('Parcel', deliveryMsg!);\r\n const ecomDeliveryServiceMode = AttributeCreate('Ecom_DeliveryService', getModDelivery);\r\n const deliveryDateError: IErrorCaseForDeliveryDate = {\r\n case: 'ATP Slots Found && selected time slot length =0 && Parcel Item',\r\n line: 724,\r\n value: productDetails?.DeliveryDate\r\n };\r\n const ecomDeliveryDate = AttributeCreate(\r\n 'Ecom_DeliveryDate',\r\n productDetails?.DeliveryDate\r\n ? productDetails?.DeliveryDate\r\n : defaultDaysParcel\r\n ? defaultDaysParcel\r\n : JSON.stringify(deliveryDateError)\r\n );\r\n const deliveryDateErrorWillCall: IErrorCaseForDeliveryDate = {\r\n case: 'Slots found and else part and is a parcel product',\r\n line: 1711,\r\n value: productDetails?.DeliveryDate\r\n };\r\n const ecomDeliveryDateWillCall = AttributeCreate(\r\n 'Ecom_DeliveryDate',\r\n productDetails?.DeliveryDate\r\n ? productDetails?.DeliveryDate\r\n : defaultDaysParcel\r\n ? defaultDaysParcel\r\n : JSON.stringify(deliveryDateErrorWillCall)\r\n );\r\n if(isWillCall) {\r\n AttributesArray.push(ecomDeliveryServiceMode, ecomDeliveryDateWillCall );\r\n } else {\r\n AttributesArray.push(ecomDeliveryServiceMode, ecomDeliveryDate );\r\n }\r\n\r\n return AttributesArray;\r\n};\r\n\r\n\r\n/**\r\n * VSI Customization - create drop ship re-useable attribute.\r\n*/\r\n export const getDropShipProductAttributes = (productDetails: IProductDetails, isWillCall: boolean, deliveryMsg: { shippingInformation: string; MOD: string; }[] | undefined, daysDropShip: string | undefined ) => {\r\n // drop ship items attributes\r\n const AttributesArray = [];\r\n const getModDelivery = _getModOfDelivery(MFRMProductTypes.dropShip, deliveryMsg!);\r\n const ecomDeliveryServiceMode = AttributeCreate('Ecom_DeliveryService', getModDelivery);\r\n const deliveryDateError: IErrorCaseForDeliveryDate = {\r\n case: 'ATP Slots Found && selected time slot && length = 0 && Drop Ship Item',\r\n line: 771,\r\n value: productDetails?.DeliveryDate\r\n };\r\n const deliveryDateErrorWillCall: IErrorCaseForDeliveryDate = {\r\n case: 'Slots found and else part and is a dropship product',\r\n line: 1766,\r\n value: productDetails?.DeliveryDate\r\n };\r\n const ecomDeliveryDate = AttributeCreate(\r\n 'Ecom_DeliveryDate',\r\n productDetails?.DeliveryDate\r\n ? productDetails?.DeliveryDate\r\n : daysDropShip\r\n ? daysDropShip\r\n : JSON.stringify(deliveryDateError)\r\n );\r\n const ecomDeliveryDateWillCall = AttributeCreate(\r\n 'Ecom_DeliveryDate',\r\n productDetails?.DeliveryDate\r\n ? productDetails?.DeliveryDate\r\n : daysDropShip\r\n ? daysDropShip\r\n : JSON.stringify(deliveryDateErrorWillCall)\r\n );\r\n const ecomDSShippingMessage = AttributeCreate(\r\n 'Ecom_ShippingMessage',\r\n `Arrives ${getDeliveryMessageForProduct(productDetails?.VariantRecordId)}`\r\n );\r\n if(isWillCall) {\r\n AttributesArray.push(\r\n ecomDeliveryServiceMode,\r\n ecomDSShippingMessage,\r\n ecomDeliveryDateWillCall\r\n );\r\n } else {\r\n AttributesArray.push(\r\n ecomDeliveryServiceMode,\r\n ecomDSShippingMessage,\r\n ecomDeliveryDate\r\n );\r\n }\r\n return AttributesArray;\r\n };\r\n// Following function detects if browser is Safari or not\r\nexport const isSafari = (): boolean => {\r\n return !!(navigator.vendor && navigator.vendor.indexOf('Apple') > -1);\r\n};\r\n\r\n// express skeleton check\r\nexport const handleExpressSkeletonCheck = (actionContext: IActionContext, data: IMfrmCheckoutShippingAddressData | IMfrmCheckoutDeliveryOptionsData) => {\r\n actionContext.update(new CheckoutSkeletonInput(), {\r\n showPaymentSkeleton: data.showSkeleton.result?.showPaymentSkeleton,\r\n expressSkeleton: data.showSkeleton.result?.expressSkeleton,\r\n expressPhoneNotavailable: data.showSkeleton.result?.expressPhoneNotavailable,\r\n expressLoaderRunning: false,\r\n showDeliverySkeleton: data.showSkeleton.result?.showDeliverySkeleton,\r\n showCustomerInfoSkeleton: data.showSkeleton.result?.showCustomerInfoSkeleton\r\n });\r\n};\r\n\r\nexport const hasCoreProduct = (products?: IProductDetails[]) => {\r\n const productSpecificationsCookieData = products ? products : getSetProductData('get');\r\n if (productSpecificationsCookieData && productSpecificationsCookieData.length) {\r\n for (const psp of productSpecificationsCookieData) {\r\n if (psp.typeOfProduct.toLowerCase().trim() === MFRMProductTypes.core) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n};\r\n\r\n// When checkout data action's value is not available e.g. in another data action (getCardPaymentAcceptPoint); check if this is express checkout using url like following\r\nexport const isExpressCheckout = (actionContext: IActionContext) => {\r\n const { requestContext: { url, app: { config: { expressApplePayCheckouturl, expressCheckouturl } } } } = actionContext;\r\n const checkoutURl = url.requestUrl.pathname?.split('/')[1]?.toLowerCase()?.trim();\r\n // Check if it's express checkout page\r\n return !!(checkoutURl === expressApplePayCheckouturl || checkoutURl === expressCheckouturl);\r\n};\r\n","export const variantQueryStringName = 'variantid';","import { IActionContext } from '@msdyn365-commerce/core';\r\nimport { addCartLinesAsync, removeCartLinesAsync, updateCartLinesAsync, updateLineDeliverySpecificationsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\r\nimport { Cart, CartLine, LineDeliverySpecification } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { ICartActionResultWithCart } from '@msdyn365-commerce/global-state';\r\nimport { ICartState } from '@msdyn365-commerce/global-state';\r\nimport { IAny, ICoreContext, IGeneric } from '@msdyn365-commerce/core';\r\nimport { IMFICLDeliveryScheduleParameters, IInventoryStatusResponse } from '../actions/CoreProductDataServiceEntities.g';\r\nimport getATPInventoryStatusAction, { GetATPInventoryStatusInput } from '../actions/get-sm-inventory-status.action';// import { IMFIATPInventoryResponse } from '../actions/CoreProductDataServiceEntities.g';\r\nimport { eventFullStoryAPISuccess, eventFullStoryFailAPI } from './analytics/fullStoryTrack';\r\n\r\nexport const cartOperationDoRetry = async (callback: () => Promise, cartState: ICartState) => {\r\n let callbackResult = await callback();\r\n if (callbackResult.status === 'SUCCESS') {\r\n if (callbackResult) {\r\n await cartState.updateCart({ newCartObject: callbackResult.cart! }).then(null);\r\n }\r\n } else {\r\n callbackResult = await callback();\r\n if (callbackResult.status === 'SUCCESS') {\r\n if (callbackResult.cart) {\r\n void cartState.updateCart({ newCartObject: callbackResult.cart }).then(null);\r\n }\r\n }\r\n }\r\n return callbackResult?.cart;\r\n};\r\n\r\nexport const atpInventoryDoRetry = async (callback: () => Promise) => {\r\n let callbackResult = await callback();\r\n if (callbackResult.Message === 'SUCCESS') {\r\n return callbackResult;\r\n } else {\r\n callbackResult = await callback();\r\n if (callbackResult.Message === 'SUCCESS') {\r\n return callbackResult;\r\n }\r\n }\r\n return callbackResult;\r\n};\r\n\r\nexport const updateCartLineDeliverySpecificationsInternal = async (cart: Readonly, cartLineDeliverySpecifications: LineDeliverySpecification[], actionContext: IActionContext, pathName = \"\"): Promise => {\r\n if (!cart || !cart.CartLines || cartLineDeliverySpecifications.length === 0) {\r\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\r\n }\r\n\r\n return updateLineDeliverySpecificationsAsync(\r\n { callerContext: actionContext },\r\n cart.Id,\r\n cartLineDeliverySpecifications\r\n )\r\n .then(newCart => {\r\n void eventFullStoryAPISuccess('order_health update_line_delivery_success', pathName);\r\n return { cart: newCart, status: 'SUCCESS' };\r\n }).catch(error => {\r\n void eventFullStoryFailAPI('order_health update_line_delivery_fail', pathName, {error});\r\n actionContext.telemetry.warning(error);\r\n actionContext.telemetry.debug('Unable to updateLineDeliverySpecificationsAsync');\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\r\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\r\n });\r\n};\r\n\r\nexport const updateCartLineInternal = async (cart: Readonly, cartLineDeliverySpecifications: LineDeliverySpecification[], actionContext: IActionContext, pathName = \"\"): Promise => {\r\n if (!cart || !cart.CartLines || cartLineDeliverySpecifications.length === 0) {\r\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\r\n }\r\n\r\n return updateCartLinesAsync(\r\n { callerContext: actionContext },\r\n cart.Id,\r\n cartLineDeliverySpecifications\r\n )\r\n .then(newCart => {\r\n void eventFullStoryAPISuccess('order_health update_cart_success', pathName);\r\n return { cart: newCart, status: 'SUCCESS' };\r\n }).catch(error => {\r\n void eventFullStoryFailAPI('order_health update_cart_fail', pathName, {error});\r\n actionContext.telemetry.warning(error);\r\n actionContext.telemetry.debug('Unable to updateLineDeliverySpecificationsAsync');\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\r\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\r\n });\r\n};\r\n\r\nexport const addCartLineInternal = async (cart: Readonly, cartLineDeliverySpecifications: CartLine[], actionContext: IActionContext): Promise => {\r\n if (!cart || !cart.CartLines || cartLineDeliverySpecifications.length === 0) {\r\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\r\n }\r\n\r\n return addCartLinesAsync(\r\n { callerContext: actionContext },\r\n cart.Id,\r\n cartLineDeliverySpecifications\r\n )\r\n .then(newCart => {\r\n return { cart: newCart, status: 'SUCCESS' };\r\n }).catch(error => {\r\n actionContext.telemetry.warning(error);\r\n actionContext.telemetry.debug('Unable to updateLineDeliverySpecificationsAsync');\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\r\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\r\n });\r\n};\r\n\r\nexport default async function removeCartLinesInternal(cart: Readonly, cartLineIds: string[], actionContext: IActionContext): Promise {\r\n if (!cart) {\r\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\r\n }\r\n\r\n return removeCartLinesAsync({ callerContext: actionContext }, cart.Id, cartLineIds)\r\n .then(newCart => {\r\n // This is because of a TSProxy typing error\r\n const returnedCart = Array.isArray(newCart) ? newCart[0] : newCart;\r\n\r\n return { cart: returnedCart, status: 'SUCCESS' };\r\n })\r\n .catch(error => {\r\n actionContext.telemetry.warning(error);\r\n actionContext.telemetry.debug('Unable to Remove Cart Line');\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\r\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\r\n });\r\n}\r\n\r\nexport const getInventoryQuantityInternal = async(request: IMFICLDeliveryScheduleParameters, context: ICoreContext>, isCached?: boolean, pathName = \"\"): Promise => {\r\n if (!request) {\r\n return { Message: 'FAILED' };\r\n }\r\n\r\n const getATPInventoryStatusInput = new GetATPInventoryStatusInput(request, isCached);\r\n return getATPInventoryStatusAction(getATPInventoryStatusInput, context.actionContext).then(result => {\r\n if (result === null || !result.ATPInventoryStatusData) {\r\n void eventFullStoryFailAPI('order_health get_inventory_status_fail', pathName, { error: { message: 'api given null' } });\r\n return { Message: 'FAILED' };\r\n }\r\n void eventFullStoryAPISuccess('order_health get_inventory_status_success', pathName);\r\n return { Message :'SUCCESS', result };\r\n })\r\n .catch(error => {\r\n void eventFullStoryFailAPI('order_health get_inventory_status_fail', pathName, {error});\r\n context.actionContext.telemetry.warning(error);\r\n context.actionContext.telemetry.debug('Unable to get ATP Inventory Status');\r\n\r\n return { Message: 'FAILED' };\r\n });\r\n};","// tslint:disable\r\nexport const hasArray = (values: any): any[] | undefined => {\r\n return (typeof values !== 'string') && values && values.length ? values : undefined;\r\n};","/* MFRMProductTypes enum is used to check/compare the product type with product_details cookie\r\nby converting it to lower case used mainly in \"conditional statements\" */\r\nexport enum MFRMProductTypes {\r\n core = 'core',\r\n smallParcel = 'parcel',\r\n dropShip = 'drop ship'\r\n}\r\n\r\n// DeliveryModes enum is used to pass the modOfDelivery value in \"API payloads\"\r\nexport enum DeliveryModes {\r\n core = 'Delivery',\r\n smallParcel = 'Parcel',\r\n dropShip = 'Drop Ship'\r\n}\r\n\r\n// coreItemShippingType constant value is used to compare the shipping type of core products\r\nexport const coreItemShippingType = 'delivery';","import { IRequestContext } from '@msdyn365-commerce/core';\r\nimport { getFallbackImageUrl } from '../data-actions/utilities/utils';\r\n\r\nexport const urlFallBackImage = (imageUrl: string, itemId: string | undefined, apiSettings: IRequestContext) => {\r\n let fallbackImageUrl = getFallbackImageUrl(itemId, apiSettings?.apiSettings);\r\n if (imageUrl && fallbackImageUrl) {\r\n fallbackImageUrl = `${fallbackImageUrl},${imageUrl}`;\r\n }\r\n return fallbackImageUrl;\r\n};","import { IGridSettings, IImageSettings, Image } from '@msdyn365-commerce/core';\r\nimport { AttributeValue } from '@msdyn365-commerce/retail-proxy';\r\nimport React from 'react';\r\nimport { IBrandListData } from '../modules/mfrm-buybox/mfrm-buybox.view';\r\nimport { IProductBonusWithBrandName } from '../modules/mfrm-cart/mfrm-cart';\r\nimport {hasArray} from './emtpyChecker';\r\nimport MsDyn365 from '@msdyn365-commerce/core';\r\n\r\nconst fallBackBrandAttribute = 'VENDOR BRAND';\r\n\r\n// tslint:disable-next-line: cyclomatic-complexity\r\nexport const parseBrandData = (\r\n attributes: AttributeValue[] | undefined,\r\n backendAttribute: string,\r\n gridSettings: IGridSettings,\r\n renderBrandNameOnly: Boolean = false,\r\n brandList: IBrandListData[],\r\n imageSettings?: IImageSettings\r\n): JSX.Element | undefined => {\r\n const attribute = backendAttribute || fallBackBrandAttribute;\r\n const productBrandName =\r\n attributes &&\r\n attributes.find(currAttribute => currAttribute.Name && currAttribute.Name.toLowerCase().trim() === attribute.toLowerCase().trim())\r\n ?.TextValue;\r\n\r\n if (renderBrandNameOnly) {\r\n return {productBrandName};\r\n }\r\n\r\n const selectedBrand =\r\n (brandList &&\r\n productBrandName &&\r\n brandList.find(\r\n (brand: IBrandListData) => brand && brand.brandName.toLowerCase().trim() === productBrandName.toLowerCase().trim()\r\n )) ||\r\n undefined;\r\n\r\n if (!selectedBrand) {\r\n return undefined;\r\n }\r\n\r\n const copySelectedBrand: IBrandListData = selectedBrand;\r\n // set alt text to brand name if no alt text is configured\r\n if (copySelectedBrand && _useDefaultAltText(copySelectedBrand) && copySelectedBrand.brandLogo) {\r\n copySelectedBrand.brandLogo.altText = productBrandName;\r\n }\r\n\r\n // set height to configured value or the default\r\n const height = copySelectedBrand && copySelectedBrand.logoHeight !== undefined ? copySelectedBrand.logoHeight : 22;\r\n const brandImageSettings: IImageSettings = {\r\n viewports: {\r\n xs: { q: `w=0&h=25&m=6`, w: 0, h: 25 },\r\n lg: { q: `w=0&h=25&m=6`, w: 0, h: 25 },\r\n xl: { q: `w=0&h=25&m=6`, w: 0, h: 25 }\r\n },\r\n lazyload: false\r\n };\r\n\r\n const brandLogo = copySelectedBrand && copySelectedBrand.brandLogo && (\r\n \r\n );\r\n // place logo inside a link if configured to\r\n const brandLink =\r\n copySelectedBrand &&\r\n copySelectedBrand.brandLink &&\r\n copySelectedBrand.brandLink.linkUrl &&\r\n copySelectedBrand.brandLink.linkUrl.destinationUrl &&\r\n copySelectedBrand.brandLink;\r\n const linkElement = brandLink && (\r\n \r\n {brandLogo}\r\n \r\n );\r\n\r\n return linkElement || brandLogo;\r\n};\r\n// get only brandName\r\nexport const parseBrandName = (attributes: AttributeValue[] | undefined, backendAttribute: string, recordId?: number): string | undefined => {\r\n const attribute = backendAttribute || fallBackBrandAttribute;\r\n let productBrandName = hasArray(attributes)?.find((currAttribute: AttributeValue) => currAttribute?.Name?.toLowerCase().trim() === attribute?.toLowerCase().trim())?.TextValue;\r\n if (!productBrandName && MsDyn365.isBrowser) {\r\n const getLocalStorage = localStorage.getItem('bonusItmesWithBrand');\r\n let bonusItemArray: IProductBonusWithBrandName[] = [];\r\n if (getLocalStorage) {\r\n bonusItemArray = JSON.parse(getLocalStorage);\r\n }\r\n const checkBrandName = bonusItemArray.find(item => item.productId === recordId)?.brandName;\r\n if(checkBrandName) {\r\n productBrandName = checkBrandName;\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n return productBrandName;\r\n};\r\n\r\nexport const parseBrandNameUnbxd = (attributes: any | undefined, backendAttribute: string, recordId?: number): string | undefined => {\r\n const attribute = backendAttribute || fallBackBrandAttribute;\r\n // let productBrandName = hasArray(attributes)?.find((currAttribute: AttributeValue) => currAttribute?.Name?.toLowerCase().trim() === attribute?.toLowerCase().trim())?.TextValue;\r\n let productBrandName = attributes && attributes[attribute];\r\n if (!productBrandName && MsDyn365.isBrowser) {\r\n const getLocalStorage = localStorage.getItem('bonusItmesWithBrand');\r\n let bonusItemArray: IProductBonusWithBrandName[] = [];\r\n if (getLocalStorage) {\r\n bonusItemArray = JSON.parse(getLocalStorage);\r\n }\r\n const checkBrandName = bonusItemArray.find(item => item.productId === recordId)?.brandName;\r\n if(checkBrandName) {\r\n productBrandName = checkBrandName;\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n return productBrandName;\r\n};\r\n\r\n// get only brandName\r\nexport const getBrandNameCheck = (attributes: AttributeValue[] | undefined, backendAttribute: string): string | undefined => {\r\n const productBrandName =\r\n attributes &&\r\n attributes.find(\r\n currAttribute => currAttribute.Name && currAttribute.Name.toLowerCase().trim() === backendAttribute.toLowerCase().trim()\r\n )?.TextValue;\r\n if (!productBrandName) {\r\n return undefined;\r\n }\r\n return productBrandName;\r\n};\r\n\r\n// get the appropriate image alt text\r\nconst _useDefaultAltText = (selectedBrand: IBrandListData): boolean => {\r\n const configuredAltText = selectedBrand.brandLogo?.altText;\r\n return !(configuredAltText && configuredAltText.trim() && configuredAltText !== 'No Data Available');\r\n};\r\n","export const _getModOfDelivery = (mod: string , list: { shippingInformation: string; MOD: string; }[]) => {\r\n let deliveryMod: string = \"\";\r\n list.map((items: { shippingInformation: string; MOD: string; }) => {\r\n if(items.shippingInformation?.trim()?.toLowerCase() === mod?.trim()?.toLowerCase()) {\r\n deliveryMod = items?.MOD;\r\n }\r\n });\r\n return deliveryMod;\r\n};\r\n","import { IDeliveryProps } from '../modules/mfrm-cart/mfrm-cart.view';\r\n\r\nexport interface IDeliveryServiceNames {\r\n serviceProductRecId: number;\r\n serviceName: string;\r\n willCallMessage: string;\r\n willCallTitle?: string;\r\n}\r\n\r\nexport const _getDeliveryService = async (deliveryServices: IDeliveryProps[]): Promise => {\r\n const newDeliveryServiceArray: number[] | PromiseLike = [];\r\n deliveryServices?.forEach((item: IDeliveryProps) => {\r\n let serviceProductRecId = item.serviceProductRecId;\r\n newDeliveryServiceArray.push(serviceProductRecId);\r\n if(item?.childService) {\r\n item.childService.map((childItem) => {\r\n serviceProductRecId = childItem.productRectId!;\r\n newDeliveryServiceArray.push(serviceProductRecId);\r\n });\r\n }\r\n });\r\n\r\n return newDeliveryServiceArray;\r\n};\r\n\r\nexport const _getDeliveryServiceNonAsync = (deliveryServices: IDeliveryProps[]): number[] => {\r\n const newDeliveryServiceArray: number[] = [];\r\n deliveryServices?.forEach((item: IDeliveryProps) => {\r\n let serviceProductRecId = item.serviceProductRecId;\r\n newDeliveryServiceArray.push(serviceProductRecId);\r\n if(item?.childService) {\r\n item.childService.map((childItem) => {\r\n serviceProductRecId = childItem.productRectId!;\r\n newDeliveryServiceArray.push(serviceProductRecId);\r\n });\r\n }\r\n });\r\n\r\n return newDeliveryServiceArray;\r\n};\r\n\r\nexport const _getDeliveryServiceWithName = (deliveryServices: IDeliveryProps[]): IDeliveryServiceNames[] => {\r\n const newDeliveryServiceArray: IDeliveryServiceNames[] = [];\r\n deliveryServices?.forEach((item: IDeliveryProps) => {\r\n let serviceProductRecId = {serviceProductRecId: item.serviceProductRecId , serviceName: item.serviceName , willCallMessage: item.willCallMessage, willCallTitle: item?.willCallTitle };\r\n newDeliveryServiceArray.push(serviceProductRecId);\r\n if(item?.childService) {\r\n item.childService.map((childItem) => {\r\n serviceProductRecId = {serviceProductRecId: childItem.productRectId! , serviceName: item.serviceName , willCallMessage: item.willCallMessage, willCallTitle: item?.willCallTitle };\r\n newDeliveryServiceArray.push(serviceProductRecId);\r\n });\r\n }\r\n });\r\n\r\n return newDeliveryServiceArray;\r\n};\r\n\r\nexport const _getDeliveryServiceWithSKU = (deliveryServices: IDeliveryProps[]): { serviceProductRecId: number; serviceSku: string; addKeyInPrice: boolean }[] => {\r\n const newDeliveryServiceArray: { serviceProductRecId: number; serviceSku: string; addKeyInPrice: boolean }[] = [];\r\n deliveryServices?.forEach((item: IDeliveryProps) => {\r\n const serviceItems = {serviceProductRecId: item.serviceProductRecId , serviceSku: item.serviceSku , addKeyInPrice: item.addKeyInPrice!};\r\n newDeliveryServiceArray.push(serviceItems);\r\n if(item?.childService) {\r\n item.childService.map((childItem) => {\r\n const serviceItems = {serviceProductRecId: childItem.productRectId! , serviceSku: childItem.serviceSKU! , addKeyInPrice: childItem.addKeyInPrice};\r\n newDeliveryServiceArray.push(serviceItems);\r\n });\r\n }\r\n });\r\n\r\n return newDeliveryServiceArray;\r\n};","import {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n IGeneric,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\n// import { ICategoryPath, ICategoryUrl } from '@msdyn365-commerce/core-internal/dist/types/interfaces/ICategoryPathInterfaces';\r\nimport { getCategoryPathsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { CategoryPathLookup, CategoryPathResult } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { hasArray } from '../Utilities/emtpyChecker';\r\n\r\n/**\r\n * Category path input\r\n */\r\nexport class GetCategoryPathsInput implements IActionInput {\r\n public readonly ChannelId: number;\r\n public CatalogId?: number;\r\n public productIds?: number[];\r\n // public readonly categoryPathLooksups: CategoryPathLookup[];\r\n public readonly apiSettings: ICommerceApiSettings;\r\n // @ts-ignore\r\n private constructedCacheKey: string | undefined;\r\n\r\n constructor(context: IRequestContext, catalogId?: number, productIds?: number[]) {\r\n this.ChannelId = context.apiSettings.channelId;\r\n this.CatalogId = catalogId; // context.apiSettings.catalogId || 0;\r\n this.productIds = productIds;\r\n // this.categoryPathLooksups = categoryPathLooksups;\r\n this.apiSettings = context.apiSettings;\r\n this.constructedCacheKey = '';\r\n // categoryPathLooksups.forEach(categoryPath=> {\r\n // this.constructedCacheKey+=`${categoryPath.ProductId && categoryPath.ProductId.toString()}|`;\r\n // });\r\n this.constructedCacheKey = this.productIds?.map(ids => ids).join('-').toString();\r\n this.constructedCacheKey += `${this.ChannelId?.toString()}|`;\r\n this.constructedCacheKey += `${this.CatalogId?.toString()}|`;\r\n }\r\n\r\n public getCacheKey = () => `MFRMProductCategoryPath-${this.constructedCacheKey}`;\r\n public getCacheObjectType = () => 'MFRMProductCategoryPath';\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\n/**\r\n * Creates the input required to make the getCategoryPath retail api call\r\n */\r\nexport const createGetCategoryPathsInput = (\r\n inputData: GetCategoryPathsInput,\r\n context: ICreateActionContext>\r\n): IActionInput => {\r\n const productId = inputData.productIds;\r\n if (productId) {\r\n return new GetCategoryPathsInput(context.requestContext, inputData.CatalogId, inputData.productIds);\r\n } else {\r\n throw new Error('Unable to create SelectedVariantInput, no productId found on module config or query');\r\n }\r\n};\r\n\r\n/**\r\n * Calls the Retail API and returns the category path for a product\r\n */\r\nexport async function getProductsCategoryPathsAction(input: GetCategoryPathsInput, ctx: IActionContext): Promise {\r\n const catPaths: CategoryPathLookup[] = [];\r\n if (!hasArray(input.productIds)) {\r\n return [];\r\n }\r\n for (let productsIter = 0; productsIter < input.productIds!.length; productsIter++) {\r\n catPaths.push({ ProductId: input.productIds![productsIter] });\r\n }\r\n try {\r\n return await getCategoryPathsAsync({ callerContext: ctx, queryResultSettings: { Paging: { Top: input.productIds!.length }, Sorting: {} } }, input.ChannelId, input.CatalogId!, catPaths);\r\n } catch (err) {\r\n console.log(err);\r\n return [];\r\n }\r\n}\r\n\r\nexport const getCategoryPathsActionDataAction = createObservableDataAction({\r\n id: 'GetMFRMProductsCategoryPaths',\r\n action: >getProductsCategoryPathsAction,\r\n input: createGetCategoryPathsInput\r\n});\r\n\r\nexport default getCategoryPathsActionDataAction;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\nexport interface ICheckoutRecycleFeeTaxUpdate {\r\n recycleFee: number | null;\r\n tax: number | null;\r\n}\r\n/**\r\n * GetRecycleFeeCheckout Input Action\r\n */\r\nexport class GetRecycleFeeCheckoutInput implements Msdyn365.IActionInput {\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 = () => `CheckoutUpdateRecycleFee`;\r\n public getCacheObjectType = () => 'CheckoutUpdateRecycleFee';\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\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n return new GetRecycleFeeCheckoutInput();\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 action(input: GetRecycleFeeCheckoutInput, ctx: Msdyn365.IActionContext): Promise {\r\n // const apiSettings = Msdyn365.msdyn365Commerce.apiSettings;\r\n\r\n // Uncomment the below line to get the value from a service\r\n return {recycleFee: null , tax: null};\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n // Give your data action a unique id\r\n id: 'GetRecycleFeeCheckout',\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 * 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 * Small parcel getInventory status 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","import Cookies from 'universal-cookie';\r\nconst cookies = new Cookies();\r\n\r\n// use this function to get cookie\r\nexport function getCookie(cookieName: string): string | undefined {\r\n return cookies.get(cookieName);\r\n}\r\n\r\n// use this function to set cookie\r\nexport function setCookie(cookieName: string, cookieValue: any, options?: any): void {\r\n cookies.set(cookieName, cookieValue, options);\r\n}\r\n\r\n// use this function to remove cookie\r\nexport function removeCookie(cookieName: string, options?: any): void {\r\n cookies.remove(cookieName, options);\r\n}","import * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\n/**\r\n * CheckoutSkeleton Input Action\r\n */\r\nexport class CheckoutSkeletonInput implements Msdyn365.IActionInput {\r\n constructor() {}\r\n\r\n public getCacheKey = () => `CheckoutSkeleton`;\r\n public getCacheObjectType = () => 'CheckoutSkeleton';\r\n public dataCacheType = (): Msdyn365.CacheType => 'application';\r\n}\r\n\r\nexport interface ICheckoutSkeletonData {\r\n showPaymentSkeleton: boolean | undefined;\r\n expressSkeleton: boolean;\r\n expressPhoneNotavailable: boolean;\r\n expressLoaderRunning: boolean;\r\n showDeliverySkeleton: boolean;\r\n showCustomerInfoSkeleton: boolean;\r\n isPaymentApiFailed: boolean;\r\n}\r\n\r\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n return new CheckoutSkeletonInput();\r\n};\r\n\r\n\r\nasync function action(input: CheckoutSkeletonInput, ctx: Msdyn365.IActionContext): Promise {\r\n return { showPaymentSkeleton: true, expressSkeleton: true, expressPhoneNotavailable: true, expressLoaderRunning: true, showDeliverySkeleton: true, showCustomerInfoSkeleton: true, isPaymentApiFailed: false };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n id: 'CheckoutSkeleton',\r\n input: createInput\r\n});\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { mFIATPInventoryDynamicAsync } from '../actions/CoreProductDataActionExtension.g';\r\nimport {\r\n IMFIATPInventoryDynamicResponse, IMFICartLine, IMFICLDeliveryScheduleParameters\r\n} from '../actions/CoreProductDataServiceEntities.g';\r\n\r\n/**\r\n * MfiAtpInventory Input Action\r\n */\r\nexport class MfiAtpInventoryInput implements Msdyn365.IActionInput {\r\n // MfiAtpInventory: Construct the input needed to run the action\r\n public inventoryType: string;\r\n public weeks: number;\r\n public storeId: string;\r\n public page: string;\r\n public requestedDate: string;\r\n public zipCode: string;\r\n public itemLines: IMFICartLine[];\r\n\r\n constructor(inventoryType: string, weeks: number, storeId: string, page: string, requestedDate: string, zipCode: string, itemLines: IMFICartLine[]) {\r\n this.inventoryType = inventoryType;\r\n this.weeks = weeks;\r\n this.storeId = storeId;\r\n this.page = page;\r\n this.requestedDate = requestedDate;\r\n this.zipCode = zipCode;\r\n this.itemLines = itemLines;\r\n }\r\n\r\n // MfiAtpInventory: 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 = () => `MfiAtpInventory`;\r\n public getCacheObjectType = () => 'MfiAtpInventory';\r\n public dataCacheType = (): Msdyn365.CacheType => 'none';\r\n}\r\n\r\n// MfiAtpInventory: Create a data model here or import one to capture the response of the action\r\nexport interface IMfiAtpInventoryData {\r\n text: string;\r\n}\r\n\r\n\r\n/**\r\n * MfiAtpInventory: Use this function to call your action and process the results as needed\r\n */\r\nexport async function mfiAtpInventoryAction(input: MfiAtpInventoryInput, ctx: Msdyn365.IActionContext): Promise {\r\n // const apiSettings = Msdyn365.msdyn365Commerce.apiSettings;\r\n\r\n const requestBody: IMFICLDeliveryScheduleParameters = {\r\n InventoryType: input.inventoryType,\r\n Weeks: input.weeks,\r\n StoreId: input.storeId,\r\n Page: input.page,\r\n RequestedDate: input.requestedDate,\r\n ZipCode: input.zipCode,\r\n ItemLines: input.itemLines\r\n };\r\n\r\n const response = await mFIATPInventoryDynamicAsync({ callerContext: ctx }, requestBody);\r\n return response;\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >mfiAtpInventoryAction,\r\n // MfiAtpInventory: Give your data action a unique id\r\n id: 'MfiAtpInventory'\r\n // input: createInput\r\n // MfiAtpInventory: 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 * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport { IAny, ICommerceApiSettings, ICoreContext, ICreateActionContext, IGeneric, IRequestContext } from '@msdyn365-commerce/core';\r\nimport {\r\n AsyncResult, CartLine, CommerceListLine, ProductDimension,\r\n ProductDimensionType, ProductSearchResult, SimpleProduct\r\n} from '@msdyn365-commerce/retail-proxy';\r\n\r\nimport { ProductDetailsCriteria, InventoryLevels, ArrayExtensions } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { variantQueryStringName } from '../../Utilities/constants';\r\n// import { parseSearchData } from '@msdyn365-commerce-modules/retail-actions/src/utilities/input-data-parser';\r\n\r\nexport const wrapInResolvedAsyncResult = (input: T | null | undefined): AsyncResult => {\r\n return >{\r\n status: 'SUCCESS',\r\n result: input,\r\n metadata: {}\r\n };\r\n};\r\n\r\nexport const wrapInRejectedAsyncResult = (input: T | null | undefined): AsyncResult => {\r\n return >{\r\n status: 'FAILED',\r\n result: input,\r\n metadata: {}\r\n };\r\n};\r\n\r\n\r\n/**\r\n * Utility function to extract the active productId in the following priority:\r\n * First query param (productId), then UrlToken (itemId), then module config.\r\n * @param inputData - The Action Input data.\r\n * @returns Productid or undefined.\r\n */\r\nexport const getSelectedProductIdFromActionInput = (inputData: ICreateActionContext>): string | undefined => {\r\n const context = inputData.requestContext;\r\n const variantId = context.app.config.queryBasedVariantSelection ? getQueryParamsFromQueryByName(context.url.requestUrl, variantQueryStringName) : undefined;\r\n\r\n if (variantId) {\r\n return variantId;\r\n } else if (context.query?.productId) {\r\n return context.query.productId;\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Exsiting code.\r\n } else if (context.urlTokens && inputData.requestContext.urlTokens.itemId && inputData.requestContext.urlTokens.pageType === 'Product') {\r\n return context.urlTokens.itemId;\r\n } else if (inputData && inputData.config && inputData.config.productId) {\r\n return inputData.config.productId;\r\n }\r\n return undefined;\r\n};\r\n\r\nexport const getQueryParamsFromQueryByName = (inputUrl: URL, queryParamName: string) => {\r\n const urlWithIgnoredCase = new URL(inputUrl.toString().toLocaleLowerCase());\r\n const urlParameters = urlWithIgnoredCase.searchParams;\r\n const value = urlParameters.get(queryParamName.trim().toLocaleLowerCase());\r\n if (!value || Number.isNaN(Number(value))) {\r\n return undefined;\r\n }\r\n return value;\r\n};\r\n/**\r\n * Generates a Image URL based on data return from retail server.\r\n * @param imageUrl The image url returned by Retail Server.\r\n * @param ctx The request context.\r\n * @param apiSettings\r\n */\r\nexport const generateImageUrl = (imageUrl: string | undefined, apiSettings: ICommerceApiSettings): string | undefined => {\r\n if (imageUrl) {\r\n // Images hosted in CMS include schema\r\n if (imageUrl.startsWith('http')) {\r\n return imageUrl;\r\n }\r\n\r\n // Images hosted in Retail Server must be encoded and joined with the base image url\r\n return apiSettings.baseImageUrl + encodeURIComponent(imageUrl);\r\n }\r\n\r\n // D365Commerce.telemetry.warning(`Unable to generate a proper Image URL for Product: ${product.RecordId}`);\r\n return undefined;\r\n\r\n};\r\n\r\n/**\r\n * Represents app configuration for dimensions.\r\n */\r\nexport interface IDimensionsConfig {\r\n dimensionsAsSwatchType?: DimensionTypes[];\r\n dimensionsInProductCard?: DimensionTypes[];\r\n inventoryLevel?: InventoryLevels;\r\n dimensionToPreSelectInProductCard?: DimensionTypes;\r\n}\r\n\r\n/**\r\n * Represents app configuration for dimensions.\r\n */\r\nexport interface IDimensionsApp {\r\n config: IDimensionsConfig;\r\n}\r\n\r\n/**\r\n * Represents product dimension types.\r\n */\r\nexport enum DimensionTypes {\r\n none = 'none',\r\n color = 'color',\r\n configuration = 'configuration',\r\n size = 'size',\r\n style = 'style'\r\n}\r\n\r\n/**\r\n * Defines display configuration types.\r\n */\r\nexport enum DimensionSwatchDisplayTypes {\r\n default = 'default',\r\n productCard = 'productCard'\r\n}\r\n\r\n/**\r\n * Checks if rendering the particular dimensions is allowed.\r\n * @param dimensionType - Dimension to be displayed.\r\n * @param context - Core application context.\r\n * @param displayType - The swatch location, the component from which it comes from.\r\n * @returns Updates the state with new product page url.\r\n */\r\nexport const checkIfShouldDisplayAsSwatch = (\r\n dimensionType: DimensionTypes,\r\n context: ICoreContext,\r\n displayType: DimensionSwatchDisplayTypes = DimensionSwatchDisplayTypes.default): boolean => {\r\n\r\n // Additional checks for the product card since it has a separate config setting.\r\n if (displayType === DimensionSwatchDisplayTypes.productCard) {\r\n const dimensionsToDisplayOnProductCard = context.app.config.dimensionsInProductCard;\r\n if (!ArrayExtensions.hasElements(dimensionsToDisplayOnProductCard) ||\r\n dimensionsToDisplayOnProductCard.includes(DimensionTypes.none) ||\r\n !dimensionsToDisplayOnProductCard.includes(dimensionType)) {\r\n return false;\r\n }\r\n }\r\n\r\n const dimensionsToDisplayAsSwatch = context.app.config.dimensionsAsSwatchType;\r\n return ArrayExtensions.hasElements(dimensionsToDisplayAsSwatch) &&\r\n !dimensionsToDisplayAsSwatch.includes(DimensionTypes.none) &&\r\n dimensionsToDisplayAsSwatch.includes(dimensionType);\r\n};\r\n\r\n/**\r\n * Generates an image URL for a swatch.\r\n * @param imageUrl - The image url returned by Retail Server.\r\n * @param apiSettings - The request context.\r\n * @returns Full image url.\r\n */\r\nexport const generateSwatchImageUrl = (imageUrl: string, apiSettings: ICommerceApiSettings): string => {\r\n if (imageUrl.startsWith('http')) {\r\n return imageUrl;\r\n }\r\n\r\n return apiSettings.baseImageUrl + encodeURIComponent(imageUrl);\r\n};\r\n\r\n/**\r\n * Generates a Image URL for a product based on data return from retail server.\r\n * @param product The Product returned by Retail Server.\r\n * @param ctx The request context.\r\n * @param apiSettings\r\n */\r\nexport const generateProductImageUrl = (\r\n product: SimpleProduct | ProductSearchResult,\r\n apiSettings: ICommerceApiSettings\r\n): string | undefined => {\r\n return generateImageUrl(product.PrimaryImageUrl, apiSettings);\r\n};\r\n\r\n/**\r\n * Creates a CartLine object from the passed data.\r\n * @param product The product.\r\n * @param quantity The quantity.\r\n * @param catalogId The catalog.\r\n */\r\nexport const buildCartLine = (product: SimpleProduct, quantity?: number, catalogId?: number): CartLine => {\r\n return {\r\n CatalogId: catalogId || 0,\r\n Description: product.Description,\r\n\r\n // TODO: Investigate this value and what it represents\r\n EntryMethodTypeValue: 3,\r\n ItemId: product.ItemId,\r\n ProductId: product.RecordId,\r\n Quantity: quantity || 1,\r\n TrackingId: '',\r\n UnitOfMeasureSymbol: product.DefaultUnitOfMeasure\r\n };\r\n};\r\n\r\n/**\r\n * Creates a CommerceListLine (also know as WishlistLine) object from the passed data.\r\n * @param productId The RecordId of the Product to be added.\r\n * @param customerId The account number of the customer.\r\n * @param wishlistId The Id of the commerce list.\r\n */\r\nexport const buildWishlistLine = (productId: number, customerId: string, wishlistId: number): CommerceListLine => {\r\n return {\r\n CommerceListId: wishlistId,\r\n ProductId: productId,\r\n CustomerId: customerId\r\n };\r\n};\r\n\r\n/**\r\n * Utility function to prepare the product details criteria before getting full product:\r\n * @param inputData The Action Input data\r\n */\r\nexport const getProductDetailsCriteriaFromActionInput = (inputData: ICreateActionContext>): ProductDetailsCriteria => {\r\n if (inputData && inputData.config) {\r\n return {\r\n getPrice: !inputData.config.hidePrice,\r\n getRating: !inputData.config.hideRating\r\n };\r\n }\r\n return {\r\n getPrice: true,\r\n getRating: true\r\n };\r\n};\r\n\r\n/**\r\n * Transforms search text into the expected 'search terms' format, expected by refiner APIs.\r\n * @param searchText Free-form text used for searching for products or categories of products.\r\n */\r\nexport const ensureSearchTextIsFormedProperly = (searchText: string): string => {\r\n const prefix = searchText.startsWith('\\'') ? '' : '\\'';\r\n const suffix = searchText.endsWith('\\'') ? '' : '\\'';\r\n return `${prefix}${searchText}${suffix}`;\r\n};\r\n\r\nexport const ensureSafeSearchText = (searchText: string): string => {\r\n return searchText?.replace(/[^\\d\\sA-Za-z]+/g, '');\r\n};\r\n\r\nexport const buildCacheKey = (base: string, apiSettings: ICommerceApiSettings, locale?: string): string => {\r\n return `${base}-chanId:${apiSettings.channelId}-catId:${apiSettings.catalogId}${locale ? `-${locale}` : ''}`;\r\n};\r\n\r\nexport const buildCacheKeyWithUrlTokens = (base: string, requestContext: IRequestContext): string => {\r\n const urlTokens = requestContext.urlTokens;\r\n const defaultCacheKey = buildCacheKey(base, requestContext.apiSettings, requestContext.locale);\r\n return urlTokens ? `${defaultCacheKey}-${urlTokens.itemId}-${urlTokens.recordId}-${urlTokens.pageType}` : defaultCacheKey;\r\n};\r\n\r\n/**\r\n * Generates a key from set of arguments as inputs.\r\n *\r\n * @param args Argument list of pivots to generate key from.\r\n * @param handler Handler function for null/undefined values.\r\n */\r\n\r\ntype TKeyTypes = string | number | boolean | null | undefined;\r\ninterface IGenerateKeyOptions {\r\n separator?: string;\r\n handler?(input: null | undefined): string;\r\n}\r\nexport const generateKey = (args: TKeyTypes[], options?: IGenerateKeyOptions): string => {\r\n const { handler, separator }: IGenerateKeyOptions = { ...{ separator: '-', handler: undefined }, ...(options || {}) };\r\n return args\r\n .map(arg => {\r\n if (arg === null || arg === undefined) {\r\n if (handler) {\r\n return handler(arg);\r\n }\r\n }\r\n return arg;\r\n })\r\n .join(separator);\r\n};\r\n\r\n/**\r\n * Gets the fall back image url for a variant image.\r\n * @param itemId Item id of a product.\r\n * @param apiSettings Api setting from request context.\r\n */\r\nexport const getFallbackImageUrl = (itemId: string | undefined, apiSettings: ICommerceApiSettings): string | undefined => {\r\n if (!itemId) {\r\n return '';\r\n }\r\n\r\n const parsedItemId = itemId.trim().split(' ')[0];\r\n\r\n const productUrl = `Products/${parsedItemId}_000_001.png`;\r\n return generateImageUrl(productUrl, apiSettings);\r\n};\r\n\r\n/**\r\n * Converts retail proxy product dimension type to display dimension type.\r\n * @param productDimensionType - Product dimension type from retail proxy.\r\n * @returns Local dimension type.\r\n */\r\nexport const convertProductDimensionTypeToDimensionTypes = (productDimensionType: ProductDimensionType): DimensionTypes => {\r\n switch (productDimensionType) {\r\n case ProductDimensionType.Color:\r\n return DimensionTypes.color;\r\n case ProductDimensionType.Configuration:\r\n return DimensionTypes.configuration;\r\n case ProductDimensionType.Size:\r\n return DimensionTypes.size;\r\n case ProductDimensionType.Style:\r\n return DimensionTypes.style;\r\n default:\r\n return DimensionTypes.none;\r\n }\r\n};\r\n\r\n/**\r\n * Converts display dimension type to retail proxy product dimension type.\r\n * @param dimensionType - Local dimension type.\r\n * @returns Product dimension type from retail proxy.\r\n */\r\nexport const convertDimensionTypeToProductDimensionType = (dimensionType: DimensionTypes): ProductDimensionType => {\r\n switch (dimensionType) {\r\n case DimensionTypes.color:\r\n return ProductDimensionType.Color;\r\n case DimensionTypes.configuration:\r\n return ProductDimensionType.Configuration;\r\n case DimensionTypes.size:\r\n return ProductDimensionType.Size;\r\n case DimensionTypes.style:\r\n return ProductDimensionType.Style;\r\n default:\r\n return ProductDimensionType.None;\r\n }\r\n};\r\n\r\n/**\r\n * Sets dimensions to url.\r\n * @param inputUrl - Url to update.\r\n * @param productDimensions - Dimensions to set.\r\n */\r\nexport const setDimensionValuesToQuery = (inputUrl: URL, productDimensions: ProductDimension[]): void => {\r\n for (const dimension of productDimensions) {\r\n inputUrl.searchParams.set(\r\n convertProductDimensionTypeToDimensionTypes(dimension.DimensionTypeValue), dimension.DimensionValue?.Value ?? '');\r\n }\r\n\r\n window.history?.replaceState(window.history.state, '', inputUrl.toString()?.replace(inputUrl.host, window.location.host));\r\n};\r\n\r\n/**\r\n * Retrieves dimension value stored in url.\r\n * @param urlParameters - Url parameters.\r\n * @param productDimensionType - The dimension type to retrieve.\r\n * @returns Product dimension item.\r\n */\r\nconst parseDimensionFromUrl = (urlParameters: URLSearchParams, productDimensionType: ProductDimensionType): ProductDimension | undefined => {\r\n const localDimensionType = convertProductDimensionTypeToDimensionTypes(productDimensionType);\r\n const value = urlParameters.get(localDimensionType);\r\n if (!value) {\r\n return undefined;\r\n }\r\n return {\r\n DimensionTypeValue: productDimensionType,\r\n DimensionValue: {\r\n RecordId: 0,\r\n Value: value\r\n }\r\n };\r\n};\r\n\r\n/**\r\n * Retrieves all dimensions from URL.\r\n * @param urlParameters - Url parameters.\r\n * @returns Product dimensions stored in url.\r\n */\r\nconst parseDimensionsFromUrl = (urlParameters: URLSearchParams): ProductDimension[] => {\r\n const dimensionsToParse: ProductDimensionType[] = [\r\n ProductDimensionType.Color,\r\n ProductDimensionType.Configuration,\r\n ProductDimensionType.Size,\r\n ProductDimensionType.Style\r\n ];\r\n const parsedDimensions = dimensionsToParse.map(dimension => parseDimensionFromUrl(urlParameters, dimension));\r\n return ArrayExtensions.validValues(parsedDimensions);\r\n};\r\n\r\n/**\r\n * Utility function to extract the dimension values from input url querystring.\r\n * @param inputUrl - The request url.\r\n * @returns The selected dimension values.\r\n */\r\nexport const getDimensionValuesFromQuery = (inputUrl: URL): ProductDimension[] => {\r\n const urlWithIgnoredCase = new URL(inputUrl.toString().toLocaleLowerCase());\r\n const urlParameters = urlWithIgnoredCase.searchParams;\r\n const dimensions: ProductDimension[] = parseDimensionsFromUrl(urlParameters);\r\n return dimensions;\r\n};\r\n","import { ICoreContext } from '@msdyn365-commerce/core-internal/dist/types/interfaces';\r\nimport { getSetDateGroupedProducts, IMFRMDateGroupedProducts } from '../../../Utilities/cart-utils';\r\nimport { hasArray } from '../../../Utilities/emtpyChecker';\r\n\r\nexport const isOneOfTheCustomMessageStates = (context: ICoreContext, stateId?: string) => {\r\n const servicesFromConfigurations = context.request.app.config.deliveryServices;\r\n for (const sc of servicesFromConfigurations) {\r\n if ((sc.serviceName.includes('silver') || sc.serviceName.includes('Silver')) && sc.multipleMessagesBasedOnState && sc.multipleMessagesBasedOnState.length) {\r\n for (const stateObj of sc.multipleMessagesBasedOnState) {\r\n if (stateObj.state === stateId) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n};\r\n\r\nexport const getDeliveryMessageForProduct = (variantID: number) => {\r\n const dateBasedGroupedProducts: IMFRMDateGroupedProducts[] = getSetDateGroupedProducts('get');\r\n if(dateBasedGroupedProducts && hasArray(dateBasedGroupedProducts)) {\r\n for(const dateBasedProduct of dateBasedGroupedProducts) {\r\n if(hasArray(dateBasedProduct.productVariantRecordIds)) {\r\n if(dateBasedProduct.productVariantRecordIds?.includes(variantID)) {\r\n let dateStr = dateBasedProduct.dateStr;\r\n if(dateStr && dateStr.includes('Delivery by')) {\r\n const splitted = dateStr.split('Delivery by ');\r\n if(splitted?.length > 1) {\r\n dateStr = splitted[1];\r\n return dateStr;\r\n }\r\n }\r\n return dateStr;\r\n }\r\n }\r\n }\r\n }\r\n return '';\r\n};"],"names":["callFS","name","detailsObject","FS","global","hasOwnProperty","event","e","console","log","eventFullStoryAPISuccess","async","pathName","objToCall","status","eventFullStoryPriceMismatch","cartLines","tradeIds","PdpPriceArrays","idsArrays","cartPriceArrays","tradeLines","length","forEach","items","push","price","variantRecordId","checkCartPrice","find","lines","ProductId","Price","id","toString","pdp_price","cart_price","tradeAgreement","eventFullStoryFailAPI","error","statusCode","message","correlationId","data","CorrelationId","validationError","ValidationResults","ErrorContext","getSetLocalStorage","key","getSet","valueToSet","returnType","MsDyn365","localStorage","setItem","JSON","stringify","parse","getItem","getSetProductData","products","setCoreProductCookie","psp","typeOfProduct","toLowerCase","trim","MFRMProductTypes","setCookie","getSetProductSpec","getSetPromoCodeApplyList","getSetPromoCode","getSetGrandTotal","total","getSetBonusItemProd","globalBonusItems","getSetSelectedBonasItem","bonusItemArray","getSetBonusCouponDetail","getCoupons","getSetPrevBonasModalState","previousBonasModal","getSetBonusItemBrandName","bonusItemsBrandName","getSetDateGroupedProducts","getSetExpressFlow","express","getSetWmapCartLines","getSetCartProductPrice","priceDetails","getSetParcelInventoryData","details","_isAllSmallParcel","isAllParcel","productspecificationsDetails","core","dropShip","product","productType","validateZipCode","zipcode","test","_isExpressFlow","context","currentUrl","window","location","pathname","substring","applepayExpressUrl","app","config","expressApplePayCheckouturl","expressCheckouturl","_isAllNonCoreItems","_updateCartLinesWithWarehouseId","actionContext","checkoutCartState","dynamicInventoryData","selectedTimeSlot","dropShipDefaultWarehouseId","datePicker","_getUpdatedCart","cartState","currentCartLines","cart","CartLines","smallParcel","selectedAtpSlot","ATPSlots","atpSlot","startAndEndTimeOfSlot","StartTime","EndTime","coreProductWarehouseId","Location1","isSameWareHouseForCore","isSameWareHouseForParcel","updatedCartLines","map","cartLine","cartLineProductSpesifications","ItemId","VariantRecordId","smallParcelWarehouseId","InventLocationId","WarehouseId","cartOperationDoRetry","updateCartLineInternal","then","checkSmallParcelOutOfStock","zipCode","detailsProduct","date","Date","currentDate","setDate","getDate","tempProducts","item","parcelDetails","prod","outOfStockSmallParcel","Quantity","requestBody","InventoryType","DeliveryModes","StoreId","Weeks","weeksPDPforATPCall","RequestedDate","dayjs","format","ZipCode","ItemLines","NoOfPriorityDC","resultData","atpInventoryDoRetry","getInventoryQuantityInternal","parcelInventoryData","result","ATPInventoryStatusData","Location","href","origin","inventoryDetails","itemId","productId","quantity","_checkATPSlotsAvailable","props","itemLinesArray","Cookies","get","productSpecification","selectedSlotNotExist","isNotAvailable","itemLines","selectedATPDate","selectedATPSlotInfo","getHours","inventoryType","weeks","storeId","page","requestedDate","mfiInventoryInput","MfiAtpInventoryInput","mfiAtpInventoryAction","ATPInventoryDynamicData","singleDate","AvailableSlots","includes","telemetry","warning","debug","priceMismatchFSEvent","cartLinesData","getCartProductPriceArray","missingTradeIds","line","PriceLines","getDiffernce","filter","some","itemProduct","cartPrice","productPrice","Math","abs","_addDefaultDays","days","deliveryDate","newDate","deliveryDateFormatted","AttributeCreate","ecomName","value","source","Name","TextValue","Object","assign","ExtensionProperties","TextValueTranslations","getCheckoutAttributeByName","attributeValues","keyValue","currAttribute","getProductsCategoryPath","productDetailsData","resources","checkout","request","apiSettings","catalogId","revenueCategory","otherRevenueDetail","getProductIdArray","RecordId","productsCategories","getProductsCategoryPathsAction","GetCategoryPathsInput","revenueCategoryConfig","newProductDetails","checkCategory","getSegments","CategoryPath","stopProccess","path","Segments","itemName","checkExist","revenueItemName","CategoryName","categoryName","mattresses","adjustableBases","boxSprings","pillows","babyAndKids","getProuductDetailsHandler","attribute","brandList","outOfStockProductKey","leadTime","brandBackofficeAttributePdp","placeholderImageName","collection","productTypeInformation","attributeValue","getProduct","coreItemShippingType","brandName","parseBrandName","outOfStock","leadTimeVal","brandLeadTime","list","brandLeadtime","getBrandLeadTime","getDeliveryDateDetails","timeValue","daysSpan","split","deliveryByMessage","deliveryByMessageRange","currentYear","year","index","parseInt","numberOfDays","singleDays","flag","findDate","fullDate","formatDeliveryDate","generateDeliveryDate","brandAndProductName","productCollection","productTypeAttribute","variantType","dimensionValueCustom","Dimensions","DimensionValue","Value","getVariant","replace","imageFallBackUrl","urlFallBackImage","String","requestContext","imagePrimary","undefined","PrimaryImageUrl","MasterProductId","sharedValues","zipCodeError","quantityMessage","primaryImageUrl","fallbackImageUrl","DeliveryDate","RequestedDeliveryDate","productSepcification","ProducName","urlParam","results","RegExp","exec","getUsaEpayErrorDetails","errorCode","usaEpayErrorMessages","exclude","markAsDefault","_verifyDeliverService","servicesFromConfigurations","deliveryServices","_getDeliveryService","_addDeliveryMode","productAttributes","deliveryMessageManagementValues","generaCartLines","Promise","all","attributesList","elem","getMode","DeliveryMode","_getModOfDelivery","extractMonthAndDate","dateString","match","padStart","setAddress","addUpdateAddress","email","firstName","lastName","emailMeCheckbox","phone","address","apt","set","Email","FirstName","LastName","EmailMeCheckbox","Phone","Address","APT","_updateCheckoutTax","RecycleFeeAttribute","recycleFeeAttributeValue","extentionArray","fee","Key","DecimalValue","update","GetRecycleFeeCheckoutInput","recycleFee","Number","tax","TaxAmount","getServiceItemsAttributes","isWillCall","willCallDeliveryDate","InventLocation","AttributesArray","ecomDeliverySetDate","slice","dayjsEcomDateDelivery","deliveryDateError","case","deliveryDateErrorWillCall","ecomDeliveryDate","ecomDeliveryDatewillCall","ecomDSDeliveryScheduleStatus","ecomInventLocationId","getCoreProductAttributes","ecomDeliveryDateWillCall","getParcelProductAttributes","productDetails","deliveryMsg","daysParcel","defaultDaysParcel","getModDelivery","ecomDeliveryServiceMode","getDropShipProductAttributes","daysDropShip","ecomDSShippingMessage","getDeliveryMessageForProduct","isSafari","navigator","vendor","indexOf","handleExpressSkeletonCheck","CheckoutSkeletonInput","showPaymentSkeleton","showSkeleton","expressSkeleton","expressPhoneNotavailable","expressLoaderRunning","showDeliverySkeleton","showCustomerInfoSkeleton","hasCoreProduct","productSpecificationsCookieData","isExpressCheckout","url","checkoutURl","requestUrl","variantQueryStringName","callback","callbackResult","updateCart","newCartObject","Message","updateCartLineDeliverySpecificationsInternal","cartLineDeliverySpecifications","updateLineDeliverySpecificationsAsync","callerContext","Id","newCart","catch","errorDetails","LocalizedMessage","substatus","updateCartLinesAsync","addCartLineInternal","addCartLinesAsync","removeCartLinesInternal","cartLineIds","removeCartLinesAsync","Array","isArray","isCached","getATPInventoryStatusInput","GetATPInventoryStatusInput","getATPInventoryStatusAction","hasArray","values","imageUrl","getFallbackImageUrl","fallBackBrandAttribute","attributes","backendAttribute","recordId","productBrandName","getLocalStorage","checkBrandName","parseBrandNameUnbxd","getBrandNameCheck","mod","deliveryMod","shippingInformation","MOD","newDeliveryServiceArray","serviceProductRecId","childService","childItem","productRectId","_getDeliveryServiceNonAsync","_getDeliveryServiceWithName","serviceName","willCallMessage","willCallTitle","_getDeliveryServiceWithSKU","serviceItems","serviceSku","addKeyInPrice","serviceSKU","constructor","productIds","getCacheKey","this","constructedCacheKey","getCacheObjectType","dataCacheType","ChannelId","channelId","CatalogId","ids","join","createGetCategoryPathsInput","inputData","Error","input","ctx","catPaths","productsIter","getCategoryPathsAsync","queryResultSettings","Paging","Top","Sorting","err","getCategoryPathsActionDataAction","createObservableDataAction","action","Msdyn365","args","prototype","call","sort","mFIATPInventoryStatusAsync","cookies","getCookie","cookieName","cookieValue","options","removeCookie","remove","isPaymentApiFailed","Page","mFIATPInventoryDynamicAsync","getSelectedProductIdFromActionInput","variantId","queryBasedVariantSelection","getQueryParamsFromQueryByName","query","urlTokens","pageType","inputUrl","queryParamName","URL","toLocaleLowerCase","searchParams","isNaN","generateImageUrl","startsWith","baseImageUrl","encodeURIComponent","DimensionTypes","DimensionSwatchDisplayTypes","parsedItemId","convertProductDimensionTypeToDimensionTypes","productDimensionType","ProductDimensionType","color","configuration","size","style","none","parseDimensionsFromUrl","urlParameters","parsedDimensions","dimension","localDimensionType","DimensionTypeValue","parseDimensionFromUrl","ArrayExtensions","getDimensionValuesFromQuery","isOneOfTheCustomMessageStates","stateId","sc","multipleMessagesBasedOnState","stateObj","state","variantID","dateBasedGroupedProducts","dateBasedProduct","productVariantRecordIds","dateStr","splitted"],"sourceRoot":""}