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A,EAAA,GAC5B9W,OAAOmZ,aAAanB,aAAe,IACnCF,EAAQE,aAEY,MAAMoB,EAAiB,GAC9BA,EAAe,yGAA2G,CAClIb,EAAGA,IAAMC,EAAQ,MACjBa,GAAI,4DAEpBrZ,OAAOmZ,aAAenZ,OAAOmZ,cAAgB,GAC7CnZ,OAAOmZ,aAAaC,eAActC,EAAAA,EAAA,GACP9W,OAAOmZ,aAAaC,gBAAkB,IACtCA,UCjG3BE,EAAOC,QAAUpW,cCAjBmW,EAAOC,QAAUC","sources":["webpack://mattressfirm/./src/Utilities/allRegex.ts?9889","webpack://mattressfirm/./src/Utilities/cart-utils.ts?6ba1","webpack://mattressfirm/./src/Utilities/constants.ts?8bdf","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-page-path.ts?590a","webpack://mattressfirm/./src/Utilities/get-product-badge.tsx?635b","webpack://mattressfirm/./src/Utilities/get-utag-product-category.ts?a69d","webpack://mattressfirm/./src/Utilities/get-utag-variant-id.ts?ea12","webpack://mattressfirm/./src/Utilities/get-view-port.tsx?4210","webpack://mattressfirm/./src/actions/get-unbxd-product-recommendations.action.ts?bae6","webpack://mattressfirm/./src/common/cookies/cookie-utils.ts?68f7","webpack://mattressfirm/./src/data-actions/buybox-get-all-variants-list.ts?6ad4","webpack://mattressfirm/./src/data-actions/get-sales-order-details-action.action.ts?5a8b","webpack://mattressfirm/./src/data-actions/utilities/utils.ts?7452","webpack://mattressfirm/./src/modules/mfrm-product-recommendation-carousel/components/unbxd-product-carousel-item.tsx?e1f8","webpack://mattressfirm/./src/modules/mfrm-product-recommendation-carousel/mfrm-product-recommendation-carousel.tsx?9766","webpack://mattressfirm/./src/Utilities/create-utag-queue.ts?1545","webpack://mattressfirm/./src/Utilities/ascendBy.ts?bcc1","webpack://mattressfirm/./src/Utilities/clear-array.ts?ce54","webpack://mattressfirm/./src/modules/mfrm-product-recommendation-carousel/mfrm-product-recommendation-carousel.view.tsx?e0c8","webpack://mattressfirm/./lib/mfrm-product-recommendation-carousel/module-registration.js?c63d","webpack://mattressfirm/external var \"React\"?0d3b","webpack://mattressfirm/external var \"ReactDOM\"?853b"],"sourcesContent":["import { ICoreContext } from '@msdyn365-commerce/core';\r\nexport const emailRegex = (emailValue: string) => {\r\n // eslint-disable-next-line security/detect-unsafe-regex\r\n const validationEmail = /^[-a-z0-9!#$%&'*+/=?^_`{|}~]+(?:\\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*@(?:[a-z0-9]+(?:-+[a-z0-9]+)*\\.)+(?:xn--[a-z0-9]+|[a-z]{2,16})$/i;\r\n\r\n return validationEmail.test(emailValue);\r\n};\r\n\r\n/**\r\n * Method to remove special characters for product name from product URL\r\n * @param str string\r\n * @param ctx ICoreContext\r\n * @returns string\r\n */\r\n\r\nexport const removeSpecialChars = (str: string, ctx: ICoreContext): string => {\r\n if (ctx && ctx.request.app?.config.removeSpecialCharsPDP) {\r\n return str?.replace(/[^a-zA-Z0-9- ]/g, '');\r\n }\r\n return str;\r\n};\r\n\r\n\r\n/**\r\n * Method to remove special characters for product URL's path\r\n * @param str string\r\n * @param ctx ICoreContext\r\n * @returns string\r\n */\r\n\r\nexport const removeSpecialCharsFromURLPath = (str: string, ctx: ICoreContext): string => {\r\n if (ctx && ctx.request.app?.config.removeSpecialCharsPDP) {\r\n const urlPath = decodeURIComponent(str.split('.p')[0])?.replace(/[^a-zA-Z0-9-/ ]/g, '');\r\n return `${urlPath}.p`;\r\n }\r\n return str;\r\n};\r\n\r\n// Following phone format is used on customer info section at checkout page\r\nexport const customerInfoPhoneRegex = /^\\(?([2-9][0-8][0-9])\\)?[ . ]?([2-9][0-9]{2})[\\-\\. ]?([0-9]{4})(\\s*x[0-9]+)?$/; // Valid USA number in format (xxx) xxx-xxxx\r\n\r\n/*\r\nThis regex object has 2 patterns:\r\n'nameRegex' matches names with letters, spaces, apostrophes, periods, and dashes.\r\n'addressInputRegex' matches alphanumeric characters and printable ASCII symbols.\r\n*/\r\nexport const inputRegexObj = {\r\n nameRegex: /^[\\p{L}\\s.'-]+$/u,\r\n addressInputRegex: /^[a-zA-Z0-9\\x20-\\x7E]*$/,\r\n phoneNumerRegex: customerInfoPhoneRegex\r\n};\r\n\r\n// This regex allows us to effectively validate and extract delivery messages\r\nexport const cartDeliveryMsgRegex = /[A-Za-z]{3} \\d{1,2}(?: - [A-Za-z]{3} \\d{1,2})?/;","import MsDyn365, { IActionContext } 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, CartLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { setCookie } from '../common/cookies/cookie-utils';\r\nimport { LocalStorageKeys, MFRMProductTypes } from './enum';\r\nimport { getByIdAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { IMfrmAddress } from '../modules/mfrm-checkout-shipping-address';\r\nimport { ICoreProductsCartData } from '../themes/mattressfirm/views/checkout.view';\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\nexport interface ICartIconData {\r\n iconUrl?: string;\r\n altText?: string;\r\n ariaLabel?: string;\r\n}\r\nexport interface IEyeBrowIcon {\r\n iconName?: string;\r\n iconURL?: string;\r\n}\r\n\r\nconst getSetLocalStorage = (key: string, getSet: string, valueToSet?: any, returnType?: any) => {\r\n // The type of the value to return (must be added).\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 const storedValue = localStorage.getItem(key);\r\n try {\r\n return storedValue ? JSON.parse(storedValue) : (returnType ?? \"\");\r\n } catch {\r\n // JSON.parse will throw an error If it's stored as string; return string value in that case\r\n return storedValue;\r\n }\r\n case 'remove':\r\n return localStorage.removeItem(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 getSetSelectedBonusItem = (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\n\r\nexport const getSetParcelInventoryData = (getSet: string, details?: IParcelInventoryDetails[]) => {\r\n return getSetLocalStorage('parcel_inventory_details', getSet, details, []);\r\n};\r\n\r\nexport const getSetDropshipLatestDeliveryMsg = (getSet: string, msg?: string) => {\r\n return getSetLocalStorage(LocalStorageKeys.DropshipLatestDeliveryMsg, getSet, msg, '');\r\n};\r\n\r\nexport const getSetParcelLatestDeliveryMsg = (getSet: string, msg?: string) => {\r\n return getSetLocalStorage(LocalStorageKeys.ParcelLatestDeliveryMsg, getSet, msg, '');\r\n};\r\n\r\nexport const getSetCustomerPhone = (getSet: string, phone?: string) => {\r\n return getSetLocalStorage(LocalStorageKeys.CustomerPhone, getSet, phone, '');\r\n};\r\n\r\nexport const getSetSelectedDeliveryService = (getSet: string, phone?: string) => {\r\n return getSetLocalStorage(LocalStorageKeys.SelectedDeliveryService, getSet, phone, '');\r\n};\r\n\r\nexport const getSetCustomerBillingSameDelivery = (getSet: string, isSame?: string) => {\r\n return getSetLocalStorage(LocalStorageKeys.CustomerBillingSameDelivery, getSet, isSame, '');\r\n};\r\n\r\nexport const getSetRecycleFee = (getSet: string, fee?: string) => {\r\n return getSetLocalStorage(LocalStorageKeys.RecycleFee, getSet, fee, '');\r\n};\r\n\r\nexport const getSetSelectedDeliverySlot = (getSet: string, slot?: string) => {\r\n return getSetLocalStorage('selected_delivery_slot ', getSet, slot, '');\r\n};\r\n\r\nexport const getSetSelectedDeliveryDate = (getSet: string, date?: Date) => {\r\n return getSetLocalStorage('selected_delivery_date', getSet, date, '');\r\n};\r\nexport const getSetCoreProductDeliveryMsg = (getSet: string, msg?: string) => {\r\n return getSetLocalStorage('coreprod_deliverymsg', getSet, msg, '');\r\n};\r\n\r\nexport const getSetDefaultDeliverySelected = (getSet: string, selected?: boolean) => {\r\n return getSetLocalStorage('default_delivery_selected', getSet, selected, '');\r\n};\r\n\r\nexport const getSetTimeSlot = (getSet: string, selected?: string) => {\r\n return getSetLocalStorage('time_slot', getSet, selected, '');\r\n};\r\n\r\nexport const getSetDaySlot = (getSet: string, selected?: string) => {\r\n return getSetLocalStorage('day_slot', getSet, selected, '');\r\n};\r\n\r\nexport const getSetServiceName = (getSet: string, selected?: string) => {\r\n return getSetLocalStorage('service_name', getSet, selected, '');\r\n};\r\n\r\nexport const getSetSelectedServicePrice = (getSet: string, selected?: number) => {\r\n return getSetLocalStorage('selected_service_price', getSet, selected, 0);\r\n};\r\n\r\nexport const getSetCoreShippingMsg = (getSet: string, selected?: string) => {\r\n return getSetLocalStorage('core_shipping_msg', getSet, selected, '');\r\n};\r\n\r\nexport const getSetEcomMonthlyAmount = (getSet: string, selected?: number) => {\r\n return getSetLocalStorage('ecom_monthly_amount', getSet, selected, '');\r\n};\r\n\r\nexport const getSetExpressType = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('express-type', getSet, value, ''); /* Selected express payment method name; Also used in sales header attributes */\r\n};\r\n\r\nexport const getSetApplepayCheckoutError = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('applepay-checkout-error', getSet, value, ''); /* It indicates that retrieveCardPayment/checkout API for applepay is failed on the Cart/Checkout page, It displays error above the shipping address */\r\n};\r\n\r\nexport const getSetApplepayError = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('applepay-error', getSet, value, ''); /* It indicates that retrieveCardPayment API for applepay is failed on the Cart page, It displays error above the shipping address */\r\n};\r\n\r\nexport const getSetApplepayIFrameError = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('applepay-iframe-error', getSet, value, ''); /* It indicates that applepay iframe has an error and if its true; applepay button will not be shown and also stop showing loader for applepay */\r\n};\r\n\r\nexport const getSetGetCardApplepayPass = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('getcardapplepay-pass', getSet, value, ''); /* It indicates that getCardPaymentAcceptPoint() API gives success for applepay; If it's true, 'applepay-iframe-error' will be checked after that */\r\n};\r\n\r\nexport const getSetGetCardApplepayFail = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('getcardapplepay-fail', getSet, value, ''); /* It indicates that getCardPaymentAcceptPoint() API is failed for applepay; If it's true => 1. 'applepay-iframe-error' will be checked after that; 2. it'll display error on the respective page cart/checkout */\r\n};\r\n\r\nexport const getSetLoadExpress = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('loadExpress', getSet, value, ''); /* Avoid display loader on checkout page in case of express checkout */\r\n};\r\n\r\nexport const getSetPaypalCheckoutError = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('paypal-checkout-error', getSet, value, ''); /* It indicates that retrieveCardPayment/checkout API for paypal is failed on the Cart/Checkout page, It displays error above the shipping address */\r\n};\r\n\r\nexport const getSetPaypalError = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('paypal-error', getSet, value, ''); /* It indicates that retrieveCardPayment API for paypal is failed on the Cart page, It displays error above the shipping address */\r\n};\r\n\r\nexport const getSetPaypalIFrameError = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('paypal-iframe-error', getSet, value, ''); /* It indicates that paypal iframe has an error and if its true; paypal button will not be shown and also stop showing loader for paypal */\r\n};\r\n\r\nexport const getSetGetCardExpressPass = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('getcardexpress-pass', getSet, value, ''); /* It indicates that getCardPaymentAcceptPoint() API gives success for paypal; If it's true, 'paypal-iframe-error' will be checked after that */\r\n};\r\n\r\nexport const getSetGetCardExpressFail = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('getcardexpress-fail', getSet, value, ''); /* It indicates that getCardPaymentAcceptPoint() API is failed for paypal; If it's true => 1. 'paypal-iframe-error' will be checked after that; 2. it'll display error on the respective page cart/checkout */\r\n};\r\n\r\nexport const getSetExpressAddress = (getSet: string, value?: IMfrmAddress) => {\r\n return getSetLocalStorage('express-address', getSet, value, []); /* Address from express address is saved. If user updates it by clicking on edit customer info, updated address will be saved in it. But if user re-authenticate, it will reset the old address and will save the new one */\r\n};\r\n\r\nexport const getSetExpressPageLoad = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('express_page_load', getSet, value, ''); /* It checks if express checkout page is reloaded */\r\n};\r\n\r\nexport const getSetThankyou = (getSet: string, value?: any) => {\r\n return getSetLocalStorage('thankyou_payment_details', getSet, value, '');\r\n};\r\n\r\nexport const getSetEcomFinanceOption = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('Ecom_FinanceOption', getSet, value, '');\r\n};\r\n\r\nexport const getSetEcomFinancePlanId = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('Ecom_FinancePlanId', getSet, value, '');\r\n};\r\n\r\nexport const getSetCoreProdMsg = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('payment_review_latest_core_prod_msg', getSet, value, '');\r\n};\r\n\r\nexport const getSetBillingAddress = (getSet: string, value?: any) => {\r\n return getSetLocalStorage('billing_address', getSet, value, {});\r\n};\r\n\r\nexport const getSetPaymentLoader = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('paymentloader', getSet, value, '');\r\n};\r\n\r\nexport const getSetLastPaymentConnector = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('lastPaymentConnector', getSet, value, '');\r\n};\r\n\r\nexport const getSetPaymentRadioName = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('payment_radio_name', getSet, value, '');\r\n};\r\n\r\nexport const getSetPaymentRadioIndex = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('payment_radio_index', getSet, value, '');\r\n};\r\n\r\nexport const getSetSelectedPaymentRadio = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('selectedPaymentRadio', getSet, value, '');\r\n};\r\n\r\nexport const getSetPaymentInfoForOCPage = (getSet: string, value?: any) => {\r\n return getSetLocalStorage('temp_card_payment_info_for_order_confirmation', getSet, value, '');\r\n};\r\n\r\nexport const getSetCurrentStep = (getSet: string, value?: number) => {\r\n return getSetLocalStorage('current_step', getSet, value, 0);\r\n};\r\n\r\nexport const getSetCheckoutCurrentStep = (getSet: string, value?: number) => {\r\n return getSetLocalStorage('checkout_current_step', getSet, value, 0);\r\n};\r\n\r\nexport const getSetCartCoreProductInfo = (getSet: string, value?: ICoreProductsCartData[]) => {\r\n return getSetLocalStorage('cart_core_prods_info', getSet, value, []);\r\n};\r\n\r\nexport const getSetUpdatedEmail = (getSet: string, value?: string) => {\r\n return getSetLocalStorage('updated_email ', getSet, value, '');\r\n};\r\n\r\nexport const getSetSelectedDeliverySlotZone = (getSet: string, zone?: string) => {\r\n return getSetLocalStorage('selected_delivery_slot_zone ', getSet, zone, '');\r\n};\r\n\r\nconst processCartLine = async (cartLine: CartLine, actionContext: IActionContext, channelId: number) => {\r\n try {\r\n const productResponse = await getByIdAsync(\r\n {callerContext: actionContext, queryResultSettings: {Paging: {Top: 1}}},\r\n cartLine.ProductId || 0,\r\n channelId\r\n );\r\n\r\n if (productResponse?.DefaultUnitOfMeasure) {\r\n // Adding unit of measure for order confirmation emails to get Ecom_variantId attribute\r\n cartLine.UnitOfMeasureSymbol = productResponse.DefaultUnitOfMeasure;\r\n return cartLine;\r\n } else {\r\n // Handle the case where DefaultUnitOfMeasure is not available\r\n return cartLine;\r\n }\r\n } catch (error) {\r\n // Handle errors if getByIdAsync fails for a specific productId\r\n console.error(`Error processing ProductId ${cartLine.ProductId}: ${error.message}`);\r\n return cartLine;\r\n }\r\n};\r\n\r\nexport const addUnitOfMeasureInAddCartLine = async (cartLines: CartLine[], actionContext: IActionContext, channelId: number) => {\r\n const promises = cartLines\r\n .filter((cartLine: any) => !cartLine.DefaultUnitOfMeasure)\r\n .map((cartLine: any) => processCartLine(cartLine, actionContext, channelId));\r\n\r\n try {\r\n return await Promise.all(promises);\r\n } catch (error) {\r\n // Handle errors if any of the promises fail\r\n console.error(`Error processing cartLines: ${error}`);\r\n return cartLines;\r\n }\r\n};","export const variantQueryStringName = 'variantid';","// 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// Enum for Delivery Date details messages show on cart page.\r\nexport enum DeliveryDateDetails {\r\n DeliveryToday = 'Delivery by Today',\r\n DeliveryTomorrow = 'Delivery by Tomorrow',\r\n DeliveryBy = 'Delivery by',\r\n AvailableYes = 'yes'\r\n}\r\n\r\n// coreItemShippingType constant value is used to compare the shipping type of core products\r\nexport const coreItemShippingType = 'delivery';\r\n\r\nexport enum EyeBrowMessage {\r\n BestSeller = \"Best Seller\",\r\n SleepExpertPick = \"Sleep Expert® Pick\",\r\n OnlyAtMattressFirm = \"Only at Mattress Firm\",\r\n SleepScoreValidated = \"Sleep score validated\",\r\n PLPRibbon = \"Best Seller\",\r\n}\r\n\r\nexport enum EyeBrowAttributeName {\r\n BestSeller = 'BestSeller',\r\n SE_Pick = 'SE_Pick',\r\n IsExclusive = 'IsExclusive',\r\n SleepScore = 'SleepScore',\r\n PLP_Ribbon = 'PLP_Ribbon',\r\n}\r\n// this text is sent to rating component on cart page (as it is used on cart page so sending cart module name)\r\nexport const cartModuleName = 'mfrm-cart';\r\n\r\n// Define an enum for local storage keys\r\nexport enum LocalStorageKeys {\r\n DropshipLatestDeliveryMsg = 'payment_review_dropship_latest_del_msg',\r\n ParcelLatestDeliveryMsg = 'payment_review_parcel_latest_del_msg',\r\n CustomerPhone = 'customer_phone',\r\n SelectedDeliveryService = 'selected_delivery_service',\r\n CustomerBillingSameDelivery = 'is_customer_billing_same_as_delivery',\r\n RecycleFee = 'recycleFee'\r\n}\r\n// this text is using for progressive value\r\nexport const progressiveName = 'Progressive';","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 MsDyn365 from '@msdyn365-commerce/core';\r\n\r\nexport const getPagePath = (): string => {\r\n return MsDyn365.isBrowser\r\n ? window.location.href.split(location.host)[1].includes('?')\r\n ? window.location.href.split(location.host)[1].split('?')[0]\r\n : window.location.href.split(location.host)[1]\r\n : '';\r\n};","import { IImageSettings, Image, IRequestContext } from '@msdyn365-commerce/core';\r\nimport dayjs from 'dayjs';\r\nimport tz from 'dayjs/plugin/timezone';\r\nimport utc from 'dayjs/plugin/utc';\r\nimport isBetween from 'dayjs/plugin/isBetween';\r\ndayjs.extend(tz);\r\ndayjs.extend(utc);\r\ndayjs.extend(isBetween);\r\nimport React from 'react';\r\nimport { AttributeValue } from '@msdyn365-commerce/retail-proxy';\r\nconst format = 'M/D/YYYY H:m:s';\r\n\r\nexport interface IBadgeData {\r\n src: string;\r\n alt: string;\r\n start: dayjs.Dayjs;\r\n end: dayjs.Dayjs;\r\n}\r\n\r\nconst defaultImageSettings: IImageSettings = {\r\n viewports: {\r\n xs: { q: `m=6`, w: 0, h: 0 }\r\n },\r\n disableLazyLoad: true\r\n};\r\n\r\nexport const parseBadgeData = (badgeData: string, requestContext: IRequestContext): IBadgeData | undefined => {\r\n let dataSegments;\r\n let scheduleStart;\r\n let scheduleEnd;\r\n let badgeType;\r\n let parsedScheduleStart;\r\n let startDate;\r\n let startTime;\r\n let parsedScheduleEnd;\r\n let endDate;\r\n let endTime;\r\n\r\n try {\r\n // split the data into its segments\r\n dataSegments = badgeData.split('#');\r\n scheduleStart = dataSegments[0];\r\n scheduleEnd = dataSegments[1];\r\n badgeType = dataSegments[2];\r\n\r\n // parse schedule start\r\n parsedScheduleStart = scheduleStart.split('_');\r\n startDate = parsedScheduleStart[0];\r\n startTime = parsedScheduleStart[1];\r\n\r\n // parse schedule end\r\n parsedScheduleEnd = scheduleEnd.split('_');\r\n endDate = parsedScheduleEnd[0];\r\n endTime = parsedScheduleEnd[1];\r\n } catch (e) {\r\n return;\r\n }\r\n\r\n const startMoment = `${startDate} ${startTime?.replace(/-/g, \":\")}`;\r\n const endMoment = `${endDate} ${endTime?.replace(/-/g, \":\")}`;\r\n\r\n const startMomentFormatted = dayjs(startMoment?.replace(/-/g, \"/\"));\r\n const endMomentFormatted = dayjs(endMoment?.replace(/-/g, \"/\"));\r\n\r\n // check if schedule is valid\r\n if (!(startMomentFormatted.isValid() && endMomentFormatted.isValid())) {\r\n return;\r\n }\r\n\r\n // parse badge type and create image src\r\n const baseUrl = requestContext.apiSettings.baseImageUrl.substring(0, requestContext.apiSettings.baseImageUrl.length - 1);\r\n if (badgeType) {\r\n const removed$ = badgeType.substring(1, badgeType.length - 1);\r\n const parsedBadgeType = removed$?.replace(' ', '-').toLowerCase();\r\n\r\n // remove page name portion\r\n const altText = removed$.split('-')[0];\r\n\r\n const src = `${baseUrl}${parsedBadgeType}.png`;\r\n return {\r\n src: src,\r\n alt: altText,\r\n start: convertTimeZone(startMomentFormatted),\r\n end: convertTimeZone(endMomentFormatted)\r\n };\r\n } else {\r\n return;\r\n }\r\n};\r\n\r\n// convert given time to Central Time (CT)\r\nconst convertTimeZone = (time: dayjs.Dayjs): dayjs.Dayjs => {\r\n return dayjs(time.format(format), format).tz('America/Chicago').local();\r\n};\r\n\r\nexport const buildProductBadge = (parsedBadgeData: IBadgeData, requestContext: IRequestContext): JSX.Element | undefined => {\r\n // only build image if it is scheduled\r\n const isScheduled = dayjs().isBetween(parsedBadgeData.start, parsedBadgeData.end);\r\n\r\n if (isScheduled) {\r\n return (\r\n \r\n );\r\n }\r\n\r\n return undefined;\r\n};\r\n\r\nexport const renderProductBadge = (\r\n attributeName: string | undefined,\r\n requestContext: IRequestContext\r\n): JSX.Element | undefined => {\r\n const badgeData = attributeName;\r\n if (!badgeData) {\r\n return;\r\n }\r\n // split badge data into its separate badges\r\n const badges = badgeData.split(',');\r\n // parse badge data to get its schedule and image src\r\n const parsedBadges = badges.map(badge => parseBadgeData(badge, requestContext));\r\n\r\n // build product badge image components\r\n const finalizedBadges = parsedBadges.map(parsedBadge => parsedBadge && buildProductBadge(parsedBadge, requestContext));\r\n\r\n return finalizedBadges ? <>{finalizedBadges} : <>;\r\n};\r\n\r\nexport const renderProductBadgeByFilteringAttributes = (\r\n attributeName: string | undefined,\r\n attributes: AttributeValue[] | undefined,\r\n requestContext: IRequestContext\r\n): JSX.Element | undefined => {\r\n const badgeData =\r\n attributeName &&\r\n attributes?.find(\r\n currAttribute => currAttribute.Name && currAttribute.Name.toLowerCase().trim() === attributeName.toLowerCase().trim()\r\n )?.TextValue;\r\n if (!badgeData) {\r\n return;\r\n }\r\n\r\n // split badge data into its separate badges\r\n const badges = badgeData.split(',');\r\n\r\n // parse badge data to get its schedule and image src\r\n const parsedBadges = badges.map(badge => parseBadgeData(badge, requestContext));\r\n // build product badge image components\r\n const finalizedBadges = parsedBadges.map(parsedBadge => parsedBadge && buildProductBadge(parsedBadge, requestContext));\r\n\r\n return finalizedBadges && <>{finalizedBadges};\r\n};\r\n","import { getCategoryPathsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { IActionContext } from '@msdyn365-commerce/core-internal';\r\nexport const getUtagProductCategory = async (actionContext: IActionContext, channelId: number, catalogId: number = 0, RecordId: number) => {\r\n //context, channelId, catalogId, categoryPathLookups\r\n const categoryPathResults = await getCategoryPathsAsync(\r\n { callerContext: actionContext, queryResultSettings: {} },\r\n channelId,\r\n catalogId,\r\n [{ ProductId: RecordId }]\r\n );\r\n const categoryPath = categoryPathResults[0]?.CategoryPath?.[0] && categoryPathResults[0].CategoryPath[0];\r\n if (!categoryPath?.Segments?.length) {\r\n return [];\r\n }\r\n return [categoryPath.Segments[categoryPath.Segments.length - 1].CategoryName!];\r\n};\r\n","import { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport getAllProductVariants, { BuyboxGetDimensionVariantAvailabilityInput } from '../data-actions/buybox-get-all-variants-list';\r\nimport { IActionContext } from '@msdyn365-commerce/core-internal';\r\n\r\nexport const getUtagVariantId = async (\r\n MasterProductId: number,\r\n channelId: number,\r\n actionContext: IActionContext,\r\n RecordId: number,\r\n ItemId: string\r\n) => {\r\n if (MasterProductId && MasterProductId > 0) {\r\n const input = new BuyboxGetDimensionVariantAvailabilityInput(MasterProductId, channelId);\r\n const variantsResp: SimpleProduct[] = await getAllProductVariants(input, actionContext);\r\n for (let variantIter = 0; variantIter < variantsResp.length; variantIter++) {\r\n if (variantsResp[variantIter].RecordId === RecordId) {\r\n const ePropsVariant = variantsResp[variantIter].ExtensionProperties!;\r\n if (ePropsVariant?.length > 0) {\r\n for (let eIter = 0; eIter < ePropsVariant?.length; eIter++) {\r\n if (ePropsVariant[eIter].Key === 'RetailVariantId') {\r\n return [ePropsVariant[eIter].Value?.StringValue];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n const variantofId = `V000${ItemId}`;\r\n return [variantofId?.slice(0, -1)];\r\n};\r\n\r\nexport const getUtagRetailVariantIdAndRecId = async (\r\n MasterProductId: number,\r\n channelId: number,\r\n actionContext: IActionContext,\r\n RecordId: number,\r\n ItemId: string\r\n) => {\r\n if (MasterProductId && MasterProductId > 0) {\r\n const input = new BuyboxGetDimensionVariantAvailabilityInput(MasterProductId, channelId);\r\n const variantsResp: SimpleProduct[] = await getAllProductVariants(input, actionContext);\r\n for (let variantIter = 0; variantIter < variantsResp.length; variantIter++) {\r\n if (variantsResp[variantIter].RecordId === RecordId) {\r\n const ePropsVariant = variantsResp[variantIter].ExtensionProperties!;\r\n if (ePropsVariant?.length > 0) {\r\n for (let eIter = 0; eIter < ePropsVariant?.length; eIter++) {\r\n if (ePropsVariant[eIter].Key === 'RetailVariantId') {\r\n return { 'retailVariantId': ePropsVariant[eIter].Value?.StringValue, 'recordId': RecordId };\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n const variantofId = `V000${ItemId}`;\r\n return { 'retailVariantId': variantofId?.slice(0, -1), 'recordId': RecordId };\r\n};\r\n","import MsDyn365, { ICoreContext } from '@msdyn365-commerce/core';\r\nexport type GridSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\r\n\r\nconst _getViewPort = (context: ICoreContext): GridSize => {\r\n if (MsDyn365.isBrowser && window.innerWidth) {\r\n const gridSettings = context.request.gridSettings;\r\n if (gridSettings) {\r\n if (gridSettings.xs && window.innerWidth <= gridSettings.xs.w) {\r\n return 'xs';\r\n } else if (gridSettings.sm && window.innerWidth <= gridSettings.sm.w) {\r\n return 'sm';\r\n } else if (gridSettings.md && window.innerWidth <= gridSettings.md.w) {\r\n return 'md';\r\n } else if (gridSettings.lg && window.innerWidth <= gridSettings.lg.w) {\r\n return 'lg';\r\n } else {\r\n return 'xl';\r\n }\r\n }\r\n }\r\n return 'xs';\r\n};\r\n\r\nexport default _getViewPort;\r\n","/*!\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 Cookies from 'universal-cookie';\r\n\r\nexport interface ICategoryLevelNamesData {\r\n categoryLevelName?: string;\r\n}\r\nexport class GetUnbxdRecommendationsDataInput implements Msdyn365.IActionInput {\r\n public pageType?: string | undefined;\r\n public widgetNumber?: string | undefined;\r\n public productID?: string | undefined;\r\n public catLevels?: ICategoryLevelNamesData[] | undefined;\r\n public cartItemIDs?: (string | undefined)[] | undefined;\r\n private currentCategories: string;\r\n\r\n constructor(pageType?: string | undefined, widgetNumber?: string | undefined, productID?: string | undefined, catLevels?: ICategoryLevelNamesData[] | undefined, cartItemIDs?: (string | undefined)[] | undefined) {\r\n this.pageType = pageType;\r\n this.widgetNumber = widgetNumber;\r\n this.productID = productID;\r\n this.catLevels = catLevels;\r\n this.cartItemIDs = cartItemIDs;\r\n this.currentCategories = '';\r\n catLevels?.forEach(catLevel => {\r\n this.currentCategories = catLevel?.categoryLevelName ? this.currentCategories.concat(`${catLevel?.categoryLevelName}-`) : this.currentCategories;\r\n });\r\n }\r\n\r\n public getCacheKey = () => `Unbxd-recommendation-data-${this.pageType}-${this.widgetNumber}-${this.currentCategories}`;\r\n public getCacheObjectType = () => 'Unbxd-recommendation-data';\r\n public dataCacheType = (): Msdyn365.CacheType => 'request';\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 getUnbxdRecommendationData(input: GetUnbxdRecommendationsDataInput, ctx: Msdyn365.IActionContext): Promise {\r\n const cookies = new Cookies();\r\n const unbxdUid = cookies.get('unbxd.userId');\r\n const pageType = input?.pageType ? input.pageType.toUpperCase() : \"\";\r\n const productID = input?.productID ? input.productID : \"\";\r\n const catLevels = input?.catLevels ? input.catLevels : [];\r\n const cartItemIDs = input?.cartItemIDs ? input.cartItemIDs : [];\r\n const unbxdApiKey = ctx.requestContext.app.config.unbxdApiKey;\r\n const unbxdSiteKey = ctx.requestContext.app.config.unbxdSiteKey;\r\n\r\n if (!pageType) {\r\n return null;\r\n }\r\n try {\r\n let unbxdUrl = \"\";\r\n switch (pageType) {\r\n case \"HOME\":\r\n unbxdUrl = `https://recommendations.unbxd.io/v2.0/${unbxdApiKey}/${unbxdSiteKey}/items?pageType=${pageType}&uid=${unbxdUid}`;\r\n break;\r\n case \"CATEGORY\":\r\n const catnames = catLevels.map((catName, index) => {\r\n return `&catlevel${index + 1}Name=${catName ? catName.categoryLevelName : ''}`;\r\n }).join('');\r\n\r\n unbxdUrl = `https://recommendations.unbxd.io/v2.0/${unbxdApiKey}/${unbxdSiteKey}/items?pageType=${pageType}${catnames}&uid=${unbxdUid}`;\r\n break;\r\n case \"PRODUCT\":\r\n unbxdUrl = `https://recommendations.unbxd.io/v2.0/${unbxdApiKey}/${unbxdSiteKey}/items?pageType=${pageType}&id=${productID}&uid=${unbxdUid}`;\r\n break;\r\n case \"CART\":\r\n const productitemIds = cartItemIDs.map((itemId) => {\r\n return `&id=${itemId}`;\r\n }).join('');\r\n\r\n unbxdUrl = `https://recommendations.unbxd.io/v2.0/${unbxdApiKey}/${unbxdSiteKey}/items?pageType=${pageType}${productitemIds}&uid=${unbxdUid}`;\r\n break;\r\n default:\r\n unbxdUrl = '';\r\n }\r\n const response = await Msdyn365.sendRequest(unbxdUrl, 'get');\r\n if (response.data && response.headers) {\r\n const recsData={\r\n \"unbxdRequestId\":response.headers[\"x-request-id\"]? response.headers[\"x-request-id\"]:'',\r\n \"unbxdRecs\":response.data[input.widgetNumber!.toLowerCase()]\r\n };\r\n return recsData;\r\n }\r\n else { return null; }\r\n } catch (e) {\r\n return null;\r\n }\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >getUnbxdRecommendationData,\r\n id: 'getUnbxdRecommendationData'\r\n});\r\n","import Cookies from 'universal-cookie';\r\n\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}","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICreateActionContext,\r\n IGeneric\r\n} from '@msdyn365-commerce/core';\r\nimport { getByIdAsync, getVariantsByDimensionValuesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n\r\n// tslint:disable-next-line: completed-docs\r\nexport class BuyboxGetDimensionVariantAvailabilityInput implements IActionInput {\r\n public channelId: number;\r\n public productId: number;\r\n constructor(productId: number, channelId: number) {\r\n this.channelId = channelId;\r\n this.productId = productId;\r\n }\r\n public getCacheKey = () => `AllMFRMProductVariantIDs-${this.productId}`;\r\n public getCacheObjectType = () => 'AllMFRMProductVariantIDs';\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\nexport interface IBuyboxGetDimensionVariantAvailabilityActionData {\r\n variantID: number;\r\n dimensionRecordID: number;\r\n itemID: string;\r\n sizeValue: string;\r\n isAvailable: boolean;\r\n}\r\n\r\nconst createInput = (inputData: ICreateActionContext>): IActionInput => {\r\n if (inputData && inputData.requestContext && inputData.requestContext.query && inputData.requestContext.query.productId) {\r\n return new BuyboxGetDimensionVariantAvailabilityInput(\r\n +inputData.requestContext.query.productId,\r\n +inputData.requestContext.apiSettings.channelId\r\n );\r\n } else if (inputData && inputData.requestContext && inputData.requestContext.urlTokens && inputData.requestContext.urlTokens.itemId) {\r\n return new BuyboxGetDimensionVariantAvailabilityInput(\r\n +inputData.requestContext.urlTokens.itemId,\r\n +inputData.requestContext.apiSettings.channelId\r\n );\r\n } else if (inputData && inputData.config && inputData.config.productId) {\r\n return new BuyboxGetDimensionVariantAvailabilityInput(inputData.config.productId, inputData.requestContext.apiSettings.channelId);\r\n } else {\r\n throw new Error('Unable to create SelectedVariantInput, no productId found on module config or query');\r\n }\r\n};\r\n\r\nexport async function getAllVariantsForProduct(\r\n input: BuyboxGetDimensionVariantAvailabilityInput,\r\n ctx: IActionContext\r\n): Promise {\r\n const productResponse = await getByIdAsync(\r\n { callerContext: ctx, queryResultSettings: { Paging: { Top: 1 } } },\r\n input.productId,\r\n input.channelId\r\n );\r\n const baseProduct = Array.isArray(productResponse) ? productResponse[0] : productResponse;\r\n try {\r\n return await getVariantsByDimensionValuesAsync(\r\n { callerContext: ctx, queryResultSettings: { Paging: { Top: 500 } } },\r\n baseProduct.MasterProductId || input.productId,\r\n input.channelId,\r\n []\r\n );\r\n } catch (error) {\r\n ctx.telemetry.exception(error);\r\n throw new Error('[IBuyboxGetDimensionPricingActionData]Unable to retieve data');\r\n }\r\n}\r\n\r\nexport default createObservableDataAction({\r\n id: 'AllMFRMProductVariantIDs',\r\n action: >getAllVariantsForProduct,\r\n input: createInput\r\n});\r\n","import { buildCacheKey, getSimpleProducts, ProductInput } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { CacheType, createObservableDataAction, IAction, IActionContext, IActionInput, ICommerceApiSettings, ICreateActionContext } from '@msdyn365-commerce/core';\r\nimport { ProductDeliveryOptions, SalesOrder, SimpleProduct, TransactionType } from '@msdyn365-commerce/retail-proxy';\r\nimport { getDeliveryOptionsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { getSalesOrderDetailsBySalesIdAsync, getSalesOrderDetailsByTransactionIdAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/SalesOrdersDataActions.g';\r\n\r\ninterface ISalesOrderWithHydrations {\r\n salesOrder: SalesOrder;\r\n products: SimpleProduct[];\r\n productDeliveryOptions?: ProductDeliveryOptions[];\r\n}\r\n\r\n/**\r\n * orderTypes Types of orders\r\n */\r\nexport const enum orderTypes {\r\n salesOrder = 'salesOrder',\r\n transaction = 'transaction'\r\n}\r\n\r\n/**\r\n * Calls the Retail API and returns the sales order\r\n */\r\nconst getSalesOrder = (orderType: string = '', orderId: string = '') => async (ctx: IActionContext): Promise => {\r\n return orderType === orderTypes.salesOrder\r\n ? getSalesOrderDetailsBySalesIdAsync({ callerContext: ctx }, orderId)\r\n : // Local (1) searches the retail server database, and remote (2) searches\r\n // on the headquarters side. All (3) and none (0) are not supported.\r\n getSalesOrderDetailsByTransactionIdAsync({ callerContext: ctx }, orderId, 1);\r\n};\r\n\r\n/**\r\n * Calls the Retail API and returns the products\r\n */\r\nconst getProducts = (productIds: number[] = [], channelId?: number) => async (ctx: IActionContext): Promise => {\r\n const productInputs = productIds.map(productId => new ProductInput(productId, ctx.requestContext.apiSettings, channelId));\r\n return getSimpleProducts(productInputs, ctx);\r\n};\r\n\r\n/**\r\n * Action input\r\n */\r\nexport class GetSalesOrderWithHydrationsInput implements IActionInput {\r\n public orderType: string;\r\n public orderId: string;\r\n private apiSettings: ICommerceApiSettings;\r\n\r\n constructor(orderType: string , orderId: string, apiSettings: ICommerceApiSettings) {\r\n this.orderType = orderType;\r\n this.orderId = orderId;\r\n this.apiSettings = apiSettings;\r\n }\r\n\r\n public getCacheKey = () => buildCacheKey(`SalesOrderWithHydrations`, this.apiSettings);\r\n public getCacheObjectType = () => `SalesOrderWithHydrations-${this.orderType}-${this.orderId}`;\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\n\r\n/**\r\n * Creates the input required to make the retail api call\r\n */\r\nconst createSalesOrderWithHydrationsInput = (inputData: ICreateActionContext) => {\r\n const { salesId = '', transactionId = '' } = (inputData.requestContext.query && inputData.requestContext.query) || {};\r\n if (salesId) {\r\n return new GetSalesOrderWithHydrationsInput(orderTypes.salesOrder, salesId, inputData.requestContext.apiSettings);\r\n } else if (transactionId) {\r\n return new GetSalesOrderWithHydrationsInput(orderTypes.transaction, transactionId, inputData.requestContext.apiSettings);\r\n }\r\n throw new Error(`createSalesOrderWithHydrationsInput - No salesId or transactionId provided.`);\r\n};\r\n\r\n/**\r\n * Get sales order with hydrations action\r\n */\r\nexport async function getSalesOrderWithHydrationsAction(\r\n input: GetSalesOrderWithHydrationsInput,\r\n ctx: IActionContext\r\n): Promise {\r\n if (!ctx) {\r\n throw new Error(`getSalesOrderWithHydrationsAction - Action context cannot be null/undefined`);\r\n }\r\n\r\n const { orderType, orderId } = input;\r\n\r\n if (!orderType || !orderId) {\r\n ctx.trace(`[getSalesOrderWithHydrationsAction] No orderType or orderId provided.`);\r\n return {};\r\n }\r\n\r\n const salesOrder = await getSalesOrder(orderType, orderId)(ctx);\r\n\r\n if (!salesOrder) {\r\n ctx.trace(`[getSalesOrderWithHydrationsAction] No salesOrder found.`);\r\n return {};\r\n }\r\n\r\n // If it is salesInvoice, return salesOrder and empty products\r\n // tslint:disable-next-line:prefer-type-cast\r\n if (salesOrder.TransactionTypeValue === 15 as TransactionType.SalesInvoice) {\r\n return {\r\n salesOrder,\r\n products: []\r\n };\r\n }\r\n\r\n if (!salesOrder.SalesLines || !salesOrder.SalesLines.length) {\r\n ctx.trace(`[getSalesOrderWithHydrationsAction] No salesLine found.`);\r\n return {};\r\n }\r\n\r\n const productIds: number[] = salesOrder.SalesLines.map(salesLine => salesLine.ProductId || 0).filter(productId => productId);\r\n\r\n if (!productIds || !productIds.length) {\r\n ctx.trace(`[getSalesOrderWithHydrationsAction] No productId in saleLines found.`);\r\n return {};\r\n }\r\n\r\n const products = await getProducts(productIds, salesOrder.ChannelId)(ctx);\r\n if (!products || !products.length) {\r\n ctx.trace(`[getSalesOrderWithHydrationsAction] No product found.`);\r\n return {};\r\n }\r\n\r\n const deliveryOptions = await getDeliveryOptionsAsync({ callerContext: ctx, queryResultSettings: {} }, products.map(x => x.RecordId), {}, 4)\r\n .then(result => {\r\n return result;\r\n }).catch((error: Error) => {\r\n ctx.trace(error.message);\r\n ctx.telemetry.exception(error);\r\n ctx.telemetry.debug(`[getDeliveryOptionsForCartLineItems]Error executing action`);\r\n throw new Error('[getDeliveryOptionsForCartLineItems]Error executing action');\r\n });\r\n\r\n return {\r\n salesOrder,\r\n products,\r\n deliveryOptions\r\n };\r\n}\r\n\r\nexport const getSalesOrderWithHydrationsActionDataAction = createObservableDataAction({\r\n id: 'mfrm-get-sales-order-with-hydrations',\r\n action: >getSalesOrderWithHydrationsAction,\r\n input: createSalesOrderWithHydrationsInput\r\n});\r\n\r\nexport default getSalesOrderWithHydrationsActionDataAction;","/*--------------------------------------------------------------\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 * as React from 'react';\r\nimport { ProductPrice } from '@msdyn365-commerce/retail-proxy';\r\nimport {\r\n ICoreContext,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport { format } from '@msdyn365-commerce-modules/utilities';\r\nimport { RatingComponent } from '@msdyn365-commerce/components';\r\nimport { buildProductBadge, parseBadgeData } from '../../../Utilities/get-product-badge';\r\nimport {\r\n IGridSettings,\r\n IImageData,\r\n IImageSettings,\r\n Image\r\n} from '@msdyn365-commerce/core';\r\nimport { generateImageUrl } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { useInView } from 'react-intersection-observer';\r\nimport { urlFallBackImage } from '../../../Utilities/fallbackImageUrl';\r\n\r\nexport interface IUnbxdProductCarouselItemProps {\r\n context: ICoreContext\r\n productUrl: string,\r\n product: any,\r\n position: number\r\n ratingAriaLabel: string,\r\n startingAtText: string,\r\n callUnbxdClickEvent: any,\r\n brandName?: string,\r\n onView?(position: number): void,\r\n emptyPlaceHolderImage: string\r\n}\r\nexport const UnbxdProductCarouselItem: React.FC = ({\r\n context,\r\n productUrl,\r\n product,\r\n position,\r\n brandName,\r\n ratingAriaLabel,\r\n startingAtText,\r\n callUnbxdClickEvent,\r\n onView,\r\n emptyPlaceHolderImage\r\n}) => {\r\n\r\n function renderProductBadge(\r\n attributeName: string | undefined,\r\n requestContext: IRequestContext\r\n ): JSX.Element | undefined {\r\n const badgeData = attributeName;\r\n if (!badgeData) {\r\n return;\r\n }\r\n // split badge data into its separate badges\r\n const badges = badgeData.split(',');\r\n // parse badge data to get its schedule and image src\r\n const parsedBadges = badges.map(badge => parseBadgeData(badge, requestContext));\r\n\r\n // build product badge image components\r\n const finalizedBadges = parsedBadges.map(parsedBadge => parsedBadge && buildProductBadge(parsedBadge, requestContext));\r\n\r\n return finalizedBadges ? <>{finalizedBadges} : <>;\r\n }\r\n function getRatingAriaLabel(rating?: number, ratingAriaLabel?: string): string {\r\n if (rating && ratingAriaLabel) {\r\n const roundedRating = rating.toFixed(2);\r\n return format(ratingAriaLabel || '', roundedRating, '5');\r\n }\r\n return '';\r\n }\r\n function renderRecsImage(\r\n imageSettings?: IImageSettings,\r\n gridSettings?: IGridSettings,\r\n imageUrl?: string,\r\n fallbackImageUrl?: string,\r\n altText?: string\r\n ): JSX.Element | null {\r\n if (!fallbackImageUrl || !gridSettings || !imageSettings) {\r\n return null;\r\n }\r\n const img: IImageData = {\r\n src: imageUrl ? imageUrl : fallbackImageUrl,\r\n altText: altText ? altText : '',\r\n fallBackSrc: fallbackImageUrl\r\n };\r\n const imageProps = {\r\n gridSettings,\r\n imageSettings,\r\n fallbackImageUrl\r\n };\r\n imageProps.imageSettings.cropFocalRegion = true;\r\n return ;\r\n }\r\n function renderRating(\r\n context: ICoreContext,\r\n typeName: string,\r\n id: string,\r\n avgRating?: number,\r\n totalRatings?: number,\r\n ariaLabel?: string\r\n ): JSX.Element | null {\r\n const numRatings = (totalRatings && totalRatings.toString()) || '0';\r\n if (avgRating && avgRating !== 0) {\r\n const ratingAriaLabel = getRatingAriaLabel(avgRating, ariaLabel);\r\n return (\r\n \r\n );\r\n } else {\r\n return null;\r\n }\r\n }\r\n function renderPrice(\r\n basePrice?: number,\r\n lowest_variant_adjustedPrice?: number,\r\n CustomerContextualPrice?: number\r\n ): JSX.Element | null {\r\n const price: ProductPrice = {\r\n BasePrice: basePrice,\r\n AdjustedPrice: lowest_variant_adjustedPrice,\r\n CustomerContextualPrice: CustomerContextualPrice\r\n };\r\n\r\n return basePrice ? (\r\n
\r\n

