{"version":3,"sources":["webpack:///src/data-actions/get-cart-state-data-action.ts?3f39","webpack:///src/cart-state/get-or-create-active-cart.ts?391f","webpack:///src/cart-state/remove-promo-codes.ts?a45c","webpack:///src/cart-state/index.ts?1d80","webpack:///src/cart-state/update-loyalty-card-id.ts?dcdd","webpack:///src/cart-state/add-product-to-cart.ts?9729","webpack:///src/cart-state/remove-all-promo-codes.ts?16d0","webpack:///src/data-actions/cart-state-data-action.ts?e4d5","webpack:///src/data-actions/get-checkout-cart.ts?eb35","webpack:///src/global-state/i-global-state.ts?b148","webpack:///src/global-state/index.ts?bbfe","webpack:///src/cart-state/update-cart-line-delivery-specifications.ts?4cfe","webpack:///src/checkout-state/base-checkout-cart-state.ts?ce87","webpack:///./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/modules/es.number.to-fixed.js?bb11","webpack:///./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/internals/this-number-value.js?2c68","webpack:///src/cart-state/update-cart.ts?d205","webpack:///src/data-actions/get-checkout-state.ts?9ed7","webpack:///./node_modules/@msdyn365-commerce/bootloader/node_modules/core-js/internals/string-repeat.js?b749","webpack:///src/data-actions/global-state-data-action.ts?31c0","webpack:///src/cart-state/remove-cart-lines.ts?06bb","webpack:///src/cart-state/update-shipping-address.ts?d0ba","webpack:///src/cart-state/update-cart-lines.ts?8f5b","webpack:///src/checkout-state/index.ts?c692","webpack:///src/data-actions/checkout-state-data-action.ts?7dbc","webpack:///src/cart-state/clear-cart-lines-delivery-information.ts?6ad7","webpack:///src/checkout-state/checkout-state-storage.ts?2803","webpack:///src/checkout-state/base-checkout-state.ts?d0a0","webpack:///src/cart-state/base-cart-state.ts?5fc2","webpack:///src/cart-state/add-invoices-to-cart.ts?7bff","webpack:///src/cart-state/add-order-invoice-to-cart.ts?73f5","webpack:///src/cart-state/update-receipt-email.ts?9092","webpack:///src/cart-state/refresh-cart.ts?1dbd","webpack:///src/global-state/global-state.ts?3fc0","webpack:///src/cart-state/add-promo-code.ts?bcd2","webpack:///src/cart-state/set-invoice-line-price.ts?a0a5","webpack:///src/cart-state/clear-cart-line-delivery-mode.ts?8016","webpack:///src/state-interfaces/index.ts?fd96","webpack:///src/data-actions/get-cart-state.ts?6577","webpack:///src/index.ts?c6ae","webpack:///src/state-interfaces/checkout-state-enums.ts?90d5","webpack:///src/cart-state/update-cart-line-quantity.ts?ba37"],"names":["GetCartStateDataInput","constructor","apiSettings","requestContext","getCacheKey","_this$catalogId","this","channelId","catalogId","getCacheObjectType","dataCacheType","getCatalogId","async","getCartStateData","input","ctx","cartState","getCartState","undefined","cart","Id","createObservableDataAction","id","action","inputData","CartTokenPrefix","getOrCreateActiveCart","cartCookieParts","cookies","getCartCookie","split","readCart","readCartId","isAuthenticated","user","length","Auth","Anon","readAsync","callerContext","bypassCache","setCartCookie","error","handleItemDiscontinuedException","telemetry","exception","getCartFromCookie","wasReadFromCookie","authCarts","searchAsync","queryResultSettings","Paging","Top","Skip","Sorting","Columns","ColumnName","IsDescending","IncludeAnonymous","CartTypeValue","searchCarts","getCartFromCustomer","anonCart","currentCart","anonCurrentCart","newCart","cartId","claimAuthCart","updateAsync","Error","claimCart","mergedCart","sourceCart","destinationCart","updatedCart","cartLines","cartLinesToDelete","hasShippingMethod","channelConfiguration","channel","featureNames","Version","CartLines","cartline","newCartLine","IsGiftCardLine","buildGiftCardLine","_featureStates$find","featureStates","getFeatureStatesAsync","find","featureState","Name","IsEnabled","_channelDeliveryOptio","channelDeliveryOptionConfig","getChannelDeliveryOptionConfigurationAsync","DeliveryMode","PickupDeliveryModeCodes","deliveryMode","FulfillmentStoreId","ShippingAddress","WarehouseId","isEmpty","PickupDeliveryModeCode","ProductId","Quantity","ExtensionProperties","Description","ReasonCodeLines","AttributeValues","CatalogId","EntryMethodTypeValue","ItemId","UnitOfMeasureSymbol","IsPriceKeyedIn","Price","push","_objectSpread","LineId","addCartLinesAsync","removeCartLinesAsync","Coupons","coupons","map","coupon","Code","addCouponsAsync","addCartLines","claimAnonCart","createNewCart","LoyaltyCardId","card","getCustomerLoyaltyCardsAsync","CardNumber","errorObj","response","name","information","createCartAsync","NetPrice","GiftCardBalance","TrackingId","removePromoCodes","promoCodes","actionContext","removeDiscountCodesAsync","then","status","catch","warning","errorDetails","LocalizedMessage","message","substatus","updateLoyaltyCardId","newLoyaltyCardId","debug","getQuantityLimit","maxQuantityForCartLineItem","inputItem","quantityLimit","shouldEnableStockCheck","availableQuantity","Math","min","getElementIndex","lines","cartLineToAdd","elementFoundAt","productIdToFind","index","line","entries","addProductsToCartWithoutSiteSettings","newCartLines","_cartLine$Quantity","cartLine","addCartLinesResult","_error$data3","trace","validationResults","data","ValidationResults","addProductsToCartInternal","addProductToCartInternal","orderQuantityLimitsFeatureIsEnabled","enableStockCheck","isAddServiceItemToCart","isMaxByQuantityValidationFeatureDefined","shouldSkipSiteSettings","i","_cart$CartLines","_error$data","IsInvoiceLine","addProductsToCartValidateMaxAgainstDefaultOrderSettings","app","config","cartActionResult","_cart$CartLines2","_error$data2","addProductsToCartValidateMaxAgainstSiteSettings","removeAllPromoCodes","createGlobalStateDataAction","BaseCartState","GetCheckoutCartInput","getCheckoutCartDataAction","getCheckoutCartCookie","checkoutCartId","checkoutCart","Promise","resolve","copyAsync","setCheckoutCartCookie","createGlobalState","ctor","updateCartLineDeliverySpecificationsInternal","cartLineDeliverySpecifications","updateLineDeliverySpecificationsAsync","BaseCheckoutCartState","isInitialized","getCheckoutCart","_cart","_status","$","uncurryThis","toIntegerOrInfinity","thisNumberValue","$repeat","fails","$RangeError","RangeError","$String","String","floor","repeat","stringSlice","slice","nativeToFixed","toFixed","pow","x","n","acc","multiply","c","c2","divide","dataToString","s","t","target","proto","forced","fractionDigits","e","z","j","k","number","fractDigits","sign","result","x2","log","module","exports","valueOf","updateCart","updatedCartObject","getCheckoutState","checkoutStateDataAction","GlobalStateInput","BaseCheckoutState","toString","requireObjectCoercible","count","str","Infinity","key","stateConstructor","getState","globalStateObject","initialize","args","removeCartLinesInternal","cartLineIds","Array","isArray","updateShippingAddress","shippingAddress","CartsDataActions","updateCartLinesInternal","cartLinesToUpdate","updateCartLinesAsync","clearCartLinesDeliveryInformation","_actionContext$reques","_actionContext$reques2","matchingLines","pickupDeliveryModeCode","emailDeliveryModeCode","EmailDeliveryModeCode","filter","dM","copiedLines","_cloneDeep","forEach","CheckoutStorageKey","GlobalState","super","_giftCardExtends","_loyaltyAmount","_guestCheckoutEmail","_customerAccountAmount","_emailAddressFromExpressCheckout","_checkoutGenericData","_checkoutCart","_attributeValues","_extensionProperties","_shouldEnableSinglePaymentAuthorizationCheckout","shouldEnableSinglePaymentAuthorizationCheckout","_shouldEnableCheckoutErrorDisplayMessaging","shouldEnableCheckoutErrorDisplayMessaging","_salesOrder","_orderedProducts","_tokenizedPaymentCard","_tenderLine","_billingAddress","_isBillingAddressSameAsShippingAddress","_shippingAddress","_hasShippingAddress","_hasCartDeliveryMode","_cardPrefix","_paymentTenderType","giftCardExtends","_loyaltyCardNumber","_hasGuestCheckoutEmail","_isTermsAndConditionAccepted","_isTermsAndConditionChecked","_shouldCollapsePaymentSection","_shouldTriggerPaymentWithPlaceOrder","_isPaymentSectionContainerReady","_cardPaymentAcceptResult","_isPaymentSectionContainerHasError","_redirectAdditionalContext","_redirectPaymentConnectorId","_checkoutErrorPaymentConnectorId","_isPlaceOrderEnabledInRedirection","_isPaymentVerificationRequired","_isCheckoutCallFailed","_shouldEnableExpressCheckoutInCheckout","_shouldEnableExpressCheckoutInCart","_shippingAddressFromExpressCheckout","_billingAddressFromExpressCheckout","_isExpressCheckoutApplied","_isExpressAddressApplied","_isExpressCheckoutAppliedInCartPage","_isExpressPaymentModulesReady","requestFormData","query","pv","redirectResult","_checkoutError","_isBillingAddressHasError","_checkoutErrorFocus","_shouldFocusOnCheckoutError","updateSalesOrder","newSalesOrder","newOrderedProducts","newAttributeValues","newExtensionProperties","updateTokenizedPaymentCard","newTokenizedPaymentCard","updateTenderLine","newTenderLine","newShippingAddress","newHasShippingAddress","newHasCartDeliveryMode","newIsTermsAndConditionAccepted","newIsTermsAndConditionChecked","newShouldCollapsePaymentSection","newShouldTriggerPaymentWithPlaceOrder","newIsPaymentSectionContainerReady","newCardPaymentAcceptResult","newIsPaymentSectionContainerHasError","newRedirectAdditionalContext","newRedirectPaymentConnectorId","newCheckoutErrorPaymentConnectorId","newIsCheckoutCallFailed","newIsPlaceOrderEnabledInRedirection","newIsPaymentVerificationRequired","updateBillingAddress","_input$additionalProp","newBillingAddress","additionalProperties","isBillingAddressSameAsShippingAddress","removeBillingAddress","updatePaymentTenderType","newPaymentTenderType","updateCardPrefix","newCardPrefix","removeGiftCard","giftCard","giftCardNumber","removeGiftCardExtend","addGiftCard","Pin","ExpirationDate","TenderTypeId","gitCardExtend","addGiftCardExtend","updateLoyaltyCardNumber","newLoyaltyCardNumber","updateLoyaltyAmount","Number","newAmount","newGuestCheckoutEmail","ReceiptEmail","updateReceiptEmail","newEmail","updateCartLines","updatedCartLinesObject","newHasGuestCheckoutEmail","removeCheckoutCartId","removeCheckoutCartCookie","saveDataInStorage","sessionStorage","billingAddress","setCheckoutCartData","BillingAddress","GiftCard","loyaltyCardNumber","LoyaltyCardNumber","loyaltyAmount","LoyaltyAmount","isTermsAndConditionAccepted","TermsAndCondition","paymentTenderType","window","setItem","PaymentTenderType","redirectPaymentConnectorId","RedirectPaymentConnectorId","isExpressCheckoutApplied","IsExpressCheckoutApplied","filtered","Object","keys","reduce","filteredData","SaveDataBeforeRedirect","CheckoutGenericData","checkoutGenericData","updateCustomerAccountAmount","newBillingAddressFromExpressCheckout","newShippingAddressFromExpressCheckout","newEmailAddressFromExpressCheckout","newShouldEnableExpressCheckoutInCheckout","newShouldEnableExpressCheckoutInCart","newIsExpressCheckoutApplied","newIsExpressAddressApplied","newIsExpressCheckoutAppliedInCartPage","newIsBillingAddressHasError","newIsExpressPaymentModulesReady","newCheckoutError","setCheckoutGenericData","getCheckoutGenericData","newCheckoutErrorFocus","newShouldFocusOnCheckoutError","setInitialData","cleanCheckoutData","removeCheckoutCartData","isPaymentVerificationRedirection","_window$sessionStorag","getCheckoutCartData","get","getItem","__decorate","observable","computed","_isProductAddedToCart","total","num","some","_doAsyncAction","refreshCartInternal","_input$catalogId","_input$product$Behavi","product","RecordId","DefaultUnitOfMeasure","isPriceKeyedIn","IsGiftCard","customPrice","location","retailMultiplePickupModeEnabled","OrgUnitNumber","InventoryLocationId","_buildAddressFromOrgUnitLocation","isAddEmailDeliveryItemToCart","ItemTypeValue","ReleasedProductType","Service","Behavior","MaximumQuantity","_doCartOperationWithRetry","internalInput","_inputItem$catalogId","_this$actionContext$r","PRODUCTASSERVICE","isStockCheckEnabled","invoiceIds","addInvoicesAsync","addInvoicesToCartInternal","invoiceId","lineDescription","addOrderInvoiceAsync","addOrderInvoiceToCartInternal","setInvoiceLinePriceInternal","cartLineId","price","removeCartLineInternal","clearCartLineDeliveryModeInternal","channelDeliveryOptionConfiguration","cartLineDeliverySpecification","DeliverySpecification","DeliveryModeId","DeliveryPreferenceTypeValue","PickUpStoreId","DeliveryAddress","lineDeliverySpecifications","deliveryModeId","trim","cartLinesForShipping","_input$channelDeliver","deliverySpecifications","_input$additionalProp2","updateCartLineQuantityInternal","newQuantity","isUsingDefaultOrderSettingsMax","updateLoyaltyCardIdInternal","addPromoCode","addPromoCodeInternal","promoCode","removePromoCodesInternal","removeAllPromoCodesInternal","email","newCartObject","callback","callbackResult","refreshCart","PostalAddressId","OrgUnitName","FullAddress","Address","Street","StreetNumber","City","DistrictName","BuildingCompliment","Postbox","ThreeLetterISORegionName","Country","ZipCode","Zip","County","CountyName","State","StateName","lambda","console","reject","hasPromoCode","addDiscountCodeAsync","code","toLowerCase","includes","setInvoiceLinePriceAsync","errorInstance","clearCartLineDeliveryMode","copyCartLine","InventLocation","cartStateDataAction","ErrorCode","ErrorMessageResource","ErrorLocation","CheckoutModule","updateCartLineQuantityValidateMaxAgainstDefaultOrderSettings","updateCartLineQuantityValidateMaxAgainstSiteSettings"],"mappings":";iPAwB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EAAWkI,OAAQ,SAAUM,UAAW,qBAG3D,MAAM0a,EAAY9c,EAAA,GAAkBoL,EAAc,IAGlD,OAFA0R,EAAa1d,SAAW0D,KAAKC,IAAIqX,EAAazY,EAAc9I,eAAeiM,IAAIC,OAAOtC,4BAA8B,IAE7GuI,+BAAqB,CAAE/P,cAAe0G,GAAiB9H,EAAKC,GAAI,CAACgjB,GAAe,MAClFjb,KAAKlF,IACgC,CAAE9C,KAAM8C,EAASmF,OAAQ,aAE9DC,MAAM3G,IAAQ,IAAAyI,EAGX,OAFAlC,EAAcrG,UAAU0G,QAAQ5G,GAChCuG,EAAcrG,UAAUiH,MAAM,8BACI,CAC9B1I,UAAMD,EACNkI,OAAQ,SAERG,aAAc,CAAEC,iBAAkB9G,EAAM+G,SACxC4B,kBAA6B,QAAZF,EAAEzI,EAAM4I,YAAI,IAAAH,OAAA,EAAVA,EAAYI,qBAxFpCqZ,CAAqDzjB,EAAMof,EAAYmB,EAAazY","file":"static/js/5.a80a3de650a424bd61fc.chunk.js","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext,\n IRequestContext\n} from '@msdyn365-commerce/core';\nimport { Cart } from '@msdyn365-commerce/retail-proxy';\n\nimport { ICartState } from '../state-interfaces';\nimport { getCartState } from './get-cart-state';\n\n/**\n * Input class for getCart data action.\n */\nexport class GetCartStateDataInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n private readonly catalogId?: number;\n\n constructor(apiSettings: ICommerceApiSettings, requestContext?: IRequestContext) {\n this.apiSettings = apiSettings;\n if (requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n public getCacheKey = () => `GetCart-ChannelId:${this.apiSettings.channelId}-CatalogId:${this.catalogId ?? 0}`;\n\n public getCacheObjectType = () => 'Cart';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nconst createInput = (inputData: ICreateActionContext) => {\n return new GetCartStateDataInput(inputData.requestContext.apiSettings, inputData.requestContext);\n};\n\n/**\n * Data action to copy the cart for actions.\n * @param input\n * @param ctx\n */\nexport async function getCartStateData(input: GetCartStateDataInput, ctx: IActionContext): Promise {\n const cartState = await getCartState(ctx);\n if (cartState && cartState.cart.Id !== undefined) {\n return cartState;\n }\n\n return undefined;\n}\n\nexport default createObservableDataAction({\n id: '@msdyn365-commerce/global-state/get-cart-state-data',\n action: >getCartStateData,\n input: createInput\n});\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { FeatureState } from '@msdyn365-commerce/retail-proxy';\nimport {\n addCartLinesAsync,\n addCouponsAsync,\n createCartAsync,\n readAsync,\n removeCartLinesAsync,\n searchAsync,\n updateAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport {\n getChannelDeliveryOptionConfigurationAsync,\n getCustomerLoyaltyCardsAsync,\n getFeatureStatesAsync\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\nimport {\n Cart,\n CartLine,\n CartSearchCriteria,\n Coupon,\n QueryResultSettings\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport isEmpty from 'lodash/isEmpty';\n\nenum CartTokenPrefix {\n Auth = 't',\n Anon = 'p'\n}\n\nexport default async function getOrCreateActiveCart(ctx: IActionContext): Promise {\n let cart: Cart | undefined;\n const cartCookie: string = ctx.requestContext.cookies.getCartCookie();\n const cartCookieParts: string[] = cartCookie.split(':');\n try {\n // Check if there are already is a cart cookie and it is in the format we understand\n cart = await getCartFromCookie(cartCookieParts, ctx);\n const wasReadFromCookie = !!cart && cart.Id;\n\n // If the customer is authenticated, and the auth cookie didn't give us a cart OR doesn't have a cookie, search for the customer's cart\n if (!(cart && cart.Id)) {\n cart = await getCartFromCustomer(ctx);\n }\n\n // If the customer just went from anon to signed in state then get that anon cart\n // if the search of carts didn't result in a cart, claim the current anon cart as a new auth cart for the customer\n // if the search resulted in a cart, and the read also resulted in cart, then go ahead an merge the carts\n const anonCart = await claimAnonCart(cartCookieParts, cart, ctx);\n if (anonCart) {\n cart = anonCart;\n }\n\n // If there is no cookie or everything else fails, create an empty cart and return that for the customer\n if (!(cart && cart.Id)) {\n cart = await createNewCart(ctx);\n }\n if (!wasReadFromCookie && ctx.requestContext.user.isAuthenticated && cart && !cart.LoyaltyCardId) {\n const card = await getCustomerLoyaltyCardsAsync({ callerContext: ctx, queryResultSettings: {} }, null);\n if (card && card.length > 0) {\n cart = await updateAsync(\n { callerContext: ctx },\n {\n Id: cart.Id,\n LoyaltyCardId: card[0].CardNumber\n }\n );\n }\n }\n } catch (error) {\n ctx.telemetry.error(`Caught exception in getting cart: ${error}`);\n cart = await createNewCart(ctx);\n }\n return cart;\n}\n\n/**\n * Function to check cart exception due to product no available\n *\n * @param ctx Request context.\n * @param errorObj Error Object.\n */\nfunction handleItemDiscontinuedException(ctx: IActionContext, errorObj: object): boolean {\n const error = errorObj as Error;\n let response = false;\n if (error && error.name === 'Microsoft_Dynamics_Commerce_Runtime_ItemDiscontinuedFromChannel') {\n ctx.telemetry.information('Caught cart ItemDiscontinuedException error.');\n response = true;\n }\n\n return response;\n}\n\nexport async function createNewCart(ctx: IActionContext): Promise {\n const newCart = await createCartAsync({ callerContext: ctx }, {});\n if (newCart && newCart.Id) {\n ctx.requestContext.cookies.setCartCookie(newCart, ctx.requestContext.user.isAuthenticated);\n\n return newCart;\n }\n\n return undefined;\n}\n\nexport async function getCartFromCookie(cartCookieParts: string[], ctx: IActionContext): Promise {\n let readCart: Cart | undefined;\n let readCartId: string = '';\n\n const isAuthenticated = ctx.requestContext.user.isAuthenticated;\n if (cartCookieParts && cartCookieParts.length === 2) {\n // If the customer is authenticated and they have an auth cookie\n // OR if the customer is not authenticated and then have an anon cookie\n // just get the cart and return that\n\n if (\n (isAuthenticated && cartCookieParts[0] === CartTokenPrefix.Auth) ||\n (!isAuthenticated && cartCookieParts[0] === CartTokenPrefix.Anon)\n ) {\n try {\n readCartId = cartCookieParts[1];\n const readCart = await readAsync({ callerContext: ctx, bypassCache: 'none' }, cartCookieParts[1]);\n\n if (readCart && readCart.Id) {\n ctx.requestContext.cookies.setCartCookie(readCart, ctx.requestContext.user.isAuthenticated);\n return readCart;\n }\n } catch (error) {\n if (handleItemDiscontinuedException(ctx, error)) {\n readCart = await readAsync({ callerContext: ctx, bypassCache: 'none' }, readCartId);\n }\n ctx.telemetry.error('Error getting cart based on saved card id');\n ctx.telemetry.exception(error);\n }\n }\n }\n\n return readCart;\n}\n\nexport async function getCartFromCustomer(ctx: IActionContext): Promise {\n if (ctx.requestContext.user.isAuthenticated) {\n const authCarts = await searchCarts(ctx);\n if (authCarts && authCarts.length > 0) {\n ctx.requestContext.cookies.setCartCookie(authCarts[0], ctx.requestContext.user.isAuthenticated);\n return authCarts[0];\n }\n }\n\n return undefined;\n}\n\nexport async function claimAnonCart(\n cartCookieParts: string[],\n currentCart: Cart | undefined,\n ctx: IActionContext\n): Promise {\n let anonCurrentCart: Cart | undefined;\n\n if (\n ctx.requestContext.user.isAuthenticated &&\n cartCookieParts &&\n cartCookieParts.length === 2 &&\n cartCookieParts[0] === CartTokenPrefix.Anon\n ) {\n try {\n anonCurrentCart = await readAsync({ callerContext: ctx, bypassCache: 'none' }, cartCookieParts[1]);\n } catch (error) {\n if (handleItemDiscontinuedException(ctx, error)) {\n anonCurrentCart = await readAsync({ callerContext: ctx, bypassCache: 'none' }, cartCookieParts[1]);\n }\n }\n\n if (anonCurrentCart && !currentCart) {\n const newCart = await claimCart(anonCurrentCart.Id, ctx);\n if (newCart && newCart.Id) {\n ctx.requestContext.cookies.setCartCookie(newCart, ctx.requestContext.user.isAuthenticated);\n return newCart;\n }\n }\n\n if (anonCurrentCart && anonCurrentCart.Id && currentCart) {\n const mergedCart = await addCartLines(anonCurrentCart, currentCart, ctx);\n\n // Once updated, take that merged cart ID and store the cart ID in the cookie\n if (!(mergedCart instanceof Error) && mergedCart.Id) {\n ctx.requestContext.cookies.setCartCookie(mergedCart, ctx.requestContext.user.isAuthenticated);\n return mergedCart;\n }\n }\n }\n\n return undefined;\n}\n\n/**\n * Function that copies a cartline for giftcard.\n * @param cartline Source CartLine you want to copy.\n */\nfunction buildGiftCardLine(cartline: CartLine): CartLine {\n return {\n DeliveryMode: cartline.DeliveryMode,\n CatalogId: cartline.CatalogId,\n Description: cartline.Description,\n EntryMethodTypeValue: cartline.EntryMethodTypeValue || 3,\n ItemId: cartline.ItemId,\n ProductId: cartline.ProductId,\n Quantity: cartline.Quantity,\n Price: cartline.Price,\n NetPrice: cartline.NetPrice,\n GiftCardBalance: cartline.GiftCardBalance,\n TrackingId: '',\n UnitOfMeasureSymbol: cartline.UnitOfMeasureSymbol,\n IsPriceKeyedIn: true,\n IsGiftCardLine: true,\n ExtensionProperties: cartline.ExtensionProperties\n };\n}\n\n/**\n * Function that adds cart lines from source cart to destination cart.\n * @param sourceCart Source cart you want to add cart lines from.\n * @param destinationCart Destination cart that you want to add cart lines to.\n * @param ctx Request context.\n */\nexport async function addCartLines(sourceCart: Cart, destinationCart: Cart, ctx: IActionContext): Promise {\n let updatedCart;\n const cartLines: CartLine[] = [];\n const cartLinesToDelete: string[] = [];\n let hasShippingMethod: boolean;\n const channelConfiguration = ctx.requestContext.channel;\n const featureNames: string[] = ['Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature'];\n if (destinationCart.Version) {\n if (sourceCart.CartLines && sourceCart.CartLines.length > 0) {\n for (const cartline of sourceCart.CartLines) {\n let newCartLine: CartLine;\n\n if (cartline.IsGiftCardLine) {\n newCartLine = buildGiftCardLine(cartline);\n } else {\n newCartLine = {};\n const featureStates = await getFeatureStatesAsync({ callerContext: ctx }, featureNames);\n const isfeatureStatesEnabled =\n featureStates?.find(\n (featureState: FeatureState) =>\n featureState.Name === 'Dynamics.AX.Application.RetailMultiplePickupDeliveryModeFeature'\n )?.IsEnabled || false;\n if (isfeatureStatesEnabled) {\n const channelDeliveryOptionConfig = await getChannelDeliveryOptionConfigurationAsync({ callerContext: ctx });\n hasShippingMethod =\n cartline.DeliveryMode ===\n channelDeliveryOptionConfig.PickupDeliveryModeCodes?.find(\n (deliveryMode: string) => deliveryMode === cartline.DeliveryMode\n );\n\n if (cartline.DeliveryMode !== undefined && hasShippingMethod) {\n newCartLine.DeliveryMode = cartline.DeliveryMode;\n newCartLine.FulfillmentStoreId = cartline.FulfillmentStoreId;\n newCartLine.ShippingAddress = cartline.ShippingAddress;\n newCartLine.WarehouseId = cartline.WarehouseId;\n }\n } else if (!isEmpty(cartline.DeliveryMode) && cartline.DeliveryMode === channelConfiguration?.PickupDeliveryModeCode) {\n newCartLine.DeliveryMode = channelConfiguration?.PickupDeliveryModeCode;\n newCartLine.FulfillmentStoreId = cartline.FulfillmentStoreId;\n newCartLine.ShippingAddress = cartline.ShippingAddress;\n newCartLine.WarehouseId = cartline.WarehouseId;\n }\n newCartLine.ProductId = cartline.ProductId;\n newCartLine.Quantity = cartline.Quantity;\n newCartLine.ExtensionProperties = cartline.ExtensionProperties;\n newCartLine.Description = cartline.Description;\n newCartLine.ReasonCodeLines = cartline.ReasonCodeLines;\n newCartLine.AttributeValues = cartline.AttributeValues;\n newCartLine.CatalogId = cartline.CatalogId;\n newCartLine.EntryMethodTypeValue = cartline.EntryMethodTypeValue;\n newCartLine.ItemId = cartline.ItemId;\n\n // without unitofmeasure cartline wont be aggregated in customer cart.\n newCartLine.UnitOfMeasureSymbol = cartline.UnitOfMeasureSymbol;\n if (cartline.IsPriceKeyedIn) {\n newCartLine.Price = cartline.Price;\n newCartLine.IsPriceKeyedIn = cartline.IsPriceKeyedIn;\n }\n }\n\n cartLines.push({ ...newCartLine });\n if (cartline.LineId) {\n cartLinesToDelete.push(cartline.LineId);\n }\n }\n }\n\n if (cartLines.length > 0) {\n try {\n updatedCart = await addCartLinesAsync({ callerContext: ctx }, destinationCart.Id, cartLines, destinationCart.Version);\n\n if (cartLinesToDelete.length > 0) {\n sourceCart = await removeCartLinesAsync({ callerContext: ctx }, sourceCart.Id, cartLinesToDelete);\n }\n } catch (error) {\n ctx.telemetry.error('Error adding cart lines to desination cart');\n ctx.telemetry.exception(error);\n return destinationCart;\n }\n }\n\n // Copy over coupon codes from source cart to destination cart so that the customer doesn't lose couponCodes while migration\n if (sourceCart.Coupons && sourceCart.Coupons.length > 0) {\n const coupons = sourceCart.Coupons.map((coupon: Coupon) => {\n return coupon.Code!;\n });\n\n try {\n updatedCart = await addCouponsAsync({ callerContext: ctx }, destinationCart.Id, coupons, false);\n } catch (error) {\n ctx.telemetry.error('Error adding existing coupon codes to the cart');\n ctx.telemetry.exception(error);\n return destinationCart;\n }\n }\n }\n\n return updatedCart || destinationCart;\n}\n\n/**\n * Function to claim a cart as auth cart and set the browser cookie accordingly.\n *\n * @param cartId Cart Id to claim as auth cart.\n * @param ctx Request Context.\n */\nexport async function claimCart(cartId: string, ctx: IActionContext): Promise {\n const claimAuthCart = await updateAsync(\n { callerContext: ctx },\n {\n Id: cartId\n }\n );\n if (!(claimAuthCart instanceof Error) && claimAuthCart && claimAuthCart.Id) {\n return claimAuthCart;\n }\n return {};\n}\n\n/**\n * Function to search carts that belong to a customer.\n *\n * @param ctx Request context.\n */\nexport async function searchCarts(ctx: IActionContext): Promise {\n const cartSearchCriteria: CartSearchCriteria = {\n IncludeAnonymous: false,\n CartTypeValue: 1\n };\n\n const queryResultSettings: QueryResultSettings = {\n Paging: {\n Top: 1,\n Skip: 0\n },\n Sorting: {\n Columns: [\n {\n ColumnName: 'ModifiedDateTime',\n IsDescending: true\n }\n ]\n }\n };\n\n return searchAsync({ callerContext: ctx, queryResultSettings }, cartSearchCriteria);\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { removeDiscountCodesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function removePromoCodes(\n cart: Readonly,\n promoCodes: string[],\n actionContext: IActionContext\n): Promise {\n if (!cart) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n return removeDiscountCodesAsync({ callerContext: actionContext }, cart.Id, promoCodes)\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch(error => {\n actionContext.telemetry.warning(error);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nexport * from './add-product-to-cart';\nexport * from './add-promo-code';\nexport * from './base-cart-state';\nexport * from './cart-action-result';\nexport * from './clear-cart-line-delivery-mode';\nexport * from './clear-cart-lines-delivery-information';\nexport * from './get-or-create-active-cart';\nexport * from './refresh-cart';\nexport * from './remove-all-promo-codes';\nexport * from './remove-cart-lines';\nexport * from './remove-promo-codes';\nexport * from './set-invoice-line-price';\nexport * from './update-cart';\nexport * from './update-cart-line-delivery-specifications';\nexport * from './update-cart-line-quantity';\nexport * from './update-loyalty-card-id';\nexport * from './update-shipping-address';\nexport * from './update-cart-lines';\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function updateLoyaltyCardId(\n cart: Readonly,\n newLoyaltyCardId: string,\n actionContext: IActionContext\n): Promise {\n if (!cart) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n return updateAsync(\n { callerContext: actionContext },\n {\n Id: cart.Id,\n LoyaltyCardId: newLoyaltyCardId\n }\n )\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch(error => {\n actionContext.telemetry.warning(error);\n actionContext.telemetry.debug('Unable to update loyalty card id');\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { addCartLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart, CartLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\n/**\n * Get the quantity limit.\n * @param maxQuantityForCartLineItem - Max quantity for cart line.\n * @param inputItem - The input item.\n * @param inputItem.cartLineToAdd - Cart line to add.\n * @param inputItem.availableQuantity - Available quantity.\n * @param inputItem.shouldEnableStockCheck - Is stock check enabled.\n * @param inputItem.isAddServiceItemToCart - Is add service item to cart.\n * @returns The quantity limit.\n */\nfunction getQuantityLimit(\n maxQuantityForCartLineItem: number | undefined,\n inputItem: {\n cartLineToAdd: CartLine;\n availableQuantity?: number;\n shouldEnableStockCheck?: boolean;\n isAddServiceItemToCart?: boolean;\n }\n): number {\n let quantityLimit: number;\n const defaultSiteMaxQuantity = 10;\n\n if (inputItem.shouldEnableStockCheck === false) {\n quantityLimit = maxQuantityForCartLineItem ?? defaultSiteMaxQuantity;\n } else if (maxQuantityForCartLineItem === undefined && inputItem.availableQuantity === undefined) {\n quantityLimit = defaultSiteMaxQuantity;\n } else if (inputItem.availableQuantity === undefined) {\n quantityLimit = maxQuantityForCartLineItem ?? defaultSiteMaxQuantity;\n } else if (maxQuantityForCartLineItem === undefined) {\n quantityLimit = inputItem.availableQuantity;\n } else {\n quantityLimit = Math.min(maxQuantityForCartLineItem, inputItem.availableQuantity);\n }\n\n return quantityLimit;\n}\n\n/**\n * Get the index of the item to add.\n * @param lines - The cart lines.\n * @param cartLineToAdd - The cart line to add.\n * @returns The index of the item to add.\n */\nfunction getElementIndex(lines: CartLine[], cartLineToAdd: CartLine): number {\n let elementFoundAt: number = -1;\n const productIdToFind = cartLineToAdd.ProductId;\n\n for (const [index, line] of lines.entries()) {\n if (\n line.ProductId === productIdToFind &&\n (line.DeliveryMode || '') === (cartLineToAdd.DeliveryMode || '') &&\n (line.FulfillmentStoreId || '') === (cartLineToAdd.FulfillmentStoreId || '')\n ) {\n elementFoundAt = index;\n\n break;\n }\n }\n\n return elementFoundAt;\n}\n\nasync function addProductsToCartValidateMaxAgainstDefaultOrderSettings(\n cart: Readonly,\n actionContext: IActionContext,\n input: {\n cartLineToAdd: CartLine;\n availableQuantity?: number;\n enableStockCheck?: boolean;\n isAddServiceItemToCart?: boolean;\n }[]\n): Promise {\n if (!cart.CartLines) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n for (const inputItem of input) {\n if (inputItem.enableStockCheck && inputItem.availableQuantity) {\n let elementFoundAt: number = -1;\n const productIdToFind = inputItem.cartLineToAdd.ProductId;\n\n for (let i = 0; i < cart.CartLines.length; i++) {\n if (\n cart.CartLines[i].ProductId === productIdToFind &&\n (cart.CartLines[i].DeliveryMode || '') === (inputItem.cartLineToAdd.DeliveryMode || '') &&\n (cart.CartLines[i].FulfillmentStoreId || '') === (inputItem.cartLineToAdd.FulfillmentStoreId || '')\n ) {\n elementFoundAt = i;\n\n break;\n }\n }\n\n if (!inputItem.isAddServiceItemToCart && elementFoundAt !== -1) {\n const cartLineToUpdate = { ...cart.CartLines[elementFoundAt] };\n const curQuantity = cartLineToUpdate.Quantity || 0;\n\n if (curQuantity + (inputItem.cartLineToAdd.Quantity || 1) > inputItem.availableQuantity) {\n return {\n cart: {\n Id: cart.Id,\n CartLines: cart.CartLines\n },\n status: 'FAILED',\n substatus: 'MAXQUANTITY'\n };\n }\n }\n }\n }\n\n const newCartLines = input.map(inputItem => {\n const cartLine = { ...inputItem.cartLineToAdd };\n return cartLine;\n });\n let addCartLinesResult: ICartActionResultWithCart;\n\n if (cart.Version) {\n return addCartLinesAsync({ callerContext: actionContext }, cart.Id, newCartLines, cart.Version)\n .then(newCart => {\n addCartLinesResult = { cart: newCart, status: 'SUCCESS', substatus: 'PRODUCTADDED' };\n return addCartLinesResult;\n })\n .catch(error => {\n actionContext.telemetry.trace(error);\n actionContext.telemetry.trace('Unable to add Cart Line');\n\n if (\n error.name === 'Microsoft_Dynamics_Commerce_Runtime_AddingItem_ExceedsMaximumQuantity' ||\n error.name === 'Microsoft_Dynamics_Commerce_Runtime_UpdatingItem_ExceedsMaximumQuantity'\n ) {\n addCartLinesResult = {\n cart: undefined,\n status: 'FAILED',\n substatus: 'QUANTITYLIMITS',\n errorDetails: { LocalizedMessage: error.message }\n };\n return addCartLinesResult;\n }\n\n const hasInvoiceInCart = cart.CartLines?.find(cartline => cartline.IsInvoiceLine === true);\n if (hasInvoiceInCart) {\n addCartLinesResult = {\n cart: undefined,\n status: 'FAILED',\n substatus: 'INVOICEINCART',\n errorDetails: { LocalizedMessage: error.message }\n };\n return addCartLinesResult;\n }\n\n addCartLinesResult = {\n cart: undefined,\n status: 'FAILED',\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n errorDetails: { LocalizedMessage: error.message },\n validationResults: error.data?.ValidationResults\n };\n\n return addCartLinesResult;\n });\n }\n actionContext.telemetry.warning('Unable to update Cart Line, Cart Version could not be found');\n\n addCartLinesResult = { cart: undefined, status: 'FAILED', substatus: 'NOCARTVERSION' };\n return addCartLinesResult;\n}\n\nasync function addProductsToCartValidateMaxAgainstSiteSettings(\n cart: Readonly,\n actionContext: IActionContext,\n input: {\n cartLineToAdd: CartLine;\n availableQuantity?: number;\n enableStockCheck?: boolean;\n isAddServiceItemToCart?: boolean;\n }[]\n): Promise {\n if (!cart.CartLines) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n const maxQuantityForCartLineItem: number | undefined = actionContext.requestContext.app.config.maxQuantityForCartLineItem;\n\n for (const inputItem of input) {\n const quantityLimit: number = getQuantityLimit(maxQuantityForCartLineItem, {\n cartLineToAdd: inputItem.cartLineToAdd,\n availableQuantity: inputItem.availableQuantity,\n shouldEnableStockCheck: inputItem.enableStockCheck,\n isAddServiceItemToCart: inputItem.isAddServiceItemToCart\n });\n const elementFoundAt: number = getElementIndex(cart.CartLines, inputItem.cartLineToAdd);\n\n if (!inputItem.isAddServiceItemToCart && elementFoundAt !== -1) {\n const cartLineToUpdate = { ...cart.CartLines[elementFoundAt] };\n const currentQuantity = cartLineToUpdate.Quantity || 0;\n\n if (currentQuantity + (inputItem.cartLineToAdd.Quantity || 1) > quantityLimit) {\n return {\n cart: {\n Id: cart.Id,\n CartLines: cart.CartLines\n },\n status: 'FAILED',\n substatus: 'MAXQUANTITY'\n };\n }\n }\n\n if (\n !inputItem.isAddServiceItemToCart &&\n inputItem.cartLineToAdd &&\n inputItem.cartLineToAdd.Quantity &&\n inputItem.cartLineToAdd.Quantity > quantityLimit\n ) {\n return {\n cart: {\n Id: cart.Id,\n CartLines: cart.CartLines\n },\n status: 'FAILED',\n substatus: 'MAXQUANTITY'\n };\n }\n }\n\n const newCartLines = input.map(inputItem => {\n const cartLine = { ...inputItem.cartLineToAdd };\n cartLine.Quantity = cartLine.Quantity || 1;\n return cartLine;\n });\n let cartActionResult: ICartActionResultWithCart;\n\n if (cart.Version) {\n return addCartLinesAsync({ callerContext: actionContext }, cart.Id, newCartLines, cart.Version)\n .then(newCart => {\n cartActionResult = { cart: newCart, status: 'SUCCESS', substatus: 'PRODUCTADDED' };\n return cartActionResult;\n })\n .catch(error => {\n actionContext.telemetry.trace(error);\n actionContext.telemetry.trace('Unable to add Cart Line');\n\n const hasInvoiceInCart = cart.CartLines?.find(cartline => cartline.IsInvoiceLine === true);\n if (hasInvoiceInCart) {\n cartActionResult = {\n cart: undefined,\n status: 'FAILED',\n substatus: 'INVOICEINCART',\n errorDetails: { LocalizedMessage: error.message }\n };\n return cartActionResult;\n }\n\n cartActionResult = {\n cart: undefined,\n status: 'FAILED',\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n errorDetails: { LocalizedMessage: error.message },\n validationResults: error.data?.ValidationResults\n };\n return cartActionResult;\n });\n }\n actionContext.telemetry.warning('Unable to update Cart Line, Cart Version could not be found');\n\n cartActionResult = { cart: undefined, status: 'FAILED', substatus: 'NOCARTVERSION' };\n return cartActionResult;\n}\n\n/**\n * Add products to cart without site settings validation.\n * @param cart - The cart.\n * @param actionContext - The action context.\n * @param input - The cart lines to add.\n * @returns The results.\n */\nasync function addProductsToCartWithoutSiteSettings(\n cart: Readonly,\n actionContext: IActionContext,\n input: {\n cartLineToAdd: CartLine;\n }[]\n): Promise {\n if (!cart.CartLines) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n const defaultQuantity = 1;\n const newCartLines = input.map(inputItem => {\n const cartLine = { ...inputItem.cartLineToAdd };\n cartLine.Quantity = cartLine.Quantity ?? defaultQuantity;\n return cartLine;\n });\n let addCartLinesResult: ICartActionResultWithCart;\n\n if (cart.Version) {\n return addCartLinesAsync({ callerContext: actionContext }, cart.Id, newCartLines, cart.Version)\n .then(newCart => {\n addCartLinesResult = { cart: newCart, status: 'SUCCESS', substatus: 'PRODUCTADDED' };\n return addCartLinesResult;\n })\n .catch(error => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- existing error type.\n actionContext.telemetry.trace(error);\n actionContext.telemetry.trace('Unable to add cart lines');\n\n addCartLinesResult = {\n cart: undefined,\n status: 'FAILED',\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n errorDetails: { LocalizedMessage: error.message },\n validationResults: error.data?.ValidationResults\n };\n return addCartLinesResult;\n });\n }\n\n actionContext.telemetry.warning('Unable to update cart lines, cart version could not be found');\n\n addCartLinesResult = { cart: undefined, status: 'FAILED', substatus: 'NOCARTVERSION' };\n return addCartLinesResult;\n}\n\nexport async function addProductsToCartInternal(\n cart: Readonly,\n actionContext: IActionContext,\n input: {\n cartLineToAdd: CartLine;\n availableQuantity?: number;\n isStockCheckEnabled?: boolean;\n isAddServiceItemToCart?: boolean;\n }[]\n): Promise {\n return addProductsToCartWithoutSiteSettings(cart, actionContext, input);\n}\n\nexport async function addProductToCartInternal(\n cart: Readonly,\n cartLineToAdd: CartLine,\n actionContext: IActionContext,\n orderQuantityLimitsFeatureIsEnabled: boolean,\n availableQuantity?: number,\n enableStockCheck?: boolean,\n isAddServiceItemToCart?: boolean,\n isMaxByQuantityValidationFeatureDefined?: boolean,\n shouldSkipSiteSettings?: boolean\n): Promise {\n if (shouldSkipSiteSettings) {\n return addProductsToCartWithoutSiteSettings(cart, actionContext, [{ cartLineToAdd }]);\n }\n\n // Using max from the default order settings if it's defined there and quantity limits feature is enabled.\n // Otherwise use max from site settings or default max 10.\n if (isMaxByQuantityValidationFeatureDefined && orderQuantityLimitsFeatureIsEnabled) {\n return addProductsToCartValidateMaxAgainstDefaultOrderSettings(cart, actionContext, [\n { cartLineToAdd, availableQuantity, enableStockCheck, isAddServiceItemToCart }\n ]);\n }\n return addProductsToCartValidateMaxAgainstSiteSettings(cart, actionContext, [\n { cartLineToAdd, availableQuantity, enableStockCheck, isAddServiceItemToCart }\n ]);\n}\n\nexport default addProductToCartInternal;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { removeDiscountCodesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function removeAllPromoCodes(\n cart: Readonly,\n actionContext: IActionContext\n): Promise {\n if (!cart) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n if (cart.Coupons && cart.Coupons.length > 0) {\n const promoCodes = cart.Coupons.map(coupon => {\n return coupon.Code || '';\n });\n\n return removeDiscountCodesAsync({ callerContext: actionContext }, cart.Id, promoCodes)\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch(error => {\n actionContext.telemetry.warning(error);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\n });\n }\n\n return { cart, status: 'SUCCESS' };\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { BaseCartState } from '../cart-state/base-cart-state';\nimport { ICartState } from '../state-interfaces/i-cart-state';\nimport createGlobalStateDataAction from './global-state-data-action';\n\nexport default createGlobalStateDataAction('CARTSTATE', BaseCartState);\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext\n} from '@msdyn365-commerce/core';\nimport { Cart } from '@msdyn365-commerce/retail-proxy';\nimport { copyAsync, readAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\n\nimport { getCartState } from './get-cart-state';\n\n/**\n * Input class for getCheckoutCart data action.\n */\nexport class GetCheckoutCartInput implements IActionInput {\n private readonly apiSettings: ICommerceApiSettings;\n\n constructor(apiSettings: ICommerceApiSettings) {\n this.apiSettings = apiSettings;\n }\n\n public getCacheKey = () => `CheckoutCart-ChannelId:${this.apiSettings.channelId}-ApiSettingsCatalogId:${this.apiSettings.catalogId}`;\n\n public getCacheObjectType = () => 'CheckoutCart';\n\n public dataCacheType = (): CacheType => 'request';\n}\n\nenum CartTokenPrefix {\n Auth = 't',\n Anon = 'p'\n}\n\nconst createInput = (inputData: ICreateActionContext) => {\n return new GetCheckoutCartInput(inputData.requestContext.apiSettings);\n};\n\n/**\n * Data action to copy the cart for checkout actions.\n * @param input\n * @param ctx\n */\nexport async function getCheckoutCart(input: GetCheckoutCartInput, ctx: IActionContext): Promise {\n const savedCheckoutCartId = ctx.requestContext.cookies.getCheckoutCartCookie();\n const cartCookieParts: string[] = savedCheckoutCartId.split(':');\n let checkoutCartId = null;\n const isAuthenticated = ctx.requestContext.user.isAuthenticated;\n\n if (\n (isAuthenticated && cartCookieParts[0] === CartTokenPrefix.Auth) ||\n (!isAuthenticated && cartCookieParts[0] === CartTokenPrefix.Anon)\n ) {\n checkoutCartId = cartCookieParts[1];\n }\n\n let checkoutCart: Cart | undefined;\n\n if (checkoutCartId) {\n try {\n checkoutCart = await readAsync({ callerContext: ctx, bypassCache: 'none' }, checkoutCartId);\n } catch (error) {\n ctx.telemetry.error('Error getting checkout cart based on saved checkout card id');\n ctx.telemetry.exception(error);\n }\n }\n\n const cartState = await getCartState(ctx);\n if (cartState && cartState.cart.Id !== undefined) {\n if (checkoutCart && checkoutCart.Version && cartState.cart.Version && checkoutCart.Version > cartState.cart.Version) {\n return Promise.resolve(checkoutCart);\n }\n\n return copyAsync({ callerContext: ctx }, cartState.cart.Id, 2)\n .then(cart => {\n ctx.requestContext.cookies.setCheckoutCartCookie(cart, isAuthenticated);\n return cart;\n })\n .catch(error => {\n ctx.telemetry.error('Error copying cart');\n ctx.telemetry.exception(error);\n return undefined;\n });\n }\n\n return undefined;\n}\n\nexport const getCheckoutCartDataAction = createObservableDataAction({\n id: '@msdyn365-commerce/global-state/get-checkout-cart',\n action: >getCheckoutCart,\n input: createInput\n});\n\nexport default getCheckoutCartDataAction;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\n\nexport declare type GlobalStateStatus = 'READY' | 'UPDATING' | 'ERROR';\n\nexport type GlobalStateConstructor = new (actionContext: IActionContext) => T;\n\nexport function createGlobalState(ctor: GlobalStateConstructor, actionContext: IActionContext): T {\n return new ctor(actionContext);\n}\n\nexport interface IGlobalState {\n readonly status: GlobalStateStatus;\n\n initialize(): Promise;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nexport * from './global-state';\nexport * from './i-action-result';\nexport * from './i-global-state';\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { updateLineDeliverySpecificationsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart, LineDeliverySpecification } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function updateCartLineDeliverySpecificationsInternal(\n cart: Readonly,\n cartLineDeliverySpecifications: LineDeliverySpecification[],\n actionContext: IActionContext\n): Promise {\n if (!cart || !cart.CartLines || cartLineDeliverySpecifications.length === 0) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n return updateLineDeliverySpecificationsAsync({ callerContext: actionContext }, cart.Id, cartLineDeliverySpecifications)\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch(error => {\n actionContext.telemetry.warning(error);\n actionContext.telemetry.debug('Unable to updateLineDeliverySpecificationsAsync');\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { BaseCartState } from '../cart-state/base-cart-state';\nimport getCheckoutCart, { GetCheckoutCartInput } from '../data-actions/get-checkout-cart';\n\n/**\n * Version of BaseCartState that uses the checkout cart.\n */\nexport class BaseCheckoutCartState extends BaseCartState {\n public async initialize(): Promise {\n if (this.isInitialized) {\n return;\n }\n\n const newCart = await getCheckoutCart(new GetCheckoutCartInput(this.actionContext.requestContext.apiSettings), this.actionContext);\n\n if (newCart) {\n this._cart = newCart;\n this._status = 'READY';\n } else {\n this._status = 'ERROR';\n }\n\n this.isInitialized = true;\n }\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\nvar thisNumberValue = require('../internals/this-number-value');\nvar $repeat = require('../internals/string-repeat');\nvar fails = require('../internals/fails');\n\nvar $RangeError = RangeError;\nvar $String = String;\nvar floor = Math.floor;\nvar repeat = uncurryThis($repeat);\nvar stringSlice = uncurryThis(''.slice);\nvar nativeToFixed = uncurryThis(1.0.toFixed);\n\nvar pow = function (x, n, acc) {\n return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);\n};\n\nvar log = function (x) {\n var n = 0;\n var x2 = x;\n while (x2 >= 4096) {\n n += 12;\n x2 /= 4096;\n }\n while (x2 >= 2) {\n n += 1;\n x2 /= 2;\n } return n;\n};\n\nvar multiply = function (data, n, c) {\n var index = -1;\n var c2 = c;\n while (++index < 6) {\n c2 += n * data[index];\n data[index] = c2 % 1e7;\n c2 = floor(c2 / 1e7);\n }\n};\n\nvar divide = function (data, n) {\n var index = 6;\n var c = 0;\n while (--index >= 0) {\n c += data[index];\n data[index] = floor(c / n);\n c = (c % n) * 1e7;\n }\n};\n\nvar dataToString = function (data) {\n var index = 6;\n var s = '';\n while (--index >= 0) {\n if (s !== '' || index === 0 || data[index] !== 0) {\n var t = $String(data[index]);\n s = s === '' ? t : s + repeat('0', 7 - t.length) + t;\n }\n } return s;\n};\n\nvar FORCED = fails(function () {\n return nativeToFixed(0.00008, 3) !== '0.000' ||\n nativeToFixed(0.9, 0) !== '1' ||\n nativeToFixed(1.255, 2) !== '1.25' ||\n nativeToFixed(1000000000000000128.0, 0) !== '1000000000000000128';\n}) || !fails(function () {\n // V8 ~ Android 4.3-\n nativeToFixed({});\n});\n\n// `Number.prototype.toFixed` method\n// https://tc39.es/ecma262/#sec-number.prototype.tofixed\n$({ target: 'Number', proto: true, forced: FORCED }, {\n toFixed: function toFixed(fractionDigits) {\n var number = thisNumberValue(this);\n var fractDigits = toIntegerOrInfinity(fractionDigits);\n var data = [0, 0, 0, 0, 0, 0];\n var sign = '';\n var result = '0';\n var e, z, j, k;\n\n // TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation\n if (fractDigits < 0 || fractDigits > 20) throw new $RangeError('Incorrect fraction digits');\n // eslint-disable-next-line no-self-compare -- NaN check\n if (number !== number) return 'NaN';\n if (number <= -1e21 || number >= 1e21) return $String(number);\n if (number < 0) {\n sign = '-';\n number = -number;\n }\n if (number > 1e-21) {\n e = log(number * pow(2, 69, 1)) - 69;\n z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1);\n z *= 0x10000000000000;\n e = 52 - e;\n if (e > 0) {\n multiply(data, 0, z);\n j = fractDigits;\n while (j >= 7) {\n multiply(data, 1e7, 0);\n j -= 7;\n }\n multiply(data, pow(10, j, 1), 0);\n j = e - 1;\n while (j >= 23) {\n divide(data, 1 << 23);\n j -= 23;\n }\n divide(data, 1 << j);\n multiply(data, 1, 1);\n divide(data, 2);\n result = dataToString(data);\n } else {\n multiply(data, 0, z);\n multiply(data, 1 << -e, 0);\n result = dataToString(data) + repeat('0', fractDigits);\n }\n }\n if (fractDigits > 0) {\n k = result.length;\n result = sign + (k <= fractDigits\n ? '0.' + repeat('0', fractDigits - k) + result\n : stringSlice(result, 0, k - fractDigits) + '.' + stringSlice(result, k - fractDigits));\n } else {\n result = sign + result;\n } return result;\n }\n});\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\n// `thisNumberValue` abstract operation\n// https://tc39.es/ecma262/#sec-thisnumbervalue\nmodule.exports = uncurryThis(1.0.valueOf);\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function updateCart(\n cart: Readonly,\n updatedCartObject: Cart,\n actionContext: IActionContext\n): Promise {\n if (!cart) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n return updateAsync({ callerContext: actionContext }, { ...updatedCartObject, Id: cart.Id })\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch(error => {\n actionContext.telemetry.warning(error);\n actionContext.telemetry.debug('Unable to update the cart');\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { AsyncResult, IActionContext } from '@msdyn365-commerce/core';\n\nimport { BaseCheckoutState } from '../checkout-state/base-checkout-state';\nimport { ICheckoutState } from '../state-interfaces/i-checkout-state';\nimport checkoutStateDataAction from './checkout-state-data-action';\nimport { GlobalStateInput } from './global-state-data-action';\n\nexport function getCheckoutState(ctx: IActionContext): AsyncResult {\n return checkoutStateDataAction(\n new GlobalStateInput('CHECKOUTSTATE', BaseCheckoutState, ctx.requestContext.apiSettings, ctx.requestContext),\n ctx\n );\n}\n","'use strict';\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\nvar toString = require('../internals/to-string');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar $RangeError = RangeError;\n\n// `String.prototype.repeat` method implementation\n// https://tc39.es/ecma262/#sec-string.prototype.repeat\nmodule.exports = function repeat(count) {\n var str = toString(requireObjectCoercible(this));\n var result = '';\n var n = toIntegerOrInfinity(count);\n if (n < 0 || n === Infinity) throw new $RangeError('Wrong number of repetitions');\n for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;\n return result;\n};\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport {\n CacheType,\n createObservableDataAction,\n getCatalogId,\n IAction,\n IActionContext,\n IActionInput,\n ICommerceApiSettings,\n ICreateActionContext,\n IObservableAction,\n IRequestContext\n} from '@msdyn365-commerce/core';\n\nimport { createGlobalState, GlobalStateConstructor, IGlobalState } from '../global-state/i-global-state';\n\nexport declare type GlobalStateType = 'CARTSTATE' | 'CHECKOUTSTATE';\n\n/**\n * Shared class that handles global state inputs.\n */\nexport class GlobalStateInput implements IActionInput {\n public readonly stateConstructor: GlobalStateConstructor;\n\n public readonly key: GlobalStateType;\n\n public readonly catalogId?: number;\n\n private readonly apiSettings: ICommerceApiSettings;\n\n public constructor(\n key: GlobalStateType,\n stateConstructor: GlobalStateConstructor,\n apiSettings: ICommerceApiSettings,\n requestContext?: IRequestContext\n ) {\n this.apiSettings = apiSettings;\n this.stateConstructor = stateConstructor;\n this.key = key;\n\n if (requestContext) {\n this.catalogId = getCatalogId(requestContext);\n }\n }\n\n public getCacheKey = () => `Key:${this.key}-ChannelId:${this.apiSettings.channelId}-CatalogId:${this.catalogId ?? 0}`;\n\n public getCacheObjectType = () => this.key;\n\n public dataCacheType = (): CacheType => 'instance';\n}\n\nexport async function getState(input: GlobalStateInput, ctx: IActionContext): Promise {\n const globalStateObject = createGlobalState(input.stateConstructor, ctx);\n\n await globalStateObject.initialize();\n\n return globalStateObject;\n}\n\nexport default function createGlobalStateDataAction(\n key: GlobalStateType,\n stateConstructor: GlobalStateConstructor\n): IObservableAction {\n return createObservableDataAction({\n action: >getState,\n input: (args: ICreateActionContext) => {\n return new GlobalStateInput(key, stateConstructor, args.requestContext.apiSettings, args.requestContext);\n }\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { removeCartLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function removeCartLinesInternal(\n cart: Readonly,\n cartLineIds: string[],\n actionContext: IActionContext\n): Promise {\n if (!cart) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n return removeCartLinesAsync({ callerContext: actionContext }, cart.Id, cartLineIds)\n .then(newCart => {\n // This is because of a TSProxy typing error\n const returnedCart = Array.isArray(newCart) ? newCart[0] : newCart;\n\n return { cart: returnedCart, status: 'SUCCESS' };\n })\n .catch(error => {\n actionContext.telemetry.warning(error);\n actionContext.telemetry.debug('Unable to Remove Cart Line');\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { Address, Cart, CartsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\n/**\n * Update shipping address in cart.\n * @param cart - The cart object.\n * @param shippingAddress - The new shipping address.\n * @param actionContext - The action context.\n * @returns The updated cart with new shipping address.\n */\nexport async function updateShippingAddress(\n cart: Readonly,\n shippingAddress: Address,\n actionContext: IActionContext\n): Promise {\n if (!cart) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n return CartsDataActions.updateAsync(\n { callerContext: actionContext },\n {\n Id: cart.Id,\n ShippingAddress: shippingAddress\n }\n )\n .then(newCart => {\n const result: ICartActionResultWithCart = { cart: newCart, status: 'SUCCESS' };\n return result;\n })\n .catch(error => {\n actionContext.telemetry.warning(error);\n actionContext.telemetry.debug('Unable to update shipping address to the cart');\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\n });\n}\n\nexport default updateShippingAddress;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { updateCartLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart, CartLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function updateCartLinesInternal(\n cart: Readonly,\n cartLinesToUpdate: CartLine[],\n actionContext: IActionContext\n): Promise {\n if (!cart || !cart.CartLines) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n return updateCartLinesAsync({ callerContext: actionContext }, cart.Id, cartLinesToUpdate, null)\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch((error: string) => {\n actionContext.telemetry.warning(error);\n actionContext.telemetry.debug('Unable to Update Cart Lines');\n\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error } };\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nexport * from './base-checkout-cart-state';\nexport * from './base-checkout-state';\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { BaseCheckoutState } from '../checkout-state/base-checkout-state';\nimport { ICheckoutState } from '../state-interfaces/i-checkout-state';\nimport createGlobalStateDataAction from './global-state-data-action';\n\nexport default createGlobalStateDataAction('CHECKOUTSTATE', BaseCheckoutState);\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { updateCartLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart, CartLine, ChannelDeliveryOptionConfiguration } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport { cloneDeep } from 'lodash';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function clearCartLinesDeliveryInformation(\n cart: Readonly,\n actionContext: IActionContext,\n channelDeliveryOptionConfig?: ChannelDeliveryOptionConfiguration\n): Promise {\n if (!cart || !cart.CartLines) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n let matchingLines: CartLine[] = [];\n const pickupDeliveryModeCode =\n actionContext && actionContext.requestContext && actionContext.requestContext.channel?.PickupDeliveryModeCode;\n const emailDeliveryModeCode =\n actionContext && actionContext.requestContext && actionContext.requestContext.channel?.EmailDeliveryModeCode;\n if (channelDeliveryOptionConfig !== undefined) {\n matchingLines = cart.CartLines.filter(\n cartLine =>\n cartLine.DeliveryMode &&\n cartLine.DeliveryMode !== channelDeliveryOptionConfig.PickupDeliveryModeCodes?.find(dM => dM === cartLine.DeliveryMode) &&\n cartLine.DeliveryMode !== emailDeliveryModeCode &&\n cartLine.LineId\n );\n } else {\n matchingLines = cart.CartLines.filter(\n cartLine =>\n cartLine.DeliveryMode &&\n cartLine.DeliveryMode !== pickupDeliveryModeCode &&\n cartLine.DeliveryMode !== emailDeliveryModeCode &&\n cartLine.LineId\n );\n }\n\n // If there are no lines needing updates, just return success\n if (matchingLines.length === 0) {\n return { cart, status: 'SUCCESS' };\n }\n\n const copiedLines: CartLine[] = cloneDeep(matchingLines);\n\n copiedLines.forEach(line => {\n line.DeliveryMode = '';\n line.FulfillmentStoreId = '';\n line.ShippingAddress = {};\n });\n\n return updateCartLinesAsync({ callerContext: actionContext }, cart.Id, copiedLines, null)\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch((error: string) => {\n actionContext.telemetry.warning(error);\n actionContext.telemetry.debug('Unable to Update Cart Lines');\n\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error } };\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nexport enum CheckoutStorageKey {\n BillingAddress = 'BillingAddress',\n GiftCard = 'GiftCard',\n LoyaltyCardNumber = 'LoyaltyCardNumber',\n LoyaltyAmount = 'LoyaltyAmount',\n TermsAndCondition = 'TermsAndCondition',\n CheckoutGenericData = 'Checkout-Generic-Data',\n PaymentTenderType = 'PaymentTenderType',\n RedirectPaymentConnectorId = 'RedirectPaymentConnectorId',\n IsExpressCheckoutApplied = 'IsExpressCheckoutApplied'\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport {\n Address,\n AttributeValueBase,\n CardPaymentAcceptResult,\n CartLine,\n CommerceProperty,\n GiftCard,\n SalesOrder,\n SimpleProduct,\n TenderLine,\n TokenizedPaymentCard\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport get from 'lodash/get';\nimport { action, computed, observable } from 'mobx';\n\nimport { GlobalState } from '../global-state/global-state';\nimport { CheckoutModule } from '../state-interfaces';\nimport { ICartState } from '../state-interfaces/i-cart-state';\nimport {\n ICheckoutActionResult,\n ICheckoutGenericData,\n ICheckoutState,\n IGiftCardExtend,\n ICheckoutError\n} from '../state-interfaces/i-checkout-state';\nimport { BaseCheckoutCartState } from './base-checkout-cart-state';\nimport { CheckoutStorageKey } from './checkout-state-storage';\n\n/**\n * State information related to what is needed to succesfully perform a checkout.\n */\nexport class BaseCheckoutState extends GlobalState implements ICheckoutState {\n @observable protected _checkoutCart: ICartState;\n\n @computed public get checkoutCart(): ICartState {\n return this._checkoutCart;\n }\n\n @observable protected _salesOrder?: SalesOrder;\n\n @computed public get salesOrder(): Readonly {\n return this._salesOrder;\n }\n\n @observable protected _attributeValues: AttributeValueBase[];\n\n @computed public get attributeValues(): Readonly {\n return this._attributeValues;\n }\n\n @observable protected _extensionProperties: CommerceProperty[];\n\n @computed public get extensionProperties(): Readonly {\n return this._extensionProperties;\n }\n\n @observable protected _orderedProducts?: SimpleProduct[];\n\n @computed public get orderedProducts(): Readonly {\n return this._orderedProducts;\n }\n\n @observable protected _tokenizedPaymentCard?: TokenizedPaymentCard;\n\n @computed public get tokenizedPaymentCard(): Readonly {\n return this._tokenizedPaymentCard;\n }\n\n @observable protected _tenderLine?: TenderLine;\n\n @computed public get tenderLine(): Readonly {\n return this._tenderLine;\n }\n\n @observable protected _billingAddress?: Address;\n\n @computed public get billingAddress(): Readonly
{\n return this._billingAddress;\n }\n\n @observable protected _isBillingAddressSameAsShippingAddress?: boolean;\n\n @computed public get isBillingAddressSameAsShippingAddress(): Readonly {\n return this._isBillingAddressSameAsShippingAddress;\n }\n\n @observable protected _shippingAddress?: Address;\n\n @computed public get shippingAddress(): Readonly
{\n return this._shippingAddress;\n }\n\n @observable protected _hasShippingAddress?: boolean;\n\n @computed public get hasShippingAddress(): Readonly {\n return this._hasShippingAddress;\n }\n\n @observable protected _hasCartDeliveryMode?: boolean;\n\n @computed public get hasCartDeliveryMode(): Readonly {\n return this._hasCartDeliveryMode;\n }\n\n @observable protected _cardPrefix?: string;\n\n @computed public get cardPrefix(): Readonly {\n return this._cardPrefix;\n }\n\n @observable protected _paymentTenderType?: string;\n\n @computed public get paymentTenderType(): Readonly {\n return this._paymentTenderType;\n }\n\n /**\n * @deprecated Use giftCardExtends method.\n */\n @computed public get giftCards(): Readonly {\n return this.giftCardExtends;\n }\n\n @observable protected _giftCardExtends: IGiftCardExtend[] = [];\n\n @computed public get giftCardExtends(): Readonly {\n return this._giftCardExtends;\n }\n\n @observable protected _loyaltyCardNumber?: string;\n\n @computed public get loyaltyCardNumber(): Readonly {\n return this._loyaltyCardNumber;\n }\n\n @observable protected _loyaltyAmount: number = 0;\n\n @computed public get loyaltyAmount(): Readonly {\n return this._loyaltyAmount;\n }\n\n @observable protected _guestCheckoutEmail: string = '';\n\n @computed public get guestCheckoutEmail(): Readonly {\n return this._guestCheckoutEmail;\n }\n\n @observable protected _hasGuestCheckoutEmail?: boolean;\n\n @computed public get hasGuestCheckoutEmail(): Readonly {\n return this._hasGuestCheckoutEmail;\n }\n\n @observable protected _isTermsAndConditionAccepted?: boolean;\n\n @computed public get isTermsAndConditionAccepted(): Readonly {\n return this._isTermsAndConditionAccepted;\n }\n\n @observable protected _isTermsAndConditionChecked?: boolean;\n\n @computed public get isTermsAndConditionChecked(): Readonly {\n return this._isTermsAndConditionChecked;\n }\n\n @observable protected _shouldEnableSinglePaymentAuthorizationCheckout?: boolean;\n\n @computed public get shouldEnableSinglePaymentAuthorizationCheckout(): Readonly {\n return this._shouldEnableSinglePaymentAuthorizationCheckout;\n }\n\n @observable protected _shouldEnableCheckoutErrorDisplayMessaging?: boolean;\n\n @computed public get shouldEnableCheckoutErrorDisplayMessaging(): Readonly {\n return this._shouldEnableCheckoutErrorDisplayMessaging;\n }\n\n @observable protected _shouldCollapsePaymentSection?: boolean;\n\n @computed public get shouldCollapsePaymentSection(): Readonly {\n return this._shouldCollapsePaymentSection;\n }\n\n @observable protected _shouldTriggerPaymentWithPlaceOrder?: boolean;\n\n @computed public get shouldTriggerPaymentWithPlaceOrder(): Readonly {\n return this._shouldTriggerPaymentWithPlaceOrder;\n }\n\n @observable protected _isPaymentSectionContainerReady?: boolean;\n\n @computed public get isPaymentSectionContainerReady(): Readonly {\n return this._isPaymentSectionContainerReady;\n }\n\n @observable protected _cardPaymentAcceptResult?: CardPaymentAcceptResult;\n\n @computed public get cardPaymentAcceptResult(): Readonly {\n return this._cardPaymentAcceptResult;\n }\n\n @observable protected _isPaymentSectionContainerHasError?: boolean;\n\n @computed public get isPaymentSectionContainerHasError(): Readonly {\n return this._isPaymentSectionContainerHasError;\n }\n\n @observable protected _redirectAdditionalContext?: string;\n\n @computed public get redirectAdditionalContext(): Readonly {\n return this._redirectAdditionalContext;\n }\n\n @observable protected _redirectPaymentConnectorId?: string;\n\n @computed public get redirectPaymentConnectorId(): Readonly {\n return this._redirectPaymentConnectorId;\n }\n\n @observable protected _checkoutErrorPaymentConnectorId?: string;\n\n @computed public get checkoutErrorPaymentConnectorId(): Readonly {\n return this._checkoutErrorPaymentConnectorId;\n }\n\n @observable protected _isPlaceOrderEnabledInRedirection?: boolean;\n\n @computed public get isPlaceOrderEnabledInRedirection(): Readonly {\n return this._isPlaceOrderEnabledInRedirection;\n }\n\n @observable protected _isPaymentVerificationRequired?: boolean;\n\n @computed public get isPaymentVerificationRequired(): Readonly {\n return this._isPaymentVerificationRequired;\n }\n\n @observable protected _isCheckoutCallFailed?: boolean;\n\n @computed public get isCheckoutCallFailed(): Readonly {\n return this._isCheckoutCallFailed;\n }\n\n @observable protected _customerAccountAmount: number = 0;\n\n @computed public get customerAccountAmount(): Readonly {\n return this._customerAccountAmount;\n }\n\n @observable protected _shouldEnableExpressCheckoutInCheckout?: boolean;\n\n @computed public get shouldEnableExpressCheckoutInCheckout(): Readonly {\n return this._shouldEnableExpressCheckoutInCheckout;\n }\n\n @observable protected _shouldEnableExpressCheckoutInCart?: boolean;\n\n @computed public get shouldEnableExpressCheckoutInCart(): Readonly {\n return this._shouldEnableExpressCheckoutInCart;\n }\n\n @observable protected _shippingAddressFromExpressCheckout?: Address;\n\n @computed public get shippingAddressFromExpressCheckout(): Readonly
{\n return this._shippingAddressFromExpressCheckout;\n }\n\n @observable protected _emailAddressFromExpressCheckout: string = '';\n\n @computed public get emailAddressFromExpressCheckout(): Readonly {\n return this._emailAddressFromExpressCheckout;\n }\n\n @observable protected _billingAddressFromExpressCheckout?: Address;\n\n @computed public get billingAddressFromExpressCheckout(): Readonly
{\n return this._billingAddressFromExpressCheckout;\n }\n\n @observable protected _isExpressCheckoutApplied?: boolean;\n\n @computed public get isExpressCheckoutApplied(): Readonly {\n return this._isExpressCheckoutApplied;\n }\n\n @observable protected _isExpressAddressApplied?: boolean;\n\n @computed public get isExpressAddressApplied(): Readonly {\n return this._isExpressAddressApplied;\n }\n\n @observable protected _isExpressCheckoutAppliedInCartPage?: boolean;\n\n @computed public get isExpressCheckoutAppliedInCartPage(): Readonly {\n return this._isExpressCheckoutAppliedInCartPage;\n }\n\n @observable protected _isExpressPaymentModulesReady?: CommerceProperty[];\n\n @computed public get isExpressPaymentModulesReady(): Readonly {\n return this._isExpressPaymentModulesReady;\n }\n\n @computed public get isPaymentVerificationRedirection(): Readonly {\n const { requestFormData, query } = this.actionContext.requestContext;\n return !!(query && query.pv === '1' && (requestFormData || query.redirectResult));\n }\n\n @observable protected _checkoutError?: ICheckoutError;\n\n @computed public get checkoutError(): Readonly {\n return this._checkoutError;\n }\n\n @observable protected _isBillingAddressHasError?: boolean;\n\n @computed public get isBillingAddressHasError(): Readonly {\n return this._isBillingAddressHasError;\n }\n\n @observable protected _checkoutErrorFocus?: CheckoutModule;\n\n @computed public get checkoutErrorFocus(): Readonly {\n return this._checkoutErrorFocus;\n }\n\n @observable protected _shouldFocusOnCheckoutError?: boolean;\n\n @computed public get shouldFocusOnCheckoutError(): Readonly {\n return this._shouldFocusOnCheckoutError;\n }\n\n @observable protected _checkoutGenericData: object = {};\n\n constructor(actionContext: IActionContext) {\n super(actionContext);\n this._checkoutCart = new BaseCheckoutCartState(actionContext);\n this._attributeValues = [];\n this._extensionProperties = [];\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- Do not need type check for app settings.\n this._shouldEnableSinglePaymentAuthorizationCheckout = actionContext.requestContext.app.config\n .shouldEnableSinglePaymentAuthorizationCheckout as boolean;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- Do not need type check for app settings.\n this._shouldEnableCheckoutErrorDisplayMessaging = actionContext.requestContext.app.config\n .shouldEnableCheckoutErrorDisplayMessaging as boolean;\n }\n\n @action\n public updateSalesOrder(input: {\n newSalesOrder: SalesOrder;\n newOrderedProducts: SimpleProduct[];\n additionalProperties?: object;\n }): Promise {\n this._salesOrder = input.newSalesOrder;\n this._orderedProducts = input.newOrderedProducts;\n this._attributeValues = input.newSalesOrder.AttributeValues || [];\n this._extensionProperties = input.newSalesOrder.ExtensionProperties || [];\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public async updateAttributeValues(input: {\n newAttributeValues: AttributeValueBase[];\n additionalProperties?: object;\n }): Promise {\n this._attributeValues = input.newAttributeValues;\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public async updateExtensionProperties(input: {\n newExtensionProperties: CommerceProperty[];\n additionalProperties?: object;\n }): Promise {\n this._extensionProperties = input.newExtensionProperties;\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public updateTokenizedPaymentCard(input: {\n newTokenizedPaymentCard?: TokenizedPaymentCard;\n additionalProperties?: object;\n }): Promise {\n this._tokenizedPaymentCard = input.newTokenizedPaymentCard;\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public updateTenderLine(input: { newTenderLine?: TenderLine; additionalProperties?: object }): Promise {\n this._tenderLine = input.newTenderLine;\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public async updateShippingAddress(input: {\n newShippingAddress: Address;\n additionalProperties?: object;\n }): Promise {\n this._shippingAddress = input.newShippingAddress;\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public async updateHasShippingAddress(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newHasShippingAddress: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._hasShippingAddress = input.newHasShippingAddress;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateHasCartDeliveryMode(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newHasCartDeliveryMode: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._hasCartDeliveryMode = input.newHasCartDeliveryMode;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateTermsAndConditionsAcceptance(input: {\n newIsTermsAndConditionAccepted: boolean;\n additionalProperties?: object;\n }): Promise {\n this._isTermsAndConditionAccepted = input.newIsTermsAndConditionAccepted;\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public async updateIsTermsAndConditionsChecked(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newIsTermsAndConditionChecked: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._isTermsAndConditionChecked = input.newIsTermsAndConditionChecked;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateShouldCollapsePaymentSection(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newShouldCollapsePaymentSection: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._shouldCollapsePaymentSection = input.newShouldCollapsePaymentSection;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateShouldTriggerPaymentWithPlaceOrder(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newShouldTriggerPaymentWithPlaceOrder: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._shouldTriggerPaymentWithPlaceOrder = input.newShouldTriggerPaymentWithPlaceOrder;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateIsPaymentSectionContainerReady(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newIsPaymentSectionContainerReady: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._isPaymentSectionContainerReady = input.newIsPaymentSectionContainerReady;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateCardPaymentAcceptResult(input: {\n newCardPaymentAcceptResult: CardPaymentAcceptResult;\n additionalProperties?: { [key: string]: unknown };\n }): Promise {\n this._cardPaymentAcceptResult = input.newCardPaymentAcceptResult;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateIsPaymentSectionContainerHasError(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newIsPaymentSectionContainerHasError: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._isPaymentSectionContainerHasError = input.newIsPaymentSectionContainerHasError;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateRedirectAdditionalContext(input: {\n newRedirectAdditionalContext: string;\n additionalProperties?: { [key: string]: unknown };\n }): Promise {\n this._redirectAdditionalContext = input.newRedirectAdditionalContext;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateRedirectPaymentConnectorId(input: {\n newRedirectPaymentConnectorId: string;\n additionalProperties?: { [key: string]: unknown };\n }): Promise {\n this._redirectPaymentConnectorId = input.newRedirectPaymentConnectorId;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateCheckoutErrorPaymentConnectorId(input: {\n newCheckoutErrorPaymentConnectorId: string;\n additionalProperties?: { [key: string]: unknown };\n }): Promise {\n this._checkoutErrorPaymentConnectorId = input.newCheckoutErrorPaymentConnectorId;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateIsCheckoutCallFailed(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newIsCheckoutCallFailed: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._isCheckoutCallFailed = input.newIsCheckoutCallFailed;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateIsPlaceOrderEnabledInRedirection(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newIsPlaceOrderEnabledInRedirection: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._isPlaceOrderEnabledInRedirection = input.newIsPlaceOrderEnabledInRedirection;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateIsPaymentVerificationRequired(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newIsPaymentVerificationRequired: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._isPaymentVerificationRequired = input.newIsPaymentVerificationRequired;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public updateBillingAddress(input: { newBillingAddress: Address; additionalProperties?: object }): Promise {\n this._billingAddress = input.newBillingAddress;\n\n // @ts-expect-error\n this._isBillingAddressSameAsShippingAddress = input.additionalProperties?.isBillingAddressSameAsShippingAddress || false;\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public removeBillingAddress(input: { additionalProperties?: object }): Promise {\n this._billingAddress = undefined;\n this._isBillingAddressSameAsShippingAddress = undefined;\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public updatePaymentTenderType(input: {\n newPaymentTenderType?: string;\n additionalProperties?: object;\n }): Promise {\n this._paymentTenderType = input.newPaymentTenderType;\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public updateCardPrefix(input: { newCardPrefix: string; additionalProperties?: object }): Promise {\n this._cardPrefix = input.newCardPrefix;\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public removeGiftCard(input: { giftCardNumber: string; additionalProperties?: object }): Promise {\n this._giftCardExtends = this._giftCardExtends.filter(giftCard => giftCard.Id !== input.giftCardNumber);\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public removeGiftCardExtend(input: { giftCardNumber: string; additionalProperties?: object }): Promise {\n this._giftCardExtends = this._giftCardExtends.filter(giftCard => giftCard.Id !== input.giftCardNumber);\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public addGiftCard(input: { giftCard: GiftCard; additionalProperties?: object }): Promise {\n // @ts-expect-error\n const { Pin, ExpirationDate, TenderTypeId } = input.additionalProperties || {};\n\n const gitCardExtend = { ...input.giftCard, ...{ Pin, ExpirationDate, TenderTypeId } };\n\n this._giftCardExtends = [gitCardExtend, ...this._giftCardExtends];\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public addGiftCardExtend(input: { giftCard: IGiftCardExtend; additionalProperties?: object }): Promise {\n this._giftCardExtends = [input.giftCard, ...this._giftCardExtends];\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public updateLoyaltyCardNumber(input: { newLoyaltyCardNumber: string; additionalProperties?: object }): Promise {\n this._loyaltyCardNumber = input.newLoyaltyCardNumber;\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public updateLoyaltyAmount(input: { newAmount: number; additionalProperties?: object }): Promise {\n this._loyaltyAmount = Number(input.newAmount.toFixed(2));\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public async updateGuestCheckoutEmail(input: {\n newGuestCheckoutEmail: string;\n additionalProperties?: object;\n }): Promise {\n this._guestCheckoutEmail = input.newGuestCheckoutEmail;\n const emailOnCart = this.checkoutCart.cart.ReceiptEmail;\n\n if (emailOnCart !== input.newGuestCheckoutEmail) {\n await this.checkoutCart.updateReceiptEmail({ newEmail: input.newGuestCheckoutEmail });\n }\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n /**\n * Updates cartLines objects in cart.\n * @param input - The input.\n * @param input.updatedCartLinesObject - updated cartline.\n * @returns ICartActionResult.\n */\n @action\n public async updateCartLines(input: { updatedCartLinesObject: CartLine[] }): Promise {\n await this.checkoutCart.updateCartLines({ updatedCartLinesObject: input.updatedCartLinesObject });\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public async updateHasGuestCheckoutEmail(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newHasGuestCheckoutEmail: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._hasGuestCheckoutEmail = input.newHasGuestCheckoutEmail;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public removeCheckoutCartId(input: { additionalProperties?: object }): Promise {\n this.actionContext.requestContext.cookies.removeCheckoutCartCookie();\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public saveDataInStorage(input: { additionalProperties?: object }): Promise {\n const { sessionStorage } = this.actionContext.requestContext;\n\n // Add all local data to session storage\n if (this.billingAddress) {\n sessionStorage.setCheckoutCartData(CheckoutStorageKey.BillingAddress, {\n billingAddress: this.billingAddress,\n isBillingAddressSameAsShippingAddress: this.isBillingAddressSameAsShippingAddress\n });\n }\n\n if (this.giftCardExtends && this.giftCardExtends.length > 0) {\n sessionStorage.setCheckoutCartData(CheckoutStorageKey.GiftCard, this.giftCardExtends);\n }\n\n if (this.loyaltyCardNumber) {\n sessionStorage.setCheckoutCartData(CheckoutStorageKey.LoyaltyCardNumber, { loyaltyCardNumber: this.loyaltyCardNumber });\n }\n\n if (this.loyaltyAmount) {\n sessionStorage.setCheckoutCartData(CheckoutStorageKey.LoyaltyAmount, { loyaltyAmount: this.loyaltyAmount });\n }\n\n if (this.isTermsAndConditionAccepted) {\n sessionStorage.setCheckoutCartData(CheckoutStorageKey.TermsAndCondition, {\n isTermsAndConditionAccepted: this.isTermsAndConditionAccepted\n });\n }\n\n if (this.paymentTenderType) {\n window.sessionStorage.setItem(CheckoutStorageKey.PaymentTenderType, this.paymentTenderType);\n }\n\n if (this.redirectPaymentConnectorId) {\n window.sessionStorage.setItem(CheckoutStorageKey.RedirectPaymentConnectorId, this.redirectPaymentConnectorId);\n }\n\n if (this.isExpressCheckoutApplied) {\n window.sessionStorage.setItem(CheckoutStorageKey.IsExpressCheckoutApplied, this.isExpressCheckoutApplied.toString());\n }\n\n // Save generic data with SaveDataBeforeRedirect value true\n const filtered = Object.keys(this._checkoutGenericData).reduce((filteredData: object, key: string) => {\n if (this._checkoutGenericData[key].SaveDataBeforeRedirect) {\n filteredData[key] = this._checkoutGenericData[key];\n }\n return filteredData;\n }, {});\n\n if (Object.keys(filtered).length > 0) {\n sessionStorage.setCheckoutCartData(CheckoutStorageKey.CheckoutGenericData, { checkoutGenericData: filtered });\n }\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public updateCustomerAccountAmount(input: { newAmount: number; additionalProperties?: object }): Promise {\n this._customerAccountAmount = Number(input.newAmount.toFixed(2));\n\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public async updateBillingAddressFromExpressCheckout(input: {\n newBillingAddressFromExpressCheckout: Address;\n additionalProperties?: { [key: string]: unknown };\n }): Promise {\n this._billingAddressFromExpressCheckout = input.newBillingAddressFromExpressCheckout;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateShippingAddressFromExpressCheckout(input: {\n newShippingAddressFromExpressCheckout: Address;\n additionalProperties?: { [key: string]: unknown };\n }): Promise {\n this._shippingAddressFromExpressCheckout = input.newShippingAddressFromExpressCheckout;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateEmailAddressFromExpressCheckout(input: {\n newEmailAddressFromExpressCheckout: string;\n additionalProperties?: { [key: string]: unknown };\n }): Promise {\n this._emailAddressFromExpressCheckout = input.newEmailAddressFromExpressCheckout;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateShouldEnableExpressCheckoutInCheckout(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newShouldEnableExpressCheckoutInCheckout: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._shouldEnableExpressCheckoutInCheckout = input.newShouldEnableExpressCheckoutInCheckout;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateShouldEnableExpressCheckoutInCart(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newShouldEnableExpressCheckoutInCart: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._shouldEnableExpressCheckoutInCart = input.newShouldEnableExpressCheckoutInCart;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateIsExpressCheckoutApplied(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newIsExpressCheckoutApplied: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._isExpressCheckoutApplied = input.newIsExpressCheckoutApplied;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateIsExpressAddressApplied(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newIsExpressAddressApplied: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._isExpressAddressApplied = input.newIsExpressAddressApplied;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateIsExpressCheckoutAppliedInCartPage(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newIsExpressCheckoutAppliedInCartPage: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._isExpressCheckoutAppliedInCartPage = input.newIsExpressCheckoutAppliedInCartPage;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateIsBillingAddressHasError(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newIsBillingAddressHasError: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._isBillingAddressHasError = input.newIsBillingAddressHasError;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateIsExpressPaymentModulesReady(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: {\n newIsExpressPaymentModulesReady: CommerceProperty[];\n additionalProperties?: { [key: string]: unknown };\n }\n ): Promise {\n this._isExpressPaymentModulesReady = input.newIsExpressPaymentModulesReady;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateExpressCheckoutDetails(input: {\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n newIsExpressCheckoutApplied: boolean;\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n newIsExpressAddressApplied?: boolean;\n newCardPaymentAcceptResult?: CardPaymentAcceptResult;\n newEmailAddressFromExpressCheckout: string;\n newTenderLine?: TenderLine;\n newPaymentTenderType?: string;\n newTokenizedPaymentCard?: TokenizedPaymentCard;\n additionalProperties?: { [key: string]: unknown };\n }): Promise {\n this._isExpressCheckoutApplied = input.newIsExpressCheckoutApplied;\n\n if (input.newIsExpressAddressApplied !== undefined) {\n this._isExpressAddressApplied = input.newIsExpressAddressApplied;\n }\n\n if (input.newCardPaymentAcceptResult !== undefined) {\n this._cardPaymentAcceptResult = input.newCardPaymentAcceptResult;\n }\n\n if (input.newPaymentTenderType !== undefined) {\n this._paymentTenderType = input.newPaymentTenderType;\n }\n\n if (input.newTokenizedPaymentCard !== undefined) {\n this._tokenizedPaymentCard = input.newTokenizedPaymentCard;\n }\n\n if (input.newTenderLine !== undefined) {\n this._tenderLine = input.newTenderLine;\n }\n\n if (input.newEmailAddressFromExpressCheckout) {\n this._emailAddressFromExpressCheckout = input.newEmailAddressFromExpressCheckout;\n }\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateCheckoutError(input: {\n newCheckoutError: ICheckoutError;\n additionalProperties?: { [key: string]: unknown };\n }): Promise {\n this._checkoutError = input.newCheckoutError;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public setCheckoutGenericData(input: {\n key: string;\n checkoutGenericData: ICheckoutGenericData;\n additionalProperties?: object;\n }): Promise {\n this._checkoutGenericData[input.key] = input.checkoutGenericData;\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n @action\n public getCheckoutGenericData(input: { key: string }): ICheckoutGenericData | undefined {\n return this._checkoutGenericData[input.key];\n }\n\n @action\n public async updateCheckoutErrorFocus(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newCheckoutErrorFocus: CheckoutModule; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._checkoutErrorFocus = input.newCheckoutErrorFocus;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n @action\n public async updateShouldFocusOnCheckoutError(\n // eslint-disable-next-line @typescript-eslint/naming-convention -- Keep the same naming pattern.\n input: { newShouldFocusOnCheckoutError: boolean; additionalProperties?: { [key: string]: unknown } }\n ): Promise {\n this._shouldFocusOnCheckoutError = input.newShouldFocusOnCheckoutError;\n\n const result: ICheckoutActionResult = { status: 'SUCCESS' };\n return Promise.resolve(result);\n }\n\n public async initialize(): Promise {\n if (this.isInitialized) {\n return;\n }\n\n await this._checkoutCart.initialize();\n\n this.setInitialData();\n this.isInitialized = true;\n this._status = 'READY';\n this._attributeValues = [];\n this._extensionProperties = [];\n }\n\n @action\n private cleanCheckoutData(input: { additionalProperties?: object }): Promise {\n this.actionContext.requestContext.sessionStorage.removeCheckoutCartData();\n return Promise.resolve({ status: 'SUCCESS' });\n }\n\n private setInitialData() {\n const { sessionStorage } = this.actionContext.requestContext;\n\n if (this.isPaymentVerificationRedirection) {\n const billingAddress = sessionStorage.getCheckoutCartData(CheckoutStorageKey.BillingAddress);\n const giftCard = sessionStorage.getCheckoutCartData(CheckoutStorageKey.GiftCard);\n\n this._billingAddress = get(billingAddress, 'billingAddress');\n this._isBillingAddressSameAsShippingAddress = get(billingAddress, 'isBillingAddressSameAsShippingAddress');\n this._giftCardExtends = (giftCard && Array.isArray(giftCard) ? giftCard : []) as IGiftCardExtend[];\n this._loyaltyCardNumber = get(sessionStorage.getCheckoutCartData(CheckoutStorageKey.LoyaltyCardNumber), 'loyaltyCardNumber');\n this._loyaltyAmount = get(sessionStorage.getCheckoutCartData(CheckoutStorageKey.LoyaltyAmount), 'loyaltyAmount');\n this._isTermsAndConditionAccepted = get(\n sessionStorage.getCheckoutCartData(CheckoutStorageKey.TermsAndCondition),\n 'isTermsAndConditionAccepted'\n );\n this._checkoutGenericData =\n get(sessionStorage.getCheckoutCartData(CheckoutStorageKey.CheckoutGenericData), 'checkoutGenericData') || {};\n this._paymentTenderType = window.sessionStorage.getItem(CheckoutStorageKey.PaymentTenderType) ?? undefined;\n this._redirectPaymentConnectorId = window.sessionStorage.getItem(CheckoutStorageKey.RedirectPaymentConnectorId) as string;\n this._isExpressCheckoutApplied = (window.sessionStorage.getItem(CheckoutStorageKey.IsExpressCheckoutApplied) as string)\n ? true\n : false;\n }\n\n this.cleanCheckoutData({});\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { getCatalogId, IActionContext } from '@msdyn365-commerce/core';\nimport {\n Address,\n Cart,\n CartLine,\n ChannelDeliveryOptionConfiguration,\n OrgUnitLocation,\n SimpleProduct\n} from '@msdyn365-commerce/retail-proxy';\nimport {\n AttributeValueBase,\n CommerceProperty,\n LineDeliverySpecification,\n ReleasedProductType\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\nimport { action, computed, observable } from 'mobx';\n\nimport { GlobalState } from '../global-state/global-state';\nimport { ICartActionResult, ICartState } from '../state-interfaces/i-cart-state';\nimport addInvoicesToCartInternal from './add-invoices-to-cart';\nimport addOrderInvoiceToCartInternal from './add-order-invoice-to-cart';\nimport addProductToCartInternal, { addProductsToCartInternal } from './add-product-to-cart';\nimport addPromoCodeInternal from './add-promo-code';\nimport { ICartActionResultWithCart } from './cart-action-result';\nimport clearCartLineDeliveryModeInternal from './clear-cart-line-delivery-mode';\nimport clearCartLinesDeliveryInformation from './clear-cart-lines-delivery-information';\nimport getOrCreateActiveCart from './get-or-create-active-cart';\nimport refreshCartInternal from './refresh-cart';\nimport removeAllPromoCodesInternal from './remove-all-promo-codes';\nimport removeCartLineInternal from './remove-cart-lines';\nimport removePromoCodesInternal from './remove-promo-codes';\nimport setInvoiceLinePriceInternal from './set-invoice-line-price';\nimport updateCart from './update-cart';\nimport updateCartLineDeliverySpecificationsInternal from './update-cart-line-delivery-specifications';\nimport updateCartLineQuantityInternal from './update-cart-line-quantity';\nimport updateLoyaltyCardIdInternal from './update-loyalty-card-id';\nimport updateReceiptEmail from './update-receipt-email';\nimport updateShippingAddress from './update-shipping-address';\nimport updateCartLinesInternal from './update-cart-lines';\n\n/**\n * Cart state information.\n */\nexport class BaseCartState extends GlobalState implements ICartState {\n @observable protected _cart: Cart;\n\n @computed public get cart(): Readonly {\n return this._cart;\n }\n\n @observable protected _attributeValues: AttributeValueBase[];\n\n @computed public get attributeValues(): AttributeValueBase[] {\n return this._attributeValues;\n }\n\n @observable protected _extensionProperties: CommerceProperty[];\n\n @computed public get extensionProperties(): CommerceProperty[] {\n return this._extensionProperties;\n }\n\n @computed public get totalItemsInCart(): number {\n if (this._cart.CartLines) {\n return this._cart.CartLines.map(cartLine => cartLine.Quantity || 1).reduce((total, num) => total + num, 0);\n }\n\n return 0;\n }\n\n @observable protected _isProductAddedToCart: boolean;\n\n @computed public get isProductAddedToCart(): boolean {\n return this._isProductAddedToCart;\n }\n\n @computed public get isEmpty(): boolean {\n return !(this._cart.CartLines && this._cart.CartLines.length > 0);\n }\n\n @computed public get hasInvoiceLine(): boolean {\n return !!(this._cart.CartLines && this._cart.CartLines.some(cartline => cartline.IsInvoiceLine === true));\n }\n\n constructor(actionContext: IActionContext) {\n super(actionContext);\n this._cart = {};\n this._attributeValues = [];\n this._extensionProperties = [];\n this._isProductAddedToCart = false;\n }\n\n /**\n * Refreshes the cart by getting it from the server.\n *\n * Other actions should keep cart up to date so shouldn't need to call this\n * outside of initialization but still might be scenarios where a manual\n * refresh is needed.\n * @param input - Input.\n * @param input.additionalProperties - Additional properties.\n * @returns - The cart action result.\n */\n @action\n public async refreshCart(input: { additionalProperties?: object }): Promise {\n return this._doAsyncAction(async () => {\n const newCart = await refreshCartInternal(this.cart.Id, this.actionContext);\n\n if (newCart) {\n this._cart = newCart;\n\n return { status: 'SUCCESS' };\n }\n\n return { status: 'FAILED' };\n });\n }\n\n /**\n * Adds the specified product to the current cart. If product is already in cart\n * will update its cart line, otherwise will add a new cart line to the cart.\n * @param input - The input.\n * @param input.product - The product to add to the cart.\n * @param input.count - How many copies of the product to add.\n * @param input.location - The org unit location, used for BuyOnlinePickupInStore scenarios\n * (If you want item to simply be shipped, leave this parameter undefined).\n * @param input.additionalProperties - Additional properties.\n * @param input.availableQuantity - Available quantity.\n * @param input.enableStockCheck - Is stock check enabled.\n * @param input.isAddEmailDeliveryItemToCart - Is add email delivery item to cart.\n * @param input.isPriceKeyedIn - Is price keyed in.\n * @param input.customPrice - Custom price.\n * @param input.deliveryMode - Delivery mode.\n * @param input.shouldSkipSiteSettings - Should skip site settings.\n * @param input.catalogId - Should skip site settings.\n * @returns Cart action result.\n */\n @action\n public async addProductToCart(input: {\n product: SimpleProduct;\n count?: number;\n location?: OrgUnitLocation;\n additionalProperties?: object;\n availableQuantity?: number;\n enableStockCheck?: boolean;\n isAddEmailDeliveryItemToCart?: boolean;\n isPriceKeyedIn?: boolean;\n customPrice?: number;\n deliveryMode?: string;\n shouldSkipSiteSettings?: boolean;\n catalogId?: number;\n retailMultiplePickupModeEnabled?: boolean;\n }): Promise {\n return this._doAsyncAction(async () => {\n const cartLine: CartLine = {\n CatalogId: input.catalogId ?? getCatalogId(this.actionContext.requestContext),\n Description: input.product.Description,\n\n // TODO: Investigate this value and what it represents\n EntryMethodTypeValue: 3,\n ItemId: input.product.ItemId,\n ProductId: input.product.RecordId,\n Quantity: input.count || 1,\n TrackingId: '',\n UnitOfMeasureSymbol: input.product.DefaultUnitOfMeasure,\n IsPriceKeyedIn: input.isPriceKeyedIn,\n IsGiftCardLine: input.product.IsGiftCard,\n Price: input.customPrice ? input.customPrice : input.product.Price\n };\n\n if (input.location) {\n if (!this.actionContext.requestContext.channel) {\n return { status: 'FAILED' };\n }\n\n // If curbside pick is not available use the default one\n if (input.deliveryMode !== undefined) {\n cartLine.DeliveryMode = input.deliveryMode;\n } else {\n cartLine.DeliveryMode = input.retailMultiplePickupModeEnabled\n ? undefined\n : this.actionContext.requestContext.channel.PickupDeliveryModeCode;\n }\n\n cartLine.FulfillmentStoreId = input.location.OrgUnitNumber;\n cartLine.WarehouseId = input.location.InventoryLocationId;\n cartLine.ShippingAddress = this._buildAddressFromOrgUnitLocation(input.location);\n }\n\n if (input.isAddEmailDeliveryItemToCart) {\n if (!this.actionContext.requestContext.channel) {\n return { status: 'FAILED' };\n }\n\n cartLine.DeliveryMode = this.actionContext.requestContext.channel.EmailDeliveryModeCode;\n }\n\n // Check if the product is service or not by product type\n const isAddServiceItemToCart = input.product.ItemTypeValue === ReleasedProductType.Service;\n\n // @ts-expect-error\n const orderQuantityLimitsFeatureIsEnabled: boolean = !!input.additionalProperties?.orderQuantityLimitsFeatureIsEnabled;\n const isMaxByQuantityValidationFeatureDefined: boolean = !!input.product.Behavior?.MaximumQuantity;\n return this._doCartOperationWithRetry(() =>\n addProductToCartInternal(\n this.cart,\n cartLine,\n this.actionContext,\n orderQuantityLimitsFeatureIsEnabled,\n input.availableQuantity,\n input.enableStockCheck,\n isAddServiceItemToCart,\n isMaxByQuantityValidationFeatureDefined,\n input.shouldSkipSiteSettings\n )\n );\n });\n }\n\n /**\n * Adds the specified product to the current cart. If product is already in cart\n * will update its cart line, otherwise will add a new cart line to the cart.\n * @param input - Input.\n * @param input.product - Product.\n * @param input.count - Count.\n * @param input.location - Location.\n * @param input.additionalProperties - Additional properties.\n * @param input.availableQuantity - Available quantity.\n * @param input.enableStockCheck - Enable stock check.\n * @param input.isAddEmailDeliveryItemToCart - Is add email delivery item to cart.\n * @param input.isPriceKeyedIn - Is price keyed in.\n * @param input.customPrice - Custom price.\n * @param input.deliveryMode - Delivery mode.\n * @returns Cart action result.\n */\n @action\n public async addProductsToCart(\n input: {\n product: SimpleProduct;\n count?: number;\n location?: OrgUnitLocation;\n additionalProperties?: object;\n availableQuantity?: number;\n enableStockCheck?: boolean;\n isAddEmailDeliveryItemToCart?: boolean;\n isPriceKeyedIn?: boolean;\n customPrice?: number;\n deliveryMode?: string;\n catalogId?: number;\n retailMultiplePickupModeEnabled?: boolean;\n }[]\n ): Promise {\n return this._doAsyncAction(async () => {\n const internalInput: {\n cartLineToAdd: CartLine;\n availableQuantity?: number;\n isStockCheckEnabled?: boolean;\n isAddServiceItemToCart?: boolean;\n }[] = [];\n\n for (const inputItem of input) {\n const cartLine: CartLine = {\n CatalogId: inputItem.catalogId ?? getCatalogId(this.actionContext.requestContext),\n Description: inputItem.product.Description,\n\n // TODO: Investigate this value and what it represents\n EntryMethodTypeValue: 3,\n ItemId: inputItem.product.ItemId,\n ProductId: inputItem.product.RecordId,\n Quantity: inputItem.count || 1,\n TrackingId: '',\n UnitOfMeasureSymbol: inputItem.product.DefaultUnitOfMeasure,\n IsPriceKeyedIn: inputItem.isPriceKeyedIn,\n IsGiftCardLine: inputItem.product.IsGiftCard,\n Price: inputItem.customPrice ? inputItem.customPrice : inputItem.product.Price\n };\n\n if (inputItem.location) {\n if (!this.actionContext.requestContext.channel) {\n return { status: 'FAILED' };\n }\n\n // If curbside pick is not available use the default one\n if (inputItem.deliveryMode !== undefined) {\n cartLine.DeliveryMode = inputItem.deliveryMode;\n } else {\n cartLine.DeliveryMode = inputItem.retailMultiplePickupModeEnabled\n ? undefined\n : this.actionContext.requestContext.channel.PickupDeliveryModeCode;\n }\n\n cartLine.FulfillmentStoreId = inputItem.location.OrgUnitNumber;\n cartLine.WarehouseId = inputItem.location.InventoryLocationId;\n cartLine.ShippingAddress = this._buildAddressFromOrgUnitLocation(inputItem.location);\n }\n\n if (inputItem.isAddEmailDeliveryItemToCart) {\n cartLine.DeliveryMode = this.actionContext.requestContext.channel?.EmailDeliveryModeCode;\n }\n\n // Check if the product is service or not by product type\n const PRODUCTASSERVICE = 2 as ReleasedProductType.Service;\n const isAddServiceItemToCart = inputItem.product.ItemTypeValue === PRODUCTASSERVICE;\n\n internalInput.push({\n cartLineToAdd: cartLine,\n availableQuantity: inputItem.availableQuantity,\n isStockCheckEnabled: inputItem.enableStockCheck,\n isAddServiceItemToCart\n });\n }\n\n return this._doCartOperationWithRetry(() => addProductsToCartInternal(this.cart, this.actionContext, internalInput));\n });\n }\n\n /**\n * Adds the specified invoices to the current cart.\n * @param input - The input.\n * @param input.invoiceIds - Invoice Ids.\n * @param input.additionalProperties - Additional properties.\n * @returns Cart action result.\n */\n @action\n public async addInvoicesToCart(input: { invoiceIds: string[]; additionalProperties?: object }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() => addInvoicesToCartInternal(this.cart, input.invoiceIds, this.actionContext));\n });\n }\n\n /**\n * Adds the specified order invoice to the current cart.\n * @param input - Input.\n * @param input.invoiceId - Invoice id.\n * @param input.lineDescription - Line description.\n * @param input.additionalProperties - Additional properties.\n * @returns Cart action result.\n */\n @action\n public async addOrderInvoiceToCart(input: {\n invoiceId: string;\n lineDescription: string;\n additionalProperties?: object;\n }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() =>\n addOrderInvoiceToCartInternal(this.cart, input.invoiceId, input.lineDescription, this.actionContext)\n );\n });\n }\n\n /**\n * Sets price for the given cart line with an invoice. Used to complete partial invoice payments.\n * @param input - Input for the operation.\n * @param input.cartLineId - The cart line with the invoice for which to update the price.\n * @param input.price - The new value of price of the invoice.\n * @returns The cart action result.\n */\n @action public async setInvoiceLinePrice(input: { cartLineId: string | null; price: number }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(async () =>\n setInvoiceLinePriceInternal(this.cart, input.cartLineId, input.price, this.actionContext)\n );\n });\n }\n\n /**\n * Removes the cart lines with the provided ids from the cart.\n * @param input - Input.\n * @param input.cartLineIds - Cart line ids.\n * @param input.additionalProperties - Additional properties.\n * @returns The cart action result.\n */\n @action\n public async removeCartLines(input: { cartLineIds: string[]; additionalProperties?: object }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() => removeCartLineInternal(this.cart, input.cartLineIds, this.actionContext));\n });\n }\n\n /**\n * Clears the pickup location information from the provided cart line,\n * resulting in it getting shipped to the customer.\n * @param input - Input.\n * @param input.cartLineId - Cart line id.\n * @param input.additionalProperties - Additional properties.\n * @returns The cart action result.\n */\n @action\n public async clearCartLinePickupLocation(input: { cartLineId: string; additionalProperties?: object }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() => clearCartLineDeliveryModeInternal(this.cart, input.cartLineId, this.actionContext));\n });\n }\n\n /**\n * Clears the delivery mode, and other information for the shipping cart lines.\n * @param input - Input.\n * @param input.additionalProperties - Additional properties.\n * @param input.channelDeliveryOptionConfiguration -- Channel delivery option configuration.\n * @returns The cart action result.\n */\n @action\n public async clearCartLinesDeliveryInformation(input: {\n additionalProperties?: object;\n channelDeliveryOptionConfiguration?: ChannelDeliveryOptionConfiguration;\n }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() =>\n clearCartLinesDeliveryInformation(this.cart, this.actionContext, input.channelDeliveryOptionConfiguration)\n );\n });\n }\n\n /**\n * Marks the provided cart line for pickup in store, with the provided location as\n * the pickup location.\n * @param input - Input.\n * @param input.cartLineId - Cart line id.\n * @param input.location - Location.\n * @param input.additionalProperties - Additional properties.\n * @param input.deliveryMode - Delivery mode.\n * @returns The cart action result.\n */\n @action\n public async updateCartLinePickupLocation(input: {\n cartLineId: string;\n location: OrgUnitLocation;\n additionalProperties?: object;\n deliveryMode?: string;\n }): Promise {\n return this._doAsyncAction(async () => {\n if (!this.actionContext.requestContext.channel) {\n return { status: 'FAILED' };\n }\n\n const cartLineDeliverySpecification = {\n LineId: input.cartLineId,\n DeliverySpecification: {\n DeliveryModeId:\n input.deliveryMode !== undefined\n ? input.deliveryMode\n : this.actionContext.requestContext.channel.PickupDeliveryModeCode,\n DeliveryPreferenceTypeValue: 2, // Pick up in store\n PickUpStoreId: input.location.OrgUnitNumber,\n DeliveryAddress: this._buildAddressFromOrgUnitLocation(input.location)\n }\n };\n\n return this._doCartOperationWithRetry(() =>\n updateCartLineDeliverySpecificationsInternal(this.cart, [cartLineDeliverySpecification], this.actionContext)\n );\n });\n }\n\n /**\n * Updates cart line pick up date.\n * @param input - The cart line.\n * @param input.lineDeliverySpecifications - Line delivery specifications.\n * @returns The cart action result.\n */\n @action\n public async updateCartLinePickupDateTimeslot(input: {\n lineDeliverySpecifications: LineDeliverySpecification[];\n }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() =>\n updateCartLineDeliverySpecificationsInternal(this.cart, input.lineDeliverySpecifications, this.actionContext)\n );\n });\n }\n\n /**\n * Updates the delivery mode for items in the cart with the desired delivery mode, preserving BOPIS status for stuff already marked as BOPIS.\n * @param input - The input.\n * @param input.deliveryModeId - Delivery mode id.\n * @param input.shippingAddress - Shipping address.\n * @param input.additionalProperties - Additional properties.\n * @param input.channelDeliveryOptionConfig - Channel delivery option configuration.\n * @returns The cart action result.\n */\n @action\n public async updateCartDeliverySpecification(input: {\n deliveryModeId: string;\n shippingAddress: Address | undefined;\n additionalProperties?: object;\n channelDeliveryOptionConfig?: ChannelDeliveryOptionConfiguration;\n }): Promise {\n return this._doAsyncAction(async () => {\n if (input.deliveryModeId.trim() === '') {\n return { status: 'FAILED', substatus: 'EMPTYINPUT' };\n }\n\n const pickupDeliveryModeCode =\n this.actionContext.requestContext.channel && this.actionContext.requestContext.channel.PickupDeliveryModeCode;\n const emailDeliveryModeCode =\n this.actionContext.requestContext.channel && this.actionContext.requestContext.channel.EmailDeliveryModeCode;\n let cartLinesForShipping: CartLine[] = [];\n\n cartLinesForShipping =\n input.channelDeliveryOptionConfig !== undefined\n ? (this.cart.CartLines || []).filter(cartLine =>\n cartLine.DeliveryMode && cartLine.DeliveryMode !== ''\n ? cartLine.DeliveryMode !==\n input.channelDeliveryOptionConfig?.PickupDeliveryModeCodes?.find(\n deliveryMode => deliveryMode === cartLine.DeliveryMode\n ) && cartLine.DeliveryMode !== emailDeliveryModeCode\n : cartLine\n )\n : (this.cart.CartLines || []).filter(cartLine =>\n cartLine.DeliveryMode && cartLine.DeliveryMode !== ''\n ? cartLine.DeliveryMode !== pickupDeliveryModeCode && cartLine.DeliveryMode !== emailDeliveryModeCode\n : cartLine\n );\n\n if (cartLinesForShipping.length > 0) {\n const deliverySpecifications = cartLinesForShipping.map(cartLine => {\n return {\n LineId: cartLine.LineId,\n DeliverySpecification: {\n DeliveryModeId: input.deliveryModeId,\n DeliveryPreferenceTypeValue: 1, // Ship\n DeliveryAddress: input.shippingAddress\n }\n };\n });\n\n return this._doCartOperationWithRetry(() =>\n updateCartLineDeliverySpecificationsInternal(this.cart, deliverySpecifications, this.actionContext)\n );\n }\n\n return { status: 'FAILED', substatus: 'NOCONTENT' };\n });\n }\n\n /**\n * Updates the quantity of the cart line.\n * @param input - The input.\n * @param input.cartLineId - Cart line id.\n * @param input.newQuantity - New quantity.\n * @param input.additionalProperties - Additional properties.\n * @returns The cart action result.\n */\n @action\n public async updateCartLineQuantity(input: {\n cartLineId: string;\n newQuantity: number;\n additionalProperties?: object;\n }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() =>\n updateCartLineQuantityInternal(\n this.cart,\n input.cartLineId,\n input.newQuantity,\n this.actionContext,\n\n // @ts-expect-error\n input.additionalProperties?.isUsingDefaultOrderSettingsMax\n )\n );\n });\n }\n\n /**\n * Updates the loyalty card ID on the card.\n * @param input - The input.\n * @param input.loyaltyCardNumber - The loyalty card id to use.\n * @param input.additionalProperties - Additional properties.\n * @returns The cart action result.\n */\n @action\n public async updateLoyaltyCardId(input: {\n loyaltyCardNumber: string | undefined;\n additionalProperties?: object;\n }): Promise {\n if (!input.loyaltyCardNumber) {\n return { status: 'FAILED', substatus: 'EMPTYINPUT' };\n }\n\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() =>\n updateLoyaltyCardIdInternal(this.cart, input.loyaltyCardNumber!, this.actionContext)\n );\n });\n }\n\n /**\n * Adds promo code to the cart.\n * @param input - The input.\n * @param input.promoCode - The promo code to add.\n * @param input.additionalProperties - Additional properties.\n * @returns The cart action result.\n */\n @action\n public addPromoCode(input: { promoCode: string; additionalProperties?: object }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() => addPromoCodeInternal(this.cart, input.promoCode, this.actionContext));\n });\n }\n\n /**\n * Removes promo codes from the cart.\n * @param input - The input.\n * @param input.promoCodes - The promo codes to remove.\n * @param input.additionalProperties - Additional properties.\n * @returns The cart action result.\n */\n @action\n public removePromoCodes(input: { promoCodes: string[]; additionalProperties?: object }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() => removePromoCodesInternal(this.cart, input.promoCodes, this.actionContext));\n });\n }\n\n /**\n * Removes all promo code from the cart.\n * @param input - The input.\n * @param input.additionalProperties - Additional properties.\n * @returns The cart action result.\n */\n @action\n public removeAllPromoCodes(input: { additionalProperties?: object }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() => removeAllPromoCodesInternal(this.cart, this.actionContext));\n });\n }\n\n /**\n * Updates receipt email.\n * @param input - The input.\n * @param input.newEmail - The receipt email.\n * @param input.additionalProperties - Additional properties.\n * @returns The cart action result.\n */\n @action\n public async updateReceiptEmail(input: { newEmail: string; additionalProperties?: object }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() => updateReceiptEmail(this.cart, input.newEmail, this.actionContext));\n });\n }\n\n /**\n * Updates shipping address.\n * @param input - The input.\n * @param input.newShippingAddress - The shipping address.\n * @param input.additionalProperties - The additional properties.\n * @returns ICartActionResult.\n */\n @action\n public async updateShippingAddress(input: {\n newShippingAddress: Address;\n additionalProperties?: { [key: string]: unknown };\n }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(async () =>\n updateShippingAddress(this.cart, input.newShippingAddress, this.actionContext)\n );\n });\n }\n\n /**\n * Updates the attribute values.\n * @param input - The input.\n * @param input.newAttributeValues - The new attribute values to update.\n * @param input.additionalProperties - The additional properties.\n * @returns ICartActionResult.\n */\n @action\n public async updateAttributeValues(input: {\n newAttributeValues: AttributeValueBase[];\n additionalProperties?: object;\n }): Promise {\n this._attributeValues = input.newAttributeValues;\n const newCartObject: Cart = {\n Id: this.cart.Id,\n AttributeValues: input.newAttributeValues\n };\n return this.updateCart({ newCartObject });\n }\n\n /**\n * Updates the extension properties.\n * @param input - The input.\n * @param input.newExtensionProperties - The new extension properties.\n * @param input.additionalProperties - The additional properties.\n * @returns ICartActionResult.\n */\n @action\n public async updateExtensionProperties(input: {\n newExtensionProperties: CommerceProperty[];\n additionalProperties?: object;\n }): Promise {\n this._extensionProperties = input.newExtensionProperties;\n const newCartObject: Cart = {\n Id: this.cart.Id,\n ExtensionProperties: input.newExtensionProperties\n };\n return this.updateCart({ newCartObject });\n }\n\n /**\n * Updates cart object.\n * @param input - The input.\n * @param input.newCartObject - The new cart object.\n * @param input.additionalProperties - Additional properties.\n * @returns Promise of cart action result.\n */\n @action\n public async updateCart(input: { newCartObject: Cart; additionalProperties?: object }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() => updateCart(this.cart, input.newCartObject, this.actionContext));\n });\n }\n\n /**\n * Updates cartLines objects in cart.\n * @param input - The input.\n * @param input.updatedCartLinesObject - updated cartline.\n * @returns ICartActionResult.\n */\n @action\n public async updateCartLines(input: { updatedCartLinesObject: CartLine[] }): Promise {\n return this._doAsyncAction(async () => {\n return this._doCartOperationWithRetry(() =>\n updateCartLinesInternal(this.cart, input.updatedCartLinesObject, this.actionContext)\n );\n });\n }\n\n /**\n * Initialize function.\n */\n public async initialize(): Promise {\n if (this.isInitialized) {\n return;\n }\n\n const newCart = await getOrCreateActiveCart(this.actionContext);\n\n if (newCart) {\n this._cart = newCart;\n this._status = 'READY';\n } else {\n this._status = 'ERROR';\n }\n\n this.isInitialized = true;\n }\n\n /**\n * Validates inventory across cart lines.\n * @param callback - Callback function.\n * @returns ICartActionResult.\n */\n private async _doCartOperationWithRetry(callback: () => Promise): Promise {\n let callbackResult = await callback();\n\n if (callbackResult.status === 'SUCCESS') {\n if (callbackResult.cart) {\n this._cart = callbackResult.cart;\n }\n } else {\n const refreshCartResult = await this.refreshCart({});\n\n if (refreshCartResult.status === 'SUCCESS') {\n callbackResult = await callback();\n\n if (callbackResult.status === 'SUCCESS') {\n if (callbackResult.cart) {\n this._cart = callbackResult.cart;\n }\n }\n }\n }\n\n if (callbackResult.status === 'SUCCESS' && callbackResult.substatus && callbackResult.substatus === 'PRODUCTADDED') {\n this._isProductAddedToCart = true;\n } else {\n this._isProductAddedToCart = false;\n }\n\n return {\n status: callbackResult.status,\n substatus: callbackResult.substatus,\n errorDetails: callbackResult.errorDetails,\n validationResults: callbackResult.validationResults\n };\n }\n\n /**\n * Build address from org unit location.\n * @param location - The location.\n * @returns Address.\n */\n private _buildAddressFromOrgUnitLocation(location: OrgUnitLocation): Address {\n return {\n RecordId: location.PostalAddressId,\n Name: location.OrgUnitName,\n FullAddress: location.Address,\n Street: location.Street,\n StreetNumber: location.StreetNumber,\n City: location.City,\n DistrictName: location.DistrictName,\n BuildingCompliment: location.BuildingCompliment,\n Postbox: location.Postbox,\n ThreeLetterISORegionName: location.Country,\n ZipCode: location.Zip,\n County: location.County,\n CountyName: location.CountyName,\n State: location.State,\n StateName: location.StateName\n };\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { Cart, CartsDataActions, CommerceException } from '@msdyn365-commerce/retail-proxy';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function addInvoicesToCartInternal(\n cart: Readonly,\n invoiceIds: string[],\n actionContext: IActionContext\n): Promise {\n if (!invoiceIds || invoiceIds.length === 0) {\n actionContext.telemetry.trace('Invoice ids are empty, unable to add invoices to cart.');\n return { cart, status: 'FAILED', substatus: 'EMPTYINPUT' };\n }\n\n if (cart.Version) {\n return CartsDataActions.addInvoicesAsync({ callerContext: actionContext }, cart.Id, invoiceIds)\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch(error => {\n actionContext.telemetry.trace(error);\n actionContext.telemetry.trace('Unable to add invoices to cart');\n\n // Error object comes from API and doesn't have type definitions yet.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- No type definition for error.\n const errorDetails: CommerceException = error.data;\n const errorResult: ICartActionResultWithCart = { cart: undefined, status: 'FAILED', errorDetails };\n return errorResult;\n });\n }\n actionContext.telemetry.warning('Unable to add invoices, Cart Version could not be found');\n\n return { cart: undefined, status: 'FAILED', substatus: 'NOCARTVERSION' };\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { addOrderInvoiceAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function addOrderInvoiceToCartInternal(\n cart: Readonly,\n invoiceId: string,\n lineDescription: string,\n actionContext: IActionContext\n): Promise {\n if (!invoiceId || invoiceId === '') {\n actionContext.telemetry.trace('Invoice id is empty, unable to add invoice to cart.');\n return { cart, status: 'FAILED', substatus: 'EMPTYINPUT' };\n }\n\n if (cart.Version) {\n return addOrderInvoiceAsync({ callerContext: actionContext }, cart.Id, invoiceId, lineDescription)\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch(error => {\n actionContext.telemetry.trace(error);\n actionContext.telemetry.trace('Unable to add order invoice to cart');\n\n const resultWithCart: ICartActionResultWithCart = {\n cart: undefined,\n status: 'FAILED',\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n errorDetails: { LocalizedMessage: error.message }\n };\n\n return resultWithCart;\n });\n }\n actionContext.telemetry.warning('Unable to add order invoice, Cart Version could not be found');\n\n return { cart: undefined, status: 'FAILED', substatus: 'NOCARTVERSION' };\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { updateAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function updateReceiptEmail(\n cart: Readonly,\n email: string,\n actionContext: IActionContext\n): Promise {\n if (!cart) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n return updateAsync(\n { callerContext: actionContext },\n {\n Id: cart.Id,\n ReceiptEmail: email\n }\n )\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch(error => {\n actionContext.telemetry.warning(error);\n actionContext.telemetry.debug('Unable to add receipt email to the cart');\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { readAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nexport default async function refreshCart(cartId: string, ctx: IActionContext): Promise {\n return readAsync({ callerContext: ctx, bypassCache: 'get' }, cartId)\n .then(cart => {\n return cart;\n })\n .catch(error => {\n return undefined;\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { computed, observable } from 'mobx';\n\nimport { GlobalStateStatus, IGlobalState } from './i-global-state';\n\n/**\n * Base global state that handles common global state behavior that other state can extend from.\n */\nexport class GlobalState implements IGlobalState {\n protected isInitialized: boolean = false;\n\n protected actionContext: IActionContext;\n\n @observable protected _status: GlobalStateStatus;\n\n @computed public get status(): Readonly {\n return this._status;\n }\n\n constructor(actionContext: IActionContext) {\n this.actionContext = actionContext;\n this._status = 'UPDATING';\n }\n\n public async initialize(): Promise {\n this.isInitialized = true;\n this._status = 'READY';\n\n return;\n }\n\n protected async _doAsyncAction(lambda: () => Promise): Promise {\n this._status = 'UPDATING';\n\n return lambda()\n .then(result => {\n this._status = 'READY';\n return result;\n })\n .catch(error => {\n console.log(error);\n this._status = 'ERROR';\n\n return Promise.reject(error);\n });\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { addDiscountCodeAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart, Coupon } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function addPromoCode(\n cart: Readonly,\n promoCode: string,\n actionContext: IActionContext\n): Promise {\n if (!cart) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n if (hasPromoCode(cart, promoCode)) {\n return { cart: undefined, status: 'FAILED', substatus: 'ALREADYADDED' };\n }\n\n return addDiscountCodeAsync({ callerContext: actionContext }, cart.Id, promoCode)\n .then(newCart => {\n // Retail server will still return success if a promo code is not valid,\n // but it won't actually add that promo code. So need to check if promo\n // code is actually in the new cart\n if (hasPromoCode(newCart, promoCode)) {\n return { cart: newCart, status: 'SUCCESS' };\n }\n return { cart: undefined, status: 'FAILED', substatus: 'INVALIDPROMOCODE' };\n })\n .catch(error => {\n actionContext.telemetry.warning(error);\n const resultWithCart: ICartActionResultWithCart = {\n cart: undefined,\n status: 'FAILED',\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n errorDetails: { LocalizedMessage: error.message }\n };\n\n return resultWithCart;\n });\n}\n\nfunction hasPromoCode(cart: Cart, code: string): boolean {\n const codes = cart.Coupons\n ? cart.Coupons.map((coupon: Coupon) => {\n return coupon.Code!.toLowerCase();\n })\n : [];\n return codes.includes(code.toLowerCase());\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { Cart, CartsDataActions } from '@msdyn365-commerce/retail-proxy';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\n/**\n * Sets price for the given cart line with an invoice. Used to complete partial invoice payments.\n * @param cart - Cart where the invoice is located.\n * @param cartLineId - The cart line with the invoice for which to update the price.\n * @param price - The new value of price of the invoice.\n * @param actionContext - The action context from SDK.\n * @returns Result of the operation with the details.\n */\nexport async function setInvoiceLinePriceInternal(\n cart: Readonly,\n cartLineId: string | null,\n price: number,\n actionContext: IActionContext\n): Promise {\n if (!cart.Version) {\n actionContext.telemetry.warning('Unable to set invoice line price, Cart Version could not be found');\n return { cart: undefined, status: 'FAILED', substatus: 'NOCARTVERSION' };\n }\n\n try {\n const newCart = await CartsDataActions.setInvoiceLinePriceAsync(\n { callerContext: actionContext },\n cart.Id,\n cartLineId,\n price,\n cart.Version\n );\n return { cart: newCart, status: 'SUCCESS' };\n } catch (error) {\n const errorInstance = error as Error;\n actionContext.telemetry.trace(error as string);\n actionContext.telemetry.trace('Unable to set invoice line price');\n\n return {\n cart: undefined,\n status: 'FAILED',\n errorDetails: { LocalizedMessage: errorInstance.message }\n };\n }\n}\n\nexport default setInvoiceLinePriceInternal;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { updateCartLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart, CartLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function clearCartLineDeliveryMode(\n cart: Readonly,\n cartLineId: string,\n actionContext: IActionContext\n): Promise {\n if (!cart || !cart.CartLines) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n const matchingLines = cart.CartLines.filter(cartLine => cartLine.LineId === cartLineId);\n\n if (matchingLines.length === 0) {\n return { cart: undefined, status: 'FAILED', substatus: 'NOMATCHEDCARTLINE' };\n }\n\n const copyCartLine: CartLine = { ...matchingLines[0] };\n\n copyCartLine.DeliveryMode = '';\n copyCartLine.FulfillmentStoreId = '';\n copyCartLine.ShippingAddress = {};\n copyCartLine.WarehouseId = actionContext.requestContext.channel?.InventLocation || cart.WarehouseId;\n\n return updateCartLinesAsync({ callerContext: actionContext }, cart.Id, [copyCartLine], null)\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch(error => {\n actionContext.telemetry.warning(error);\n actionContext.telemetry.debug('Unable to Update Cart Line');\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n return { cart: undefined, status: 'FAILED', errorDetails: { LocalizedMessage: error.message } };\n });\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nexport * from './checkout-state-enums';\nexport * from './i-cart-state';\nexport * from './i-checkout-state';\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { AsyncResult, IActionContext } from '@msdyn365-commerce/core';\n\nimport { BaseCartState } from '../cart-state/base-cart-state';\nimport { ICartState } from '../state-interfaces/i-cart-state';\nimport cartStateDataAction from './cart-state-data-action';\nimport { GlobalStateInput } from './global-state-data-action';\n\nexport function getCartState(ctx: IActionContext): AsyncResult {\n return cartStateDataAction(\n new GlobalStateInput('CARTSTATE', BaseCartState, ctx.requestContext.apiSettings, ctx.requestContext),\n ctx\n );\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nexport * from './cart-state';\nexport * from './checkout-state';\nexport * from './data-actions';\nexport * from './global-state';\nexport * from './state-interfaces';\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nexport enum ErrorCode {\n ActionError = 'ActionError',\n Microsoft_Dynamics_Commerce_Runtime_BlockedLoyaltyCard = 'Microsoft_Dynamics_Commerce_Runtime_BlockedLoyaltyCard',\n Microsoft_Dynamics_Commerce_Runtime_CustomerAccountLimitSignDifferentFromAmountDue = 'Microsoft_Dynamics_Commerce_Runtime_CustomerAccountLimitSignDifferentFromAmountDue',\n Microsoft_Dynamics_Commerce_Runtime_CustomerAccountPaymentExceedsAvailableCreditLimit = 'Microsoft_Dynamics_Commerce_Runtime_CustomerAccountPaymentExceedsAvailableCreditLimit',\n Microsoft_Dynamics_Commerce_Runtime_CustomerAccountPaymentExceedsCustomerAccountFloorLimit = 'Microsoft_Dynamics_Commerce_Runtime_CustomerAccountPaymentExceedsCustomerAccountFloorLimit',\n Microsoft_Dynamics_Commerce_Runtime_CustomerAccountPaymentExceedsTotalAmountForCarryOutAndReturnItems = 'Microsoft_Dynamics_Commerce_Runtime_CustomerAccountPaymentExceedsTotalAmountForCarryOutAndReturnItems',\n Microsoft_Dynamics_Commerce_Runtime_CustomerAccountPaymentForCustomerWithoutAllowOnAccount = 'Microsoft_Dynamics_Commerce_Runtime_CustomerAccountPaymentForCustomerWithoutAllowOnAccount',\n Microsoft_Dynamics_Commerce_Runtime_CustomerAccountPaymentNotAllowedForOpenInvoices = 'Microsoft_Dynamics_Commerce_Runtime_CustomerAccountPaymentNotAllowedForOpenInvoices',\n Microsoft_Dynamics_Commerce_Runtime_FraudRisk = 'Microsoft_Dynamics_Commerce_Runtime_FraudRisk',\n Microsoft_Dynamics_Commerce_Runtime_GiftCardBalanceInquiryFailed = 'Microsoft_Dynamics_Commerce_Runtime_GiftCardBalanceInquiryFailed',\n Microsoft_Dynamics_Commerce_Runtime_GiftCardCurrencyMismatch = 'Microsoft_Dynamics_Commerce_Runtime_GiftCardCurrencyMismatch',\n Microsoft_Dynamics_Commerce_Runtime_InvalidCartVersion = 'Microsoft_Dynamics_Commerce_Runtime_InvalidCartVersion',\n Microsoft_Dynamics_Commerce_Runtime_InvalidLoyaltyCardNumber = 'Microsoft_Dynamics_Commerce_Runtime_InvalidLoyaltyCardNumber',\n Microsoft_Dynamics_Commerce_Runtime_InvalidPaymentRequest = 'Microsoft_Dynamics_Commerce_Runtime_InvalidPaymentRequest',\n Microsoft_Dynamics_Commerce_Runtime_MissingRequiredCartTenderLines = 'Microsoft_Dynamics_Commerce_Runtime_MissingRequiredCartTenderLines',\n Microsoft_Dynamics_Commerce_Runtime_MultipleCustomerAccountPaymentsNotAllowed = ' Microsoft_Dynamics_Commerce_Runtime_MultipleCustomerAccountPaymentsNotAllowed',\n Microsoft_Dynamics_Commerce_Runtime_NoMoreThanOneLoyaltyTender = 'Microsoft_Dynamics_Commerce_Runtime_NoMoreThanOneLoyaltyTender',\n Microsoft_Dynamics_Commerce_Runtime_NoResponseFromGatewayForGiftCardBalanceInquiry = 'Microsoft_Dynamics_Commerce_Runtime_NoResponseFromGatewayForGiftCardBalanceInquiry',\n Microsoft_Dynamics_Commerce_Runtime_NoTenderLoyaltyCard = 'Microsoft_Dynamics_Commerce_Runtime_NoTenderLoyaltyCard',\n Microsoft_Dynamics_Commerce_Runtime_NotEnoughRewardPoints = 'Microsoft_Dynamics_Commerce_Runtime_NotEnoughRewardPoints',\n Microsoft_Dynamics_Commerce_Runtime_PaymentAlreadyVoided = 'Microsoft_Dynamics_Commerce_Runtime_PaymentAlreadyVoided',\n Microsoft_Dynamics_Commerce_Runtime_PaymentAmountExceedsGiftBalance = 'Microsoft_Dynamics_Commerce_Runtime_PaymentAmountExceedsGiftBalance',\n Microsoft_Dynamics_Commerce_Runtime_PaymentRequiresMerchantProperties = 'Microsoft_Dynamics_Commerce_Runtime_PaymentRequiresMerchantProperties',\n Microsoft_Dynamics_Commerce_Runtime_PaymentUsingUnauthorizedAccount = 'Microsoft_Dynamics_Commerce_Runtime_PaymentUsingUnauthorizedAccount',\n Microsoft_Dynamics_Commerce_Runtime_RefundAmountMoreThanAllowed = 'Microsoft_Dynamics_Commerce_Runtime_RefundAmountMoreThanAllowed',\n Microsoft_Dynamics_Commerce_Runtime_UnableToAuthorizePayment = 'Microsoft_Dynamics_Commerce_Runtime_UnableToAuthorizePayment',\n Microsoft_Dynamics_Commerce_Runtime_UnableToAuthorizePaymentCardAdditionalContextRequired = 'Microsoft_Dynamics_Commerce_Runtime_UnableToAuthorizePaymentCardAdditionalContextRequired',\n Microsoft_Dynamics_Commerce_Runtime_UnableToAuthorizePaymentCardTypeMissingOrNotSupported = 'Microsoft_Dynamics_Commerce_Runtime_UnableToAuthorizePaymentCardTypeMissingOrNotSupported',\n Microsoft_Dynamics_Commerce_Runtime_UnableToCancelPayment = 'Microsoft_Dynamics_Commerce_Runtime_UnableToCancelPayment',\n Microsoft_Dynamics_Commerce_Runtime_UnableToReadCardTokenInfo = 'Microsoft_Dynamics_Commerce_Runtime_UnableToReadCardTokenInfo',\n Microsoft_Dynamics_Commerce_Runtime_UnableToRetrieveCardPaymentAcceptResult = 'Microsoft_Dynamics_Commerce_Runtime_UnableToRetrieveCardPaymentAcceptResult'\n}\n\nexport enum ErrorMessageResource {\n blockedLoyaltyCardErrorMessage = 'blockedLoyaltyCardErrorMessage',\n checkoutTimeoutErrorMessage = 'checkoutTimeoutErrorMessage',\n customerAccountLimitSignDifferentFromAmountDueErrorMessage = 'customerAccountLimitSignDifferentFromAmountDueErrorMessage',\n customerAccountPaymentExceedsAvailableCreditLimitErrorMessage = 'customerAccountPaymentExceedsAvailableCreditLimitErrorMessage',\n customerAccountPaymentExceedsCustomerAccountFloorLimitErrorMessage = 'customerAccountPaymentExceedsCustomerAccountFloorLimitErrorMessage',\n customerAccountPaymentExceedsTotalAmountForCarryOutAndReturnItemsErrorMessage = 'customerAccountPaymentExceedsTotalAmountForCarryOutAndReturnItemsErrorMessage',\n customerAccountPaymentForCustomerWithoutAllowOnAccountErrorMessage = 'customerAccountPaymentForCustomerWithoutAllowOnAccountErrorMessage',\n customerAccountPaymentNotAllowedForOpenInvoicesErrorMessage = 'customerAccountPaymentNotAllowedForOpenInvoicesErrorMessage',\n fraudRiskErrorMessage = 'fraudRiskErrorMessage',\n giftCardBalanceInquiryFailedErrorMessage = 'giftCardBalanceInquiryFailedErrorMessage',\n giftCardCurrencyMismatchErrorMessage = 'giftCardCurrencyMismatchErrorMessage',\n invalidCartVersionErrorMessage = 'invalidCartVersionErrorMessage',\n invalidLoyaltyCardNumberErrorMessage = 'invalidLoyaltyCardNumberErrorMessage',\n invalidPaymentRequestConsoleErrorMessage = 'invalidPaymentRequestConsoleErrorMessage',\n invalidPaymentRequestErrorMessage = 'invalidPaymentRequestErrorMessage',\n missingRequiredCartTenderLinesErrorMessage = 'missingRequiredCartTenderLinesErrorMessage',\n multipleCustomerAccountPaymentsNotAllowedErrorMessage = 'multipleCustomerAccountPaymentsNotAllowedErrorMessage',\n noMoreThanOneLoyaltyTenderErrorMessage = 'noMoreThanOneLoyaltyTenderErrorMessage',\n noResponseFromGatewayForGiftCardBalanceInquiryErrorMessage = 'noResponseFromGatewayForGiftCardBalanceInquiryErrorMessage',\n noTenderLoyaltyCardErrorMessage = 'noTenderLoyaltyCardErrorMessage',\n notEnoughRewardPointsErrorMessage = 'notEnoughRewardPointsErrorMessage',\n paymentAlreadyVoidedErrorMessage = 'paymentAlreadyVoidedErrorMessage',\n paymentAmountExceedsGiftBalanceErrorMessage = 'paymentAmountExceedsGiftBalanceErrorMessage',\n paymentRequiresMerchantPropertiesConsoleErrorMessage = 'paymentRequiresMerchantPropertiesConsoleErrorMessage',\n paymentRequiresMerchantPropertiesErrorMessage = 'paymentRequiresMerchantPropertiesErrorMessage',\n paymentUsingUnauthorizedAccountErrorMessage = 'paymentUsingUnauthorizedAccountErrorMessage',\n refundAmountMoreThanAllowedErrorMessage = 'refundAmountMoreThanAllowedErrorMessage',\n unableToAuthorizePaymentCardAdditionalContextRequiredErrorMessage = 'unableToAuthorizePaymentCardAdditionalContextRequiredErrorMessage',\n unableToAuthorizePaymentCardTypeMissingOrNotSupportedErrorMessage = 'unableToAuthorizePaymentCardTypeMissingOrNotSupportedErrorMessage',\n unableToAuthorizePaymentErrorMessage = 'unableToAuthorizePaymentErrorMessage',\n unableToCancelPaymentErrorMessage = 'unableToCancelPaymentErrorMessage',\n unableToReadCardTokenInfoErrorMessage = 'unableToReadCardTokenInfoErrorMessage',\n unableToRetrieveCardPaymentAcceptResultErrorMessage = 'unableToRetrieveCardPaymentAcceptResultErrorMessage'\n}\n\nexport enum ErrorLocation {\n Checkout,\n CheckoutBillingAddress,\n CheckoutCustomerAccountPayment,\n CheckoutDeliveryOptions,\n CheckoutExpress,\n CheckoutGiftCard,\n CheckoutGuestProfile,\n CheckoutLoyalty,\n CheckoutPaymentInstrument,\n CheckoutPickup,\n CheckoutShippingAddress,\n CheckoutTermsAndConditions,\n Console,\n GiftCardBalanceCheck\n}\n\nexport enum CheckoutModule {\n CheckoutBillingAddress = 'checkout-billing-address',\n CheckoutCustomerAccountPayment = 'checkout-customer-account-payment',\n CheckoutDeliveryOptions = 'checkout-delivery-options',\n CheckoutExpress = 'checkout-express',\n CheckoutGiftCard = 'checkout-gift-card',\n CheckoutGuestProfile = 'checkout-guest-profile',\n CheckoutLoyalty = 'checkout-loyalty',\n CheckoutPaymentInstrument = 'checkout-payment-instrument',\n CheckoutPickup = 'checkout-pickup',\n CheckoutShippingAddress = 'checkout-shipping-address',\n CheckoutTermsAndConditions = 'checkout-terms-and-conditions',\n None = 'none'\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IActionContext } from '@msdyn365-commerce/core';\nimport { updateCartLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\nimport { Cart, CartLine } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\n\nimport { ICartActionResultWithCart } from './cart-action-result';\n\nexport default async function updateCartLineQuantityInternal(\n cart: Readonly,\n cartLineId: string,\n newQuantity: number,\n actionContext: IActionContext,\n isUsingDefaultOrderSettingsMax: boolean\n): Promise {\n if (isUsingDefaultOrderSettingsMax) {\n return updateCartLineQuantityValidateMaxAgainstDefaultOrderSettings(cart, cartLineId, newQuantity, actionContext);\n }\n return updateCartLineQuantityValidateMaxAgainstSiteSettings(cart, cartLineId, newQuantity, actionContext);\n}\nasync function updateCartLineQuantityValidateMaxAgainstDefaultOrderSettings(\n cart: Readonly,\n cartLineId: string,\n newQuantity: number,\n actionContext: IActionContext\n): Promise {\n if (!cart || !cart.CartLines) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n const matchingLines = cart.CartLines.filter(cartLine => cartLine.LineId === cartLineId);\n\n if (matchingLines.length === 0) {\n return { cart: undefined, status: 'FAILED', substatus: 'NOMATCHEDCARTLINE' };\n }\n\n const copyCartLine: CartLine = { ...matchingLines[0] };\n\n copyCartLine.Quantity = newQuantity;\n\n return updateCartLinesAsync({ callerContext: actionContext }, cart.Id, [copyCartLine], null)\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch(error => {\n let cartActionResult: ICartActionResultWithCart;\n\n actionContext.telemetry.warning(error);\n actionContext.telemetry.debug('Unable to Update Cart Line');\n if (\n error.name === 'Microsoft_Dynamics_Commerce_Runtime_AddingItem_ExceedsMaximumQuantity' ||\n error.name === 'Microsoft_Dynamics_Commerce_Runtime_UpdatingItem_ExceedsMaximumQuantity'\n ) {\n cartActionResult = {\n cart: undefined,\n status: 'FAILED',\n substatus: 'QUANTITYLIMITS',\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n errorDetails: { LocalizedMessage: error.message },\n validationResults: error.data?.ValidationResults\n };\n return cartActionResult;\n }\n\n cartActionResult = {\n cart: undefined,\n status: 'FAILED',\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n errorDetails: { LocalizedMessage: error.message },\n validationResults: error.data?.ValidationResults\n };\n return cartActionResult;\n });\n}\n\nasync function updateCartLineQuantityValidateMaxAgainstSiteSettings(\n cart: Readonly,\n cartLineId: string,\n newQuantity: number,\n actionContext: IActionContext\n): Promise {\n if (!cart || !cart.CartLines) {\n return { cart: undefined, status: 'FAILED', substatus: 'EMPTYCART' };\n }\n\n const matchingLines = cart.CartLines.filter(cartLine => cartLine.LineId === cartLineId);\n\n if (matchingLines.length === 0) {\n return { cart: undefined, status: 'FAILED', substatus: 'NOMATCHEDCARTLINE' };\n }\n\n const copyCartLine: CartLine = { ...matchingLines[0] };\n copyCartLine.Quantity = Math.min(newQuantity, actionContext.requestContext.app.config.maxQuantityForCartLineItem || 10);\n\n return updateCartLinesAsync({ callerContext: actionContext }, cart.Id, [copyCartLine], null)\n .then(newCart => {\n return { cart: newCart, status: 'SUCCESS' };\n })\n .catch(error => {\n actionContext.telemetry.warning(error);\n actionContext.telemetry.debug('Unable to Update Cart Line');\n return {\n cart: undefined,\n status: 'FAILED',\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- existing error type.\n errorDetails: { LocalizedMessage: error.message },\n validationResults: error.data?.ValidationResults\n };\n });\n}\n"],"sourceRoot":""}