{startingAtText}

\r\n {price.AdjustedPrice && price.CustomerContextualPrice && price.CustomerContextualPrice < price.AdjustedPrice ? <>\r\n ${price.CustomerContextualPrice}\r\n \r\n \r\n ${price.AdjustedPrice}\r\n \r\n \r\n :\r\n \r\n ${price.BasePrice}\r\n }\r\n
\r\n ) : null;\r\n }\r\n const imageUrl = generateImageUrl(product.PrimaryImageUrl, context.request.apiSettings);\r\n const fallBackImageUrl = urlFallBackImage(emptyPlaceHolderImage, product?.uniqueId, context.actionContext.requestContext);\r\n const defaultImageSettings: IImageSettings = {\r\n viewports: {\r\n xs: { q: `w=0&h=210&m=6`, w: 0, h: 0 },\r\n lg: { q: `w=0&h=210&m=6`, w: 0, h: 0 },\r\n xl: { q: `w=0&h=210&m=6`, w: 0, h: 0 }\r\n },\r\n lazyload: true\r\n };\r\n\r\n const [mscProductRef, inView] = useInView({\r\n threshold: .6,\r\n triggerOnce: true //This doesn't work reliably - the children in the carousel remount unexpectedly\r\n });\r\n React.useEffect(() => {\r\n if (inView && onView) {\r\n onView(position);\r\n }\r\n }, [inView]);\r\n\r\n return (\r\n
\r\n {\r\n e.preventDefault();\r\n callUnbxdClickEvent(productUrl, product.uniqueId, position + 1);\r\n }}\r\n >\r\n
\r\n {renderProductBadge(product.Attr_5637149147, context.request)}\r\n
\r\n
\r\n {renderRecsImage(\r\n defaultImageSettings,\r\n context.request.gridSettings,\r\n imageUrl,\r\n fallBackImageUrl,\r\n product.ProductName)}\r\n
\r\n
\r\n \r\n \r\n {`${brandName} ${product.ProductName}`}\r\n \r\n
\r\n {renderPrice(\r\n product.BasePrice,\r\n product.lowest_variant_adjustedPrice,\r\n product.CustomerContextualPrice)}\r\n
\r\n
\r\n
\r\n {renderRating(context, \"mfrm-product-recommendation-carousel\", `${product.uniqueId}`, product.AverageRatingOverall, product.AverageRatingCountOverall, ratingAriaLabel)}\r\n
\r\n
\r\n Shop Now\r\n
\r\n
\r\n \r\n
\r\n );\r\n};\r\n\r\nexport default UnbxdProductCarouselItem;","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as React from 'react';\r\nimport { IMfrmProductRecommendationCarouselData } from './mfrm-product-recommendation-carousel.data';\r\nimport { IMfrmProductRecommendationCarouselProps } from './mfrm-product-recommendation-carousel.props.autogenerated';\r\n\r\nimport getUnbxdRecommendationData, { GetUnbxdRecommendationsDataInput } from '../../actions/get-unbxd-product-recommendations.action';\r\nimport { getProductPageUrlSync } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { UnbxdProductCarouselItem } from './components/unbxd-product-carousel-item';\r\nimport { addThrottledEvent } from '@msdyn365-commerce-modules/utilities';\r\nimport _getViewPort from '../../Utilities/get-view-port';\r\nimport MsDyn365, { ICoreContext } from '@msdyn365-commerce/core';\r\nimport { SimpleProduct, SalesLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { getPagePath } from '../../Utilities/get-page-path';\r\nimport { getActivePricesAsync, getAttributeValuesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport partialRight from 'lodash/partialRight';\r\nimport { getUtagProductCategory } from '../../Utilities/get-utag-product-category';\r\nimport { getUtagVariantId } from '../../Utilities/get-utag-variant-id';\r\nimport { createUtagQueue } from '../../Utilities/create-utag-queue';\r\nimport { hasArray } from \"../../Utilities/emtpyChecker\";\r\nimport { getSetWmapCartLines } from \"../../Utilities/cart-utils\";\r\nimport { removeSpecialChars } from '../../Utilities/allRegex';\r\n\r\n\r\nexport interface IMfrmProductRecommendationCarouselViewProps extends IMfrmProductRecommendationCarouselProps {\r\n carouselItems: React.ReactNode[] | null;\r\n carouselHeading?: string;\r\n isMobile: boolean;\r\n currentPageName: string;\r\n}\r\ninterface IMfrmProductRecommendationCarouselState {\r\n unbxdRecommendationData: any[] | undefined;\r\n widgetTitle?: string | undefined;\r\n count?: number | undefined;\r\n isMobile: boolean;\r\n unbxdRequestId: string;\r\n}\r\nexport const getProductURLForUnbxd = (product: SimpleProduct | undefined, context: ICoreContext, wmapPageUrlSuffix: string): string => {\r\n let productUrl = getProductPageUrlSync(removeSpecialChars(product?.Name!, context) || '', product?.RecordId || 0, context?.actionContext, undefined);\r\n productUrl = productUrl?.replace(`/${wmapPageUrlSuffix}`, '');\r\n return `${context.request.url.requestUrl.origin}${productUrl}?variantid=${product?.RecordId}`;\r\n};\r\nclass MfrmProductRecommendationCarousel extends React.PureComponent, IMfrmProductRecommendationCarouselState> {\r\n private resizeThrottledEventHandler?: (event: Event) => void;\r\n private viewedItems: any[];\r\n private utagQueue: object[] | undefined;\r\n private stopQueuing: (() => void) | undefined;\r\n private currentPageType: string;\r\n constructor(props: IMfrmProductRecommendationCarouselProps & IMfrmProductRecommendationCarouselState) {\r\n super(props);\r\n this.state = {\r\n count: 0,\r\n unbxdRecommendationData: [],\r\n widgetTitle: \"\",\r\n isMobile: false,\r\n unbxdRequestId: ''\r\n };\r\n this.viewedItems = [];\r\n this.currentPageType = \"\";\r\n const createUtagQueueResult = createUtagQueue('product_impression_position', 1000);\r\n if (createUtagQueueResult) {\r\n this.utagQueue = createUtagQueueResult.utagQueue;\r\n this.stopQueuing = createUtagQueueResult.stopQueuing;\r\n }\r\n }\r\n public async componentDidMount(): Promise {\r\n\r\n this.currentPageType = getPagePath()?.split('/')[1].toLowerCase();\r\n void this._getUnbxdRecommendationsData();\r\n if (MsDyn365.isBrowser) {\r\n this.updateViewPort(this.props.context);\r\n }\r\n }\r\n public async componentDidUpdate(): Promise {\r\n if (MsDyn365.isBrowser) {\r\n this.resizeThrottledEventHandler = addThrottledEvent(window, 'resize', () => this.updateViewPort(this.props.context));\r\n }\r\n }\r\n\r\n public componentWillUnmount(): void {\r\n if (MsDyn365.isBrowser) {\r\n window.removeEventListener('resize', this.resizeThrottledEventHandler!, false);\r\n this.stopQueuing!();\r\n }\r\n }\r\n\r\n private isWmap = (): boolean => {\r\n const pathName = this.props.context.request && this.props.context.request.url.requestUrl.pathname?.toLowerCase().split('/');\r\n const makeaPaymentLink = this.props.context?.app.config.wmapPageUrlSuffix?.toLowerCase();\r\n return pathName && makeaPaymentLink && pathName?.includes(makeaPaymentLink);\r\n };\r\n private updateViewPort = (context: ICoreContext): void => {\r\n const viewport = _getViewPort(context);\r\n if (viewport === 'xs' || viewport === 'sm') {\r\n this.setState({\r\n isMobile: true\r\n });\r\n } else {\r\n this.setState({\r\n isMobile: false\r\n });\r\n }\r\n };\r\n\r\n private handleUnbxdClickEvent = async (productUrl: string, productID: string, position: number, product: any) => {\r\n const { config: { productListPage } } = this.props;\r\n const productSpecificationData = await getAttributeValuesAsync(\r\n { callerContext: this.props.context.actionContext, queryResultSettings: {} },\r\n product.MasterProductId,\r\n this.props.context.request.apiSettings.channelId,\r\n this.props.context.request.apiSettings.catalogId || 0\r\n );\r\n const brand = productSpecificationData.find(attr => attr.Name === 'Brand')?.TextValue;\r\n const pageType = this.props.context.actionContext.requestContext.urlTokens.pageType;\r\n\r\n //@ts-ignore\r\n utag.link({\r\n 'event': 'product-click',\r\n 'enhanced_action': 'product_click',\r\n 'event_category': 'ecommerce',\r\n 'event_action': 'product click',\r\n 'event_label': `${productID}: ${product.ProductName}`,\r\n 'event_noninteraction': 'false',\r\n 'product_list_name': [`Recommended Products: ${productListPage ? productListPage.trim() : this.isWmap() ? 'WMAP' : pageType === 'Product' ? 'Product' : pageType === 'Category' ? 'Category' : this.currentPageType}`], //for list name use ‘Recommended Products: Cart’ on the cart page and ‘Recommended Products: Order Confirmation’ on the order complete page\r\n 'product_position': [`${position}`],\r\n 'product_id': [`${product.uniqueId}`],\r\n 'product_name': [`${product.ProductName}`],\r\n 'product_category': [`${await getUtagProductCategory(\r\n this.props.context.actionContext,\r\n this.props.context.request.apiSettings.channelId,\r\n this.props.context.request.apiSettings.catalogId,\r\n product.Unbxd_DefaultVariantID)\r\n }`],\r\n 'product_brand': [`${brand}`],\r\n 'product_variant': [`${await getUtagVariantId(\r\n product.MasterProductId,\r\n this.props.context.request.apiSettings.channelId,\r\n this.props.context.actionContext,\r\n Number(product.Unbxd_DefaultVariantID), `${productID}`)}`],\r\n // adding the below variables for unbxd\r\n 'unbxd_page_type': this.props.config.pageType.toUpperCase(),\r\n 'unbxd_experience_widget': this.props.config.widgetNumber?.toUpperCase(),\r\n 'd365_product_id': [`${product.MasterProductId}`],\r\n 'd365_product_variant': [`${product.Unbxd_DefaultVariantID}`]\r\n });\r\n\r\n this.currentPageType === 'orderconfirmation' ? window.open(productUrl, \"_blank\") : window.location.href = productUrl;\r\n };\r\n\r\n private handleViewEvent = async (position: number, product: any, products: any[]) => {\r\n const productID = product.uniqueId;\r\n const unbxd_DefaultVariantID = product.Unbxd_DefaultVariantID;\r\n const getUtagProductCategoryProps = {\r\n actionContext: this.props.context.actionContext,\r\n channelId: this.props.context.request.apiSettings.channelId,\r\n catalogId: this.props.context.request.apiSettings.catalogId,\r\n RecordId: unbxd_DefaultVariantID\r\n };\r\n const widgetNumber = this.props.config.widgetNumber;\r\n const unbxdPageType = this.props.config.pageType;\r\n\r\n\r\n if (!this.viewedItems.includes(product.Unbxd_DefaultVariantID)) {\r\n this.viewedItems.push(product.Unbxd_DefaultVariantID);\r\n\r\n const productSpecificationData = await getAttributeValuesAsync(\r\n { callerContext: this.props.context.actionContext, queryResultSettings: {} },\r\n product.MasterProductId,\r\n this.props.context.request.apiSettings.channelId,\r\n this.props.context.request.apiSettings.catalogId || 0\r\n );\r\n const brand = productSpecificationData.find(attr => attr.Name === 'Brand')?.TextValue;\r\n const variant = await getUtagVariantId(product.MasterProductId, getUtagProductCategoryProps.channelId, getUtagProductCategoryProps.actionContext, Number(getUtagProductCategoryProps.RecordId), `${productID}`);\r\n const prices = await getActivePricesAsync(\r\n { callerContext: this.props.context.actionContext },\r\n {\r\n ChannelId: this.props.context.actionContext.requestContext.apiSettings.channelId,\r\n CatalogId: this.props.context.actionContext.requestContext.apiSettings.catalogId\r\n },\r\n [Number(product.Unbxd_DefaultVariantID)],\r\n new Date(),\r\n null,\r\n [],\r\n true\r\n );\r\n const pageType = this.props.context.actionContext.requestContext.urlTokens.pageType;\r\n const { config: { productListPage } } = this.props;\r\n\r\n this.utagQueue!.push({\r\n 'event': 'product-impression',\r\n 'event_category': 'ecommerce',\r\n 'event_action': 'product impression',\r\n 'enhanced_action': 'product_impression',\r\n 'event_label': `${getPagePath()}`,\r\n 'event_noninteraction': 'true',\r\n 'product_impression_list_name': [`Recommended Products: ${productListPage ? productListPage.trim() : this.isWmap() ? 'WMAP' : pageType === 'Product' ? 'Product' : pageType === 'Category' ? 'Category' : this.currentPageType}`],\r\n 'product_impression_position': [`${position + 1}`],\r\n 'product_impression_id': [`${productID}`],\r\n 'product_impression_name': [product.ProductName],\r\n 'product_impression_category': [\r\n `${await getUtagProductCategory(\r\n getUtagProductCategoryProps.actionContext,\r\n getUtagProductCategoryProps.channelId,\r\n getUtagProductCategoryProps.catalogId,\r\n Number(getUtagProductCategoryProps.RecordId)\r\n )}`\r\n ],\r\n 'product_impression_brand': [brand],\r\n 'product_impression_variant': [`${variant}`],\r\n 'product_impression_price': prices.map(price => `${price.CustomerContextualPrice}`),\r\n // // adding the below variables for unbxd\r\n 'unbxd_page_type': `${unbxdPageType.toUpperCase()}`,\r\n 'unbxd_experience_widget': `${widgetNumber?.toUpperCase()}`,\r\n 'd365_product_id': [`${product.MasterProductId}`],\r\n 'd365_product_variant': [`${getUtagProductCategoryProps.RecordId}`]\r\n });\r\n }\r\n };\r\n\r\n private _getUnbxdRecommendationsData = async (): Promise => {\r\n const {\r\n config: {\r\n pageType,\r\n widgetNumber,\r\n categoryLevelNames\r\n },\r\n data: {\r\n cart: { result }\r\n }\r\n } = this.props;\r\n const wmapCartItemIDs = getSetWmapCartLines('get');\r\n const cartLineItems = result?.cart.CartLines;\r\n const productItemID = this.props.data.product.result?.ItemId;\r\n let cartItemIDs = hasArray(cartLineItems)?.map((item) => {\r\n return item.ItemId;\r\n });\r\n if (!productItemID && wmapCartItemIDs?.length && this.isWmap()) {\r\n cartItemIDs = wmapCartItemIDs;\r\n }\r\n\r\n if (this.currentPageType === 'orderconfirmation') {\r\n const salesLines = (await this.props.data.mfrmSalesOrderDetails).salesOrder.SalesLines;\r\n cartItemIDs = hasArray(salesLines)?.map((item: SalesLine) => {\r\n return item.ItemId;\r\n });\r\n }\r\n try {\r\n getUnbxdRecommendationData(new GetUnbxdRecommendationsDataInput(pageType, widgetNumber, productItemID, categoryLevelNames, cartItemIDs), this.props.context.actionContext)\r\n .then((responseData: any) => {\r\n if (responseData) {\r\n this.setState({\r\n count: responseData.unbxdRecs.count,\r\n unbxdRecommendationData: responseData.unbxdRecs.recommendations,\r\n widgetTitle: responseData.unbxdRecs.widgetTitle,\r\n unbxdRequestId: responseData.unbxdRequestId ? responseData.unbxdRequestId : ''\r\n });\r\n }\r\n }).catch((e: any) => console.log(e));\r\n\r\n } catch (error) {\r\n console.log('Unbxd API error', Error);\r\n }\r\n };\r\n public render(): JSX.Element | null {\r\n const { carouselHeading } = this.props.config;\r\n const { unbxdRecommendationData } = this.state;\r\n\r\n const viewProps: IMfrmProductRecommendationCarouselViewProps = {\r\n ...(this.props as IMfrmProductRecommendationCarouselProps),\r\n carouselItems: unbxdRecommendationData ? this._getCarouselItems(unbxdRecommendationData) : null,\r\n carouselHeading: carouselHeading ? carouselHeading : '',\r\n isMobile: this.state.isMobile,\r\n currentPageName: this.currentPageType\r\n };\r\n return this.props.renderView(viewProps);\r\n }\r\n\r\n private _getCarouselItems = (products: any[]): React.ReactNode[] | null => {\r\n if (products.length === 0 || products.length < 4) {\r\n return null;\r\n }\r\n const { context, app: { config: { wmapPageUrlSuffix, placeholderImageName } } } = this.props;\r\n const { ratingAriaLabel, startingAtText } = this.props.resources;\r\n return products.map((product, index) => {\r\n const unbxd_DefaultVariantID = product.Unbxd_DefaultVariantID;\r\n let productUrl = getProductPageUrlSync(removeSpecialChars(product?.ProductName!, context) || '', product.MasterProductId, context && this.props.context.actionContext, undefined);\r\n productUrl = productUrl?.replace(`/${wmapPageUrlSuffix}`, '');\r\n const variantIdQueryParams = unbxd_DefaultVariantID !== 0 && (productUrl.includes('?') ? `&variantid=${unbxd_DefaultVariantID}` : `?variantid=${unbxd_DefaultVariantID}`) || '';\r\n productUrl += variantIdQueryParams;\r\n const brandName = product && product.Attr_5637145355;\r\n return (\r\n \r\n );\r\n });\r\n };\r\n}\r\n\r\nexport default MfrmProductRecommendationCarousel;\r\n","import { ascendBy } from './ascendBy';\r\nimport { clearArray } from './clear-array';\r\nimport MsDyn365 from '@msdyn365-commerce/core';\r\n\r\ninterface createUtagQueueResult {\r\n utagQueue: object[],\r\n stopQueuing: () => void;\r\n}\r\n\r\nexport const createUtagQueue = (sortBy: string, batchingInterval: number):createUtagQueueResult|undefined => {\r\n const utagQueue: object[] = [];\r\n if (MsDyn365.isBrowser) {\r\n const id = window.setInterval(() => {\r\n if (utagQueue.length) {\r\n //@ts-ignore\r\n utag.link(\r\n utagQueue.sort(ascendBy(sortBy)).reduce((fullUtagObject, singleItemUtagObject) => {\r\n Object.entries(singleItemUtagObject).forEach(([prop, val]) => {\r\n if (typeof val === 'string') {\r\n fullUtagObject[prop] = val;\r\n } else if (Array.isArray(val)) {\r\n if (typeof fullUtagObject[prop] === 'undefined') {\r\n fullUtagObject[prop] = [];\r\n }\r\n fullUtagObject[prop].push(val[0]);\r\n }\r\n });\r\n\r\n return fullUtagObject;\r\n }, {})\r\n );\r\n clearArray(utagQueue);\r\n }\r\n }, batchingInterval);\r\n const stopQueuing = () => {\r\n window.clearInterval(id);\r\n };\r\n return { utagQueue, stopQueuing };\r\n }\r\n return;\r\n};\r\n","export const ascendBy = (propName: string) => (a: object, b: object) => a[propName] - b[propName];","export const clearArray = (array: any[]) => {\r\n while (array.length > 0) {\r\n array.pop();\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 React from 'react';\r\nimport { IMfrmProductRecommendationCarouselViewProps } from './mfrm-product-recommendation-carousel';\r\nimport Carousel from 'mfcl/Carousel';\r\n\r\nexport default (props: IMfrmProductRecommendationCarouselViewProps) => {\r\n const { carouselHeading, carouselItems, isMobile, currentPageName } = props;\r\n if (!carouselItems) {\r\n props.context.telemetry.error('Product Recommendations is empty, module wont render.');\r\n return null;\r\n }\r\n\r\n return (\r\n carouselItems ?
\r\n
\r\n

{carouselHeading}

\r\n
\r\n
\r\n {isMobile ? (\r\n
\r\n \r\n {carouselItems}\r\n \r\n
\r\n ) : (\r\n \r\n {carouselItems}\r\n \r\n )}\r\n
\r\n
\r\n : <>\r\n );\r\n};\r\n","const binding = { modules: {}, dataActions: {} };\n\n const registerActionId = (actionPath) => {\n if (binding.dataActions[actionPath] &&\n binding.dataActions[actionPath].default &&\n binding.dataActions[actionPath].default.prototype &&\n binding.dataActions[actionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[actionPath].default.prototype.id] = binding.dataActions[actionPath];\n } else {\n Object.keys(binding.dataActions[actionPath] || {}).forEach(exportName => {\n if (binding.dataActions[actionPath][exportName] &&\n binding.dataActions[actionPath][exportName].prototype &&\n binding.dataActions[actionPath][exportName].prototype.Action) {\n binding.dataActions[binding.dataActions[actionPath][exportName].prototype.id] = binding.dataActions[actionPath][exportName];\n }\n })\n }\n };\n\n const registerSanitizedActionPath = (sanitizedActionPath, dataAction) => {\n if (process.env.NODE_ENV === 'development') {\n if (!dataAction.default) {\n throw new Error('Data action path does not have a default export');\n }\n if (!(dataAction.default.prototype.id && binding.dataActions[dataAction.default.prototype.id]) || !binding.dataActions[sanitizedActionPath]) {\n binding.dataActions[sanitizedActionPath] = dataAction;\n }\n } else {\n binding.dataActions[sanitizedActionPath] = dataAction;\n if (!binding.dataActions[sanitizedActionPath].default) {\n throw new Error('Data action path ' + sanitizedActionPath + ' does not have a default export');\n }\n binding.dataActions[sanitizedActionPath].default.prototype.RegistrationId = sanitizedActionPath;\n if (binding.dataActions[sanitizedActionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[sanitizedActionPath].default.prototype.id] = sanitizedActionPath;\n }\n }\n };\n \n\n (binding.modules['mfrm-product-recommendation-carousel'] = {\n c: () => require('partner/modules/mfrm-product-recommendation-carousel/mfrm-product-recommendation-carousel.tsx'),\n $type: 'contentModule',\n da: [{name:'cart', path:'@msdyn365-commerce/global-state/dist/lib/data-actions/cart-state-data-action', runOn: 0},{name:'mfrmSalesOrderDetails', path:'data-actions/get-sales-order-details-action.action', runOn: 0},{name:'product', path:'@msdyn365-commerce-modules/retail-actions/dist/lib/get-selected-variant', runOn: 0}],\n \n iNM: false,\n ns: '__local__',\n n: 'mfrm-product-recommendation-carousel',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/mfrm-product-recommendation-carousel'\n });\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce-modules/retail-actions/dist/lib/get-selected-variant';\n let dataAction = require('@msdyn365-commerce-modules/retail-actions/dist/lib/get-selected-variant');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce/global-state/dist/lib/data-actions/cart-state-data-action';\n let dataAction = require('@msdyn365-commerce/global-state/dist/lib/data-actions/cart-state-data-action');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n {\n const sanitizedActionPath = 'data-actions/get-sales-order-details-action.action';\n let dataAction = require('partner/data-actions/get-sales-order-details-action.action');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.dataActions = {\n ...window.__bindings__.dataActions || {},\n ...binding.dataActions\n };\n export const viewDictionary = {};\n viewDictionary['__local__|__local__|modules|mfrm-product-recommendation-carousel|mfrm-product-recommendation-carousel'] = {\n c: () => require('partner/modules/mfrm-product-recommendation-carousel/mfrm-product-recommendation-carousel.view.tsx'),\n cn: '__local__-__local__-mfrm-product-recommendation-carousel'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","module.exports = React;","module.exports = ReactDOM;"],"names":["emailRegex","emailValue","test","removeSpecialChars","str","ctx","_ctx$request$app","request","app","config","removeSpecialCharsPDP","replace","removeSpecialCharsFromURLPath","_ctx$request$app2","_decodeURIComponent","decodeURIComponent","split","customerInfoPhoneRegex","inputRegexObj","nameRegex","addressInputRegex","phoneNumerRegex","cartDeliveryMsgRegex","getSetLocalStorage","key","getSet","valueToSet","returnType","MsDyn365","isBrowser","localStorage","setItem","JSON","stringify","storedValue","getItem","parse","_unused","removeItem","getSetProductData","products","length","setCoreProductCookie","psp","typeOfProduct","toLowerCase","trim","MFRMProductTypes","core","setCookie","getSetProductSpec","getSetPromoCodeApplyList","getSetPromoCode","getSetGrandTotal","total","getSetBonusItemProd","globalBonusItems","getSetSelectedBonusItem","bonusItemArray","getSetBonusCouponDetail","getCoupons","getSetPrevBonasModalState","previousBonasModal","getSetBonusItemBrandName","bonusItemsBrandName","getSetDateGroupedProducts","getSetExpressFlow","express","getSetWmapCartLines","getSetCartProductPrice","priceDetails","getSetParcelInventoryData","details","getSetDropshipLatestDeliveryMsg","msg","LocalStorageKeys","DropshipLatestDeliveryMsg","getSetParcelLatestDeliveryMsg","ParcelLatestDeliveryMsg","getSetCustomerPhone","phone","CustomerPhone","getSetSelectedDeliveryService","SelectedDeliveryService","getSetCustomerBillingSameDelivery","isSame","CustomerBillingSameDelivery","getSetRecycleFee","fee","RecycleFee","getSetSelectedDeliverySlot","slot","getSetSelectedDeliveryDate","date","getSetCoreProductDeliveryMsg","getSetDefaultDeliverySelected","selected","getSetTimeSlot","getSetDaySlot","getSetServiceName","getSetSelectedServicePrice","getSetCoreShippingMsg","getSetEcomMonthlyAmount","getSetExpressType","value","getSetApplepayCheckoutError","getSetApplepayError","getSetApplepayIFrameError","getSetGetCardApplepayPass","getSetGetCardApplepayFail","getSetLoadExpress","getSetPaypalCheckoutError","getSetPaypalError","getSetPaypalIFrameError","getSetGetCardExpressPass","getSetGetCardExpressFail","getSetExpressAddress","getSetExpressPageLoad","getSetThankyou","getSetEcomFinanceOption","getSetEcomFinancePlanId","getSetCoreProdMsg","getSetBillingAddress","getSetPaymentLoader","getSetLastPaymentConnector","getSetPaymentRadioName","getSetPaymentRadioIndex","getSetSelectedPaymentRadio","getSetPaymentInfoForOCPage","getSetCurrentStep","getSetCheckoutCurrentStep","getSetCartCoreProductInfo","getSetUpdatedEmail","getSetSelectedDeliverySlotZone","zone","addUnitOfMeasureInAddCartLine","async","cartLines","actionContext","channelId","promises","filter","cartLine","DefaultUnitOfMeasure","map","productResponse","getByIdAsync","callerContext","queryResultSettings","Paging","Top","ProductId","UnitOfMeasureSymbol","error","console","message","processCartLine","Promise","all","variantQueryStringName","hasArray","values","undefined","DeliveryModes","DeliveryDateDetails","coreItemShippingType","EyeBrowMessage","EyeBrowAttributeName","cartModuleName","progressiveName","urlFallBackImage","imageUrl","itemId","apiSettings","fallbackImageUrl","getFallbackImageUrl","getPagePath","window","location","href","host","includes","dayjs","tz","utc","isBetween","format","defaultImageSettings","viewports","xs","q","w","h","disableLazyLoad","parseBadgeData","badgeData","requestContext","_startTime","_endTime","dataSegments","scheduleStart","scheduleEnd","badgeType","parsedScheduleStart","startDate","startTime","parsedScheduleEnd","endDate","endTime","e","startMoment","endMoment","startMomentFormatted","endMomentFormatted","isValid","baseUrl","baseImageUrl","substring","removed$","src","alt","start","convertTimeZone","end","time","local","buildProductBadge","parsedBadgeData","React","Image","className","gridSettings","altText","title","imageSettings","renderProductBadge","attributeName","finalizedBadges","badge","parsedBadge","getUtagProductCategory","_categoryPathResults$","_categoryPath$Segment","catalogId","arguments","RecordId","categoryPathResults","getCategoryPathsAsync","categoryPath","CategoryPath","Segments","CategoryName","getUtagVariantId","MasterProductId","ItemId","input","BuyboxGetDimensionVariantAvailabilityInput","variantsResp","getAllProductVariants","variantIter","ePropsVariant","ExtensionProperties","eIter","_ePropsVariant$eIter$","Key","Value","StringValue","variantofId","slice","context","innerWidth","sm","md","lg","GetUnbxdRecommendationsDataInput","constructor","pageType","widgetNumber","productID","catLevels","cartItemIDs","getCacheKey","this","currentCategories","getCacheObjectType","dataCacheType","forEach","catLevel","categoryLevelName","concat","Msdyn365","action","unbxdUid","Cookies","get","toUpperCase","unbxdApiKey","unbxdSiteKey","unbxdUrl","catName","index","join","response","data","headers","id","cookies","getCookie","cookieName","cookieValue","options","set","removeCookie","remove","productId","getAllVariantsForProduct","baseProduct","Array","isArray","getVariantsByDimensionValuesAsync","telemetry","exception","Error","createObservableDataAction","inputData","query","urlTokens","orderTypes","GetSalesOrderWithHydrationsInput","orderType","orderId","buildCacheKey","getSalesOrderWithHydrationsAction","trace","salesOrder","getSalesOrderDetailsBySalesIdAsync","getSalesOrderDetailsByTransactionIdAsync","getSalesOrder","TransactionTypeValue","SalesLines","productIds","salesLine","productInputs","ProductInput","getSimpleProducts","getProducts","ChannelId","deliveryOptions","getDeliveryOptionsAsync","x","then","result","catch","debug","getSalesOrderWithHydrationsActionDataAction","salesId","transactionId","transaction","getSelectedProductIdFromActionInput","_context$query","variantId","queryBasedVariantSelection","getQueryParamsFromQueryByName","url","requestUrl","inputUrl","queryParamName","URL","toString","toLocaleLowerCase","searchParams","Number","isNaN","generateImageUrl","startsWith","encodeURIComponent","DimensionTypes","DimensionSwatchDisplayTypes","parsedItemId","UnbxdProductCarouselItem","_ref","productUrl","product","position","brandName","ratingAriaLabel","startingAtText","callUnbxdClickEvent","onView","emptyPlaceHolderImage","PrimaryImageUrl","fallBackImageUrl","uniqueId","xl","lazyload","mscProductRef","inView","useInView","threshold","triggerOnce","ref","ProductName","onClick","preventDefault","Attr_5637149147","img","fallBackSrc","imageProps","cropFocalRegion","Object","assign","imageFallbackOptimize","loadFailureBehavior","renderRecsImage","basePrice","lowest_variant_adjustedPrice","CustomerContextualPrice","price","BasePrice","AdjustedPrice","renderPrice","typeName","avgRating","totalRatings","ariaLabel","numRatings","rating","roundedRating","toFixed","getRatingAriaLabel","RatingComponent","Math","round","ratingCount","readOnly","renderRating","AverageRatingOverall","AverageRatingCountOverall","getProductURLForUnbxd","wmapPageUrlSuffix","_productUrl","getProductPageUrlSync","Name","origin","MfrmProductRecommendationCarousel","props","super","isWmap","_this$props$context$r","_this$props$context","pathName","pathname","makeaPaymentLink","updateViewPort","viewport","_getViewPort","setState","isMobile","handleUnbxdClickEvent","_productSpecification","_this$props$config$wi","productListPage","brand","getAttributeValuesAsync","find","attr","TextValue","utag","link","currentPageType","Unbxd_DefaultVariantID","open","handleViewEvent","unbxd_DefaultVariantID","getUtagProductCategoryProps","unbxdPageType","viewedItems","_productSpecification2","push","variant","prices","getActivePricesAsync","CatalogId","Date","utagQueue","_getUnbxdRecommendationsData","_this$props$data$prod","_hasArray","categoryLevelNames","cart","wmapCartItemIDs","cartLineItems","CartLines","productItemID","item","_hasArray2","salesLines","mfrmSalesOrderDetails","getUnbxdRecommendationData","responseData","count","unbxdRecs","unbxdRecommendationData","recommendations","widgetTitle","unbxdRequestId","log","_getCarouselItems","placeholderImageName","resources","_productUrl2","variantIdQueryParams","Attr_5637145355","partialRight","state","createUtagQueueResult","createUtagQueue","sortBy","batchingInterval","setInterval","propName","sort","a","b","reduce","fullUtagObject","singleItemUtagObject","entries","prop","val","array","pop","clearArray","stopQueuing","clearInterval","_getPagePath","resizeThrottledEventHandler","addThrottledEvent","componentWillUnmount","removeEventListener","render","carouselHeading","viewProps","_objectSpread","carouselItems","currentPageName","renderView","Carousel","itemsToShow","hideIndicators","hideControls","controlStyle","controlClass","layoutGap","infinite","disableEndButtons","variableWidth","responsive","breakpoint","binding","modules","dataActions","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","prototype","RegistrationId","c","require","$type","da","name","path","runOn","iNM","ns","n","p","pdp","__bindings__","viewDictionary","cn","module","exports","ReactDOM"],"sourceRoot":""}