{"version":3,"sources":["webpack:///./src/modules/smwe-buybox/utilities/error-utilities.ts?a23e","webpack:///./src/modules/smwe-buybox/components/smwe-buybox-small-components.tsx?0c13","webpack:///./src/modules/smwe-buybox/components/smwe-buybox-find-in-store.tsx?a585","webpack:///./src/modules/smwe-buybox/components/smwe-buybox-product-configure.tsx?03a3","webpack:///./src/modules/smwe-buybox/smwe-buybox.tsx?19e0","webpack:///./src/modules/elicit-cart/components/elicit-subscription-header.tsx?bc30","webpack:///./src/components/elicit-cartlineitem.component.tsx?6a35","webpack:///./src/modules/subscriptions-minicart/components/box-edit.component.tsx?f42a","webpack:///./src/modules/subscriptions-minicart/subscriptions-minicart.tsx?7cf8","webpack:///./src/modules/smwe-buybox/components/dropdown/dropdown.tsx?3e6e","webpack:///./src/modules/subscriptions-minicart/components/subscription-banner-display.component.tsx?a3de","webpack:///./src/modules/smwe-buybox/smwe-buybox.view.tsx?fbd7","webpack:///./src/themes/stemichelle-new/views/smwe-buybox.view.tsx?06b1","webpack:///./src/Utilities/elicit-savings-calculation.tsx?adc6","webpack:///./src/modules/subscriptions-minicart/components/bottle-count-display.component.tsx?494a","webpack:///./src/themes/blend/views/smwe-buybox.view.tsx?c2ea","webpack:///../../../src/module-state-manager/module-state.ts?7579","webpack:///../../../src/module-state-manager/with-module-state.tsx?61ca","webpack:///./src/themes/conn-creek/views/smwe-checkout-delivery-options.view.tsx?08a5","webpack:///./src/modules/smwe-checkout-delivery-options/components/smwe-checkout-delivery-options.description.tsx?ad16","webpack:///./src/modules/smwe-checkout-delivery-options/components/smwe-checkout-delivery-options.error-message.tsx?39b0","webpack:///./src/modules/smwe-checkout-delivery-options/components/smwe-checkout-delivery-options.error-title.tsx?5475","webpack:///./src/modules/smwe-checkout-delivery-options/components/smwe-checkout-delivery-options.radio-button.tsx?9f4c","webpack:///./src/modules/smwe-checkout-delivery-options/smwe-checkout-delivery-options.tsx?526e","webpack:///./src/modules/elicit-cart/components/elicit-cart-pick-up-in-store.tsx?9a6e","webpack:///./src/modules/elicit-cart/components/elicit-cart-line-items.tsx?7a1e","webpack:///./src/themes/emp/views/smwe-buybox.view.tsx?8fd1","webpack:///./src/Utilities/smwe-order-summary-lineitem.tsx?ad55","webpack:///./src/modules/elicit-cart/components/elicit-promo-code.tsx?eed9","webpack:///./src/modules/elicit-cart/components/elicit-subscription-upsell.tsx?2829","webpack:///./src/modules/elicit-cart/elicit-cart.tsx?6b2b","webpack:///./src/themes/fth/views/smwe-buybox.view.tsx?48ab","webpack:///./src/modules/subscriptions-minicart/components/cart-display.component.tsx?2f3a","webpack:///./src/Utilities/event-bus.tsx?eb5b","webpack:///./src/themes/patzhall/views/smwe-buybox.view.tsx?ed02","webpack:///./src/Utilities/smwe-order-summary-shipment-calculation.tsx?9ab2","webpack:///./src/modules/smwe-checkout-delivery-options/smwe-checkout-delivery-options.view.tsx?be40","webpack:///./src/themes/elicit/views/smwe-checkout-delivery-options.view.tsx?ec3e","webpack:///./src/Utilities/get-product-attributes.tsx?b745","webpack:///./src/themes/elicit/views/smwe-buybox.view.tsx?150c","webpack:///./src/modules/elicit-cart/elicit-cart.view.tsx?e2b3","webpack:///./src/components/elicit-amountselector.component.tsx?78ab","webpack:///./src/modules/smwe-buybox/components/dropdown/index.ts?5c05","webpack:///./src/modules/subscriptions-minicart/subscriptions-minicart.view.tsx?f150"],"names":["getQuantityError","stockLeft","resources","errorMessageOutOfStock","errorMessageOutOfRangeOneLeft","errorMessageOutOfRangeFormat","replace","toString","getGenericError","result","context","failureReason","addedToCartFailureMessage","cartActionResult","substatus","maxQuantityForLineItem","app","config","maxQuantityForCartLineItem","maxQuantityLimitText","mixedCartErrorText","getConfigureErrors","dimensions","forEach","dimension","DimensionTypeValue","dimensionTypeValue","productDimensionTypeColorErrorMessage","productDimensionTypeConfigurationErrorMessage","productDimensionTypeSizeErrorMessage","productDimensionTypeStyleErrorMessage","getDimensionErrorString","getBuyboxProductTitle","props","data","product","titleHeadingTag","React","Heading","className","headingTag","text","Name","getBuyboxProductDescription","Description","getBuyboxAddToCart","state","callbacks","shouldNavigateToCart","productTypeAttribute","attributes","displaySubscription","id","typeName","quantity","errorState","configureErrors","quantityError","otherError","errorHost","selectedProduct","onAddToCartFailed","updateErrorState","undefined","missingDimensions","emailDeliveryModeCode","channelConfiguration","EmailDeliveryModeCode","keyedInPrice","cartText","addToCartText","smweBuybox__subscriptionBtnText","ContainerProps","button","productAvailability","ItemId","toLowerCase","AddToCart","useElicitAddToCart","useForElicit","isSubscriptionItem","outOfStockText","navigationUrl","getUrlSync","actionContext","onError","getSelectedProduct","productAttributes","errorBlock","BuyboxErrorBlock","showError","getBuyboxProductPrice","productPrice","PriceComponent","price","freePriceText","priceFree","originalPriceText","currentPriceText","getBuyboxProductRating","ratingsSummary","ratingComponent","averageRating","RatingComponent","avgRating","readOnly","ariaLabel","format","averageRatingAriaLabel","ratingCount","reviewsCount","getBuyboxProductAddToWishlist","wishlists","AddToWishlistComponent","addToWishlistButtonText","removeFromWishlistButtonText","addToWishlistMessage","removedFromWishlistMessage","addItemToWishlistError","removeItemFromWishlistError","nameOfWishlist","status","getBuyboxProductQuantity","onChange","newValue","updateQuantity","showQuanatityAsDropdown","showQuantityAsDropdown","AvailableQuantity","outOfStockThreshold","LabelContainerProps","tag","htmlFor","heading","productQuantityHeading","errors","input","_generateSelectMenu","event","parseInt","target","value","ElicitAmountSelector","_updateQuantityRaw","currentQuantity","Quantity","max","currentCount","inputQuantityAriaLabel","maxQuantity","onchange","nodes","i","push","_generateMenu","errorMessages","Object","values","filter","message","isMixedCart","find","item","Alert","isOpen","length","color","assertive","buyboxErrorMessageHeader","map","index","key","getBuyboxFindInStore","storeSelectorStateManager","cart","deliveryOptions","slots","storeSelector","request","channel","PickupDeliveryModeCode","onClick","async","dataProduct","Dimensions","DimensionValue","Value","openDialog","onLocationSelected","orgUnitLocation","addProductToCart","count","location","then","window","assign","catch","error","Promise","resolve","findInStoreOnClick","DeliveryOptions","option","Code","openFindInStoreDialog","findInStoreHeaderText","description","findInStoreDescriptionText","findInStoreLinkText","disabled","getBuyboxProductConfigure","productDimensions","getDropdownName","onChanged","_onChanged","notification","dimensionSelectedAsync","dropdowns","productDimensionFull","_mapProductDimensionFullToDropdownViewProps","dimensionChanged","dropdownId","selectId","dropdownCallback","dropdownName","dropdownToggleName","selectDimensionFormatString","toLocaleLowerCase","dropdownList","DimensionValues","dimensionValue","RecordId","errorMessage","select","Dropdown","SmweBuybox","constructor","super","buyboxCallbacks","newQuantity","this","setState","newErrorState","updateSelectedProduct","newSelectedProduct","selectedDimensionId","selectedDimensionValueId","_dimensionSelected","dimensionType","_getDropdownName","selectedDimensionValue","apiSettings","channelId","selectedDimensions","newSelectedDimensions","mappedDimensions","_updateDimensionValue","ExtensionProperties","reject","newProduct","getSelectedVariant","SelectedVariantInput","MasterProductId","getDimensionsForSelectedVariant","GetDimensionsForSelectedVariantInput","newValueId","productDimensionTypeColor","productDimensionTypeConfiguration","productDimensionTypeSize","productDimensionTypeStyle","reaction","CartLines","_updateProductAvailability","cartLines","delay","componentDidMount","console","all","productSpecificationData","categories","publish","CommerceAttributesParser","getParsedAttributes","category","_getCurrentCategory","e","telemetry","exception","render","mediaGallery","productApellation","content","productTitle","productClubPrice","acclaimRatings","cookbookTagline","productDescription","eventSchedule","attributeList","canAddToCartAttribute","attribute","productType","TextValue","show","BooleanValue","viewProps","tastingNotes","ModuleProps","moduleProps","classnames","ProductInfoContainerProps","MediaGalleryContainerProps","title","configure","findInStore","addToCart","subscriptionButton","_showSubscriptionButton","addToWishlist","rating","renderView","availableQuantity","Math","isProductSubscribable","qtyInCart","cartline","ProductId","getProductAvailabilitiesForSelectedVariantAction","createProductAvailabilitiesForSelectedVariantInput","clonedProductAvailability","UnitOfMeasure","categorySlug","_getCategorySlug","toJS","shift","Slug","Children","concat","sliceIndexes","currentUrl","pathname","suffix","slice","split","join","ElicitSubscriptionHeader","_name","SubscriptionCommerceValues","SUBSCRIPTION_DEFAULT_NAME","_onFrequencyChange","bind","_onNameChange","_onNameBlur","_publishNameChange","debounce","getSubscriptionValues","name","_selectedFrequency","frequencyTable","freq","freqId","frequency","wineBottleSummaryCount","deliveryText","savingText","savingLabel","boxNamePlaceholder","cartState","subState","subLines","filterCartLines","subscriptionLines","formatter","cultureFormatter","formatCurrency","total","CartUtilities","countCartLineNetPrice","discountedTotal","countCartLineDiscountedPrice","totalBottles","countCartLineAmount","futureSavings","calculateSavingPercentAmount","savings","isFinite","savingFormatted","type","placeholder","onBlur","_frequencyTable","initialId","firstId","freqLabel","updates","cartChanges","change","Key","StringValue","updateSubscription","_pushUpdateToCart","SUBSCRIPTION_NAME","frequncy","_submitSubscriptionToCart","SUBSCRIPTION_FREQUENCY","__decorate","observable","observer","SmweCartLine","isSalesLine","productUrl","primaryImageUrl","showImages","gridSettings","imageSettings","zeroAvailabilityError","intlFormatter","num","quantityOnChange","cartLine","_isWineProduct","productId","test","_getPriceAdjustmentPercent","Price","toFixed","_getPriceDiscount","DiscountAmountWithoutTax","DiscountLines","showDiscountPercent","NetPrice","_doubleDiscounts","DiscountCode","GiftCardFieldType","giftCardFormObj","FirstName","Type","Extension","Required","isValid","LastName","ElectronicDeliveryEmail","Attribute","ElectronicDeliveryEmailContent","_getPriceAdjustmentSavings","brandCode","brandCodeParser","appContext","tabIndex","href","Image","src","altText","RichTextComponent","_getKitDescription","priceAdjustmentSavings","isOutOfStock","isQuantityEditable","shouldDisableQty","GiftCardItemId","cartLineId","LineId","isSubLine","isLineSubscriptionLine","remove","quantityDisplayString","percentSaving","TotalAmount","_generateQuantityAndPrice","Comment","IsGiftCardLine","giftCardFormField","setGiftCardFormField","useState","formFieldsDebounce","setFormFieldsDebounce","useEffect","unhydratedCartLineLoad","keys","field","fieldState","property","extension","prevState","setFormFieldState","giftCardFormIsValid","trim","RegExp","cartLineErrors","giftCardValidation","delayDebounceFn","setTimeout","ItemTaxGroupId","cartLineOnChange","updateFormFieldToCartLine","clearTimeout","handleChange","_renderGiftCardPrompt","BoxEditComponent","_popupState","_removeItemFromCartHandler","cartlineToRemove","_generateRemovalAnalyticsEvent","cartLineIds","removeCartLines","warning","debug","productID","products","entry","subscription","_moveToWishlistSuccessHandler","_updateCartlineQuantity","cartlineToUpdate","updateCartLineQuantity","_onBoxNameChange","_publishBoxNameChange","_togglePopup","_emptyCart","frequencyId","initialValues","_selectedFrequencyId","_getProductavailabilty","subscriptionsMinicart__editBoxBtn","subscriptionsMinicart__editBoxNamePlaceholder","subscriptionsMinicart_subscriptionSavingText","subscriptionsMinicart_subscriptionLinePercentSavingText","subscriptionsMinicart_emptyCartBtn","faqLink","contextProps","productAvailabilities","productAvailabilites","productDeliveryOptions","orgUnitLocations","elicitModalProps","_cartFilteredLines","templatePercentSavingText","templateSavingText","cartlines","mixedCart","mixedCartLines","viewports","xs","q","w","h","sm","lg","lazyload","isStockCheckEnabled","enableStockCheck","maxCartlineQuantity","sizeString","subscriptionsMinicart__productDimensionTypeSize","colorString","subscriptionsMinicart__productDimensionTypeColor","configString","styleString","subscriptionsMinicart__productDimensionTypeStyle","subscriptionsMinicart__quantityDisplayText","subscriptionsMinicart__inputQuantityAriaLabel","discountStringText","subscriptionsMinicart__discountStringText","subscriptionsMinicart__originalPriceText","subscriptionsMinicart__currentPriceText","shippingChargesText","subscriptionsMinicart__shippingCharges","subscriptionsMinicart__addToWishlistButtonText","subscriptionsMinicart__removeFromWishlistButtonText","removeButtonText","subscriptionsMinicart__removeCartButtonText","shipItText","subscriptionsMinicart__shipInsteadDisplayText","pickitUpText","subscriptionsMinicart__pickItUpDisplayText","changeStoreText","subscriptionsMinicart__changeStoreDisplayText","defaultWishlistName","subscriptionsMinicart__defaultWishlistName","pickupDeliveryModeCode","invalidProductError","subscriptionsMinicart__invalidProductError","outOfStockError","subscriptionsMinicart__outOfStockError","subscriptionsMinicart__zeroAvailabilityError","removeItemClickHandler","moveToWishlistSuccessHandler","updateCartLinesQuantitySuccessHandler","headerProps","label","subscriptionsMinicart_subscriptionDeliveryText","subscriptionsMinicart_subscriptionSavingLabel","subscriptionsMinicart_subscriptionWineBottleSummaryCount","_renderFrequencies","_isCartEmpty","linkUrl","destinationUrl","openInNewTab","role","rel","Modal","autoFocus","fade","horizontalPosition","verticalPosition","zIndex","toggle","applicationNode","modalClassName","ModalHeader","ModalBody","ElicitCartLineItems","editBoxWarning","newName","newFreq","linesToRemove","lineIds","line","onBoxNameChange","onFrequencyChange","productIds","availabilityAll","getEstimatedAvailabilityAsync","callerContext","ProductIds","DefaultWarehouseOnly","ProductWarehouseInventoryAvailabilities","PhysicalAvailable","SubscriptionsMinicart","usePNGImageSetting","modifiedViewports","md","xl","modifiedImageSettings","_boxName","_frequencyId","run","exec","getActiveCartProductsAction","ActiveCartProductsInput","_eventId","bus","subscribe","refreshCart","componentWillUnmount","unsubscribe","renderProps","baseProps","boxName","subscriptionBannerDisplayComponent","SubscriptionBannerDisplayComponent","subscriptionName","editBoxComponent","bottleCountComponent","BottleCountDisplay","subscriptionProps","cartDisplaySummaryComponent","CartDisplayComponent","subscriptionsProps","LoadBus","selectMenu","selectedIndex","selectedValue","innerText","current","ref","selected","hidden","_renderTable","tableClass","isGiftCard","Table","borderless","responsive","size","scope","_renderQuantity","_renderAddToCart","Node","SmweBuyboxView","get","Module","contentSlotData","unselectable","lines","_maxBottleCount","_fillBottleList","_generateBottleListFromProducts","bottleList","newBottleIndex","_specializeIndex","rollingIndex","fragments","requestContext","_getProductFromLine","lineIdx","PrimaryImageUrl","alt","currentIndex","subscriptionsMinicart__discount10Percent","subscriptionsMinicart__discount15Percent","productCollection","productCollectionSlotData","getCacheKey","getCacheObjectType","dataCacheType","getModuleStates","ctx","cacheKey","ModuleStatesCacheKey","moduleStates","update","withModuleState","WrappedComponent","_super","_this","states","_a","hasInitialized","hasError","isRequired","isCancellable","isSubmitContainer","childIds","moduleState","validate","isReady","isUpdating","isPending","isSkipped","isDisabled","isCancelAllowed","shouldSubmitContainer","hasExternalSubmitGroup","hasModuleState","setIsRequired","setIsCancellable","setIsSubmitContainer","setHasError","onReady","onUpdating","onPending","onSkip","onDisable","getModule","moduleId","getModuleStateManager","getModuleByTypeName","getModuleStateManagerByTypeName","init","options","__assign","_moduleState","modules","source","module","isMatch","allMatched","skipSkippableItem","_validateLeaf","method","childId","_validateContainer","enableControl","initializeState","__extends","ModuleState","DeliveryOptionList","DeliveryOptionsList","list","globalConfig","pennyShippingMethodIds","pennyShippingIds","modShippingMethodIds","modShippingIds","localList","combinedList","sort","a","b","ShippingChargeAmount","deliveryData","isModShippingMethod","modShipping","Number","isPennyShippingMethod","pennyShipping","amount","deliveryOption","DeliveryOption","code","radioButton","DeliveryOptionSelected","ErrorMessage","Error","CheckoutDeliveryOptionsView","CheckoutDeliveryOptions","viewState","deliveryOptionsData","deliveryOptionSelected","waiting","saveButton","editButton","cancelButton","isLoading","isError","isShowList","isShowSelected","isShowSaveButton","isShowEditButton","isShowCancelButton","CheckoutDeliveryOptionsDescription","CheckoutDeliveryOptionsErrorMessage","CheckoutDeliveryOptionsErrorTitle","CheckoutDeliveryOptionsRadioButton","isChecked","ariaSetSize","ariaPosInSet","checked","selectedItemId","onEdit","onCancel","onSubmit","canShip","getCartLinesForShipping","getDeliveryOptionSelected","selectedItem","DescriptionComponent","CustomerContextualPrice","getErrorMessage","errorMessageTitle","CheckoutDeliveryOptionsError","ErrorTitleComponent","ErrorMessageComponent","getDeliveryOptionList","RadioButtonComponent","onDeliveryOptionChange","getSaveButton","saveBtnLabel","Button","onSave","getEditButton","editBtnLabel","getCancelButton","cancelBtnLabel","setError","clearError","updateCartDeliverySpecification","savedDeliveryOption","getSavedDeliveryOption","cartLinesForShipping","DeliveryMode","deliveryModeId","checkoutState","checkout","updateCartDeliverySpecificationInput","shippingAddress","checkoutCart","response","genericErrorMessage","ProductType","EventDeliveryMode","getDeliveryOptions","cartId","Id","getDeliveryOptionsAsync","queryResultSettings","deliveryOptionsNotFound","loadDeliveryOptions","currentTarget","errorMessageData","classname","Waiting","action","PickUpInStore","_toggleBOPIS","isBopisSelected","alreadySelectedLocation","InventoryLocationId","FulfillmentStoreId","updateCartLinePickupLocation","_onLocationChangedCallback","ShippingAddress","clearCartLinePickupLocation","_getOrgUnitName","fulfillmentStoreId","foundLocation","OrgUnitName","toggleBopis","defaultComponent","pickupInStoretext","orgUnitName","bopisSelected","_renderShippingMethod","shipitText","pickUpInStoreText","_getCartItemMaxQuantity","productInCartQty","productInCart","_updateCartLine","updateCartLinesAsync","cartInput","GlobalStateInput","BaseCartState","getCartState","newCart","_assembleCartlines","reactNodes","productTypeInit","check","isMixedProduct","_getProduct","foundProductAvailability","foundProductDeliveryOption","isWineProduct","foundProductDeliveryOptions","isAuthenticated","user","onRemoveClickHandler","getProductUrlSync","productAttributesList","pickUpInStore","showButtonText","showStatusMessage","showRemoveButton","showButtonTooltip","onSuccess","_assembleNode","OrderSummaryLine","toBeCalculatedText","freeText","cssLabel","_buildOrderSummarySection","_computedLoyaltyAmount","loyaltyAmount","OrderSummary","TaxAmount","hasDeliveryMethod","hasShippingMethod","freightFee","deliveryModes","reduce","ChargeLines","chargeTotal","chargeLine","IsShipping","CalculatedAmount","some","deliveryMode","getDeliveryConfiguration","shippingPrice","orderSummaryShipmentCalculation","subtotal","subTotalLabel","tax","taxLabel","orderTotal","orderTotalLabel","shipping","shippingLabel","shipmentWarningText","giftCardAmount","giftCardTotalValue","giftCards","giftCard","Balance","min","_computeGiftCardAmount","totalAmountAfterGiftCard","loyalty","loyaltyLabel","giftcardLabel","totalDiscounts","totalDiscountsLabel","ElicitPromoCode","_onInputChange","promoCodeInputValue","canApply","_applyPromotion","appliedPromo","addPromoCode","promoCode","duplicatePromoCodeErrorText","invalidPromoCodeErrorText","failedToAddPromoCodeErrorText","_renderForm","promoPlaceholderText","promoCodeApplyButtonText","preventDefault","_removePromotion","getAttribute","removePromoCodes","promoCodes","failedToRemovePromoCodeErrorText","_calculateDiscount","discountAmount","discountLine","DiscountCost","_renderAppliedPromoCode","Coupons","appliedPromoCodeHeadingText","appliedPromoCodeSubheadingText","coupon","removePromoAriaLabelFormat","removePromoText","isCollapseOpen","promoCodeHeadingText","ElicitPromoCodeComponent","msdyn365Commerce","createComponent","component","ElicitSubscriptionUpsell","savingRatioAmount","savingRatio","showUpsell","upsellPercent","upsellBottleCount","_renderUpsellCTA","editSubscriptionLink","link","linkText","ElicitCart","Component","cartLinesInvalid","parsedProductAttributes","_getImageSettings","_updateSubscriptionName","_displaySummary","_setProductAttributes","_generateCheckoutAnalyticsEvent","signInUrl","routes","guestCheckoutUrl","backToShoppingUrl","backToShopping","checkoutURL","_getCheckoutURL","isCartEmpty","_contextualLines","isCartREALLYEmpty","isAllCartEmpty","elicitCartItemProps","elicitCart_subscriptionLinePercentSavingText","elicitCart_subscriptionSavingText","elicitCart__productDimensionTypeSize","elicitCart__productDimensionTypeColor","elicitCart__productDimensionTypeStyle","elicitCart__quantityDisplayText","elicitCart__inputQuantityAriaLabel","elicitCart__discountStringText","elicitCart__originalPriceText","elicitCart__currentPriceText","elicitCart__shippingCharges","elicitCart__addToWishlistButtonText","elicitCart__removeFromWishlistButtonText","elicitCart__removeCartButtonText","elicitCart__shipInsteadDisplayText","elicitCart__pickItUpDisplayText","elicitCart__changeStoreDisplayText","elicitCart__defaultWishlistName","elicitCart__invalidProductError","elicitCart__outOfStockError","elicitCart__zeroAvailabilityError","_title","CartlinesWrapper","OrderSummaryWrapper","OrderSummaryItems","elicitCart__promoCodeHeadingText","elicitCart__promoPlaceholderText","elicitCart__promoCodeApplyButtonText","elicitCart__appliedPromoCodeHeadingText","elicitCart__appliedPromoCodeSubheadingText","collapseTimeOut","elicitCart__removePromoAriaLabelFormat","elicitCart__removePromoText","elicitCart__invalidPromoCodeErrorText","elicitCart__failedToAddPromoCodeErrorText","elicitCart__failedToRemovePromoCodeErrorText","elicitCart__duplicatePromotionErrorText","orderSummaryHeading","elicitCart__orderSummaryTitle","orderSummaryLineitems","elicitCart__itemsWithCountLabel","elicitCart__estimatedShippingLabel","elicitCart__estimatedTaxLabel","elicitCart__orderTotal","elicitCart__totalDiscountsLabel","elicitCart__yetToBeCalculatedText","elicitCart__priceFree","checkoutAsSignInUserButton","elicitCart__checkoutButtonTitle","checkoutAsGuestButton","elicitCart__guestCheckoutButtonTitle","backToShoppingButton","elicitCart__backToShoppingButtonTitle","waitingComponent","cartLoadingStatus","elicitCart__cartLoadingErrorMessage","cartDataResult","_useForSubscriptions","checkoutButtonDisabled","cartLineStatus","subscriptionHeader","elicitCart_subscriptionDeliveryText","elicitCart_subscriptionSavingLabel","elicitCart_subscriptionWineBottleSummaryCount","elicitCart__editBoxNamePlaceholder","subscriptionUpsell","shouldShowCheckoutInline","_shouldShowCheckoutInline","isAbsoluteUrl","returnURL","origin","indexOf","useForSubscriptions","displaySummary","isSubscription","subFrequency","mappedProducts","discounts","step","getAttributesForCart","entries","productAttribs","unParseAttributes","elicitCart__subCartTitle","elicitCart__cartTitle","subscriptionsMinicart__boxPrice","subscriptionsMinicart__shipping","subscriptionsMinicart__savings","subscriptionsMinicart__goToCart","savingPercent","cartUrl","_calculateDiscountedTotalAmount","_calculateTotalAmount","EventBusLoader","_buses","getBus","busNamespace","BusLoader","deleteBus","purge","_subscriptions","subName","onPublish","nextId","IdGenerator","_readyForDeletion","_purgeById","args","idValue","Loader","eventNamespace","CHILD_COMP","prototype","_renderQuantityHeader","style","display","CartOrderPriceGuide","NONSUBSCRIPTION_LE_3","NONSUBSCRIPTION_G_3","SUBSCRIPTION_LE_3","SUBSCRIPTION_GE_4_LE_5","SUBSCRIPTION_GE_6_AND_LE_11","SUBSCRIPTION_GE_12","GIFT_CARDS_ONLY","MIXED_ADD_PRICE","subscriptionCartLength","countCartLineAmountNoGiftCards","nonSubscriptionCartLength","orderSubscriptionBased","formatShipmentCalculation","cartLength","shipmentCalculationResult","summary","orderMixedBased","shipCostDefinition","cartRequirements","shippingState","State","allowedShippingMethodIds","shipmentMethodTiers","allowedShippingMethod","shippingMethodId","shippingMethodConfigError","attributeCache","getAttributesByProductID","productIDs","groupedIDs","uncachedAttributes","uncached","productSearchCriteria","Ids","Context","ChannelId","CatalogId","catalogId","searchAsync","output","translatedProperties","FriendlyName","ValueString","fetchProductAttributes","cached","ElicitCartView","preventCheckout","lineId","_isInvalidCart","renderModuleAttributes","elicitCart__mixModeCartError","cartEmptyText","elicitCart__emptyCartText","itemsTitle","elicitCart__itemsTitle","qtyTitle","elicitCart__qtyTitle","unitPriceTitle","elicitCart__unitPriceTitle","totalTitle","elicitCart__totalTitle","orderSummaryLines","elicitCart__conditionsText","_renderOrderSummarylines","constProps","_setQuantity","_upQuantity","_downQuantity","_onQuantityChange","_postValidateQuantity","_trackedTotal","unrelatedLines","delta","quantityState","_canAddMore"],"mappings":"oWAKM,SAAUA,EAAiBC,EAA+BC,GAC5D,OAAKD,GAAaA,GAAa,EACpBC,EAAUC,uBACI,IAAdF,EACAC,EAAUE,8BAEVF,EAAUG,6BAA6BC,QAAQ,YAAaL,EAAUM,YAI/E,SAAUC,EAAgBC,EAAiCP,EAAiCQ,GAC9F,GAA6B,eAAzBD,EAAOE,cACP,OAAOT,EAAUU,0BACd,GAA6B,qBAAzBH,EAAOE,cAAsC,CACpD,GAAIF,EAAOI,kBAA0D,gBAAtCJ,EAAOI,iBAAiBC,UAA6B,CAChF,MAAMC,EAAyBL,EAAQM,IAAIC,OAAOC,4BAA8B,GAChF,OAAOhB,EAAUiB,qBAAqBb,QAAQ,aAAcS,EAAuBR,YAGvF,OAAOL,EAAUU,0BACd,MAA4B,cAAzBH,EAAOE,cACNT,EAAUkB,wBADd,EAOL,SAAUC,EAAmBZ,EAAwCP,GACvE,IAAKO,EACD,MAAO,GAGX,MAAMa,EAA4D,GAMlE,OAJAb,EAAOc,QAAQC,IACXF,EAAWE,EAAUC,oBAMvB,SAAkCC,EAA4BxB,GAChE,OAAQwB,GACJ,KAAK,EACD,OAAOxB,EAAUyB,sCACrB,KAAK,EACD,OAAOzB,EAAU0B,8CACrB,KAAK,EACD,OAAO1B,EAAU2B,qCACrB,KAAK,EACD,OAAO3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zW,QAAQ,qBAAsBxC,KAAK69B,cAAiBlkC,SAASC,EAAOC,MAAO,MAErFmG,KAAKC,SAAS,CAAE+9B,cAAe,IAG/BrkC,SAASC,EAAOC,MAAO,IAAM,EAC7BmG,KAAKC,SAAS,CAAE+9B,cAAerkC,SAASC,EAAOC,MAAO,MAEtDmG,KAAKC,SAAS,CAAE+9B,cAAe,IAGvCh+B,KAAKw9B,eAGDA,eACJx9B,KAAK/M,MAAM8G,mBAAmBiG,KAAKlM,MAAMkqC,iBAxFjC3zB,sBAAXC,KAAW,oCAHHxQ,EAAoB,sBAFhCqgB,YAAQ,0BACR5P,KACYzQ,I,kCCxBb,sE,kCCAA;;;;GAQe,cAKuB,IALtB,qBACZ+f,EADY,iBAEZD,EAFY,4BAGZI,EAHY,mCAIZP,GACkC,EAClC,OACIpmB,uBAAKE,UAAU,yBACXF,uBAAKE,UAAU,gCACVkmB,GAELpmB,uBAAKE,UAAU,iCACVsmB,EACDxmB,uBAAKE,UAAU,uCACVqmB,EACAI","file":"static/js/21.df73360afc6e8c041481.chunk.js","sourcesContent":["import { IAny, ICoreContext, IGeneric } from '@msdyn365-commerce/core';\r\nimport { ProductDimension } from '@msdyn365-commerce/retail-proxy';\r\nimport { IAddToCartFailureResult } from '../../../components/addtocart.component';\r\nimport { ISmweBuyboxResources } from '../smwe-buybox.props.autogenerated';\r\n\r\nexport function getQuantityError(stockLeft: number | undefined, resources: ISmweBuyboxResources): string | undefined {\r\n if (!stockLeft || stockLeft <= 0) {\r\n return resources.errorMessageOutOfStock;\r\n } else if (stockLeft === 1) {\r\n return resources.errorMessageOutOfRangeOneLeft;\r\n } else {\r\n return resources.errorMessageOutOfRangeFormat.replace('{numLeft}', stockLeft.toString());\r\n }\r\n}\r\n\r\nexport function getGenericError(result: IAddToCartFailureResult, resources: ISmweBuyboxResources, context: ICoreContext>): string | undefined {\r\n if (result.failureReason === 'EMPTYINPUT') {\r\n return resources.addedToCartFailureMessage;\r\n } else if (result.failureReason === 'CARTACTIONFAILED') {\r\n if (result.cartActionResult && result.cartActionResult.substatus === 'MAXQUANTITY') {\r\n const maxQuantityForLineItem = context.app.config.maxQuantityForCartLineItem || 10;\r\n return resources.maxQuantityLimitText.replace('{quantity}', maxQuantityForLineItem.toString());\r\n }\r\n\r\n return resources.addedToCartFailureMessage;\r\n } else if(result.failureReason === 'MIXEDCART') {\r\n return resources.mixedCartErrorText;\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\nexport function getConfigureErrors(result: ProductDimension[] | undefined, resources: ISmweBuyboxResources): { [configureId: string]: string | undefined } {\r\n if (!result) {\r\n return {};\r\n }\r\n\r\n const dimensions: { [configureId: string]: string | undefined } = {};\r\n\r\n result.forEach(dimension => {\r\n dimensions[dimension.DimensionTypeValue] = getDimensionErrorString(dimension.DimensionTypeValue, resources);\r\n });\r\n\r\n return dimensions;\r\n}\r\n\r\nexport function getDimensionErrorString(dimensionTypeValue: number, resources: ISmweBuyboxResources): string {\r\n switch (dimensionTypeValue) {\r\n case 1: // ProductDimensionType.Color\r\n return resources.productDimensionTypeColorErrorMessage;\r\n case 2: // ProductDimensionType.Configuration\r\n return resources.productDimensionTypeConfigurationErrorMessage;\r\n case 3: // ProductDimensionType.Size\r\n return resources.productDimensionTypeSizeErrorMessage;\r\n case 4: // ProductDimensionType.Style\r\n return resources.productDimensionTypeStyleErrorMessage;\r\n default:\r\n return '';\r\n }\r\n}","import * as React from 'react';\r\n\r\nimport { Alert, format, Heading, INodeProps, Quantity } from '@msdyn365-commerce-modules/utilities';\r\nimport {\r\n AddToWishlistComponent,\r\n IWishlistActionErrorResult,\r\n PriceComponent,\r\n RatingComponent\r\n} from '@msdyn365-commerce/components';\r\nimport { getUrlSync } from '@msdyn365-commerce/core';\r\nimport { AttributeValue } from '@msdyn365-commerce/retail-proxy';\r\nimport { IBuyboxCallbacks, IBuyboxState, ISmweBuyboxData, ISmweBuyboxProps, ISmweBuyboxResources } from '../';\r\nimport AddToCart, { IAddToCartFailureResult } from '../../../components/addtocart.component';\r\nimport { ElicitAmountSelector } from '../../../components/elicit-amountselector.component';\r\nimport { getConfigureErrors, getGenericError, getQuantityError } from '../utilities/error-utilities';\r\n\r\nexport function getBuyboxProductTitle(props: ISmweBuyboxProps): React.ReactElement | undefined {\r\n const {\r\n data: { product: { result: product } },\r\n config: { titleHeadingTag = 'h1' }\r\n } = props;\r\n\r\n return product && (\r\n \r\n );\r\n}\r\n\r\nexport function getBuyboxProductDescription(props: ISmweBuyboxProps): React.ReactElement | undefined {\r\n const {\r\n data: { product: { result: product } }\r\n } = props;\r\n\r\n return product && (\r\n

{product.Description}

\r\n );\r\n}\r\n\r\nexport interface IBuyboxAddToCartViewProps {\r\n ContainerProps: INodeProps;\r\n errorBlock?: React.ReactNode;\r\n button?: React.ReactNode;\r\n}\r\nexport function getBuyboxAddToCart(\r\n props: ISmweBuyboxProps,\r\n state: IBuyboxState,\r\n callbacks: IBuyboxCallbacks,\r\n shouldNavigateToCart: boolean,\r\n productTypeAttribute: AttributeValue | undefined,\r\n attributes: AttributeValue[],\r\n displaySubscription: boolean = false\r\n): IBuyboxAddToCartViewProps {\r\n const {\r\n id,\r\n typeName,\r\n context,\r\n data: { product: { result: product } },\r\n resources\r\n } = props;\r\n\r\n const\r\n {\r\n quantity,\r\n errorState: {\r\n configureErrors,\r\n quantityError,\r\n otherError,\r\n errorHost\r\n },\r\n selectedProduct\r\n } = state;\r\n\r\n const onAddToCartFailed = (result: IAddToCartFailureResult) => {\r\n callbacks.updateErrorState({\r\n errorHost: 'ADDTOCART',\r\n quantityError: result.failureReason === 'OUTOFSTOCK' ? getQuantityError(result.stockLeft, resources) : undefined,\r\n configureErrors: result.failureReason === 'MISSINGDIMENSION' ? getConfigureErrors(result.missingDimensions, resources) : {},\r\n otherError: getGenericError(result, resources, context)\r\n });\r\n };\r\n\r\n const emailDeliveryModeCode: string | undefined = props.data && props.data.channelConfiguration.result && props.data.channelConfiguration.result.EmailDeliveryModeCode;\r\n const keyedInPrice = props.data.keyedInPrice.result;\r\n let cartText: string = resources.addToCartText;\r\n if (props.config.addToCartText) {\r\n cartText = props.config.addToCartText;\r\n }\r\n if (displaySubscription) {\r\n cartText = resources.smweBuybox__subscriptionBtnText;\r\n }\r\n return {\r\n ContainerProps: {\r\n className: 'ms-buybox__add-to-cart-container'\r\n },\r\n button: product && (state.productAvailability || product.ItemId?.toLowerCase() === 'giftcard') && (\r\n \r\n ),\r\n errorBlock: !displaySubscription && (\r\n \r\n )\r\n };\r\n}\r\n\r\nexport function getBuyboxProductPrice(props: ISmweBuyboxProps): React.ReactElement | undefined {\r\n const {\r\n id,\r\n typeName,\r\n context,\r\n data: { productPrice: { result: productPrice } },\r\n resources\r\n } = props;\r\n\r\n return productPrice && (\r\n \r\n );\r\n}\r\n\r\nexport function getBuyboxProductRating(props: ISmweBuyboxProps): React.ReactElement | undefined {\r\n const {\r\n id,\r\n typeName,\r\n context,\r\n data: { ratingsSummary: { result: ratingsSummary } },\r\n resources\r\n } = props;\r\n\r\n const ratingComponent = ratingsSummary && ratingsSummary.averageRating && (\r\n \r\n ) || undefined;\r\n\r\n return ratingsSummary && ratingComponent && (\r\n ratingComponent\r\n );\r\n}\r\n\r\nexport interface IBuyboxAddToWishlistViewProps {\r\n ContainerProps: INodeProps;\r\n errorBlock?: React.ReactNode;\r\n button?: React.ReactNode;\r\n}\r\nexport function getBuyboxProductAddToWishlist(props: ISmweBuyboxProps, state: IBuyboxState, callbacks: IBuyboxCallbacks): IBuyboxAddToWishlistViewProps | undefined {\r\n const {\r\n id,\r\n typeName,\r\n context,\r\n data: {\r\n product: { result: product },\r\n wishlists: { result: wishlists }\r\n },\r\n resources\r\n } = props;\r\n\r\n const\r\n {\r\n errorState: {\r\n configureErrors,\r\n quantityError,\r\n otherError,\r\n errorHost\r\n },\r\n selectedProduct\r\n } = state;\r\n\r\n const onAddToWishlistFailed = (result: IWishlistActionErrorResult) => {\r\n callbacks.updateErrorState({\r\n errorHost: 'WISHLIST',\r\n configureErrors: result.status === 'MISSINGDIMENSION' ? getConfigureErrors(result.missingDimensions, resources) : {},\r\n });\r\n };\r\n\r\n return {\r\n ContainerProps: {\r\n className: 'ms-buybox__add-to-wishlist-container'\r\n },\r\n button: product && (\r\n \r\n ),\r\n errorBlock: (\r\n \r\n )\r\n };\r\n}\r\n\r\nexport interface IBuyboxProductQuantityViewProps {\r\n ContainerProps: INodeProps;\r\n LabelContainerProps: INodeProps;\r\n\r\n heading: React.ReactNode;\r\n errors?: React.ReactNode;\r\n\r\n input: React.ReactNode;\r\n}\r\nexport function getBuyboxProductQuantity(props: ISmweBuyboxProps, state: IBuyboxState, callbacks: IBuyboxCallbacks): IBuyboxProductQuantityViewProps {\r\n const {\r\n resources,\r\n context: {\r\n app: {\r\n config: {\r\n maxQuantityForCartLineItem\r\n }\r\n }\r\n }\r\n } = props;\r\n\r\n const\r\n {\r\n quantity,\r\n errorState: {\r\n quantityError,\r\n }\r\n } = state;\r\n\r\n const onChange = (newValue: number) => {\r\n if (callbacks.updateQuantity) {\r\n callbacks.updateQuantity(newValue);\r\n }\r\n };\r\n\r\n const _updateQuantity = (event:React.ChangeEvent): void => {\r\n if (callbacks.updateQuantity) {\r\n callbacks.updateQuantity(parseInt(event.target.value, 10));\r\n }\r\n };\r\n\r\n const showQuanatityAsDropdown: boolean = props.config.showQuantityAsDropdown || false;\r\n const availability = state.productAvailability?.AvailableQuantity && state.productAvailability.AvailableQuantity - props.context.app.config.outOfStockThreshold;\r\n const productAvailability = availability || state.quantity || maxQuantityForCartLineItem || 10;\r\n\r\n return {\r\n ContainerProps: {\r\n className: 'ms-buybox__quantity'\r\n },\r\n LabelContainerProps: {\r\n tag: 'label',\r\n className: 'ms-buybox__product-quantity-label',\r\n htmlFor: 'ms-buybox__product-quantity-input'\r\n },\r\n heading: (\r\n
{resources.productQuantityHeading}
\r\n ),\r\n errors: quantityError && (\r\n \r\n \r\n ),\r\n input: (showQuanatityAsDropdown)? (\r\n _generateSelectMenu(productAvailability, quantity, _updateQuantity)\r\n ) : (!props.config.useForElicit) ? (\r\n ) : (\r\n \r\n )\r\n };\r\n}\r\n\r\nconst _generateMenu = (quantity: number) => {\r\n const nodes = [];\r\n\r\n for (let i = 1; i <= quantity; i++) {\r\n // tslint:disable-next-line:react-a11y-role-has-required-aria-props\r\n nodes.push();\r\n }\r\n\r\n return nodes;\r\n};\r\n\r\nconst _generateSelectMenu = (maxQuantity: number, currentQuantity: number, onchange:(event:React.ChangeEvent) => void): JSX.Element => {\r\n return (\r\n \r\n );\r\n};\r\n\r\nexport interface IBuyboxErrorBlockProps {\r\n configureErrors: { [configureId: string]: string | undefined };\r\n quantityError?: string;\r\n otherError?: string;\r\n resources: ISmweBuyboxResources;\r\n showError: boolean;\r\n}\r\nexport const BuyboxErrorBlock: React.FC = ({ showError, configureErrors, quantityError, otherError, resources }) => {\r\n let errorMessages: (string | undefined)[] = [];\r\n\r\n errorMessages = Object.values(configureErrors).filter(message => message !== undefined);\r\n\r\n if (quantityError) {\r\n errorMessages.push(quantityError);\r\n }\r\n\r\n if (otherError) {\r\n errorMessages.push(otherError);\r\n }\r\n\r\n const isMixedCart = errorMessages.find(item => {\r\n return item === resources.mixedCartErrorText;\r\n });\r\n\r\n return (\r\n 0} color='danger' assertive={true} aria-label={resources.buyboxErrorMessageHeader} >\r\n \r\n {errorMessages.map((message, index: number) => {\r\n if (message) {\r\n return (\r\n
{message}
\r\n );\r\n } else {\r\n return null;\r\n }\r\n })}\r\n
\r\n );\r\n};","import * as React from 'react';\r\n\r\nimport { Heading, INodeProps } from '@msdyn365-commerce-modules/utilities';\r\nimport { getUrlSync } from '@msdyn365-commerce/core';\r\nimport { ProductDimension } from '@msdyn365-commerce/retail-proxy';\r\n\r\nimport { IBuyboxCallbacks, IBuyboxState } from '../smwe-buybox';\r\nimport { ISmweBuyboxData } from '../smwe-buybox.data';\r\nimport { ISmweBuyboxProps } from '../smwe-buybox.props.autogenerated';\r\nimport { getConfigureErrors } from '../utilities/error-utilities';\r\nimport { BuyboxErrorBlock } from './index';\r\n\r\nexport interface IFindInStoreFailureResult {\r\n missingDimensions?: ProductDimension[];\r\n}\r\n\r\nexport interface IBuyboxFindInStoreViewProps {\r\n storeSelector?: React.ReactNode;\r\n heading?: React.ReactNode;\r\n description?: React.ReactNode;\r\n errors?: React.ReactNode;\r\n button?: React.ReactNode;\r\n\r\n ContainerProps: INodeProps;\r\n\r\n openFindInStoreDialog(): Promise;\r\n}\r\n\r\nexport function getBuyboxFindInStore(props: ISmweBuyboxProps, state: IBuyboxState, callbacks: IBuyboxCallbacks): IBuyboxFindInStoreViewProps | undefined {\r\n const {\r\n data: {\r\n product: { result: product },\r\n storeSelectorStateManager: { result: storeSelectorStateManager },\r\n cart: { result: cart },\r\n deliveryOptions: { result: deliveryOptions }\r\n },\r\n slots: {\r\n storeSelector\r\n },\r\n resources,\r\n context: {\r\n request: {\r\n channel: {\r\n PickupDeliveryModeCode\r\n } = { PickupDeliveryModeCode: undefined }\r\n }\r\n }\r\n } = props;\r\n\r\n const\r\n {\r\n errorState: {\r\n configureErrors,\r\n quantityError,\r\n otherError,\r\n errorHost\r\n }\r\n } = state;\r\n\r\n const onClick = () => findInStoreOnClick(props, state, callbacks);\r\n\r\n if (!product || !storeSelectorStateManager || storeSelector.length === 0) {\r\n return undefined;\r\n }\r\n\r\n // If no delivery options present on the product, or none of the delivery options\r\n // match the PickupDeliveryModeCode, that means the item cannot be used for BOPIS\r\n if (!deliveryOptions ||\r\n !deliveryOptions.DeliveryOptions ||\r\n !PickupDeliveryModeCode ||\r\n !deliveryOptions.DeliveryOptions.find(option => option.Code === PickupDeliveryModeCode)) {\r\n return undefined;\r\n }\r\n\r\n return {\r\n ContainerProps: {\r\n className: 'ms-buybox__find-in-store'\r\n },\r\n\r\n storeSelector: storeSelector[0],\r\n\r\n openFindInStoreDialog: onClick,\r\n\r\n heading: (\r\n \r\n ),\r\n\r\n description: (\r\n

{resources.findInStoreDescriptionText}

\r\n ),\r\n\r\n errors: (\r\n \r\n ),\r\n\r\n button: (\r\n \r\n {resources.findInStoreLinkText}\r\n \r\n )\r\n };\r\n}\r\n\r\nasync function findInStoreOnClick(props: ISmweBuyboxProps, state: IBuyboxState, callbacks: IBuyboxCallbacks): Promise {\r\n const {\r\n data: {\r\n storeSelectorStateManager: { result: storeSelectorStateManager },\r\n cart: { result: cart }\r\n },\r\n resources,\r\n context\r\n } = props;\r\n\r\n const {\r\n selectedProduct\r\n } = state;\r\n\r\n let dataProduct = props.data.product.result;\r\n\r\n if (selectedProduct) {\r\n dataProduct = (await selectedProduct) || dataProduct;\r\n }\r\n\r\n if (!dataProduct || !storeSelectorStateManager) {\r\n return;\r\n }\r\n\r\n const product = dataProduct;\r\n\r\n const missingDimensions = product.Dimensions && product.Dimensions.filter(dimension => !(dimension.DimensionValue && dimension.DimensionValue.Value));\r\n\r\n if (missingDimensions && missingDimensions.length > 0) {\r\n if (callbacks.updateErrorState) {\r\n callbacks.updateErrorState(\r\n {\r\n errorHost: 'FINDINSTORE',\r\n configureErrors: getConfigureErrors(missingDimensions, resources),\r\n }\r\n );\r\n }\r\n } else {\r\n storeSelectorStateManager.openDialog({\r\n product,\r\n onLocationSelected: orgUnitLocation => {\r\n if (!cart) {\r\n return Promise.resolve();\r\n }\r\n\r\n return cart.addProductToCart({ product: product, count: 1, location: orgUnitLocation })\r\n .then(result => {\r\n const navigationUrl = getUrlSync('cart', context.actionContext);\r\n\r\n if (result.status === 'SUCCESS' && navigationUrl) {\r\n window.location.assign(navigationUrl);\r\n }\r\n }).catch(error => {\r\n return;\r\n });\r\n }\r\n }).catch(error => {\r\n return;\r\n });\r\n }\r\n\r\n return;\r\n}","import * as React from 'react';\r\n\r\nimport { INodeProps } from '@msdyn365-commerce-modules/utilities';\r\nimport { ProductDimensionFull } from '@msdyn365-commerce/commerce-entities';\r\nimport { IActionContext } from '@msdyn365-commerce/core';\r\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\n\r\nimport { IBuyboxCallbacks, IBuyboxState } from '../smwe-buybox';\r\nimport { ISmweBuyboxData } from '../smwe-buybox.data';\r\nimport { ISmweBuyboxProps, ISmweBuyboxResources } from '../smwe-buybox.props.autogenerated';\r\nimport { Dropdown, IDropdownItemProps, IDropdownOnSelectionChangeNotification } from './dropdown';\r\n\r\nexport interface IBuyboxProductConfigureProps {\r\n product: SimpleProduct;\r\n productDimensions: ProductDimensionFull[];\r\n resources: ISmweBuyboxResources;\r\n channelId: number;\r\n actionContext: IActionContext;\r\n errors: { [configureId: string]: string | undefined };\r\n\r\n dimensionChanged?(newValue: number): void;\r\n}\r\n\r\nexport interface IBuyboxProductConfigureDropdownViewProps {\r\n ContainerProps: INodeProps;\r\n LabelContainerProps: INodeProps;\r\n\r\n heading: React.ReactNode;\r\n errors?: React.ReactNode;\r\n\r\n select: React.ReactNode;\r\n}\r\n\r\nexport interface IBuyboxProductConfigureViewProps {\r\n ContainerProps: INodeProps;\r\n\r\n dropdowns: IBuyboxProductConfigureDropdownViewProps[];\r\n}\r\n\r\nexport function getBuyboxProductConfigure(props: ISmweBuyboxProps, state: IBuyboxState, callbacks: IBuyboxCallbacks): IBuyboxProductConfigureViewProps | undefined {\r\n const {\r\n data: {\r\n product: {result: product },\r\n productDimensions: {result: productDimensions },\r\n },\r\n resources\r\n } = props;\r\n\r\n const\r\n {\r\n errorState: {\r\n configureErrors,\r\n }\r\n } = state;\r\n\r\n const\r\n {\r\n getDropdownName\r\n } = callbacks;\r\n\r\n if (!product || !productDimensions) {\r\n return undefined;\r\n }\r\n\r\n const onChanged = async (notification: IDropdownOnSelectionChangeNotification) =>\r\n _onChanged(notification, callbacks.dimensionSelectedAsync);\r\n\r\n const dropdowns = productDimensions.map(productDimensionFull => _mapProductDimensionFullToDropdownViewProps(productDimensionFull, resources, configureErrors, getDropdownName, onChanged));\r\n\r\n if (!dropdowns || dropdowns.length === 0) {\r\n return undefined;\r\n }\r\n\r\n return {\r\n ContainerProps: {\r\n className: 'ms-buybox__configure'\r\n },\r\n dropdowns: dropdowns\r\n };\r\n}\r\n\r\nconst _onChanged = async (\r\n notification: IDropdownOnSelectionChangeNotification,\r\n dimensionChanged: (newValue: number, selectedDimensionValue: string) => Promise,\r\n ): Promise => {\r\n await dimensionChanged(+notification.dropdownId, notification.selectId);\r\n};\r\n\r\nconst _mapProductDimensionFullToDropdownViewProps =\r\n (\r\n productDimensionFull: ProductDimensionFull,\r\n resources: ISmweBuyboxResources,\r\n configureErrors: {[configureId: string]: string | undefined},\r\n getDropdownName: (dimensionType: number, resources: ISmweBuyboxResources) => string,\r\n dropdownCallback: (notification: IDropdownOnSelectionChangeNotification) => Promise\r\n ): IBuyboxProductConfigureDropdownViewProps => {\r\n const dropdownName = getDropdownName(productDimensionFull.DimensionTypeValue, resources);\r\n const dropdownId = productDimensionFull.DimensionTypeValue.toString();\r\n const dropdownToggleName = resources.selectDimensionFormatString.replace('{0}', dropdownName.toLocaleLowerCase());\r\n const dropdownList: IDropdownItemProps[] = productDimensionFull.DimensionValues\r\n ? productDimensionFull.DimensionValues.map(dimensionValue => {\r\n return {\r\n value: dimensionValue.Value || '',\r\n id: dimensionValue.RecordId.toString()\r\n };\r\n })\r\n : [];\r\n const errorMessage = configureErrors[dropdownId];\r\n\r\n return {\r\n ContainerProps: {\r\n className: 'ms-buybox__dropdown'\r\n },\r\n LabelContainerProps: {\r\n tag: 'label',\r\n className: 'ms_buybox__dropdown-quantity-label',\r\n htmlFor: `ms-buybox__dropown-quantity-input-${dropdownId}`\r\n },\r\n errors: errorMessage && (\r\n \r\n \r\n ),\r\n heading: (\r\n
{dropdownName}
\r\n ),\r\n select: (\r\n \r\n )\r\n };\r\n};","import classnames from 'classnames';\r\nimport { reaction, toJS } from 'mobx';\r\nimport * as React from 'react';\r\n\r\nimport { getDimensionsForSelectedVariant, GetDimensionsForSelectedVariantInput, getSelectedVariant, SelectedVariantInput } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { IModuleProps, INodeProps } from '@msdyn365-commerce-modules/utilities';\r\nimport { ProductDimensionFull } from '@msdyn365-commerce/commerce-entities';\r\nimport { CartLine, ProductAvailableQuantity, ProductDimensionValue, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\n\r\nimport { createProductAvailabilitiesForSelectedVariantInput, getProductAvailabilitiesForSelectedVariantAction, ProductAvailabilitiesForSelectedVariantInput } from '../../actions/get-product-availabilities-for-selected-variant.override.action';\r\nimport { publish } from '../../Utilities/analytics/analytics-dispatcher';\r\nimport CommerceAttributesParser from '../../Utilities/commerce-attributes-parser';\r\nimport { isProductSubscribable } from '../../Utilities/subscription-manager';\r\n\r\nimport {\r\n getBuyboxAddToCart,\r\n getBuyboxFindInStore,\r\n getBuyboxProductAddToWishlist,\r\n getBuyboxProductConfigure,\r\n getBuyboxProductDescription,\r\n getBuyboxProductPrice,\r\n getBuyboxProductQuantity,\r\n getBuyboxProductRating,\r\n getBuyboxProductTitle,\r\n IBuyboxAddToCartViewProps,\r\n IBuyboxAddToWishlistViewProps,\r\n IBuyboxFindInStoreViewProps,\r\n IBuyboxProductConfigureViewProps,\r\n IBuyboxProductQuantityViewProps\r\n} from './components';\r\nimport { ISmweBuyboxData } from './smwe-buybox.data';\r\nimport { ISmweBuyboxProps, ISmweBuyboxResources } from './smwe-buybox.props.autogenerated';\r\n\r\nexport declare type IBuyboxErrorHost = 'ADDTOCART' | 'FINDINSTORE' | 'WISHLIST';\r\n\r\nexport interface IErrorState {\r\n errorHost?: IBuyboxErrorHost;\r\n\r\n configureErrors: { [configureId: string]: string | undefined };\r\n quantityError?: string;\r\n otherError?: string;\r\n}\r\n\r\nexport interface IBuyboxCallbacks {\r\n updateQuantity(newQuantity: number): void;\r\n updateErrorState(newErrorState: IErrorState): void;\r\n updateSelectedProduct(selectedProduct: Promise): void;\r\n getDropdownName(dimensionType: number, resources: ISmweBuyboxResources): string;\r\n\r\n dimensionSelectedAsync(selectedDimensionId: number, selectedDimensionValueId: string): Promise;\r\n}\r\n\r\nexport interface IBuyboxState {\r\n quantity: number;\r\n\r\n errorState: IErrorState;\r\n\r\n selectedDimensions: { [id: number]: string | undefined };\r\n\r\n selectedProduct?: Promise;\r\n productAvailability?: ProductAvailableQuantity;\r\n}\r\n\r\nexport interface ISmweBuyboxViewProps extends ISmweBuyboxProps {\r\n state: IBuyboxState;\r\n ModuleProps: IModuleProps;\r\n ProductInfoContainerProps: INodeProps;\r\n MediaGalleryContainerProps: INodeProps;\r\n callbacks: IBuyboxCallbacks;\r\n mediaGallery?: React.ReactNode;\r\n productApellation?: React.ReactNode;\r\n acclaimRatings?: React.ReactNode;\r\n cookbookTagline?: React.ReactNode;\r\n content?: React.ReactNode[];\r\n productTitle?: React.ReactNode;\r\n productDescription?: React.ReactNode;\r\n productPrice?: React.ReactNode;\r\n productClubPrice?: React.ReactNode;\r\n title?: React.ReactNode;\r\n description?: React.ReactNode;\r\n rating?: React.ReactNode;\r\n price?: React.ReactNode;\r\n addToWishlist?: IBuyboxAddToWishlistViewProps;\r\n show?: Boolean;\r\n addToCart: IBuyboxAddToCartViewProps;\r\n subscriptionButton?: IBuyboxAddToCartViewProps;\r\n findInStore?: IBuyboxFindInStoreViewProps;\r\n quantity?: IBuyboxProductQuantityViewProps;\r\n configure?: IBuyboxProductConfigureViewProps;\r\n eventSchedule?: React.ReactNode;\r\n tastingNotes?: React.ReactNode;\r\n}\r\n\r\n/**\r\n * Buybox Module\r\n */\r\nclass SmweBuybox extends React.Component, IBuyboxState> {\r\n\r\n private buyboxCallbacks: IBuyboxCallbacks = {\r\n updateQuantity: (newQuantity: number): void => {\r\n const errorState = { ...this.state.errorState };\r\n errorState.quantityError = undefined;\r\n\r\n this.setState({ quantity: newQuantity, errorState: errorState });\r\n },\r\n updateErrorState: (newErrorState: IErrorState): void => {\r\n this.setState({ errorState: newErrorState });\r\n },\r\n updateSelectedProduct: (newSelectedProduct: Promise): void => {\r\n this.setState({ selectedProduct: newSelectedProduct });\r\n },\r\n dimensionSelectedAsync: (selectedDimensionId: number, selectedDimensionValueId: string): Promise => {\r\n return this._dimensionSelected(selectedDimensionId, selectedDimensionValueId);\r\n },\r\n getDropdownName: (dimensionType: number, resources: ISmweBuyboxResources): string => {\r\n return this._getDropdownName(dimensionType, resources);\r\n }\r\n };\r\n\r\n constructor(props: ISmweBuyboxProps, state: IBuyboxState) {\r\n super(props);\r\n this.state = {\r\n errorState: {\r\n configureErrors: {}\r\n },\r\n quantity: 1,\r\n selectedProduct: undefined,\r\n selectedDimensions: {}\r\n };\r\n\r\n // This is fragile. It will only trigger is the cart isn't loaded initially.\r\n // If the cart is already loaded by the time this is constructed, this will never trigger and\r\n // the add to cart button will never appear!\r\n reaction(\r\n () => {\r\n return this.props.data.cart.result?.cart.CartLines;\r\n },\r\n async (cartLines) => {\r\n await this._updateProductAvailability(cartLines);\r\n },\r\n { delay: 500 }\r\n );\r\n }\r\n\r\n // Restoring quantity check on render\r\n // There's a chance this will conflict with the reaction version. Worst case, two calls will be initiated.\r\n // However, this module has worse issues. It has strayed too far from the core and won't support variants.\r\n public componentDidMount(): void {\r\n const { data } = this.props;\r\n\r\n if (data.cart.result?.cart) {\r\n this._updateProductAvailability(data.cart.result.cart.CartLines).catch(() => {\r\n console.error('Failed to fetch availability');\r\n });\r\n }\r\n\r\n // Analytics event emitter\r\n // tslint:disable-next-line: no-floating-promises\r\n Promise.all([data.product.result, data.productSpecificationData.result, data.categories])\r\n .then(() => {\r\n publish('productDetailView', {\r\n product: data.product.result,\r\n attributes: CommerceAttributesParser.getParsedAttributes(data.productSpecificationData.result || []),\r\n category: this._getCurrentCategory(),\r\n context: this.props.context,\r\n });\r\n }).catch(e => this.props.telemetry.exception(e));\r\n }\r\n\r\n // tslint:disable-next-line: cyclomatic-complexity\r\n public render(): JSX.Element | null {\r\n const {\r\n slots: {\r\n mediaGallery,\r\n productApellation,\r\n content,\r\n productTitle,\r\n productPrice,\r\n productClubPrice,\r\n acclaimRatings,\r\n cookbookTagline,\r\n productDescription,\r\n eventSchedule\r\n },\r\n data: {\r\n product: { result: product }\r\n },\r\n config: { className = '' }\r\n } = this.props;\r\n\r\n if (!product) {\r\n return null;\r\n }\r\n const attributeList = this.props.data && this.props.data.productSpecificationData && this.props.data.productSpecificationData.result;\r\n\r\n const canAddToCartAttribute = attributeList && attributeList.filter(\r\n attribute => attribute.Name! === 'Can add to cart'\r\n );\r\n\r\n const productTypeAttribute = attributeList && attributeList.find(\r\n attribute => attribute.Name === 'Product Type'\r\n );\r\n\r\n const productType = (productTypeAttribute?.TextValue)?.replace(/\\s+/g, '-').toLowerCase();\r\n const show = (canAddToCartAttribute && canAddToCartAttribute.length) ? canAddToCartAttribute[0].BooleanValue : true;\r\n const shouldNavigateToCart = this.props.config.shouldNavigateToCart;\r\n const viewProps: ISmweBuyboxViewProps = {\r\n ...(this.props as ISmweBuyboxProps),\r\n state: this.state,\r\n mediaGallery: mediaGallery && mediaGallery.length > 0 ? mediaGallery[0] : undefined,\r\n productApellation: productApellation && productApellation.length > 0 ? productApellation[0] : undefined,\r\n acclaimRatings: acclaimRatings && acclaimRatings.length > 0 ? acclaimRatings[0] : undefined,\r\n cookbookTagline: cookbookTagline && cookbookTagline.length > 0 ? cookbookTagline[0] : undefined,\r\n content: content && content.length > 0 ? content : undefined,\r\n productTitle: productTitle && productTitle.length > 0 ? productTitle[0] : undefined,\r\n productDescription: productDescription && productDescription.length > 0 ? productDescription[0] : undefined,\r\n eventSchedule: eventSchedule && eventSchedule.length > 0 ? eventSchedule[0] : undefined,\r\n productPrice: productPrice && productPrice.length > 0 ? productPrice[0] : undefined,\r\n productClubPrice: productClubPrice && productClubPrice.length > 0 ? productClubPrice[0] : undefined,\r\n tastingNotes: mediaGallery && mediaGallery.length > 1 ? mediaGallery[1] : undefined,\r\n show,\r\n ModuleProps: {\r\n moduleProps: this.props,\r\n className: classnames('ms-buybox', className)\r\n },\r\n ProductInfoContainerProps: {\r\n className: classnames('ms-buybox__content', productType)\r\n },\r\n MediaGalleryContainerProps: {\r\n className: 'ms-buybox__media-gallery'\r\n },\r\n callbacks: this.buyboxCallbacks,\r\n title: getBuyboxProductTitle(this.props),\r\n description: getBuyboxProductDescription(this.props),\r\n configure: getBuyboxProductConfigure(this.props, this.state, this.buyboxCallbacks),\r\n findInStore: getBuyboxFindInStore(this.props, this.state, this.buyboxCallbacks),\r\n price: getBuyboxProductPrice(this.props),\r\n addToCart: getBuyboxAddToCart(this.props, this.state, this.buyboxCallbacks, shouldNavigateToCart, productTypeAttribute, attributeList || []),\r\n subscriptionButton: (this._showSubscriptionButton) ? getBuyboxAddToCart(this.props, this.state, this.buyboxCallbacks, shouldNavigateToCart, productTypeAttribute, attributeList || [], true) : undefined,\r\n addToWishlist: getBuyboxProductAddToWishlist(this.props, this.state, this.buyboxCallbacks),\r\n rating: getBuyboxProductRating(this.props),\r\n quantity: getBuyboxProductQuantity(this.props, this.state, this.buyboxCallbacks),\r\n };\r\n\r\n return this.props.renderView(viewProps);\r\n }\r\n\r\n private get _showSubscriptionButton(): boolean {\r\n const availableQuantity = (this.state.productAvailability && this.state.productAvailability.AvailableQuantity) || 0;\r\n const stockLeft = Math.max(availableQuantity - this.props.context.app.config.outOfStockThreshold, 0);\r\n if (!stockLeft) { return false; }\r\n\r\n const attributes = this.props.data.productSpecificationData.result;\r\n return isProductSubscribable(attributes);\r\n }\r\n\r\n private _dimensionSelected = async (selectedDimensionId: number, selectedDimensionValue?: string): Promise => {\r\n const {\r\n data: {\r\n product: { result: product },\r\n productDimensions: { result: productDimensions },\r\n },\r\n context: {\r\n actionContext,\r\n request: {\r\n apiSettings: {\r\n channelId\r\n }\r\n }\r\n }\r\n } = this.props;\r\n\r\n const\r\n {\r\n selectedDimensions\r\n } = this.state;\r\n\r\n if (!product || !productDimensions) {\r\n return;\r\n }\r\n\r\n // Step 1: Update state to indicate which dimensions are selected\r\n const newSelectedDimensions: { [id: number]: string | undefined } = { ...selectedDimensions };\r\n newSelectedDimensions[selectedDimensionId] = selectedDimensionValue;\r\n\r\n this.setState({ selectedDimensions: newSelectedDimensions });\r\n\r\n // Step 2: Clear any errors indicating the dimension wasn't selected\r\n if (this.state.errorState.configureErrors[selectedDimensionId]) {\r\n const errorState = { ...this.state.errorState };\r\n errorState.configureErrors[selectedDimensionId] = undefined;\r\n\r\n this.setState({ errorState: errorState });\r\n }\r\n\r\n // Step 3, Build the actually selected dimensions, prioritizing the information in state\r\n // over the information in data\r\n const mappedDimensions = productDimensions.map(dimension => {\r\n return {\r\n DimensionTypeValue: dimension.DimensionTypeValue,\r\n DimensionValue: this._updateDimensionValue(dimension, newSelectedDimensions[dimension.DimensionTypeValue]) || dimension.DimensionValue,\r\n ExtensionProperties: dimension.ExtensionProperties\r\n };\r\n }).filter(dimension => {\r\n return dimension && dimension.DimensionValue;\r\n });\r\n\r\n // Step 4. Use these dimensions hydrate the product. Wrap this in a promise\r\n // so that places like add to cart can await it\r\n const selectedProduct = new Promise(async (resolve, reject) => {\r\n const newProduct = (await getSelectedVariant(\r\n new SelectedVariantInput(\r\n product.MasterProductId ? product.MasterProductId : product.RecordId,\r\n channelId,\r\n mappedDimensions\r\n ),\r\n actionContext\r\n ));\r\n\r\n if (newProduct) {\r\n await getDimensionsForSelectedVariant(\r\n new GetDimensionsForSelectedVariantInput(\r\n newProduct.MasterProductId ? newProduct.MasterProductId : newProduct.RecordId,\r\n channelId,\r\n mappedDimensions\r\n ),\r\n actionContext\r\n );\r\n }\r\n\r\n resolve(newProduct);\r\n });\r\n\r\n this.setState({ selectedProduct: selectedProduct });\r\n\r\n await selectedProduct;\r\n };\r\n\r\n private _updateDimensionValue = (productDimensionFull: ProductDimensionFull, newValueId: string | undefined): ProductDimensionValue | undefined => {\r\n if (newValueId && productDimensionFull.DimensionValues) {\r\n return productDimensionFull.DimensionValues.find(dimension => dimension.RecordId === +newValueId);\r\n }\r\n\r\n return undefined;\r\n };\r\n\r\n private _getDropdownName = (dimensionType: number, resources: ISmweBuyboxResources): string => {\r\n switch (dimensionType) {\r\n case 1: // ProductDimensionType.Color\r\n return resources.productDimensionTypeColor;\r\n case 2: // ProductDimensionType.Configuration\r\n return resources.productDimensionTypeConfiguration;\r\n case 3: // ProductDimensionType.Size\r\n return resources.productDimensionTypeSize;\r\n case 4: // ProductDimensionType.Style\r\n return resources.productDimensionTypeStyle;\r\n default:\r\n return '';\r\n }\r\n };\r\n\r\n private async _updateProductAvailability(cartLines: CartLine[] | undefined): Promise {\r\n let qtyInCart = 0;\r\n if (cartLines) {\r\n cartLines.map(cartline => {\r\n if (cartline.ProductId === this.props.data.product.result?.RecordId) {\r\n qtyInCart = qtyInCart + cartline.Quantity!;\r\n }\r\n });\r\n }\r\n const productAvailability = await getProductAvailabilitiesForSelectedVariantAction(\r\n createProductAvailabilitiesForSelectedVariantInput(this.props.context.actionContext) as ProductAvailabilitiesForSelectedVariantInput,\r\n this.props.context.actionContext\r\n );\r\n\r\n if (productAvailability) {\r\n const clonedProductAvailability = {\r\n AvailableQuantity: productAvailability.AvailableQuantity! - qtyInCart,\r\n ExtensionProperties: productAvailability.ExtensionProperties,\r\n ProductId: productAvailability.ProductId,\r\n UnitOfMeasure: productAvailability.UnitOfMeasure\r\n } as ProductAvailableQuantity;\r\n this.setState({ productAvailability: clonedProductAvailability });\r\n }\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n private _getCurrentCategory(): string {\r\n const categorySlug = this._getCategorySlug();\r\n\r\n // Attempt to locate category slug in the category hierarchy\r\n // Array.concat doesn't work with mobx Observables, so convert to JS first\r\n let categories = toJS(this.props.data.categories.result || []);\r\n while (categories.length) {\r\n // Pull an entry from the front or back of the list -- either is fine (the front may be marginally faster)\r\n const category = categories.shift();\r\n\r\n // Check for a match\r\n if (category!.Slug === categorySlug) {\r\n return category!.Name || categorySlug;\r\n }\r\n\r\n // No match, so add any children to the list to scan\r\n if (category!.Children && category!.Children.length) {\r\n categories = categories.concat(category!.Children); // Add new entries to the front or back of the list -- again it doesn't matter which\r\n }\r\n }\r\n\r\n // No match was found, so use the category slug as a fallback\r\n return categorySlug;\r\n }\r\n\r\n //----------------------------------------------------------\r\n // Figure out the slug for the current category\r\n //----------------------------------------------------------\r\n private _getCategorySlug(): string {\r\n\r\n // Based on the page type (category or product) we want to remove a\r\n // different number of chunks of the URL\r\n const sliceIndexes = {\r\n '.c': -1,\r\n '.p': -2,\r\n };\r\n\r\n const currentUrl = window.location.pathname;\r\n\r\n // Use the last 2 chars of the pathname to determine if we're on a product (.p) or category (.c) page\r\n const suffix = currentUrl.slice(-2);\r\n\r\n if (sliceIndexes[suffix]) {\r\n // Slice off part of the current URL to find the category URL\r\n return currentUrl.split('/').slice(0, sliceIndexes[suffix]).join('/');\r\n }\r\n\r\n // We don't really know what to do here. Just use the current URL, even though it will probably fail.\r\n return currentUrl;\r\n }\r\n\r\n}\r\n\r\nexport default SmweBuybox;\r\n","import { format } from '@msdyn365-commerce-modules/utilities';\r\nimport {\r\n ICoreContext\r\n} from '@msdyn365-commerce/core';\r\nimport { ICartState } from '@msdyn365-commerce/global-state';\r\nimport { AsyncResult, CommerceProperty } from '@msdyn365-commerce/retail-proxy';\r\nimport debounce from 'lodash/debounce';\r\nimport { observable, reaction } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport * as React from 'react';\r\nimport { SubscriptionCommerceValues } from '../../../common/subscription-commerce.values';\r\nimport { CartUtilities } from '../../../Utilities/cart-utils';\r\nimport { calculateSavingPercentAmount } from '../../../Utilities/elicit-savings-calculation';\r\nimport { filterCartLines, getSubscriptionValues, updateSubscription } from '../../../Utilities/subscription-manager';\r\nimport { IEditSubscriptionLinkData, IFrequencyTableData } from '../elicit-cart.props.autogenerated';\r\n\r\nexport interface IElicitSubscriptionHeaderProps {\r\n // elicitCartProps: IElicitCartProps;\r\n className: string;\r\n cart: AsyncResult;\r\n frequencyTable: IFrequencyTableData[];\r\n editSubscriptionLink?: IEditSubscriptionLinkData;\r\n resources: {\r\n deliveryText: string;\r\n savingText: string;\r\n savingLabel: string;\r\n wineBottleSummaryCount: string;\r\n boxNamePlaceholder: string;\r\n };\r\n context: ICoreContext;\r\n useFetchFromCart?: boolean;\r\n}\r\n\r\n/**\r\n * Subscription header renders the part of the UI that allows the user to change their subscription\r\n */\r\n@observer\r\nexport class ElicitSubscriptionHeader extends React.Component {\r\n /**\r\n * stores the user's selected frequency, gets defaulted in constructor\r\n */\r\n @observable private _selectedFrequency: IFrequencyTableData | undefined;\r\n\r\n @observable private _name: string = SubscriptionCommerceValues.SUBSCRIPTION_DEFAULT_NAME;\r\n\r\n constructor(props: IElicitSubscriptionHeaderProps) {\r\n super(props);\r\n\r\n this._onFrequencyChange = this._onFrequencyChange.bind(this);\r\n this._onNameChange = this._onNameChange.bind(this);\r\n this._onNameBlur = this._onNameBlur.bind(this);\r\n\r\n // debounce function now has typings and requires an intermediate function to use properly.\r\n // implement later. new typings declare DebouncedFunc<() => Promise> not () => Promise\r\n this._publishNameChange = debounce(this._publishNameChange.bind(this), 500) as unknown as () => Promise;\r\n\r\n reaction(\r\n () => [this.props.cart.result?.cart],\r\n () => {\r\n const values = getSubscriptionValues(this.props.cart.result?.cart);\r\n this._name = values.name || '';\r\n this._selectedFrequency = this.props.frequencyTable.find(freq => freq.freqId === values.frequency) || this._selectedFrequency;\r\n }\r\n );\r\n }\r\n\r\n public render(): JSX.Element {\r\n if (!this.props.cart.result) { return
; }\r\n const {\r\n className,\r\n resources: {\r\n wineBottleSummaryCount,\r\n deliveryText,\r\n savingText,\r\n savingLabel,\r\n boxNamePlaceholder\r\n },\r\n cart: { result: cartState },\r\n context\r\n } = this.props;\r\n const subState = getSubscriptionValues(cartState.cart);\r\n const subLines = filterCartLines(cartState.cart).subscriptionLines;\r\n const formatter = context.cultureFormatter.formatCurrency;\r\n const total = CartUtilities.countCartLineNetPrice(subLines);\r\n const discountedTotal = CartUtilities.countCartLineDiscountedPrice(subLines);\r\n const totalBottles = CartUtilities.countCartLineAmount(subLines);\r\n\r\n //only show savings if subscription box qualifies for subsequent orders\r\n const futureSavings = calculateSavingPercentAmount(subLines);\r\n let savings = total - discountedTotal;\r\n if (!isFinite(savings)) {\r\n savings = 0;\r\n }\r\n const savingFormatted = formatter(savings);\r\n return (\r\n
\r\n
\r\n
\r\n
\r\n \r\n
{format(wineBottleSummaryCount, totalBottles)}
\r\n
\r\n
\r\n
\r\n
{deliveryText}
\r\n {this._frequencyTable(subState.frequency)}\r\n
\r\n
\r\n
{savingLabel}
\r\n
\r\n
{formatter(futureSavings ? discountedTotal : total)}
\r\n {savings && futureSavings ?
{format(savingText, savingFormatted)}
: ''}\r\n
\r\n
\r\n
\r\n );\r\n }\r\n\r\n private _frequencyTable(initialId?: string): JSX.Element {\r\n const { frequencyTable } = this.props;\r\n\r\n let firstId: string | undefined;\r\n if (!initialId && this._selectedFrequency) {\r\n firstId = frequencyTable?.find(freq => !!freq)?.freqId;\r\n }\r\n return (\r\n \r\n );\r\n }\r\n\r\n private async _pushUpdateToCart(updates: { key: string; value: string }[]): Promise {\r\n const cartChanges: CommerceProperty[] = updates.map(change => {\r\n return {\r\n Key: change.key,\r\n Value: {\r\n StringValue: change.value\r\n }\r\n };\r\n });\r\n\r\n await updateSubscription(this.props.cart, cartChanges, this.props.context);\r\n }\r\n\r\n private async _publishNameChange(): Promise {\r\n await this._pushUpdateToCart([\r\n {\r\n key: SubscriptionCommerceValues.SUBSCRIPTION_NAME,\r\n value: this._name\r\n }\r\n ]);\r\n }\r\n\r\n private async _onNameChange(event: React.ChangeEvent): Promise {\r\n this._name = event.target.value;\r\n }\r\n\r\n private async _onNameBlur(event: React.ChangeEvent): Promise {\r\n return this._publishNameChange();\r\n }\r\n\r\n private async _onFrequencyChange(event: React.ChangeEvent): Promise {\r\n this._selectedFrequency = this.props.frequencyTable?.find(frequncy => frequncy.freqId === event.target.value);\r\n return this._submitSubscriptionToCart();\r\n }\r\n\r\n private async _submitSubscriptionToCart(): Promise {\r\n\r\n const { context, cart: cartState } = this.props;\r\n const cartChanges: CommerceProperty[] = [];\r\n\r\n cartChanges.push({\r\n Key: SubscriptionCommerceValues.SUBSCRIPTION_FREQUENCY,\r\n Value: {\r\n StringValue: this._selectedFrequency!.freqId\r\n }\r\n });\r\n\r\n await updateSubscription(cartState, cartChanges, context);\r\n return;\r\n }\r\n}","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport {\r\n IActionContext,\r\n IComponentProps,\r\n IGridSettings,\r\n IImageSettings,\r\n Image,\r\n RichTextComponent\r\n} from '@msdyn365-commerce/core';\r\nimport { ICartState } from '@msdyn365-commerce/global-state';\r\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport {\r\n AttributeValue,\r\n CartLine,\r\n SalesLine\r\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport React, { useEffect, useState } from 'react';\r\nimport { brandCodeParser } from '../Utilities/brand-code-parser';\r\nimport { isLineSubscriptionLine } from '../Utilities/subscription-manager';\r\nimport { ElicitAmountSelector } from './elicit-amountselector.component';\r\n\r\n/**\r\n * ICartlineResourceString: Interface for specifying the\r\n * resource strings that the component needs\r\n */\r\nexport interface ICartlineResourceString {\r\n /** Display string for discount label */\r\n discountStringText: string;\r\n /** String for size key */\r\n sizeString: string;\r\n /** String for color key */\r\n colorString: string;\r\n /** String associated with the configuration product dimension */\r\n configString: string;\r\n /** String for style key */\r\n styleString: string;\r\n /** Display string for quantity label */\r\n quantityDisplayString: string;\r\n /** Display string for quantity label */\r\n inputQuantityAriaLabel: string;\r\n}\r\n\r\ninterface ICartLineData {\r\n cartLine: CartLine | SalesLine;\r\n product: SimpleProduct;\r\n}\r\n\r\n/**\r\n * ICartLineProps: The props required to render cartLineitem\r\n */\r\nexport interface ICartLineProps extends IComponentProps {\r\n percentSaving: number;\r\n templateSavingText: string;\r\n templatePercentSavingText: string;\r\n /** The flag to change the quantity component from interactible to static */\r\n disableQuantityInteractivity?: boolean;\r\n /** The primary image url */\r\n primaryImageUrl?: string;\r\n /** The product url */\r\n productUrl?: string;\r\n /** GridSettings for the product image in cartLine */\r\n gridSettings: IGridSettings;\r\n /** ImageSettings for the product image in cartLine */\r\n imageSettings: IImageSettings;\r\n /** Boolean flag to indicate if the item is out of stock */\r\n isOutOfStock?: boolean;\r\n /** Flag to make quantity section editable */\r\n isQuantityEditable?: boolean;\r\n /** Max quantity for line item */\r\n maxQuantity?: number;\r\n /** Current quantity for line item */\r\n currentQuantity?: number;\r\n /** Resource string for the component */\r\n resources: ICartlineResourceString;\r\n /** SalesLine flag */\r\n isSalesLine?: boolean;\r\n // Remove button coming from smwe-cartline\r\n // remove:string;\r\n remove?: React.ReactNode;\r\n /** Display images for on cart lines */\r\n showImages?: boolean;\r\n /** Has zero availability error? */\r\n zeroAvailabilityError?: boolean;\r\n cartState?: ICartState;\r\n cartLineErrors?: { [index: string]: boolean };\r\n /** Replaces discount code name with percent */\r\n showDiscountPercent?: boolean;\r\n /** Attributes for product */\r\n productAttributes?: AttributeValue[];\r\n /** Quantity onChange callback */\r\n quantityOnChange?(cartLine: CartLine, newQuantity: number): void;\r\n cartLineOnChange?(ctx: IActionContext, cartState: ICartState | undefined, cartLine: CartLine): void;\r\n}\r\n\r\n// tslint:disable-next-line:max-func-body-length\r\nconst SmweCartLine: React.FC = (props: ICartLineProps) => {\r\n const { isSalesLine, productUrl, resources, primaryImageUrl, showImages, gridSettings, imageSettings, zeroAvailabilityError } = props;\r\n const intlFormatter = props.context.cultureFormatter;\r\n const { product } = props.data;\r\n\r\n const _updateQuantityRaw = (num: number) => {\r\n if (props.quantityOnChange) {\r\n props.quantityOnChange(\r\n props.data.cartLine,\r\n num || 10\r\n );\r\n }\r\n };\r\n\r\n const _generateSelectMenu = (\r\n quantity: number,\r\n currentQuantity: number | undefined\r\n ): JSX.Element => {\r\n const shouldDisableQty = props.data.product && props.data.product.ItemId?.toLowerCase() === props.context.request.channel?.GiftCardItemId?.toLowerCase();\r\n return (\r\n \r\n \r\n {props.remove}\r\n \r\n );\r\n };\r\n const _isWineProduct = (productId: string | undefined) => {\r\n return productId && /^\\d+$/.test(productId);\r\n };\r\n\r\n const _generateQuantityAndPrice = (): JSX.Element[] | null => {\r\n const nodes = [];\r\n const priceAdjustmentSavings = _getPriceAdjustmentSavings();\r\n // TODO: Temporary solution till we get better solution in checking product type in Cart\r\n const isWineProduct = _isWineProduct(product.ItemId);\r\n if (isWineProduct && props.isOutOfStock && !zeroAvailabilityError) {\r\n return null;\r\n }\r\n\r\n if (props.isQuantityEditable) {\r\n nodes.push(\r\n _generateSelectMenu(props.maxQuantity || 10, props.currentQuantity)\r\n );\r\n } else {\r\n nodes.push(\r\n \r\n \r\n \r\n {props.data.cartLine.Quantity} {props.remove}\r\n \r\n \r\n );\r\n }\r\n nodes.push(\r\n \r\n
\r\n {props.data.cartLine.Price !== undefined\r\n ? intlFormatter.formatCurrency(props.data.cartLine.Price * (1 - ((props.data.cartLine.DiscountAmountWithoutTax || 0) / (props.data.cartLine.NetPrice || 0))))\r\n : ''}\r\n {_getPriceAdjustmentPercent()}\r\n
\r\n
\r\n {_getPriceDiscount()}\r\n
\r\n \r\n );\r\n let price = props.data.cartLine.NetPrice! / props.percentSaving;\r\n if (!isFinite(price)) {\r\n price = 0;\r\n }\r\n nodes.push(\r\n \r\n
\r\n {isSalesLine\r\n ? props.data.cartLine.Price && intlFormatter.formatCurrency(props.data.cartLine.Price)\r\n : props.data.cartLine.TotalAmount === 0\r\n ? intlFormatter.formatCurrency(0)\r\n : props.data.cartLine.TotalAmount && intlFormatter.formatCurrency(props.data.cartLine.TotalAmount)\r\n }\r\n
\r\n
\r\n {(props.data.cartLine.DiscountAmountWithoutTax && props.data.cartLine.DiscountAmountWithoutTax > 0)\r\n || (priceAdjustmentSavings && priceAdjustmentSavings > 0)\r\n ? `${intlFormatter.formatCurrency((props.data.cartLine.DiscountAmountWithoutTax || 0) + _getPriceAdjustmentSavings())} savings`\r\n : null\r\n }\r\n
\r\n \r\n );\r\n return nodes;\r\n };\r\n\r\n const _getCartLineImage = (): JSX.Element | null => {\r\n if (showImages && primaryImageUrl) {\r\n return (\r\n
\r\n \r\n
\r\n );\r\n } else {\r\n return null;\r\n }\r\n };\r\n\r\n const _getPriceAdjustmentPercent = (): JSX.Element | null => {\r\n if (props.data.product.Price && props.data.cartLine.Price && (props.data.cartLine.Price < props.data.product.Price)) {\r\n return {` (${((props.data.cartLine.Price / props.data.product.Price) * 100).toFixed(0)}% Off)`};\r\n } else {\r\n return null;\r\n }\r\n };\r\n\r\n const _getPriceDiscount = (): string | null => {\r\n if (\r\n props.data.cartLine.DiscountAmountWithoutTax !== undefined &&\r\n props.data.cartLine.DiscountAmountWithoutTax !== 0 &&\r\n props.data.cartLine.Quantity &&\r\n props.data.cartLine.DiscountLines\r\n ) {\r\n if (props.showDiscountPercent && props.data.cartLine.NetPrice) {\r\n return `${((props.data.cartLine.DiscountAmountWithoutTax / props.data.cartLine.NetPrice) * 100).toFixed(0)}% off`;\r\n }\r\n return `${_doubleDiscounts()} ${props.data.cartLine.DiscountLines[0].DiscountCode}`;\r\n\r\n }\r\n return null;\r\n };\r\n\r\n enum GiftCardFieldType {\r\n Extension, Attribute\r\n }\r\n\r\n interface IGiftCardFields {\r\n Key: string;\r\n Type: GiftCardFieldType;\r\n StringValue: string;\r\n Required: boolean;\r\n isValid?: boolean;\r\n }\r\n\r\n interface IGiftCardFormObj {\r\n FirstName: IGiftCardFields;\r\n LastName: IGiftCardFields;\r\n ElectronicDeliveryEmail: IGiftCardFields;\r\n ElectronicDeliveryEmailContent: IGiftCardFields;\r\n }\r\n\r\n const giftCardFormObj: IGiftCardFormObj = {\r\n FirstName: {\r\n Key: 'FirstName',\r\n Type: GiftCardFieldType.Extension,\r\n StringValue: '',\r\n Required: true,\r\n isValid: true\r\n },\r\n LastName: {\r\n Key: 'LastName',\r\n Type: GiftCardFieldType.Extension,\r\n StringValue: '',\r\n Required: true,\r\n isValid: true\r\n },\r\n ElectronicDeliveryEmail: {\r\n Key: 'ElectronicDeliveryEmail',\r\n Type: GiftCardFieldType.Attribute,\r\n StringValue: '',\r\n Required: true,\r\n isValid: true\r\n },\r\n ElectronicDeliveryEmailContent: {\r\n Key: 'ElectronicDeliveryEmailContent',\r\n Type: GiftCardFieldType.Attribute,\r\n StringValue: '',\r\n Required: false\r\n },\r\n };\r\n\r\n // tslint:disable-next-line: max-func-body-length\r\n const _renderGiftCardPrompt = (): JSX.Element | null => {\r\n\r\n if (!props.data.cartLine.IsGiftCardLine) {\r\n return null;\r\n }\r\n\r\n const [giftCardFormField, setGiftCardFormField] = useState(giftCardFormObj);\r\n const [formFieldsDebounce, setFormFieldsDebounce] = useState('');\r\n\r\n const setFormFieldState = () => {\r\n const unhydratedCartLineLoad = { ...props.data.cartLine };\r\n Object.keys(giftCardFormField).forEach((field) => {\r\n const fieldState = giftCardFormField[field];\r\n if (fieldState.Type === GiftCardFieldType.Extension) {\r\n unhydratedCartLineLoad.ExtensionProperties = unhydratedCartLineLoad.ExtensionProperties || [];\r\n const property = unhydratedCartLineLoad.ExtensionProperties.find((extension) => {\r\n return extension.Key?.toLowerCase() === fieldState.Key?.toLowerCase();\r\n });\r\n if (property) {\r\n setGiftCardFormField((prevState: IGiftCardFormObj) => ({\r\n ...prevState,\r\n [field]: {\r\n ...prevState[field],\r\n StringValue: property.Value?.StringValue\r\n }\r\n }));\r\n }\r\n } else if (fieldState.Type === GiftCardFieldType.Attribute) {\r\n const property = unhydratedCartLineLoad[fieldState.Key];\r\n if (property) {\r\n setGiftCardFormField((prevState: IGiftCardFormObj) => ({\r\n ...prevState,\r\n [fieldState.Key]: {\r\n ...prevState[fieldState.Key],\r\n StringValue: unhydratedCartLineLoad[fieldState.Key]\r\n }\r\n }));\r\n }\r\n }\r\n });\r\n };\r\n\r\n const updateFormFieldToCartLine = () => {\r\n const unhydratedCartLineLoad = { ...props.data.cartLine };\r\n Object.keys(giftCardFormField).forEach((field) => {\r\n const fieldState = giftCardFormField[field];\r\n if (fieldState.Type === GiftCardFieldType.Extension) {\r\n unhydratedCartLineLoad.ExtensionProperties = unhydratedCartLineLoad.ExtensionProperties || [];\r\n unhydratedCartLineLoad.ExtensionProperties.push({\r\n Key: fieldState.Key,\r\n Value: {\r\n StringValue: fieldState.StringValue\r\n }\r\n });\r\n } else if (fieldState.Type === GiftCardFieldType.Attribute) {\r\n unhydratedCartLineLoad[fieldState.Key] = giftCardFormField[fieldState.Key].StringValue;\r\n }\r\n });\r\n // Removing 'ItemTaxGroupId' from the object because now in new SSK its READONLY Attribute, can't be updated.\r\n delete (unhydratedCartLineLoad.ItemTaxGroupId);\r\n props.cartLineOnChange && props.cartLineOnChange(props.context.actionContext, props.cartState, unhydratedCartLineLoad);\r\n };\r\n\r\n const giftCardValidation = () => {\r\n let giftCardFormIsValid = true;\r\n Object.keys(giftCardFormField).forEach((field) => {\r\n const fieldState = giftCardFormField[field];\r\n if (fieldState.Required) {\r\n if (fieldState.StringValue.trim() === '') {\r\n giftCardFormIsValid = false;\r\n fieldState.isValid = false;\r\n } else {\r\n fieldState.isValid = true;\r\n }\r\n\r\n if (fieldState.Key === 'ElectronicDeliveryEmail') {\r\n const validEmailRegex =\r\n RegExp(/^(([^<>()\\[\\]\\.,;:\\s@\\\"]+(\\.[^<>()\\[\\]\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>()[\\]\\.,;:\\s@\\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\\"]{2,})$/i);\r\n if (!validEmailRegex.test(fieldState.StringValue)) {\r\n giftCardFormIsValid = false;\r\n fieldState.isValid = false;\r\n } else {\r\n fieldState.isValid = true;\r\n }\r\n }\r\n }\r\n });\r\n if (props.cartLineErrors) {\r\n if (giftCardFormIsValid) {\r\n props.cartLineErrors[props.data.cartLine.LineId!] = false;\r\n } else {\r\n props.cartLineErrors[props.data.cartLine.LineId!] = true;\r\n }\r\n }\r\n };\r\n\r\n // Setting the data from the cartline to State on load\r\n useEffect(() => {\r\n setFormFieldState();\r\n }, []);\r\n\r\n //Checking giftCard form validation\r\n useEffect(() => {\r\n giftCardValidation();\r\n }, [giftCardFormField]);\r\n\r\n // Updating formfield to cardLine\r\n useEffect(() => {\r\n const delayDebounceFn = setTimeout(() => {\r\n updateFormFieldToCartLine();\r\n }, 600);\r\n\r\n return () => clearTimeout(delayDebounceFn);\r\n }, [formFieldsDebounce]);\r\n\r\n const handleChange = (name: string) => (event: React.ChangeEvent) => {\r\n const value = event?.target.value;\r\n if (name) {\r\n setGiftCardFormField((prevState: IGiftCardFormObj) => ({\r\n ...prevState,\r\n [name]: {\r\n ...prevState[name],\r\n StringValue: value,\r\n },\r\n }));\r\n setFormFieldsDebounce(value);\r\n }\r\n };\r\n\r\n return (\r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n

IMPORTANT: Gift Cards are sent to the recipient email address the same day orders are placed. You can use your own e-mail address to keep it a surprise.

\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n );\r\n };\r\n\r\n const _getCartLineComment = (): JSX.Element | null => {\r\n if (_isWineProduct(props.data.product.ItemId) && props.data.cartLine.Comment) {\r\n return (\r\n
\r\n {props.data.cartLine.Comment}\r\n
);\r\n } else {\r\n return null;\r\n }\r\n };\r\n\r\n const _getPriceAdjustmentSavings = (): number => {\r\n if (props.data.product.Price && props.data.cartLine.Price && props.data.cartLine.NetPrice) {\r\n const priceUnadjusted = (props.data.cartLine.NetPrice / (props.data.cartLine.Price / props.data.product.Price));\r\n return (priceUnadjusted - props.data.cartLine.NetPrice);\r\n } else {\r\n return 0;\r\n }\r\n };\r\n\r\n const _doubleDiscounts = (): string => {\r\n if (_getPriceAdjustmentPercent()) {\r\n return '+ ';\r\n } else {\r\n return '';\r\n }\r\n };\r\n\r\n const _getKitDescription = (): JSX.Element | null => {\r\n if (props.productAttributes) {\r\n const productType = props.productAttributes.find(attribute => attribute.Name === 'Product Type');\r\n if (productType?.TextValue === 'Assembly') {\r\n const description = props.productAttributes.find(\r\n attribute => attribute.Name === 'Includes'\r\n )?.TextValue;\r\n return (\r\n
\r\n \r\n
\r\n );\r\n }\r\n }\r\n return null;\r\n };\r\n\r\n const brandCode = brandCodeParser({ description: product.Description, appContext: props.context });\r\n\r\n return (\r\n <>\r\n \r\n \r\n \r\n {_getCartLineImage()}\r\n
\r\n {brandCode &&\r\n
\r\n {brandCode}\r\n
\r\n }\r\n
\r\n {product.Name}\r\n
\r\n {_getKitDescription()}\r\n
\r\n
\r\n \r\n {_generateQuantityAndPrice()}\r\n \r\n {_getCartLineComment()}\r\n {_renderGiftCardPrompt()}\r\n \r\n );\r\n};\r\n\r\n// @ts-ignore\r\nexport default SmweCartLine;\r\n","import debounce from 'lodash/debounce';\r\nimport { observable, reaction } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport * as React from 'react';\r\n\r\nimport { Modal, ModalBody, ModalHeader } from '@msdyn365-commerce-modules/utilities';\r\nimport { IWishlistActionSuccessResult } from '@msdyn365-commerce/components';\r\nimport { RichTextComponent } from '@msdyn365-commerce/core';\r\nimport { AttributeValue, CartLine, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport { getEstimatedAvailabilityAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\n\r\nimport { publish } from '../../../Utilities/analytics/analytics-dispatcher';\r\nimport { calculateSavingPercentAmount } from '../../../Utilities/elicit-savings-calculation';\r\nimport { filterCartLines, getSubscriptionValues } from '../../../Utilities/subscription-manager';\r\nimport { ElicitCartLineItems, IElicitCartLineItemsProps } from '../../elicit-cart/components/elicit-cart-line-items';\r\nimport { ElicitSubscriptionHeader, IElicitSubscriptionHeaderProps } from '../../elicit-cart/components/elicit-subscription-header';\r\n\r\nimport { ISubscriptionsMinicartData } from '../subscriptions-minicart.data';\r\nimport { IFrequencyTableData, ISubscriptionsMinicartProps } from '../subscriptions-minicart.props.autogenerated';\r\n\r\nexport interface IBoxEditComponentProps {\r\n initialValues: {\r\n name?: string;\r\n frequencyId?: string;\r\n };\r\n props: ISubscriptionsMinicartProps;\r\n onBoxNameChange(newName: string): void;\r\n onFrequencyChange(newFrequency: IFrequencyTableData): void;\r\n}\r\n\r\n/**\r\n * declaration for the component that manages the editing\r\n * of the minicart when a user decides to name their box or\r\n * change their frequency\r\n */\r\n@observer\r\nexport class BoxEditComponent extends React.Component {\r\n\r\n @observable private _popupState: boolean = false;\r\n @observable private _name: string;\r\n @observable private _selectedFrequencyId: string;\r\n\r\n constructor(props: IBoxEditComponentProps) {\r\n super(props);\r\n\r\n this._onBoxNameChange = this._onBoxNameChange.bind(this);\r\n this._publishBoxNameChange = debounce(this._publishBoxNameChange.bind(this), 500);\r\n this._onFrequencyChange = this._onFrequencyChange.bind(this);\r\n this._togglePopup = this._togglePopup.bind(this);\r\n this._emptyCart = this._emptyCart.bind(this);\r\n\r\n const { name, frequencyId } = this.props.initialValues;\r\n this._name = name || '';\r\n this._selectedFrequencyId = frequencyId || props.props.config.frequencyTable?.find((freq) => !!freq.id)!.id!;\r\n\r\n reaction(\r\n () => { return this._popupState; },\r\n async () => {\r\n // tslint:disable-next-line: no-floating-promises\r\n await this._getProductavailabilty(this.props.props.data.products.result);\r\n }\r\n );\r\n }\r\n\r\n // tslint:disable-next-line:cyclomatic-complexity max-func-body-length\r\n public render(): JSX.Element | null {\r\n const {\r\n resources: {\r\n subscriptionsMinicart__editBoxBtn,\r\n subscriptionsMinicart__editBoxNamePlaceholder,\r\n subscriptionsMinicart_subscriptionSavingText,\r\n subscriptionsMinicart_subscriptionLinePercentSavingText,\r\n subscriptionsMinicart_emptyCartBtn\r\n }, config: { faqLink }\r\n } = this.props.props;\r\n\r\n const contextProps = this.props.props;\r\n const resources = contextProps.resources;\r\n const cart = contextProps.data.cart.result;\r\n const products = contextProps.data.products.result;\r\n const productAvailabilities = contextProps.data.productAvailabilites.result;\r\n const productDeliveryOptions = contextProps.data.deliveryOptions.result;\r\n const storeSelectorStateManager = contextProps.data.storeSelectorStateManager.result;\r\n const orgUnitLocations = contextProps.data.orgUnitLocations.result;\r\n\r\n if (!cart || !products || !productAvailabilities || !productDeliveryOptions || !storeSelectorStateManager || !orgUnitLocations) {\r\n return null;\r\n }\r\n\r\n const elicitModalProps: IElicitCartLineItemsProps = {\r\n percentSaving: calculateSavingPercentAmount(this._cartFilteredLines.subscriptionLines),\r\n templatePercentSavingText: subscriptionsMinicart_subscriptionLinePercentSavingText,\r\n templateSavingText: subscriptionsMinicart_subscriptionSavingText,\r\n cartlines: this._cartFilteredLines.subscriptionLines,\r\n cartLineErrors: {},\r\n mixedCart: {},\r\n mixedCartLines: cart.cart.CartLines|| [],\r\n products: products,\r\n productAvailabilites: productAvailabilities,\r\n productDeliveryOptions: productDeliveryOptions,\r\n imageSettings: contextProps.config.imageSettings || {\r\n viewports: {\r\n xs: { q: `w=80&h=94&m=6`, w: 0, h: 0 },\r\n sm: { q: `w=148&h=174&m=6`, w: 0, h: 0 },\r\n lg: { q: `w=148&h=174&m=6`, w: 0, h: 0 }\r\n },\r\n lazyload: true\r\n },\r\n outOfStockThreshold: contextProps.context.app.config.outOfStockThreshold || 10,\r\n isStockCheckEnabled: contextProps.app.config.enableStockCheck || false,\r\n maxCartlineQuantity: contextProps.app.config.maxQuantityForCartLineItem,\r\n gridSettings: contextProps.context.request.gridSettings!,\r\n context: contextProps.context,\r\n typeName: contextProps.typeName,\r\n id: contextProps.id,\r\n resources: {\r\n sizeString: resources.subscriptionsMinicart__productDimensionTypeSize,\r\n colorString: resources.subscriptionsMinicart__productDimensionTypeColor,\r\n configString: 'asd',\r\n styleString: resources.subscriptionsMinicart__productDimensionTypeStyle,\r\n quantityDisplayString: resources.subscriptionsMinicart__quantityDisplayText,\r\n inputQuantityAriaLabel: resources.subscriptionsMinicart__inputQuantityAriaLabel,\r\n discountStringText: resources.subscriptionsMinicart__discountStringText,\r\n\r\n originalPriceText: resources.subscriptionsMinicart__originalPriceText,\r\n currentPriceText: resources.subscriptionsMinicart__currentPriceText,\r\n shippingChargesText: resources.subscriptionsMinicart__shippingCharges,\r\n },\r\n telemetry: contextProps.telemetry,\r\n addToWishlistButtonText: resources.subscriptionsMinicart__addToWishlistButtonText,\r\n removeFromWishlistButtonText: resources.subscriptionsMinicart__removeFromWishlistButtonText,\r\n removeButtonText: resources.subscriptionsMinicart__removeCartButtonText,\r\n shipItText: resources.subscriptionsMinicart__shipInsteadDisplayText,\r\n pickitUpText: resources.subscriptionsMinicart__pickItUpDisplayText,\r\n changeStoreText: resources.subscriptionsMinicart__changeStoreDisplayText,\r\n storeSelectorStateManager: storeSelectorStateManager,\r\n cartState: cart,\r\n orgUnitLocations: orgUnitLocations,\r\n wishlists: [],\r\n defaultWishlistName: resources.subscriptionsMinicart__defaultWishlistName,\r\n pickupDeliveryModeCode: contextProps.context.request.channel?.PickupDeliveryModeCode!,\r\n showImages: contextProps.config.showImages,\r\n invalidProductError: resources.subscriptionsMinicart__invalidProductError,\r\n outOfStockError: resources.subscriptionsMinicart__outOfStockError,\r\n zeroAvailabilityError: resources.subscriptionsMinicart__zeroAvailabilityError,\r\n showDiscountPercent: contextProps.config.showDiscountPercent,\r\n removeItemClickHandler: this._removeItemFromCartHandler,\r\n moveToWishlistSuccessHandler: this._moveToWishlistSuccessHandler,\r\n updateCartLinesQuantitySuccessHandler: this._updateCartlineQuantity,\r\n };\r\n\r\n const headerProps: IElicitSubscriptionHeaderProps = {\r\n cart: this.props.props.data.cart,\r\n className: 'minicart-modal-subscription-header',\r\n context: this.props.props.context,\r\n frequencyTable: this.props.props.config.frequencyTable!.map(freq => { return { freqId: freq.id, freqLabel: freq.label }; }),\r\n resources: {\r\n deliveryText: resources.subscriptionsMinicart_subscriptionDeliveryText,\r\n savingText: resources.subscriptionsMinicart_subscriptionSavingText,\r\n savingLabel: resources.subscriptionsMinicart_subscriptionSavingLabel,\r\n wineBottleSummaryCount: resources.subscriptionsMinicart_subscriptionWineBottleSummaryCount,\r\n boxNamePlaceholder: resources.subscriptionsMinicart__editBoxNamePlaceholder\r\n }\r\n };\r\n\r\n return (\r\n
\r\n \r\n {this._renderFrequencies()}\r\n
\r\n \r\n {faqLink?.linkUrl?.destinationUrl &&\r\n \r\n }\r\n
\r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
    \r\n {ElicitCartLineItems(elicitModalProps)?.map((cartLine, index) => {\r\n return (\r\n
  • \r\n {cartLine.cartline}\r\n
  • \r\n );\r\n })}\r\n
\r\n \r\n {this.props.props.config.editBoxWarning && }\r\n
\r\n \r\n
\r\n );\r\n }\r\n\r\n private get _cartFilteredLines(): {\r\n subscriptionLines: CartLine[];\r\n lines: CartLine[];\r\n } {\r\n return filterCartLines(this.props.props.data.cart.result?.cart);\r\n }\r\n\r\n private _togglePopup(): void {\r\n if (this._popupState) {\r\n const { name: newName, frequency: newFreq } = getSubscriptionValues(this.props.props.data.cart.result?.cart);\r\n this._name = newName || '';\r\n this._selectedFrequencyId = newFreq || this._selectedFrequencyId;\r\n }\r\n this._popupState = !this._popupState;\r\n }\r\n\r\n private _renderFrequencies(): JSX.Element {\r\n return (\r\n \r\n );\r\n }\r\n\r\n // ========================================================================\r\n // Taken from elicit-cart.tsx\r\n // ========================================================================\r\n\r\n private _removeItemFromCartHandler = (cartlineToRemove: CartLine) => {\r\n const cart = this.props.props.data.cart.result;\r\n\r\n if (cart) {\r\n this._generateRemovalAnalyticsEvent(cartlineToRemove);\r\n\r\n const input = {\r\n cartLineIds: [cartlineToRemove.LineId!.toString()]\r\n };\r\n\r\n cart.removeCartLines(input)\r\n .then(() => {\r\n if (cart.cart.CartLines?.length === 0) { this._popupState = false; }\r\n })\r\n .catch((error) => {\r\n this.props.props.telemetry.warning(error);\r\n this.props.props.telemetry.debug('Unable to Remove Cart Line');\r\n });\r\n }\r\n };\r\n\r\n //----------------------------------------------------------\r\n // Almost identical to elicit-cart -- why isn't this shared code??\r\n //----------------------------------------------------------\r\n private _generateRemovalAnalyticsEvent = (cartlineToRemove: CartLine): void => {\r\n const productID = cartlineToRemove.ProductId;\r\n if (!productID) {\r\n return;\r\n }\r\n\r\n const product = this.props.props.data.products.result?.find(entry => entry.RecordId === productID);\r\n const attributes: AttributeValue[] = [];\r\n\r\n publish('removeFromCart', {\r\n product,\r\n quantity: cartlineToRemove.Quantity,\r\n attributes,\r\n subscription: true,\r\n context: this.props.props.context\r\n });\r\n };\r\n\r\n private _moveToWishlistSuccessHandler = (result: IWishlistActionSuccessResult, cartline?: CartLine) => {\r\n if (result.status === 'ADDED' && cartline) {\r\n this._removeItemFromCartHandler(cartline);\r\n }\r\n };\r\n\r\n private _updateCartlineQuantity = (cartlineToUpdate: CartLine, quantity: number) => {\r\n if (this.props.props.data.cart.result) {\r\n const input = {\r\n cartLineId: cartlineToUpdate.LineId!.toString(),\r\n newQuantity: quantity\r\n };\r\n this.props.props.data.cart.result.updateCartLineQuantity(input)\r\n .catch((error) => {\r\n this.props.props.telemetry.warning(error);\r\n this.props.props.telemetry.debug('Unable to update Cart Line quantity');\r\n });\r\n }\r\n };\r\n\r\n // ========================================================================\r\n // end\r\n // ========================================================================\r\n\r\n private get _isCartEmpty(): boolean {\r\n return this._cartFilteredLines.subscriptionLines?.length === 0;\r\n }\r\n\r\n private async _emptyCart(): Promise {\r\n const { result: cart } = this.props.props.data.cart;\r\n\r\n if (cart) {\r\n const linesToRemove = this._cartFilteredLines.subscriptionLines;\r\n\r\n // Generate a removal event for each line\r\n linesToRemove.forEach(this._generateRemovalAnalyticsEvent);\r\n\r\n const lineIds = linesToRemove.map(line => line.LineId!);\r\n await cart.removeCartLines({ cartLineIds: lineIds });\r\n this._popupState = false;\r\n }\r\n }\r\n\r\n private _publishBoxNameChange(): void {\r\n this.props.onBoxNameChange(this._name);\r\n }\r\n\r\n private _onFrequencyChange(event: React.ChangeEvent): void {\r\n this._selectedFrequencyId = event.target.value;\r\n const frequency = this.props.props.config.frequencyTable?.find(freq => freq.id === this._selectedFrequencyId)!;\r\n this.props.onFrequencyChange(frequency);\r\n }\r\n\r\n private _onBoxNameChange(event: React.ChangeEvent): void {\r\n this._name = event.target.value;\r\n this._publishBoxNameChange();\r\n }\r\n\r\n private async _getProductavailabilty(products: SimpleProduct[] | undefined): Promise {\r\n if (products && products.length > 0) {\r\n const productIds: number[] = [];\r\n products.forEach((product) => {\r\n productIds.push(product.RecordId);\r\n });\r\n const availabilityAll = await getEstimatedAvailabilityAsync({ callerContext: this.props.props.context.actionContext }, {ProductIds: productIds, DefaultWarehouseOnly: true});\r\n this.props.props.data.productAvailabilites.result = availabilityAll.ProductWarehouseInventoryAvailabilities?.map((product) => {\r\n return {ProductId: product.ProductId, AvailableQuantity: product.PhysicalAvailable, ExtensionProperties: product.ExtensionProperties};\r\n });\r\n }\r\n }\r\n}","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as React from 'react';\r\n\r\nimport { ActiveCartProductsInput, getActiveCartProductsAction } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { IImageDimension } from '@msdyn365-commerce/core';\r\nimport { CartLine, CommerceProperty, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport { observable, reaction } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport { SubscriptionCommerceValues } from '../../common/subscription-commerce.values';\r\nimport { BusLoader, LoadBus } from '../../Utilities/event-bus';\r\nimport { getSubscriptionValues, updateSubscription } from '../../Utilities/subscription-manager';\r\nimport { BottleCountDisplay } from './components/bottle-count-display.component';\r\nimport { BoxEditComponent } from './components/box-edit.component';\r\nimport { CartDisplayComponent } from './components/cart-display.component';\r\nimport { SubscriptionBannerDisplayComponent } from './components/subscription-banner-display.component';\r\nimport { ISubscriptionsMinicartData } from './subscriptions-minicart.data';\r\nimport { IFrequencyTableData, ISubscriptionsMinicartProps } from './subscriptions-minicart.props.autogenerated';\r\nexport interface ISubscriptionsMinicartViewProps extends ISubscriptionsMinicartProps {\r\n editBoxComponent: React.ReactNode;\r\n bottleCountComponent: React.ReactNode;\r\n cartDisplaySummaryComponent: React.ReactNode;\r\n subscriptionBannerDisplayComponent: React.ReactNode;\r\n baseProps: {\r\n boxName: string;\r\n frequency: IFrequencyTableData;\r\n };\r\n}\r\n\r\nexport interface IWineBoxLine {\r\n line: CartLine;\r\n product: SimpleProduct;\r\n}\r\n\r\ninterface IImageSettingsViewports {\r\n xs: IImageDimension;\r\n sm?: IImageDimension | undefined;\r\n md?: IImageDimension | undefined;\r\n lg?: IImageDimension | undefined;\r\n xl?: IImageDimension | undefined;\r\n}\r\n\r\n/**\r\n *\r\n * SubscriptionsMinicart component\r\n * @extends {React.Component>}\r\n */\r\n@LoadBus('product-component-wrapper')\r\n@observer\r\nclass SubscriptionsMinicart extends React.Component> {\r\n\r\n @observable private _boxName: string;\r\n @observable private _frequencyId: string;\r\n private bus: BusLoader | undefined;\r\n private _eventId: number;\r\n\r\n constructor(props: ISubscriptionsMinicartProps) {\r\n super(props);\r\n\r\n this._onBoxNameChange = this._onBoxNameChange.bind(this);\r\n this._onFrequencyChange = this._onFrequencyChange.bind(this);\r\n\r\n const modifiedImageSettings = props.config.imageSettings;\r\n if (modifiedImageSettings) {\r\n if (modifiedImageSettings.viewports) {\r\n modifiedImageSettings.viewports = this.usePNGImageSetting(modifiedImageSettings.viewports);\r\n props.config.imageSettings = modifiedImageSettings;\r\n }\r\n }\r\n\r\n this._boxName = '';\r\n this._frequencyId = '';\r\n\r\n reaction(\r\n () => { return this.props.data.cart.result?.cart.CartLines; },\r\n () => {\r\n this.props.data.products.run(async (exec) => {\r\n exec(\r\n await getActiveCartProductsAction(\r\n new ActiveCartProductsInput(),\r\n this.props.context.actionContext\r\n )\r\n );\r\n });\r\n }\r\n );\r\n\r\n reaction(\r\n () => { return this.props.data.cart.result?.cart; },\r\n () => {\r\n const { name: newName, frequency: newFreq } = getSubscriptionValues(this.props.data.cart.result?.cart);\r\n this._boxName = newName || '';\r\n if (newFreq) { this._frequencyId = newFreq; }\r\n }\r\n );\r\n\r\n this._eventId = this.bus?.subscribe('finished-adding-to-cart', () => {\r\n this.props.data.cart.result && this.props.data.cart.result.refreshCart({});\r\n }).id!;\r\n\r\n // sets default subscription box name if unset\r\n props.data.cart.then(() => {\r\n const values = getSubscriptionValues(this.props.data.cart.result?.cart);\r\n if (!values.name) {\r\n // tslint:disable-next-line: no-floating-promises\r\n void this._onBoxNameChange(SubscriptionCommerceValues.SUBSCRIPTION_DEFAULT_NAME);\r\n }\r\n }).catch(e => this.props.telemetry.exception(e));\r\n }\r\n\r\n public componentWillUnmount(): void {\r\n this.bus?.unsubscribe(this._eventId);\r\n }\r\n\r\n public render(): JSX.Element | null {\r\n if (!this.props.data.cart.result) { return
; }\r\n const values = getSubscriptionValues(this.props.data.cart.result?.cart);\r\n const renderProps: ISubscriptionsMinicartViewProps = {\r\n ...this.props,\r\n baseProps: {\r\n boxName: this._boxName,\r\n frequency: this.props.config.frequencyTable?.find(freq => this._frequencyId === freq.id)!\r\n },\r\n subscriptionBannerDisplayComponent: (\r\n \r\n ),\r\n editBoxComponent: (\r\n \r\n ),\r\n bottleCountComponent: (\r\n \r\n ),\r\n cartDisplaySummaryComponent: (\r\n \r\n )\r\n };\r\n\r\n return this.props.renderView(renderProps);\r\n }\r\n\r\n public usePNGImageSetting = (viewports: IImageSettingsViewports): IImageSettingsViewports => {\r\n const modifiedViewports = viewports;\r\n if (modifiedViewports?.xs?.q) {\r\n modifiedViewports.xs.q = modifiedViewports.xs.q.replace('f=jpg', 'f=png');\r\n }\r\n if (modifiedViewports?.sm?.q) {\r\n modifiedViewports.sm.q = modifiedViewports.sm.q.replace('f=jpg', 'f=png');\r\n }\r\n if (modifiedViewports?.md?.q) {\r\n modifiedViewports.md.q = modifiedViewports.md.q.replace('f=jpg', 'f=png');\r\n }\r\n if (modifiedViewports?.lg?.q) {\r\n modifiedViewports.lg.q = modifiedViewports.lg.q.replace('f=jpg', 'f=png');\r\n }\r\n if (modifiedViewports?.xl?.q) {\r\n modifiedViewports.xl.q = modifiedViewports.xl.q.replace('f=jpg', 'f=png');\r\n }\r\n\r\n return modifiedViewports;\r\n };\r\n\r\n private async _pushUpdateToCart(updates: { key: string; value: string }[]): Promise {\r\n // we need to parse this form's format into how the cart likes to\r\n // handle things\r\n const cartChanges: CommerceProperty[] = updates.map(change => {\r\n return {\r\n Key: change.key,\r\n Value: {\r\n StringValue: change.value\r\n }\r\n };\r\n });\r\n\r\n await updateSubscription(this.props.data.cart, cartChanges, this.props.context);\r\n }\r\n\r\n private async _onBoxNameChange(newName: string): Promise {\r\n this._boxName = newName;\r\n await this._pushUpdateToCart([\r\n {\r\n key: SubscriptionCommerceValues.SUBSCRIPTION_NAME,\r\n value: this._boxName\r\n },\r\n {\r\n key: SubscriptionCommerceValues.SUBSCRIPTION_FREQUENCY,\r\n value: this._frequencyId\r\n },\r\n ]);\r\n }\r\n\r\n private async _onFrequencyChange(frequency: IFrequencyTableData): Promise {\r\n this._frequencyId = frequency.id;\r\n await this._pushUpdateToCart([\r\n {\r\n key: SubscriptionCommerceValues.SUBSCRIPTION_FREQUENCY,\r\n value: this._frequencyId\r\n }\r\n ]);\r\n }\r\n\r\n}\r\n\r\nexport default SubscriptionsMinicart;\r\n","/**\r\n * Copyright (c) 2018 Microsoft Corporation\r\n */\r\nimport * as React from 'react';\r\nimport { IDropdownProps } from './';\r\nimport { IDropdownItemProps } from './dropdown.props';\r\n\r\ntype IDropdownState = {\r\n /**\r\n * @friendlyName selectedIndex\r\n * @description selected index\r\n */\r\n selectedIndex: string;\r\n};\r\n\r\n/**\r\n *\r\n * DropDown component\r\n * @extends {React.PureComponent}\r\n */\r\nexport class Dropdown extends React.PureComponent {\r\n private selectMenu: React.RefObject = React.createRef();\r\n\r\n constructor(props: IDropdownProps, state: IDropdownState) {\r\n super(props);\r\n this.state = {\r\n selectedIndex: ''\r\n };\r\n }\r\n\r\n public componentDidMount(): void {\r\n if (this.selectMenu.current) {\r\n this.selectMenu.current.selectedIndex = 0;\r\n }\r\n }\r\n\r\n public render(): JSX.Element {\r\n const {dropdownId, dropdownList, dropdownName, dropdownToggleName} = this.props;\r\n\r\n return (\r\n \r\n \r\n {dropdownList.map(\r\n (item: IDropdownItemProps) => item && \r\n )}\r\n \r\n );\r\n }\r\n\r\n private _onChanged = async (event: React.ChangeEvent) => {\r\n this.setState({selectedIndex: event.target.value});\r\n\r\n if (this.props.onChange) {\r\n await this.props.onChange({\r\n dropdownId: this.props.dropdownId,\r\n selectId: event.target.value,\r\n selectedValue: event.target.innerText\r\n });\r\n }\r\n };\r\n}","import * as React from 'react';\r\nimport { ISubscriptionsMinicartResources } from '../subscriptions-minicart.props.autogenerated';\r\nexport interface ISubscriptionBannerDisplayProps {\r\n resources: ISubscriptionsMinicartResources;\r\n subscriptionName: string;\r\n}\r\n\r\n/**\r\n * Wrapper component for the subscription banner display\r\n */\r\nexport class SubscriptionBannerDisplayComponent extends React.Component {\r\n public render(): JSX.Element {\r\n const { subscriptionName } = this.props;\r\n return (\r\n
\r\n
\r\n {subscriptionName &&

{subscriptionName}

}\r\n
\r\n );\r\n }\r\n}","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport {\r\n IBuyboxAddToCartViewProps,\r\n IBuyboxProductQuantityViewProps\r\n} from '@msdyn365-commerce-modules/buybox/dist/types';\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { AsyncResult } from '@msdyn365-commerce/core';\r\nimport * as React from 'react';\r\nimport Table from 'reactstrap/lib/Table';\r\nimport { ISmweBuyboxViewProps } from './smwe-buybox';\r\n\r\nconst SmweBuyboxView: React.FC = props => {\r\n const {\r\n ModuleProps,\r\n MediaGalleryContainerProps,\r\n ProductInfoContainerProps,\r\n addToCart,\r\n quantity,\r\n title,\r\n productDescription,\r\n productTitle,\r\n productPrice,\r\n productClubPrice,\r\n show,\r\n acclaimRatings,\r\n cookbookTagline,\r\n eventSchedule,\r\n subscriptionButton\r\n } = props;\r\n // @ts-ignore\r\n const tableClass: AsyncResult = props.context.actionContext.get('String', 'Generic-SkuSelectorClasses');\r\n const isGiftCard = props.data.product && props.data.product.result ? props.data.product.result.ItemId?.toLowerCase() === 'giftcard' : false;\r\n\r\n return (\r\n \r\n {props.mediaGallery}\r\n \r\n {props.productApellation && (\r\n
{props.productApellation}
\r\n )}\r\n {title}\r\n {productDescription}\r\n {eventSchedule}\r\n {acclaimRatings}\r\n {cookbookTagline}\r\n {show && _renderTable({\r\n addToCart: addToCart,\r\n quantity: quantity,\r\n productPrice: productPrice,\r\n productClubPrice: productClubPrice,\r\n tableClass: tableClass,\r\n isGiftCard: isGiftCard,\r\n productTitle,\r\n subscriptionButton\r\n })}\r\n {props.content &&\r\n props.content.map(\r\n (contentSlotData: React.ReactNode, index: number) => {\r\n return (\r\n
\r\n {contentSlotData}\r\n
\r\n );\r\n }\r\n )}\r\n
\r\n
\r\n );\r\n};\r\n\r\nexport interface IRenderTable {\r\n subscriptionButton?: IBuyboxAddToCartViewProps;\r\n addToCart: IBuyboxAddToCartViewProps;\r\n quantity: IBuyboxProductQuantityViewProps | undefined;\r\n productTitle: React.ReactNode;\r\n productPrice: React.ReactNode;\r\n productClubPrice: React.ReactNode;\r\n isGiftCard: boolean;\r\n tableClass: AsyncResult;\r\n}\r\n\r\nconst _renderTable = (props: IRenderTable) => {\r\n const { addToCart, quantity, productTitle, productPrice, productClubPrice, tableClass, isGiftCard, subscriptionButton } = props;\r\n\r\n return (\r\n
\r\n \r\n \r\n \r\n {productTitle && }\r\n {productPrice && }\r\n {!isGiftCard && productClubPrice && }\r\n {quantity && }\r\n {addToCart && \r\n \r\n \r\n \r\n {productTitle && }\r\n {productPrice && }\r\n {!isGiftCard && productClubPrice && }\r\n {quantity && }\r\n {addToCart && }\r\n {subscriptionButton && }\r\n \r\n \r\n
ProductPriceClubQTY}\r\n
{productTitle}{productPrice}{productClubPrice}{_renderQuantity(quantity)}{_renderAddToCart(addToCart)}{_renderAddToCart(subscriptionButton)}
\r\n
\r\n);};\r\n\r\nconst _renderAddToCart = (addToCart: IBuyboxAddToCartViewProps): JSX.Element => {\r\n const { ContainerProps, errorBlock, button } = addToCart;\r\n\r\n return (\r\n \r\n {errorBlock}\r\n {button}\r\n \r\n );\r\n};\r\n\r\nconst _renderQuantity = (quantity: IBuyboxProductQuantityViewProps): JSX.Element => {\r\n const { ContainerProps, LabelContainerProps, input, errors } = quantity;\r\n\r\n return (\r\n \r\n \r\n {errors}\r\n \r\n {input}\r\n \r\n );\r\n};\r\n\r\nexport default SmweBuyboxView;\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport {\r\n IBuyboxAddToCartViewProps,\r\n IBuyboxProductQuantityViewProps\r\n} from '@msdyn365-commerce-modules/buybox/dist/types';\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { AsyncResult } from '@msdyn365-commerce/core';\r\nimport classnames from 'classnames';\r\nimport * as React from 'react';\r\nimport { ISmweBuyboxViewProps } from '../../../modules/smwe-buybox/./smwe-buybox';\r\n\r\nconst SmweBuyboxView: React.FC = props => {\r\n const {\r\n ModuleProps,\r\n MediaGalleryContainerProps,\r\n ProductInfoContainerProps,\r\n addToCart,\r\n quantity,\r\n title,\r\n productDescription,\r\n productTitle,\r\n productPrice,\r\n productClubPrice,\r\n show,\r\n acclaimRatings,\r\n cookbookTagline,\r\n eventSchedule\r\n } = props;\r\n // @ts-ignore\r\n const tableClass: AsyncResult = props.context.actionContext.get('String', 'Generic-SkuSelectorClasses');\r\n const isGiftCard = props.data.product && props.data.product.result ? props.data.product.result.ItemId?.toLowerCase() === 'giftcard' : false;\r\n\r\n return (\r\n \r\n {props.mediaGallery}\r\n \r\n {props.productApellation && (\r\n
{props.productApellation}
\r\n )}\r\n {title}\r\n {productTitle}\r\n {productDescription}\r\n {eventSchedule}\r\n {acclaimRatings}\r\n {cookbookTagline}\r\n {show && _renderTable({\r\n addToCart: addToCart,\r\n quantity: quantity,\r\n productPrice: productPrice,\r\n productClubPrice: productClubPrice,\r\n tableClass: tableClass,\r\n isGiftCard: isGiftCard\r\n })}\r\n {props.content &&\r\n props.content.map(\r\n (contentSlotData: React.ReactNode, index: number) => {\r\n return (\r\n \r\n {contentSlotData}\r\n \r\n );\r\n }\r\n )}\r\n
\r\n
\r\n );\r\n};\r\n\r\nexport interface IRenderTable {\r\n addToCart: IBuyboxAddToCartViewProps;\r\n quantity: IBuyboxProductQuantityViewProps | undefined;\r\n productPrice: React.ReactNode;\r\n productClubPrice: React.ReactNode;\r\n isGiftCard: boolean;\r\n tableClass: AsyncResult;\r\n}\r\n\r\nconst _renderTable = (props: IRenderTable) => {\r\n const { addToCart, quantity, productPrice, productClubPrice, tableClass, isGiftCard } = props;\r\n\r\n return (\r\n
\r\n
\r\n {productPrice &&
{productPrice}
}\r\n {!isGiftCard && productClubPrice &&
{productClubPrice} Club
}\r\n
\r\n
\r\n {quantity &&
{_renderQuantity(quantity)}
}\r\n {addToCart &&
{_renderAddToCart(addToCart)}
}\r\n
\r\n
\r\n );\r\n};\r\n\r\nconst _renderAddToCart = (addToCart: IBuyboxAddToCartViewProps): JSX.Element => {\r\n const { ContainerProps, errorBlock, button } = addToCart;\r\n\r\n return (\r\n \r\n {errorBlock}\r\n {button}\r\n \r\n );\r\n};\r\n\r\nconst _renderQuantity = (quantity: IBuyboxProductQuantityViewProps): JSX.Element => {\r\n const { ContainerProps, LabelContainerProps, input, errors } = quantity;\r\n\r\n return (\r\n \r\n \r\n {errors}\r\n \r\n {input}\r\n \r\n );\r\n};\r\n\r\nexport default SmweBuyboxView;\r\n","import { CartLine } from '@msdyn365-commerce/retail-proxy';\r\nexport function calculateSavingPercentAmount(lines?: CartLine[]): number {\r\n let total = 0;\r\n lines?.forEach(line => total += line.Quantity || 0);\r\n if (total > 11) { return 15; }\r\n if (total > 3) { return 10; }\r\n return 0;\r\n}","import * as React from 'react';\r\n\r\nimport { Image } from '@msdyn365-commerce/core';\r\nimport { CartLine, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport { filterCartLines } from '../../../Utilities/subscription-manager';\r\nimport { ISubscriptionsMinicartData } from '../subscriptions-minicart.data';\r\nimport { ISubscriptionsMinicartProps } from '../subscriptions-minicart.props.autogenerated';\r\n\r\ninterface IBottleCountDisplay {\r\n subscriptionProps: ISubscriptionsMinicartProps;\r\n}\r\n\r\n/**\r\n * declaration for component that renders a list that displays the percent off\r\n */\r\nexport class BottleCountDisplay extends React.Component {\r\n\r\n private readonly _maxBottleCount: number = 12;\r\n\r\n public render(): JSX.Element {\r\n return (\r\n
\r\n {this._fillBottleList(this._generateBottleListFromProducts().slice(0, this._maxBottleCount))}\r\n
\r\n );\r\n }\r\n\r\n private _fillBottleList(bottleList: JSX.Element[]): JSX.Element[] {\r\n for (let newBottleIndex = bottleList.length; newBottleIndex < this._maxBottleCount; newBottleIndex++) {\r\n bottleList.push(\r\n (\r\n
\r\n
\r\n {this._specializeIndex(newBottleIndex)}\r\n
\r\n )\r\n );\r\n }\r\n return bottleList;\r\n }\r\n\r\n private _generateBottleListFromProducts(): JSX.Element[] {\r\n let rollingIndex = 0;\r\n const fragments: JSX.Element[] = [];\r\n this._cartFilteredLines.subscriptionLines?.forEach((line) => {\r\n\r\n const gridSettings = this.props.subscriptionProps.context.actionContext.requestContext.gridSettings;\r\n const product = this._getProductFromLine(line);\r\n for (let lineIdx = 0; lineIdx < line.Quantity!; lineIdx++) {\r\n fragments.push((\r\n
\r\n {gridSettings && product &&\r\n \r\n }\r\n {this._specializeIndex(rollingIndex)}\r\n
\r\n ));\r\n rollingIndex++;\r\n }\r\n });\r\n return fragments;\r\n }\r\n\r\n private _getProductFromLine(line: CartLine): SimpleProduct | undefined {\r\n const { products: { result: products } } = this.props.subscriptionProps.data;\r\n return products?.find(product => product.ItemId === line.ItemId);\r\n }\r\n\r\n private _specializeIndex(currentIndex: number): JSX.Element | null {\r\n const {\r\n subscriptionsMinicart__discount10Percent,\r\n subscriptionsMinicart__discount15Percent\r\n } = this.props.subscriptionProps.resources;\r\n if (currentIndex === 3) {\r\n return
{subscriptionsMinicart__discount10Percent}
;\r\n } else if (currentIndex === 11) {\r\n return
{subscriptionsMinicart__discount15Percent}
;\r\n }\r\n return null;\r\n }\r\n\r\n private get _cartFilteredLines(): {\r\n subscriptionLines: CartLine[];\r\n lines: CartLine[];\r\n } {\r\n return filterCartLines(this.props.subscriptionProps.data.cart.result?.cart);\r\n }\r\n}","import {\r\n IBuyboxAddToCartViewProps,\r\n IBuyboxProductQuantityViewProps\r\n} from '@msdyn365-commerce-modules/buybox/dist/types';\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { AsyncResult } from '@msdyn365-commerce/core';\r\nimport * as React from 'react';\r\nimport { ISmweBuyboxViewProps } from '../../../modules/smwe-buybox/smwe-buybox';\r\nimport { ISmweBuyboxProps } from '../definition-extensions/smwe-buybox.ext.props.autogenerated';\r\n\r\nconst SmweBuyboxView: React.FC> = props => {\r\n const { subscriptionButton, ModuleProps, MediaGalleryContainerProps, ProductInfoContainerProps, addToCart, quantity, title, productDescription, productClubPrice, productPrice, show, acclaimRatings, cookbookTagline, eventSchedule } = props;\r\n // @ts-ignore\r\n const tableClass: AsyncResult = props.context.actionContext.get('String', 'Generic-SkuSelectorClasses');\r\n const isGiftCard = props.data.product?.result ? props.data.product.result.ItemId?.toLowerCase() === 'giftcard' : false;\r\n return (\r\n \r\n
\r\n {props.productApellation && <>{props.productApellation}}\r\n {title}\r\n
\r\n
\r\n \r\n {props.mediaGallery}\r\n \r\n {props.tastingNotes}\r\n
\r\n \r\n {props.productApellation && <>{props.productApellation}}\r\n {title}\r\n {productDescription}\r\n {eventSchedule}\r\n {acclaimRatings}\r\n {cookbookTagline}\r\n {show &&
\r\n
\r\n {productPrice &&
{productPrice}
}\r\n {!isGiftCard && productClubPrice &&
{productClubPrice} Club
}\r\n {isGiftCard && addToCart &&
{_renderAddToCart(addToCart)}
}\r\n
\r\n {!isGiftCard && quantity &&
{_renderQuantity(quantity)}
}\r\n {!isGiftCard && addToCart &&
{_renderAddToCart(addToCart)}
}\r\n {subscriptionButton &&
{_renderAddToCart(subscriptionButton)}
}\r\n
}\r\n {props.content &&\r\n props.content.map(\r\n (contentSlotData: React.ReactNode, index: number) => {\r\n return (\r\n \r\n {contentSlotData}\r\n \r\n );\r\n }\r\n )\r\n }\r\n
\r\n {props.slots?.productCollection?.length &&\r\n
\r\n {props.slots.productCollection.map(\r\n (productCollectionSlotData: React.ReactNode, index: number) => {\r\n return (\r\n \r\n {productCollectionSlotData}\r\n \r\n );\r\n }\r\n )\r\n }\r\n
\r\n }\r\n
\r\n );\r\n};\r\n\r\nconst _renderAddToCart = (addToCart: IBuyboxAddToCartViewProps): JSX.Element => {\r\n const { ContainerProps, errorBlock, button } = addToCart;\r\n\r\n return (\r\n \r\n {button}\r\n {errorBlock}\r\n \r\n );\r\n};\r\n\r\nconst _renderQuantity = (quantity: IBuyboxProductQuantityViewProps): JSX.Element => {\r\n const { ContainerProps, LabelContainerProps, input, errors } = quantity;\r\n\r\n return (\r\n \r\n \r\n {errors}\r\n \r\n {input}\r\n \r\n );\r\n};\r\n\r\nexport default SmweBuyboxView;\r\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CacheType, IActionContext, IActionInput } from '@msdyn365-commerce/core';\nimport { IModuleStates } from './module-state.data';\n\n/**\n * GetModulesInput\n */\nexport class ModuleStatesCacheKey implements IActionInput {\n public getCacheKey = () => 'ModuleState';\n public getCacheObjectType = () => 'ModuleState';\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport function getModuleStates(ctx: IActionContext): IModuleStates {\n const cacheKey = new ModuleStatesCacheKey();\n\n // @ts-ignore\n let moduleStates = ctx.get(cacheKey.getCacheObjectType(), cacheKey.getCacheKey());\n if (moduleStates) {\n return moduleStates;\n }\n ctx.update(cacheKey, {});\n moduleStates = ctx.get(cacheKey.getCacheObjectType(), cacheKey.getCacheKey());\n return moduleStates;\n}\n\nexport function updateModuleStates(value: IModuleStates, ctx: IActionContext): void {\n const cacheKey = new ModuleStatesCacheKey();\n ctx.update(cacheKey, value);\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IModule } from '@msdyn365-commerce/core';\nimport isMatch from 'lodash/isMatch';\nimport { observer } from 'mobx-react';\nimport * as React from 'react';\nimport { getModuleStates, updateModuleStates } from './module-state';\nimport { IModuleState, IModuleStateManager, IModuleStateProps, IModuleStates } from './module-state.data';\n\nexport interface IProps extends IModule, IModuleStateProps {\n enableControl?: boolean;\n}\n\nconst withModuleState =

(WrappedComponent: React.ComponentType

): React.ComponentType

=> {\n /**\n *\n * ModuleState component\n * @extends {React.Component

}\n */\n @observer\n class ModuleState extends React.Component

{\n constructor(props: P) {\n super(props);\n this.initializeState();\n }\n\n public render(): JSX.Element | null {\n const { id } = this.props;\n return ;\n }\n\n private initializeState = (): void => {\n const { id, typeName, context } = this.props;\n const states = getModuleStates(context.actionContext);\n if (!states) {\n this.props.telemetry.error('withModuleState initializeState() - states not found');\n return;\n }\n\n if (states[id]) {\n // state has been initialized\n return;\n }\n\n updateModuleStates(\n {\n ...states,\n [id]: {\n id,\n typeName,\n hasInitialized: false,\n hasError: false,\n isRequired: true,\n isCancellable: true,\n isSubmitContainer: false,\n status: undefined,\n childIds: []\n }\n },\n context.actionContext\n );\n };\n\n /**\n * GetModuleStateManager\n * Get module state manager by id\n */\n private getModuleStateManager = (id: string): IModuleStateManager => {\n const moduleState = this.get()[id];\n return {\n ...moduleState,\n hasInitialized: this.validate(id, { hasInitialized: true }, true), // All has initialized is initialized\n hasError: this.validate(id, { hasError: true }), // Partial has error is error\n isReady: this.validate(id, { status: 'ready' }, true, true), // All ready is ready (exclued disabled and skipped)\n isUpdating: this.validate(id, { status: 'updating' }), // Partial updating is updating\n isPending: this.validate(id, { status: 'pending' }), // Partial pending is pending\n isSkipped: this.validate(id, { status: 'skipped' }, true, true), // All skipped is skipped (exclued disabled)\n isDisabled: this.validate(id, { status: 'disabled' }, true), // All disabled is disabled\n isCancelAllowed: this.validate(id, { isCancellable: true }, true, true), // Partial not allowed is not allowed\n shouldSubmitContainer: this.validate(id, { isSubmitContainer: true }), // Partial submit is submit.\n hasExternalSubmitGroup: this.hasExternalSubmitGroup(),\n hasModuleState: this.hasModuleState(id),\n setIsRequired: (value: boolean): void => this.update(id, { isRequired: value }),\n setIsCancellable: (value: boolean): void => this.update(id, { isCancellable: value }),\n setIsSubmitContainer: (value: boolean): void => this.update(id, { isSubmitContainer: value }),\n setHasError: (value: boolean): void => this.update(id, { hasError: value }),\n onReady: (): void => this.update(id, { status: 'ready' }),\n onUpdating: (): void => this.update(id, { status: 'updating' }),\n onPending: (): void => this.update(id, { status: 'pending' }),\n onSkip: (): void => this.update(id, { status: 'skipped' }),\n onDisable: (): void => this.update(id, { status: 'disabled' }),\n getModule: (moduleId: string): IModuleStateManager => this.getModuleStateManager(moduleId),\n getModuleByTypeName: (typeName: string): IModuleStateManager => this.getModuleStateManagerByTypeName(typeName),\n init: (options?: Partial): void => {\n if (moduleState.hasInitialized) {\n // state has been initialized\n return;\n }\n this.update(id, {\n hasInitialized: true,\n ...options\n });\n }\n };\n };\n\n /**\n * GetModuleStateManagerByTypeName\n * Get module state manager by type name\n */\n private getModuleStateManagerByTypeName = (typeName: string): IModuleStateManager => {\n const moduleStates = getModuleStates(this.props.context.actionContext);\n const moduleState = Object.values(moduleStates).find(_moduleState => _moduleState.typeName === typeName);\n return this.getModuleStateManager((moduleState && moduleState.id) || '');\n };\n\n /**\n * Get\n * Get all module states\n */\n private get = (): IModuleStates => {\n return getModuleStates(this.props.context.actionContext);\n };\n\n /**\n * Update\n * Update module state\n */\n private update = (id: string, value: Partial): void => {\n // console.log('withModuleState - update', id, value);\n const modules = this.get();\n if (!modules[id]) {\n this.props.telemetry.error(`withModuleState update() - Module state with id ${id} is not found.`);\n return;\n }\n modules[id] = {\n ...modules[id],\n ...value\n };\n };\n\n private _validateLeaf = (id: string, source: Partial): boolean => {\n const modules = this.get();\n const module = modules[id];\n if (!module) {\n return false;\n }\n return isMatch(module, source);\n };\n\n private _validateContainer = (\n id: string,\n source: Partial,\n allMatched?: boolean,\n skipSkippableItem?: boolean\n ): boolean => {\n const modules = this.get();\n const module = modules[id];\n if (!module) {\n // module doesn't has module state\n return !!allMatched;\n }\n\n if (skipSkippableItem && (module.status === 'disabled' || module.status === 'skipped')) {\n // Skip disabled or skipped modules\n return !!allMatched;\n }\n\n // It is leaf module\n if (!module.childIds || !module.childIds.length) {\n return this._validateLeaf(id, source);\n }\n\n // It is container module\n const method = allMatched ? 'every' : 'some';\n return module.childIds[method](childId => this._validateContainer(childId, source, allMatched, skipSkippableItem));\n };\n\n /**\n * Validate\n * Validate current module and all its child module match the provided condition\n */\n private validate = (id: string, source: Partial, allMatched?: boolean, skipSkippableItem?: boolean): boolean => {\n const modules = this.get();\n const module = modules[id];\n if (!module) {\n return false;\n }\n\n // It is leaf module\n if (!module.childIds || !module.childIds.length) {\n return this._validateLeaf(id, source);\n }\n\n // It is container module\n return this._validateContainer(id, source, allMatched, skipSkippableItem);\n };\n\n /**\n * hasExternalSubmitGroup\n * Module will use external submit group\n */\n private hasExternalSubmitGroup = (): boolean => {\n return !!this.props.enableControl;\n };\n\n /**\n * hasModuleState\n * Module is using module state manager\n */\n private hasModuleState = (id: string): boolean => {\n const modules = this.get();\n const module = modules[id];\n return !!module;\n };\n }\n\n return ModuleState;\n};\n\nexport default withModuleState;","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { DeliveryOption as DeliveryOptionData } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport { ICheckoutDeliveryOption, ICheckoutDeliveryOptionEdit, ICheckoutDeliveryOptionsError, ICheckoutDeliveryOptionsList, ICheckoutDeliveryOptionsViewProps } from '../../../modules/smwe-checkout-delivery-options/smwe-checkout-delivery-options';\r\ninterface ICheckoutDeliveryOptionsListFiltered extends ICheckoutDeliveryOptionsList {\r\n globalConfig?: {\r\n [x: string]: unknown;\r\n };\r\n options?: DeliveryOptionData[];\r\n}\r\n\r\ntype ModShipping = {\r\n id: number;\r\n amount: number;\r\n}[];\r\n\r\nconst DeliveryOptionList: React.FC = ({\r\n DeliveryOptionsList,\r\n list,\r\n globalConfig,\r\n options\r\n}) => {\r\n if (!list || list.length === 0) {\r\n return null;\r\n }\r\n\r\n const pennyShippingMethodIds = globalConfig?.pennyShippingIds as number[] || [];\r\n const modShippingMethodIds = globalConfig?.modShippingIds as ModShipping || [];\r\n\r\n let localList: ICheckoutDeliveryOptionEdit[] = [];\r\n if (options) {\r\n // maps options with list for sorting\r\n const combinedList: {option: DeliveryOptionData; list: ICheckoutDeliveryOptionEdit}[] = [];\r\n options.map((option, index) => combinedList.push({option: option, list: list[index]}));\r\n // sort list by lowest to highest price\r\n const combinedListSorted = combinedList.sort((a, b) => (a.option.ShippingChargeAmount! > b.option.ShippingChargeAmount!) ? 1 : ((b.option.ShippingChargeAmount! > a.option.ShippingChargeAmount!) ? -1 : 0));\r\n combinedListSorted.forEach((deliveryData) => {\r\n if (deliveryData.list) {\r\n // search to find out if it is a mod shipping method\r\n const isModShippingMethod = modShippingMethodIds.find(modShipping => Number(modShipping.id) === deliveryData.option.RecordId);\r\n // backwards compatibility for penny shipping\r\n const isPennyShippingMethod = pennyShippingMethodIds.find(pennyShipping => Number(pennyShipping) === deliveryData.option.RecordId);\r\n\r\n // Filter out mod shipping methods that are declared\r\n // in the global config, only show shipping methods\r\n // that have a matching mod price for the customer at this current time\r\n // of checkout. If it's not a mod shipping method, always display\r\n // it.\r\n if (isModShippingMethod && deliveryData.option.ShippingChargeAmount === isModShippingMethod.amount) {\r\n localList.push(deliveryData.list);\r\n } else if (isPennyShippingMethod && deliveryData.option.ShippingChargeAmount === 0.01) {\r\n localList.push(deliveryData.list);\r\n } else if (!isModShippingMethod && !isPennyShippingMethod) {\r\n localList.push(deliveryData.list);\r\n }\r\n }\r\n });\r\n }\r\n // just in case options doesn't load in, fail safely back to the original\r\n // list\r\n if (localList.length === 0) { localList = list; }\r\n return (\r\n \r\n {localList.map((deliveryOption: ICheckoutDeliveryOptionEdit) => {\r\n return (\r\n \r\n {deliveryOption.price}\r\n );\r\n })}\r\n \r\n );\r\n};\r\n\r\nconst DeliveryOptionSelected: React.FC = ({\r\n DeliveryOption,\r\n description,\r\n price,\r\n}) => {\r\n\r\n return (\r\n \r\n {description}\r\n {price}\r\n \r\n );\r\n};\r\n\r\nconst ErrorMessage: React.FC = ({\r\n Error,\r\n title,\r\n message,\r\n}) => {\r\n\r\n return (\r\n \r\n {title}\r\n {message}\r\n \r\n );\r\n};\r\n\r\nconst CheckoutDeliveryOptionsView: React.FC = props => {\r\n const { CheckoutDeliveryOptions,\r\n viewState,\r\n deliveryOptions,\r\n deliveryOptionsData,\r\n deliveryOptionSelected,\r\n errorMessage,\r\n waiting,\r\n saveButton,\r\n editButton,\r\n cancelButton } = props;\r\n return (\r\n // TODO: All wrapper div should be provided by viewProps. Once SDK provide the sln, update markup.\r\n \r\n {viewState.isLoading && waiting}\r\n {viewState.isError && errorMessage && }\r\n {viewState.isShowList && deliveryOptions &&

Delivery Options
}\r\n {viewState.isShowSelected && deliveryOptionSelected && }\r\n {viewState.isShowSaveButton && saveButton}\r\n {viewState.isShowEditButton && editButton}\r\n {viewState.isShowCancelButton && cancelButton}\r\n \r\n );\r\n};\r\n\r\nexport default CheckoutDeliveryOptionsView;","\r\n/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as React from 'react';\r\n\r\nexport interface ICheckoutDeliveryOptionsDescriptionProps {\r\n description?: string;\r\n}\r\n\r\n/**\r\n *\r\n * AddPaymentForm SFC\r\n * @extends {React.FC}\r\n */\r\nconst CheckoutDeliveryOptionsDescription: React.FC = ({\r\n description\r\n}) => {\r\n if (!description) {\r\n return null;\r\n }\r\n\r\n return {description};\r\n};\r\n\r\nexport default CheckoutDeliveryOptionsDescription;","\r\n/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as React from 'react';\r\n\r\nexport interface ICheckoutDeliveryOptionsErrorMessageProps {\r\n message?: string;\r\n}\r\n\r\n/**\r\n *\r\n * AddPaymentForm SFC\r\n * @extends {React.FC}\r\n */\r\nconst CheckoutDeliveryOptionsErrorMessage: React.FC = ({\r\n message\r\n}) => {\r\n if (!message) {\r\n return null;\r\n }\r\n\r\n return (\r\n

{message}

\r\n );\r\n\r\n};\r\n\r\nexport default CheckoutDeliveryOptionsErrorMessage;","\r\n/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as React from 'react';\r\n\r\nexport interface ICheckoutDeliveryOptionsErrorTitleProps {\r\n title?: string;\r\n}\r\n\r\n/**\r\n *\r\n * AddPaymentForm SFC\r\n * @extends {React.FC}\r\n */\r\nconst CheckoutDeliveryOptionsErrorTitle: React.FC = ({\r\n title\r\n}) => {\r\n if (!title) {\r\n return null;\r\n }\r\n\r\n return (\r\n

{title}

\r\n );\r\n\r\n};\r\n\r\nexport default CheckoutDeliveryOptionsErrorTitle;","\r\n/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as React from 'react';\r\nexport interface ICheckoutDeliveryOptionsRadioButtonProps {\r\n isChecked: boolean;\r\n value?: string;\r\n ariaSetSize: number;\r\n ariaPosInSet: number;\r\n ariaLabel?: string;\r\n onChange(event: React.ChangeEvent): void;\r\n}\r\n\r\n/**\r\n *\r\n * AddPaymentForm SFC\r\n * @extends {React.FC}\r\n */\r\nconst CheckoutDeliveryOptionsRadioButton: React.FC = ({\r\n isChecked,\r\n value,\r\n ariaSetSize,\r\n ariaPosInSet,\r\n ariaLabel,\r\n onChange\r\n}) => {\r\n if (!value) {\r\n return null;\r\n }\r\n\r\n return (\r\n \r\n );\r\n};\r\n\r\nexport default CheckoutDeliveryOptionsRadioButton;\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport classname from 'classnames';\r\nimport get from 'lodash/get';\r\nimport { action, observable, reaction } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport * as React from 'react';\r\n\r\nimport { IModuleStateProps, withModuleState } from '@msdyn365-commerce-modules/checkout-utilities';\r\nimport { Button, IModuleProps, INodeProps, Waiting } from '@msdyn365-commerce-modules/utilities';\r\nimport { PriceComponent } from '@msdyn365-commerce/components';\r\nimport { ICheckoutState } from '@msdyn365-commerce/global-state';\r\nimport { Cart } from '@msdyn365-commerce/retail-proxy';\r\nimport {\r\n getDeliveryOptionsAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\r\nimport {\r\n Address, CartLine, DeliveryOption\r\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n\r\nimport ProductType from '../../Utilities/productType';\r\nimport DescriptionComponent from './components/smwe-checkout-delivery-options.description';\r\nimport ErrorMessageComponent from './components/smwe-checkout-delivery-options.error-message';\r\nimport ErrorTitleComponent from './components/smwe-checkout-delivery-options.error-title';\r\nimport RadioButtonComponent from './components/smwe-checkout-delivery-options.radio-button';\r\nimport { ISmweCheckoutDeliveryOptionsData } from './smwe-checkout-delivery-options.data';\r\nimport { ISmweCheckoutDeliveryOptionsProps } from './smwe-checkout-delivery-options.props.autogenerated';\r\n\r\nexport interface ICheckoutDeliveryOptionsModuleProps extends ISmweCheckoutDeliveryOptionsProps, IModuleStateProps { }\r\n\r\nexport interface ICheckoutDeliveryOption {\r\n DeliveryOption: INodeProps;\r\n description?: React.ReactNode;\r\n price?: React.ReactNode;\r\n}\r\n\r\nexport interface ICheckoutDeliveryOptionEdit extends ICheckoutDeliveryOption {\r\n code: string;\r\n radioButton?: React.ReactNode;\r\n}\r\n\r\nexport interface ICheckoutDeliveryOptionsList {\r\n DeliveryOptionsList: INodeProps;\r\n list: ICheckoutDeliveryOptionEdit[];\r\n}\r\n\r\nexport interface ICheckoutDeliveryOptionsError {\r\n Error: INodeProps;\r\n title: React.ReactNode;\r\n message: React.ReactNode;\r\n}\r\n\r\nexport interface ICheckoutDeliveryOptionsViewState {\r\n isLoading: boolean;\r\n isError: boolean;\r\n isShowList: boolean;\r\n isShowSelected: boolean;\r\n isShowSaveButton: boolean;\r\n isShowEditButton: boolean;\r\n isShowCancelButton: boolean;\r\n}\r\n\r\nexport interface ICheckoutDeliveryOptionsViewProps extends ISmweCheckoutDeliveryOptionsProps<{}> {\r\n CheckoutDeliveryOptions: IModuleProps;\r\n selectedItemId: string;\r\n deliveryOptionsData: DeliveryOption[];\r\n isLoading: boolean;\r\n errorMessageData: string;\r\n viewState: ICheckoutDeliveryOptionsViewState;\r\n deliveryOptions?: ICheckoutDeliveryOptionsList;\r\n deliveryOptionSelected?: ICheckoutDeliveryOption;\r\n errorMessage?: ICheckoutDeliveryOptionsError;\r\n waiting?: React.ReactNode;\r\n saveButton?: React.ReactNode;\r\n editButton?: React.ReactNode;\r\n cancelButton?: React.ReactNode;\r\n checkoutState?: ICheckoutState;\r\n onDeliveryOptionChange(event: React.ChangeEvent): void;\r\n onSave(): void;\r\n onEdit(): void;\r\n onCancel(): void;\r\n}\r\n\r\n/**\r\n *\r\n * CheckoutDeliveryOptions component\r\n * @extends {React.Component>}\r\n */\r\n// @ts-ignore\r\n@withModuleState\r\n@observer\r\nclass CheckoutDeliveryOptions extends React.Component {\r\n @observable private selectedItemId: string = '';\r\n @observable private deliveryOptions: DeliveryOption[] = [];\r\n @observable private isLoading: boolean = false;\r\n @observable private errorMessage?: string;\r\n\r\n public async componentDidMount(): Promise {\r\n this.props.data.checkout.then(() => {\r\n this.init();\r\n }).catch(e => this.props.telemetry.exception(e));\r\n\r\n this.loadDeliveryOptions();\r\n\r\n // @ts-ignore: Compiler not reconizing condition check for function params\r\n reaction(\r\n () => this.props.data.checkout.result && this.props.data.checkout.result.shippingAddress,\r\n () => {\r\n this.loadDeliveryOptions();\r\n }\r\n );\r\n }\r\n\r\n public render(): JSX.Element | null {\r\n if (!this.canShip()) {\r\n return null;\r\n }\r\n\r\n const {\r\n moduleState: { isReady, isUpdating, hasError }\r\n } = this.props;\r\n const isError = !this.isLoading && hasError;\r\n const isShowList = !this.isLoading && !hasError && isUpdating;\r\n const isShowSelected = !this.isLoading && !hasError && isReady;\r\n\r\n const viewProps = {\r\n ...this.props,\r\n onDeliveryOptionChange: this.onDeliveryOptionChange,\r\n selectedItemId: this.selectedItemId,\r\n deliveryOptionsData: this.deliveryOptions,\r\n isLoading: this.isLoading,\r\n errorMessageData: this.errorMessage,\r\n viewState: {\r\n isLoading: this.isLoading,\r\n isError: isError,\r\n isShowList: isShowList,\r\n isShowSelected: isShowSelected,\r\n isShowSaveButton: isShowList && !this.props.moduleState.hasExternalSubmitGroup,\r\n isShowEditButton: isShowSelected && !this.props.moduleState.hasExternalSubmitGroup,\r\n isShowCancelButton: isShowList && !this.props.moduleState.hasExternalSubmitGroup && !!this.getSavedDeliveryOption()\r\n },\r\n CheckoutDeliveryOptions: {\r\n moduleProps: this.props,\r\n className: classname('ms-checkout-delivery-options', this.props.config.className)\r\n },\r\n deliveryOptions: {\r\n // @ts-ignore\r\n DeliveryOptionsList: { className: 'ms-checkout-delivery-options__list' },\r\n list: this.getDeliveryOptionList()\r\n },\r\n deliveryOptionSelected: this.getDeliveryOptionSelected(),\r\n errorMessage: this.getErrorMessage(),\r\n waiting: ,\r\n saveButton: this.getSaveButton(),\r\n editButton: this.getEditButton(),\r\n cancelButton: this.getCancelButton(),\r\n checkoutState: this.props.data.checkout.result,\r\n onSave: this.onSave,\r\n onEdit: this.onEdit,\r\n onCancel: this.onCancel\r\n };\r\n\r\n return this.props.renderView(viewProps) as React.ReactElement;\r\n }\r\n\r\n @action\r\n private init = (): void => {\r\n this.props.moduleState.init({\r\n onEdit: this.onEdit,\r\n onCancel: this.onCancel,\r\n onSubmit: this.onSubmit,\r\n status: this.canShip() ? 'updating' : 'disabled'\r\n });\r\n };\r\n\r\n private canShip = (): boolean => {\r\n return this.getCartLinesForShipping().length > 0;\r\n };\r\n\r\n private getDeliveryOptionSelected = (): ICheckoutDeliveryOption | null => {\r\n const selectedItem = this.deliveryOptions.find(deliveryOption => deliveryOption.Code === this.selectedItemId);\r\n if (!selectedItem) {\r\n return null;\r\n }\r\n\r\n const { id, typeName, context } = this.props;\r\n const { priceFree } = this.props.resources;\r\n const price = get(selectedItem, 'ShippingChargeAmount', 0);\r\n\r\n // @ts-ignore\r\n return {\r\n // @ts-ignore\r\n DeliveryOption: { className: 'ms-checkout-delivery-options__option-selected' },\r\n description: ,\r\n price: \r\n };\r\n };\r\n\r\n private getErrorMessage = (): ICheckoutDeliveryOptionsError => {\r\n const { errorMessageTitle } = this.props.resources;\r\n return {\r\n // @ts-ignore\r\n CheckoutDeliveryOptionsError: { tag: 'span', className: 'ms-address-form__error', role: 'alert', 'aria-live': 'assertive' },\r\n title: ,\r\n message: \r\n };\r\n };\r\n\r\n private getDeliveryOptionList = (): ICheckoutDeliveryOptionEdit[] => {\r\n const count = this.deliveryOptions.length - 1;\r\n const { priceFree } = this.props.resources;\r\n const { id, typeName, context } = this.props;\r\n\r\n // @ts-ignore\r\n return this.deliveryOptions.map((deliveryOption: DeliveryOption, index: number) => {\r\n return {\r\n // @ts-ignore\r\n DeliveryOption: { className: 'ms-checkout-delivery-options__option' },\r\n code: deliveryOption.Code || '',\r\n radioButton: (\r\n \r\n ),\r\n description: (\r\n \r\n ),\r\n price: (\r\n \r\n )\r\n };\r\n });\r\n };\r\n\r\n private getSaveButton = (): React.ReactNode => {\r\n const { saveBtnLabel = 'Save' } = this.props.resources;\r\n return (\r\n \r\n {saveBtnLabel}\r\n \r\n );\r\n };\r\n\r\n private getEditButton = (): React.ReactNode => {\r\n const { editBtnLabel = 'Change' } = this.props.resources;\r\n return (\r\n \r\n {editBtnLabel}\r\n \r\n );\r\n };\r\n\r\n private getCancelButton = (): React.ReactNode => {\r\n const { cancelBtnLabel = 'Cancel' } = this.props.resources;\r\n return (\r\n \r\n {cancelBtnLabel}\r\n \r\n );\r\n };\r\n\r\n private setError = (errorMessage: string): void => {\r\n this.props.telemetry.error(errorMessage);\r\n this.props.moduleState.setHasError(true);\r\n this.props.moduleState.onUpdating();\r\n this.errorMessage = errorMessage;\r\n };\r\n\r\n private clearError = (): void => {\r\n this.props.moduleState.setHasError(false);\r\n this.errorMessage = undefined;\r\n };\r\n\r\n private onSave = (): void => {\r\n this.onSubmit();\r\n };\r\n\r\n private onEdit = (): void => {\r\n this.onUpdating();\r\n };\r\n\r\n private onSubmit = (): void => {\r\n // tslint:disable-next-line:no-floating-promises\r\n void this.updateCartDeliverySpecification(this.selectedItemId);\r\n };\r\n\r\n private onCancel = (): void => {\r\n // Reset to the saved value\r\n const savedDeliveryOption = this.getSavedDeliveryOption();\r\n if (savedDeliveryOption) {\r\n this.selectedItemId = savedDeliveryOption;\r\n this.onReady();\r\n } else {\r\n this.onUpdating();\r\n }\r\n };\r\n\r\n private getSavedDeliveryOption = (): string | undefined => {\r\n const cartLinesForShipping = this.getCartLinesForShipping();\r\n return cartLinesForShipping[0] && cartLinesForShipping[0].DeliveryMode;\r\n };\r\n\r\n private updateCartDeliverySpecification = async (deliveryModeId: string): Promise => {\r\n if (deliveryModeId.trim() === '') {\r\n return;\r\n }\r\n\r\n const { resources } = this.props;\r\n const checkoutState = this.props.data.checkout.result as ICheckoutState;\r\n const updateCartDeliverySpecificationInput = {\r\n deliveryModeId: deliveryModeId,\r\n shippingAddress: checkoutState.shippingAddress\r\n };\r\n\r\n this.clearError();\r\n this.onPending();\r\n\r\n await checkoutState.checkoutCart.updateCartDeliverySpecification(updateCartDeliverySpecificationInput)\r\n .then((response) => {\r\n if (response.status === 'FAILED') {\r\n this.setError(resources.genericErrorMessage);\r\n } else {\r\n this.onReady();\r\n }\r\n })\r\n .catch(\r\n () => {\r\n this.setError(resources.genericErrorMessage);\r\n }\r\n );\r\n };\r\n\r\n private getCartLinesForShipping = (): CartLine[] => {\r\n const { request } = this.props.context;\r\n const pickupDeliveryModeCode = request && request.channel && request.channel.PickupDeliveryModeCode;\r\n const emailDeliveryModeCode = request && request.channel && request.channel.EmailDeliveryModeCode;\r\n\r\n return ((this.props.data.checkout.result && this.props.data.checkout.result.checkoutCart.cart.CartLines) || []).filter(\r\n cartLine => cartLine.DeliveryMode !== pickupDeliveryModeCode && cartLine.DeliveryMode !== emailDeliveryModeCode && cartLine.DeliveryMode !== ProductType.EventDeliveryMode\r\n );\r\n };\r\n\r\n private getDeliveryOptions = async (shippingAddress: Address): Promise => {\r\n if (!this.props.data.checkout.result) {\r\n return;\r\n }\r\n\r\n const { context, resources } = this.props;\r\n const cartId = (this.props.data.checkout.result.checkoutCart.cart as Cart).Id;\r\n if (context) {\r\n this.isLoading = true;\r\n this.deliveryOptions = [];\r\n this.selectedItemId = '';\r\n this.clearError();\r\n\r\n try {\r\n // TODO: Check if we can move this getDeliveryOptions to checkout state\r\n const response = await getDeliveryOptionsAsync({ callerContext: context.actionContext, queryResultSettings: {} }, cartId, shippingAddress, [], 1);\r\n\r\n if (response && response.length) {\r\n this.deliveryOptions = response;\r\n }\r\n } catch (error) {\r\n this.setError(resources.genericErrorMessage);\r\n }\r\n\r\n if (this.deliveryOptions.length === 0) {\r\n this.setError(resources.deliveryOptionsNotFound);\r\n } else {\r\n this.onUpdating();\r\n this.selectedItemId = this.deliveryOptions.length > 0 ? this.deliveryOptions[0].Code || '' : ''; // By default, select first delivery\r\n }\r\n\r\n this.isLoading = false;\r\n }\r\n };\r\n\r\n private loadDeliveryOptions = (): void => {\r\n const shippingAddress = this.props.data.checkout.result && this.props.data.checkout.result.shippingAddress;\r\n\r\n if (this.canShip() && shippingAddress) {\r\n // tslint:disable-next-line:no-floating-promises\r\n void this.getDeliveryOptions(shippingAddress);\r\n }\r\n };\r\n\r\n private onDeliveryOptionChange = (event: React.ChangeEvent) => {\r\n const deliveryModeId = event.currentTarget.value;\r\n this.selectedItemId = deliveryModeId;\r\n };\r\n\r\n private onReady = () => {\r\n this.props.moduleState.onReady();\r\n };\r\n\r\n private onUpdating = () => {\r\n this.props.moduleState.onUpdating();\r\n };\r\n\r\n private onPending = () => {\r\n this.props.moduleState.onPending();\r\n };\r\n}\r\n\r\nexport default CheckoutDeliveryOptions;\r\n","import { IStoreSelectorStateManager } from '@msdyn365-commerce-modules/bopis-utilities';\r\nimport { INodeProps } from '@msdyn365-commerce-modules/utilities';\r\nimport { ICartState } from '@msdyn365-commerce/global-state';\r\nimport { CartLine, OrgUnitLocation, ProductDeliveryOptions, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\n\r\nexport interface IElicitPickUpInStoreViewProps {\r\n callbacks: {\r\n toggleBopis(isBopisSelected: boolean): void;\r\n };\r\n defaultComponent?: React.ReactNode;\r\n orgUnitName?: string;\r\n isBopisSelected: boolean;\r\n ContainerProps: INodeProps;\r\n}\r\n\r\nexport interface IElicitPickUpInStoreProps {\r\n cartline: CartLine;\r\n product: SimpleProduct;\r\n shipitText: string;\r\n pickUpInStoreText: string;\r\n changeStoreText: string;\r\n cartState: ICartState | undefined;\r\n storeSelectorStateManager: IStoreSelectorStateManager | undefined;\r\n orgUnitLocations?: OrgUnitLocation[] | undefined;\r\n deliveryOptions?: ProductDeliveryOptions;\r\n pickupDeliveryModeCode?: string;\r\n}\r\n\r\n// tslint:disable-next-line:max-func-body-length\r\nexport const PickUpInStore = (props: IElicitPickUpInStoreProps): IElicitPickUpInStoreViewProps | undefined => {\r\n const _onLocationChangedCallback = (orgUnitLocation: OrgUnitLocation, cartState: ICartState | undefined, cartline: CartLine) => {\r\n if(!cartState) {\r\n return Promise.resolve();\r\n }\r\n return cartState.updateCartLinePickupLocation({cartLineId: cartline.LineId!, location: orgUnitLocation})\r\n .then(result => {\r\n if (result.status === 'SUCCESS') {\r\n // do something\r\n }\r\n })\r\n .catch(error => {\r\n return;\r\n });\r\n };\r\n\r\n const _toggleBOPIS = (isBopisSelected: boolean) => {\r\n const { storeSelectorStateManager, product, cartline, cartState } = props;\r\n\r\n if(isBopisSelected) {\r\n if(!storeSelectorStateManager) {\r\n return;\r\n }\r\n storeSelectorStateManager.openDialog({\r\n product,\r\n alreadySelectedLocation: {\r\n InventoryLocationId: cartline.FulfillmentStoreId\r\n },\r\n onLocationSelected: (orgUnitLocation) => {\r\n return _onLocationChangedCallback(orgUnitLocation, cartState, cartline);\r\n }\r\n })\r\n .catch(error => {\r\n return;\r\n });\r\n } else {\r\n if(!cartState) {\r\n return;\r\n }\r\n cartline.DeliveryMode = '';\r\n cartline.FulfillmentStoreId = '';\r\n cartline.ShippingAddress = {};\r\n cartState.clearCartLinePickupLocation({cartLineId: cartline.LineId!})\r\n .then(result => {\r\n if (result.status === 'SUCCESS') {\r\n // do something\r\n }\r\n })\r\n .catch(error => {\r\n return;\r\n });\r\n }\r\n };\r\n\r\n const _getOrgUnitName = (fulfillmentStoreId: string | undefined, orgUnitLocations: OrgUnitLocation[] | undefined) => {\r\n if(!orgUnitLocations || !fulfillmentStoreId || !(orgUnitLocations.length > 0)) {\r\n return '';\r\n }\r\n\r\n const foundLocation = orgUnitLocations.find(orgUnitLocation => {\r\n return orgUnitLocation.InventoryLocationId === fulfillmentStoreId;\r\n });\r\n\r\n if(foundLocation) {\r\n return foundLocation.OrgUnitName;\r\n } else {\r\n return fulfillmentStoreId;\r\n }\r\n };\r\n\r\n const _renderShippingMethod = (\r\n cartLine: CartLine,\r\n shipItText: string,\r\n pickupInStoretext: string,\r\n changeStoreText:string,\r\n orgUnitLocations: OrgUnitLocation[] | undefined):JSX.Element => {\r\n\r\n const orgUnitName = _getOrgUnitName(cartLine.FulfillmentStoreId, orgUnitLocations);\r\n const bopisSelected = cartLine.FulfillmentStoreId ? true : false;\r\n\r\n return (\r\n // tslint:disable:react-this-binding-issue react-a11y-role-has-required-aria-props jsx-no-lambda\r\n <>\r\n \r\n \r\n {\r\n cartLine.FulfillmentStoreId ? (\r\n
\r\n {orgUnitName}\r\n \r\n
\r\n ) : null\r\n }\r\n \r\n );\r\n };\r\n\r\n // If no delivery options present on the product, or none of the delivery options\r\n // match the PickupDeliveryModeCode, that means the item cannot be used for BOPIS\r\n if (!props.deliveryOptions ||\r\n !props.deliveryOptions.DeliveryOptions ||\r\n !props.pickupDeliveryModeCode ||\r\n !props.deliveryOptions.DeliveryOptions.find(option => option.Code === props.pickupDeliveryModeCode)) {\r\n return undefined;\r\n }\r\n\r\n return {\r\n callbacks: {\r\n toggleBopis: _toggleBOPIS\r\n },\r\n defaultComponent: _renderShippingMethod(props.cartline, props.shipitText, props.pickUpInStoreText, props.changeStoreText, props.orgUnitLocations),\r\n orgUnitName: _getOrgUnitName(props.cartline.FulfillmentStoreId, props.orgUnitLocations),\r\n isBopisSelected: props.cartline.FulfillmentStoreId ? true : false,\r\n ContainerProps: {\r\n className: 'msc-cart-line__bopis-container'\r\n }\r\n };\r\n};","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\nimport { IStoreSelectorStateManager } from '@msdyn365-commerce-modules/bopis-utilities';\r\nimport { getProductUrlSync } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { Button, format } from '@msdyn365-commerce-modules/utilities';\r\nimport {\r\n AddToWishlistComponent,\r\n ICartlineResourceString,\r\n IWishlistActionSuccessResult\r\n} from '@msdyn365-commerce/components';\r\nimport {\r\n IActionContext,\r\n ICoreContext,\r\n IGridSettings,\r\n IImageSettings,\r\n ITelemetry\r\n} from '@msdyn365-commerce/core';\r\nimport { BaseCartState, getCartState,GlobalStateInput, ICartState } from '@msdyn365-commerce/global-state';\r\nimport {\r\n AttributeValue,\r\n CartLine,\r\n CommerceList,\r\n OrgUnitLocation,\r\n ProductAvailableQuantity,\r\n ProductDeliveryOptions,\r\n SimpleProduct\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport { updateCartLinesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\r\nimport * as React from 'react';\r\nimport SmweCartLine from '../../../components/elicit-cartlineitem.component';\r\nimport ProductType from '../../../Utilities/productType';\r\nimport {\r\n IElicitPickUpInStoreViewProps,\r\n PickUpInStore\r\n} from './elicit-cart-pick-up-in-store';\r\n\r\nexport interface IElicitCartLineItemsProps {\r\n percentSaving: number;\r\n templateSavingText?: string;\r\n templatePercentSavingText?: string;\r\n cartlines: CartLine[];\r\n mixedCart: {[index:string]: boolean};\r\n mixedCartLines: CartLine[];\r\n cartLineErrors: {[index:string]: boolean};\r\n cartState: ICartState | undefined;\r\n orgUnitLocations: OrgUnitLocation[] | undefined;\r\n resources: ICartlineResourceString;\r\n productAvailabilites: ProductAvailableQuantity[] | undefined;\r\n products: SimpleProduct[] | undefined;\r\n productDeliveryOptions: ProductDeliveryOptions[] | undefined;\r\n pickupDeliveryModeCode?: string;\r\n /** GridSettings for the product image in cartline */\r\n gridSettings: IGridSettings;\r\n /** ImageSettings for the product image in cartline */\r\n imageSettings: IImageSettings;\r\n id: string;\r\n typeName: string;\r\n context: ICoreContext;\r\n telemetry: ITelemetry;\r\n removeButtonText: string;\r\n addToWishlistButtonText: string;\r\n removeFromWishlistButtonText: string;\r\n shipItText: string;\r\n pickitUpText: string;\r\n changeStoreText: string;\r\n storeSelectorStateManager: IStoreSelectorStateManager | undefined;\r\n outOfStockThreshold: number;\r\n isStockCheckEnabled: boolean;\r\n wishlists: CommerceList[] | undefined;\r\n defaultWishlistName: string;\r\n maxCartlineQuantity: number;\r\n showImages: boolean | undefined;\r\n invalidProductError: string;\r\n outOfStockError: string;\r\n zeroAvailabilityError: string;\r\n showDiscountPercent?: boolean;\r\n productAttributesList?: { [key: number]: AttributeValue[] };\r\n removeItemClickHandler(cartlineToRemove: CartLine): void;\r\n moveToWishlistSuccessHandler(\r\n result: IWishlistActionSuccessResult,\r\n cartlineId: CartLine\r\n ): void;\r\n updateCartLinesQuantitySuccessHandler(\r\n cartline: CartLine,\r\n quantity: number\r\n ): void;\r\n}\r\n\r\nexport interface IElicitCartlinesViewProps {\r\n cartline: React.ReactNode;\r\n pickUpInStore?: IElicitPickUpInStoreViewProps;\r\n remove: React.ReactNode;\r\n addToWishlist: React.ReactNode | undefined;\r\n}\r\n\r\nconst _getProduct = (\r\n productId: number | undefined,\r\n products: SimpleProduct[]\r\n): SimpleProduct | undefined => {\r\n if (productId !== undefined && products) {\r\n return products.find(product => {\r\n return productId === product.RecordId;\r\n });\r\n }\r\n return undefined;\r\n};\r\n\r\nconst _getCartItemMaxQuantity = (\r\n outOfStockThreshold: number,\r\n maxCartlineQuantity: number,\r\n isStockCheckEnabled: boolean,\r\n cartLines: CartLine[],\r\n currentQuantity: number,\r\n productId: number | undefined,\r\n productAvailability?: ProductAvailableQuantity\r\n) => {\r\n if (isStockCheckEnabled) {\r\n if (\r\n !productAvailability ||\r\n !productAvailability.AvailableQuantity ||\r\n productAvailability.AvailableQuantity <= 0\r\n ) {\r\n return 0;\r\n }\r\n let productInCartQty = 0;\r\n const productInCart = cartLines.filter(cartline => {\r\n return cartline.ProductId === productId;\r\n });\r\n if (productInCart && productInCart.length) {\r\n productInCart.forEach(line => {\r\n productInCartQty = productInCartQty + line.Quantity!;\r\n });\r\n productInCartQty = productInCartQty - currentQuantity;\r\n if (productInCartQty >= (productAvailability.AvailableQuantity)) {\r\n return currentQuantity;\r\n }\r\n }\r\n return productAvailability.AvailableQuantity - productInCartQty;\r\n }\r\n\r\n return maxCartlineQuantity;\r\n};\r\n\r\nconst _updateCartLine = (ctx: IActionContext, cartState: ICartState, cartLine: CartLine): void => {\r\n if (ctx && cartState) {\r\n updateCartLinesAsync({ callerContext: ctx }, cartState.cart.Id, [cartLine])\r\n .then(cart => {\r\n const cartInput = new GlobalStateInput(\r\n 'CARTSTATE',\r\n BaseCartState,\r\n ctx.requestContext.apiSettings);\r\n getCartState(ctx)\r\n .then(newCart => {\r\n ctx.update(cartInput, newCart);\r\n // tslint:disable-next-line: no-floating-promises\r\n void newCart.refreshCart({});\r\n })\r\n .catch((e) => ctx.telemetry.exception(e));\r\n })\r\n .catch((e) => ctx.telemetry.exception(e));\r\n }\r\n};\r\n\r\n// tslint:disable:max-func-body-length\r\nconst _assembleNode = (\r\n cartline: CartLine,\r\n product: SimpleProduct,\r\n props: IElicitCartLineItemsProps,\r\n index: number,\r\n zeroAvailabilityError: boolean,\r\n cartState: ICartState | undefined,\r\n foundProductAvailability?: ProductAvailableQuantity,\r\n foundProductDeliveryOptions?: ProductDeliveryOptions,\r\n): IElicitCartlinesViewProps => {\r\n const {\r\n imageSettings,\r\n gridSettings,\r\n id,\r\n typeName,\r\n context,\r\n resources,\r\n removeButtonText,\r\n removeItemClickHandler,\r\n moveToWishlistSuccessHandler,\r\n addToWishlistButtonText,\r\n removeFromWishlistButtonText,\r\n wishlists,\r\n defaultWishlistName,\r\n cartLineErrors,\r\n showDiscountPercent\r\n } = props;\r\n\r\n const maxQuantity = _getCartItemMaxQuantity(\r\n props.outOfStockThreshold,\r\n props.maxCartlineQuantity,\r\n props.isStockCheckEnabled,\r\n props.mixedCartLines,\r\n cartline.Quantity || 0,\r\n product.RecordId,\r\n foundProductAvailability\r\n );\r\n\r\n const isAuthenticated = context.request.user.isAuthenticated;\r\n const nameOfWishlist =\r\n wishlists && wishlists.length > 0 && wishlists[0].Name\r\n ? wishlists[0].Name\r\n : defaultWishlistName;\r\n\r\n const onRemoveClickHandler = (event: React.MouseEvent) => {\r\n removeItemClickHandler(cartline);\r\n };\r\n\r\n return {\r\n cartline: (\r\n \r\n }\r\n showImages={props.showImages}\r\n zeroAvailabilityError={zeroAvailabilityError}\r\n cartLineOnChange={_updateCartLine}\r\n cartState={cartState}\r\n cartLineErrors={cartLineErrors}\r\n showDiscountPercent={showDiscountPercent}\r\n productAttributes={props.productAttributesList && props.productAttributesList[product.RecordId]}\r\n />\r\n ),\r\n pickUpInStore: PickUpInStore({\r\n cartState: props.cartState,\r\n cartline: cartline,\r\n product: product,\r\n shipitText: props.shipItText,\r\n pickUpInStoreText: props.pickitUpText,\r\n changeStoreText: props.changeStoreText,\r\n storeSelectorStateManager: props.storeSelectorStateManager,\r\n orgUnitLocations: props.orgUnitLocations,\r\n deliveryOptions: foundProductDeliveryOptions,\r\n pickupDeliveryModeCode: props.pickupDeliveryModeCode\r\n }),\r\n remove: (\r\n \r\n {removeButtonText}\r\n \r\n ),\r\n addToWishlist: isAuthenticated ? (\r\n \r\n ) : (\r\n undefined\r\n )\r\n };\r\n};\r\n\r\nexport const _assembleCartlines = (\r\n cartlines: CartLine[],\r\n products: SimpleProduct[] | undefined,\r\n props: IElicitCartLineItemsProps,\r\n cartState: ICartState | undefined\r\n): IElicitCartlinesViewProps[] | null => {\r\n const reactNodes: IElicitCartlinesViewProps[] = [];\r\n\r\n if (!products || products.length === 0) {\r\n return null;\r\n }\r\n\r\n const productTypeInit = new ProductType();\r\n\r\n cartlines.map(cartLine => {\r\n productTypeInit.check(cartLine?.DeliveryMode, props.context);\r\n });\r\n props.mixedCart.isMixedCart = productTypeInit.isMixedProduct();\r\n\r\n cartlines.map((cartline, index) => {\r\n const product = _getProduct(cartline.ProductId, products);\r\n let foundProductAvailability;\r\n if (props.productAvailabilites && props.productAvailabilites.length > 0) {\r\n foundProductAvailability = props.productAvailabilites.find(\r\n productAvailability => {\r\n return productAvailability.ProductId! === cartline.ProductId;\r\n }\r\n );\r\n }\r\n let foundProductDeliveryOption;\r\n if (\r\n props.productDeliveryOptions &&\r\n props.productDeliveryOptions.length > 0\r\n ) {\r\n foundProductDeliveryOption = props.productDeliveryOptions.find(\r\n deliveryOption => {\r\n return (\r\n deliveryOption && deliveryOption.ProductId === cartline.ProductId\r\n );\r\n }\r\n );\r\n }\r\n\r\n const maxQuantity = _getCartItemMaxQuantity(\r\n props.outOfStockThreshold,\r\n props.maxCartlineQuantity,\r\n props.isStockCheckEnabled,\r\n props.mixedCartLines,\r\n cartline.Quantity || 0,\r\n product?.RecordId,\r\n foundProductAvailability\r\n );\r\n\r\n let zeroAvailabilityError: boolean = false;\r\n const productType = new ProductType();\r\n productType.check(cartline?.DeliveryMode, props.context);\r\n if (productType.isWineProduct() && (cartline.Quantity) && foundProductAvailability && foundProductAvailability.AvailableQuantity && foundProductAvailability.AvailableQuantity <= props.outOfStockThreshold) {\r\n cartline.Comment = props.zeroAvailabilityError;\r\n props.cartLineErrors[cartline.LineId!] = true;\r\n zeroAvailabilityError = true;\r\n } else if (productType.isWineProduct() && (cartline.Quantity && maxQuantity < cartline.Quantity)) {\r\n cartline.Comment = format(props.outOfStockError, maxQuantity);\r\n props.cartLineErrors[cartline.LineId!] = true;\r\n } else if (cartline.ItemId?.toLowerCase() !== props.context.request.channel?.GiftCardItemId?.toLowerCase()) {\r\n cartline.Comment = '';\r\n props.cartLineErrors[cartline.LineId!] = false;\r\n }\r\n\r\n if (product) {\r\n reactNodes.push(\r\n _assembleNode(\r\n cartline,\r\n product,\r\n props,\r\n index,\r\n zeroAvailabilityError,\r\n cartState,\r\n foundProductAvailability,\r\n foundProductDeliveryOption\r\n )\r\n );\r\n }\r\n });\r\n\r\n return reactNodes;\r\n};\r\n\r\n/**\r\n * CartLineItems component\r\n */\r\n\r\nexport const ElicitCartLineItems = (props: IElicitCartLineItemsProps) => {\r\n const { products, cartlines, cartState } = props;\r\n return _assembleCartlines(cartlines, products, props, cartState);\r\n};\r\n","import {\r\n IBuyboxAddToCartViewProps,\r\n IBuyboxProductQuantityViewProps\r\n} from '@msdyn365-commerce-modules/buybox/dist/types';\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { AsyncResult } from '@msdyn365-commerce/core';\r\nimport * as React from 'react';\r\nimport Table from 'reactstrap/lib/Table';\r\nimport { ISmweBuyboxViewProps } from '../../../modules/smwe-buybox/smwe-buybox';\r\n\r\nconst SmweBuyboxView: React.FC = props => {\r\n const {\r\n ModuleProps,\r\n MediaGalleryContainerProps,\r\n ProductInfoContainerProps,\r\n addToCart,\r\n quantity,\r\n title,\r\n productDescription,\r\n productTitle,\r\n productPrice,\r\n productClubPrice,\r\n show,\r\n acclaimRatings,\r\n cookbookTagline,\r\n eventSchedule,\r\n subscriptionButton\r\n } = props;\r\n // @ts-ignore\r\n const tableClass: AsyncResult = props.context.actionContext.get('String', 'Generic-SkuSelectorClasses');\r\n return (\r\n \r\n {props.mediaGallery}\r\n \r\n {props.productApellation && (\r\n
{props.productApellation}
\r\n )}\r\n {title}\r\n {productDescription}\r\n {eventSchedule}\r\n {acclaimRatings}\r\n {cookbookTagline}\r\n {show &&
\r\n \r\n \r\n \r\n {productTitle && }\r\n {productPrice && }\r\n {productClubPrice && }\r\n {quantity && }\r\n {addToCart && \r\n \r\n \r\n \r\n {productTitle && }\r\n {productPrice && }\r\n {productClubPrice && }\r\n {quantity && }\r\n {addToCart && }\r\n {subscriptionButton && }\r\n \r\n \r\n
ProductRetailYour PriceQTY}\r\n
{productTitle}{productPrice}{productClubPrice}{_renderQuantity(quantity)}{_renderAddToCart(addToCart)}{_renderAddToCart(subscriptionButton)}
\r\n
}\r\n {props.content &&\r\n props.content.map(\r\n (contentSlotData: React.ReactNode, index: number) => {\r\n return (\r\n \r\n {contentSlotData}\r\n \r\n );\r\n }\r\n )}\r\n\r\n
\r\n
\r\n );\r\n};\r\n\r\nconst _renderAddToCart = (addToCart: IBuyboxAddToCartViewProps): JSX.Element => {\r\n const { ContainerProps, errorBlock, button } = addToCart;\r\n\r\n return (\r\n \r\n {errorBlock}\r\n {button}\r\n \r\n );\r\n};\r\n\r\nconst _renderQuantity = (quantity: IBuyboxProductQuantityViewProps): JSX.Element => {\r\n const { ContainerProps, LabelContainerProps, input, errors } = quantity;\r\n\r\n return (\r\n \r\n \r\n {errors}\r\n \r\n {input}\r\n \r\n );\r\n};\r\n\r\nexport default SmweBuyboxView;\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\nimport { PriceComponent } from '@msdyn365-commerce/components';\r\nimport { ICoreContext, ITelemetry, RichTextComponent } from '@msdyn365-commerce/core';\r\nimport { ICheckoutState } from '@msdyn365-commerce/global-state';\r\nimport { Cart, ChannelConfiguration, GiftCard } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport { orderSummaryShipmentCalculation } from './smwe-order-summary-shipment-calculation';\r\n\r\nexport interface IOrderSummaryProps {\r\n subTotalLabel: string;\r\n shippingLabel: string;\r\n taxLabel: string;\r\n orderTotalLabel: string;\r\n loyaltyLabel?: string;\r\n shipmentWarningText?: string;\r\n giftcardLabel?: string;\r\n totalDiscountsLabel: string;\r\n context: ICoreContext;\r\n telemetry: ITelemetry;\r\n cart: Cart;\r\n channelConfiguration: ChannelConfiguration;\r\n id: string;\r\n typeName: string;\r\n freeText?: string;\r\n toBeCalculatedText?: string;\r\n checkoutState?: ICheckoutState;\r\n}\r\n\r\nexport interface IOrderSummaryLines {\r\n subtotal: React.ReactNode;\r\n shipping?: React.ReactNode;\r\n tax: React.ReactNode;\r\n orderTotal: React.ReactNode;\r\n totalDiscounts?: React.ReactNode;\r\n giftCard?: React.ReactNode;\r\n loyalty?: React.ReactNode;\r\n}\r\n\r\ninterface IOrderSummaryLineProps {\r\n label: string;\r\n context: ICoreContext;\r\n telemetry: ITelemetry;\r\n price?: number;\r\n freeText?: string;\r\n toBeCalculatedText?: string;\r\n id: string;\r\n typeName: string;\r\n cssLabel: string;\r\n}\r\n\r\ninterface IShippingOrderLine {\r\n cart: Cart;\r\n channelConfiguration: ChannelConfiguration;\r\n canShip?: boolean;\r\n hasDeliveryMethod?: boolean;\r\n hasShippingMethod?: boolean;\r\n freightFee?: number;\r\n}\r\n\r\nconst OrderSummaryLine: React.FC = ({\r\n price,\r\n label,\r\n context,\r\n id,\r\n typeName,\r\n toBeCalculatedText,\r\n freeText,\r\n cssLabel\r\n}) => {\r\n return (\r\n

\r\n {label}\r\n {price || price === 0 ? (\r\n \r\n ) : (\r\n {toBeCalculatedText}\r\n )}\r\n

\r\n );\r\n};\r\n\r\nconst _buildOrderSummarySection = (\r\n props: IOrderSummaryProps,\r\n price: number | undefined,\r\n label: string,\r\n cssLabel: string\r\n): React.ReactNode => {\r\n return (\r\n \r\n );\r\n};\r\n\r\nconst _computedLoyaltyAmount = (checkoutState: ICheckoutState): number => {\r\n return (checkoutState && checkoutState.loyaltyAmount) || 0;\r\n};\r\n\r\nconst _computeGiftCardAmount = (checkoutState: ICheckoutState, cart: Cart): number => {\r\n\r\n const giftCardCounter = (count: number, giftCard: GiftCard) => {\r\n return count + (giftCard.Balance || 0);\r\n };\r\n const giftCardTotalValue = (checkoutState.giftCards || []).reduce(giftCardCounter, 0);\r\n const amount = (cart.TotalAmount || 0) - _computedLoyaltyAmount(checkoutState);\r\n return Math.min(giftCardTotalValue, amount);\r\n};\r\n\r\nconst getDeliveryConfiguration = (cart: Cart, channelConfiguration: ChannelConfiguration): IShippingOrderLine => {\r\n\r\n const pickupDeliveryModeCode = channelConfiguration && channelConfiguration.PickupDeliveryModeCode;\r\n const cartLines = cart.CartLines || [];\r\n const deliveryModes = cartLines.map(cartLine => cartLine.DeliveryMode);\r\n\r\n const freightFee = cartLines.reduce(\r\n (count, cartLine) => {\r\n return count + (cartLine.ChargeLines || []).reduce(\r\n (chargeTotal, chargeLine) => {\r\n return chargeTotal + ((chargeLine.IsShipping && chargeLine.CalculatedAmount)\r\n ? chargeLine.CalculatedAmount\r\n : 0);\r\n },\r\n 0\r\n );\r\n },\r\n 0\r\n );\r\n\r\n const canShip = deliveryModes.some(deliveryMode => deliveryMode !== pickupDeliveryModeCode);\r\n const hasDeliveryMethod = deliveryModes.some(deliveryMode => !!deliveryMode);\r\n const hasShippingMethod = deliveryModes.some(deliveryMode => !!deliveryMode && deliveryMode !== pickupDeliveryModeCode);\r\n return {\r\n canShip,\r\n hasDeliveryMethod,\r\n hasShippingMethod,\r\n freightFee\r\n } as IShippingOrderLine;\r\n};\r\n\r\nexport const OrderSummary = (props: IOrderSummaryProps) => {\r\n const { NetPrice, TaxAmount, DiscountAmountWithoutTax = 0, TotalAmount } = props.cart;\r\n const { canShip, hasDeliveryMethod, hasShippingMethod, freightFee } = getDeliveryConfiguration(props.cart, props.channelConfiguration);\r\n let shippingPrice = 0;\r\n if (canShip) {\r\n shippingPrice = orderSummaryShipmentCalculation({\r\n cart: props.cart\r\n }).price;\r\n }\r\n const reactNodes: IOrderSummaryLines = {\r\n subtotal: _buildOrderSummarySection(props, NetPrice, props.subTotalLabel, 'net-price'),\r\n tax: _buildOrderSummarySection(props, hasDeliveryMethod ? TaxAmount : undefined, props.taxLabel, 'tax-amount'),\r\n orderTotal: _buildOrderSummarySection(props, TotalAmount! + shippingPrice, props.orderTotalLabel, 'total')\r\n };\r\n\r\n reactNodes.shipping = (\r\n \r\n {_buildOrderSummarySection(props, hasShippingMethod ? freightFee : shippingPrice, props.shippingLabel, 'shipping')}\r\n {props.shipmentWarningText && }\r\n \r\n );\r\n if (props.checkoutState) {\r\n const giftCardAmount = _computeGiftCardAmount(props.checkoutState, props.cart);\r\n const loyaltyAmount = _computedLoyaltyAmount(props.checkoutState);\r\n const totalAmountAfterGiftCard = (TotalAmount || 0) - giftCardAmount - loyaltyAmount;\r\n\r\n if (loyaltyAmount > 0) {\r\n reactNodes.loyalty = _buildOrderSummarySection(props, -loyaltyAmount, props.loyaltyLabel || 'Loyalty amount', 'loyalty');\r\n }\r\n\r\n if (giftCardAmount > 0) {\r\n reactNodes.giftCard = _buildOrderSummarySection(props, -giftCardAmount, props.giftcardLabel || 'Gift card amount', 'gift-card');\r\n }\r\n\r\n reactNodes.orderTotal = _buildOrderSummarySection({ ...props, freeText: undefined }, totalAmountAfterGiftCard, props.orderTotalLabel, 'total');\r\n }\r\n\r\n if (DiscountAmountWithoutTax > 0) {\r\n reactNodes.totalDiscounts = _buildOrderSummarySection(props, -DiscountAmountWithoutTax, props.totalDiscountsLabel, 'total-discounts');\r\n }\r\n\r\n return reactNodes;\r\n};","import * as React from 'react';\r\n\r\nimport { Button, format } from '@msdyn365-commerce-modules/utilities';\r\nimport { PriceComponent } from '@msdyn365-commerce/components';\r\nimport { IComponent, IComponentProps, msdyn365Commerce } from '@msdyn365-commerce/core';\r\nimport { ICartState } from '@msdyn365-commerce/global-state';\r\nimport { Coupon } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n\r\nexport interface IElicitPromoCodeProps extends IComponentProps<{}> {\r\n cart: ICartState | undefined;\r\n promoCodeHeadingText: string;\r\n appliedPromoCodeHeadingText: string;\r\n appliedPromoCodeSubheadingText: string;\r\n removePromoAriaLabelFormat: string;\r\n promoPlaceholderText: string;\r\n promoCodeApplyButtonText: string;\r\n collapseTimeOut: number;\r\n removePromoText: string;\r\n invalidPromoCodeErrorText: string;\r\n failedToAddPromoCodeErrorText: string;\r\n duplicatePromoCodeErrorText: string;\r\n failedToRemovePromoCodeErrorText: string;\r\n promoCodeApplyCallback?(): void;\r\n}\r\n\r\nexport interface IElicitPromoCodeComponent extends IComponent { }\r\n\r\nconst PromoCodeComponentActions = {\r\n};\r\n\r\ninterface IElicitPromoCodeState {\r\n isCollapseOpen: boolean;\r\n promoCodeInputValue: string;\r\n error: string;\r\n canApply: boolean;\r\n}\r\n\r\n/**\r\n *\r\n * The PromoCode component renders the promocode section.\r\n * @extends {React.PureComponent}\r\n */\r\nclass ElicitPromoCode extends React.PureComponent {\r\n\r\n constructor(props: IElicitPromoCodeProps, state: IElicitPromoCodeState) {\r\n super(props);\r\n this.state = {\r\n isCollapseOpen: false,\r\n promoCodeInputValue: '',\r\n error: '',\r\n canApply: false\r\n };\r\n }\r\n\r\n public render(): JSX.Element {\r\n return (\r\n <>\r\n
{this.props.promoCodeHeadingText}
\r\n {this._renderForm(this.props.promoPlaceholderText, this.props.promoCodeApplyButtonText, this.props.cart)}\r\n

{this.state.error}

\r\n {this._renderAppliedPromoCode(this.props)}\r\n \r\n );\r\n }\r\n\r\n private _onInputChange = (e: React.ChangeEvent) => {\r\n const error = e.target.value === '' ? '' : this.state.error;\r\n this.setState({\r\n promoCodeInputValue: e.target.value, error: error,\r\n canApply: e.target.value ? true : false\r\n });\r\n };\r\n\r\n private _applyPromotion = (cartState: ICartState | undefined) => {\r\n if (!cartState || !cartState.cart) {\r\n return;\r\n }\r\n const appliedPromo = this.state.promoCodeInputValue;\r\n\r\n cartState.addPromoCode({ promoCode: appliedPromo })\r\n .then(result => {\r\n if (result.status === 'SUCCESS') {\r\n // show success text\r\n this.setState({ promoCodeInputValue: '', error: '', canApply: false});\r\n } else if (result.substatus === 'ALREADYADDED') {\r\n this.setState({ error: this.props.duplicatePromoCodeErrorText });\r\n } else {\r\n this.setState({ error: this.props.invalidPromoCodeErrorText });\r\n }\r\n })\r\n .catch(error => {\r\n this.setState({ error: this.props.failedToAddPromoCodeErrorText });\r\n });\r\n };\r\n\r\n private _renderForm = (promoPlaceholderText: string, promoCodeApplyButtonText: string, cartState: ICartState | undefined) => {\r\n return (\r\n // tslint:disable-next-line:react-this-binding-issue jsx-no-lambda\r\n
{e.preventDefault(); this._applyPromotion(cartState); }} className='msc-promo-code__form'>\r\n \r\n { this._applyPromotion(cartState); }}\r\n disabled={!this.state.canApply}\r\n >\r\n {promoCodeApplyButtonText}\r\n \r\n \r\n );\r\n };\r\n\r\n private _removePromotion = (cartState: ICartState | undefined, event: React.MouseEvent) => {\r\n if (!cartState) {\r\n return;\r\n }\r\n const code = event.currentTarget.getAttribute('data-value') || '';\r\n cartState.removePromoCodes({\r\n promoCodes: [\r\n code\r\n ]\r\n })\r\n .then(result => {\r\n if (result.status === 'SUCCESS') {\r\n this.setState({ error: ''});\r\n }\r\n })\r\n .catch(() => {\r\n this.setState({ error: this.props.failedToRemovePromoCodeErrorText});\r\n });\r\n\r\n };\r\n private _calculateDiscount = (code: string, cartState: ICartState | undefined) => {\r\n if (!cartState || !cartState.cart || !cartState.cart.CartLines || cartState.cart.CartLines.length === 0 || !code) {\r\n return;\r\n }\r\n let discountAmount = 0;\r\n for (const line of cartState.cart.CartLines) {\r\n if (line.DiscountLines) {\r\n for (const discountLine of line.DiscountLines) {\r\n if (discountLine.DiscountCode === code) {\r\n discountAmount += discountLine.DiscountCost!;\r\n }\r\n }\r\n }\r\n }\r\n return discountAmount * -1;\r\n };\r\n\r\n private _renderAppliedPromoCode = (props: IElicitPromoCodeProps) => {\r\n if (!props.cart || !props.cart.cart || !props.cart.cart.Coupons || !(props.cart.cart.Coupons.length > 0)) {\r\n return;\r\n }\r\n return (\r\n
\r\n
{this.props.appliedPromoCodeHeadingText}
\r\n
{this.props.appliedPromoCodeSubheadingText}
\r\n
\r\n {\r\n props.cart.cart.Coupons.map((coupon: Coupon) => {\r\n const ariaLabel = props.removePromoAriaLabelFormat ? format(props.removePromoAriaLabelFormat, props.removePromoText, coupon.Code) : '';\r\n return (\r\n
\r\n
\r\n {coupon.Code}\r\n \r\n {this._calculateDiscount(coupon.Code || '', props.cart) === 0\r\n ? null\r\n : <>\r\n (\r\n \r\n )\r\n \r\n }\r\n \r\n
\r\n {this._removePromotion(props.cart, event);}}\r\n data-value={coupon.Code}\r\n aria-label={ariaLabel}\r\n >\r\n {props.removePromoText}\r\n \r\n
\r\n );\r\n })\r\n }\r\n
\r\n
\r\n );\r\n };\r\n}\r\n\r\n// @ts-ignore\r\nexport const ElicitPromoCodeComponent: React.FunctionComponent = msdyn365Commerce.createComponent(\r\n 'ElicitPromoCode',\r\n { component: ElicitPromoCode, ...PromoCodeComponentActions }\r\n);","import { ICartState } from '@msdyn365-commerce/global-state';\r\nimport { AsyncResult } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport { CartUtilities } from '../../../Utilities/cart-utils';\r\nimport { calculateSavingPercentAmount } from '../../../Utilities/elicit-savings-calculation';\r\nimport { filterCartLines } from '../../../Utilities/subscription-manager';\r\nimport { IEditSubscriptionLinkData } from '../elicit-cart.props.autogenerated';\r\n\r\nexport interface IElicitSubscriptionUpsell {\r\n editSubscriptionLink?: IEditSubscriptionLinkData;\r\n cart: AsyncResult;\r\n}\r\n\r\n/**\r\n * displays an upsell for getting more subscription items to the user\r\n */\r\nexport class ElicitSubscriptionUpsell extends React.Component {\r\n\r\n public render(): JSX.Element {\r\n const {\r\n cart: { result: cartState },\r\n } = this.props;\r\n if (!cartState) { return
; }\r\n const subLines = filterCartLines(cartState.cart).subscriptionLines;\r\n const total = CartUtilities.countCartLineNetPrice(subLines);\r\n const savingRatioAmount = calculateSavingPercentAmount(subLines);\r\n let savingRatio = total / savingRatioAmount;\r\n if (!isFinite(savingRatio)) {\r\n savingRatio = 0;\r\n }\r\n const totalBottles = CartUtilities.countCartLineAmount(subLines);\r\n const showUpsell = totalBottles < 12 ? true : false;\r\n const upsellPercent = savingRatioAmount < 4 ? 10 : 15;\r\n const upsellBottleCount = upsellPercent === 10 ? 4 - totalBottles : 12 - totalBottles;\r\n return (\r\n
\r\n {showUpsell &&\r\n
\r\n Your order includes a subscription for a\r\n {` ${totalBottles} bottle `}\r\n box. Add\r\n {` ${upsellBottleCount} more `}\r\n bottles to your subscription to get\r\n {` ${upsellPercent}% off `}\r\n on your subsequent orders!\r\n
\r\n }\r\n {this._renderUpsellCTA(this.props.editSubscriptionLink)}\r\n
\r\n );\r\n }\r\n\r\n private _renderUpsellCTA(link: IEditSubscriptionLinkData | undefined): JSX.Element | null {\r\n if (link && link.linkUrl.destinationUrl && link.linkText) {\r\n return (\r\n \r\n {link.linkText}\r\n \r\n );\r\n }\r\n return null;\r\n }\r\n}","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\nimport classnames from 'classnames';\r\nimport { observable } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport React from 'react';\r\n\r\nimport { Button, INodeProps, Waiting } from '@msdyn365-commerce-modules/utilities';\r\nimport { IWishlistActionSuccessResult } from '@msdyn365-commerce/components';\r\nimport { getUrlSync, IDictionary, IImageDimension, IImageSettings } from '@msdyn365-commerce/core';\r\nimport { ICartState } from '@msdyn365-commerce/global-state';\r\nimport { AttributeValue, CartLine, CommerceProperty, SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\n\r\nimport { SubscriptionCommerceValues } from '../../common/subscription-commerce.values';\r\nimport { publish } from '../../Utilities/analytics/analytics-dispatcher';\r\nimport CommerceAttributesParser from '../../Utilities/commerce-attributes-parser';\r\nimport { calculateSavingPercentAmount } from '../../Utilities/elicit-savings-calculation';\r\nimport { getAttributesForCart, IAttributeBank } from '../../Utilities/get-product-attributes';\r\nimport { filterCartLines, getSubscriptionValues, isLineSubscriptionLine, updateSubscription } from '../../Utilities/subscription-manager';\r\nimport { IOrderSummaryLines, OrderSummary } from './../../Utilities/smwe-order-summary-lineitem';\r\n\r\nimport { _assembleCartlines, ElicitCartLineItems, IElicitCartlinesViewProps } from './components/elicit-cart-line-items';\r\nimport { ElicitPromoCodeComponent } from './components/elicit-promo-code';\r\nimport { ElicitSubscriptionHeader } from './components/elicit-subscription-header';\r\nimport { ElicitSubscriptionUpsell } from './components/elicit-subscription-upsell';\r\nimport { IElicitCartData } from './elicit-cart.data';\r\nimport { IElicitCartProps } from './elicit-cart.props.autogenerated';\r\n\r\nexport interface IElicitCartViewProps extends IElicitCartProps {\r\n className: string;\r\n title?: React.ReactNode;\r\n CartlinesWrapper: INodeProps;\r\n cartlines?: IElicitCartlinesViewProps[];\r\n cart: ICartState | undefined;\r\n orderSummaryHeading: React.ReactNode;\r\n orderSummaryLineitems?: IOrderSummaryLines;\r\n OrderSummaryWrapper: INodeProps;\r\n OrderSummaryItems: INodeProps;\r\n checkoutAsGuestButton: React.ReactNode;\r\n checkoutAsSignInUserButton: React.ReactNode;\r\n storeSelector?: React.ReactNode;\r\n backToShoppingButton: React.ReactNode;\r\n waitingComponent: React.ReactNode;\r\n promoCode: React.ReactNode;\r\n cartLoadingStatus: string;\r\n cartDataResult: boolean;\r\n\r\n checkoutButtonDisabled: React.ReactNode;\r\n cartLineStatus: IDictionary;\r\n mixedCart: IDictionary;\r\n\r\n subscriptionHeader: React.ReactNode;\r\n subscriptionUpsell: React.ReactNode;\r\n\r\n shouldShowCheckoutInline: boolean;\r\n\r\n removeItemClickHandler(cartlineToRemove: CartLine): void;\r\n moveToWishlistSuccessHandler(result: IWishlistActionSuccessResult, cartlineId: CartLine): void;\r\n}\r\n\r\ninterface IImageSettingsViewports {\r\n xs: IImageDimension;\r\n sm?: IImageDimension | undefined;\r\n md?: IImageDimension | undefined;\r\n lg?: IImageDimension | undefined;\r\n xl?: IImageDimension | undefined;\r\n}\r\n\r\n/**\r\n *\r\n * Cart component\r\n * @extends {React.Component>}\r\n */\r\n@observer\r\nclass ElicitCart extends React.Component> {\r\n\r\n private cartLinesInvalid: IDictionary = {};\r\n private mixedCart: IDictionary = {};\r\n\r\n @observable private productAttributesList: { [key: number]: AttributeValue[] } = {};\r\n private parsedProductAttributes: IAttributeBank = {};\r\n\r\n constructor(props: IElicitCartProps) {\r\n super(props);\r\n this._updateSubscriptionName = this._updateSubscriptionName.bind(this);\r\n\r\n const modifiedImageSettings = props.config.imageSettings;\r\n if (modifiedImageSettings) {\r\n if (modifiedImageSettings.viewports) {\r\n modifiedImageSettings.viewports = this.usePNGImageSetting(modifiedImageSettings.viewports);\r\n props.config.imageSettings = modifiedImageSettings;\r\n }\r\n }\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n public componentDidMount(): void {\r\n if (this._displaySummary) {\r\n\r\n const { cart, products } = this.props.data;\r\n\r\n // Wait for all data to load (except attributes, which rely on product IDs)\r\n Promise.all([cart, products]).then(() => {\r\n\r\n // Fetch attributes, then generate the checkout event\r\n this._setProductAttributes().then(() => {\r\n this._generateCheckoutAnalyticsEvent(cart.result!, products.result!);\r\n }).catch(e => this.props.telemetry.exception(e));\r\n })\r\n .catch((e) => this.props.telemetry.exception(e));\r\n }\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n // tslint:disable-next-line:cyclomatic-complexity max-func-body-length\r\n public render(): JSX.Element | null {\r\n const {\r\n data: {\r\n cart: { result: cart },\r\n wishlists: { result: wishlists }\r\n },\r\n context: {\r\n request: {\r\n user: {\r\n isAuthenticated,\r\n signInUrl\r\n },\r\n channel: {\r\n PickupDeliveryModeCode\r\n } = { PickupDeliveryModeCode: undefined }\r\n },\r\n app: {\r\n routes\r\n }\r\n },\r\n config: config,\r\n telemetry,\r\n resources\r\n } = this.props;\r\n\r\n const channelConfiguration = this.props.context && this.props.context.request && this.props.context.request.channel;\r\n const imageSettings = this._getImageSettings(config.imageSettings);\r\n const guestCheckoutUrl = getUrlSync('checkout', this.props.context.actionContext) || '';\r\n const backToShoppingUrl = routes.backToShopping && routes.backToShopping.destinationUrl ?\r\n routes.backToShopping.destinationUrl\r\n : getUrlSync('home', this.props.context.actionContext) || '';\r\n const checkoutURL = this._getCheckoutURL(isAuthenticated, guestCheckoutUrl, signInUrl || '');\r\n const isCartEmpty = cart && cart.cart.CartLines && this._contextualLines.length === 0;\r\n const isCartREALLYEmpty = cart && cart.cart.CartLines && cart.cart.CartLines.length === 0;\r\n const isAllCartEmpty = cart?.cart.CartLines?.length === 0;\r\n\r\n const elicitCartItemProps = {\r\n percentSaving: calculateSavingPercentAmount(this._contextualLines),\r\n templatePercentSavingText: resources.elicitCart_subscriptionLinePercentSavingText,\r\n templateSavingText: resources.elicitCart_subscriptionSavingText,\r\n cartlines: this._contextualLines,\r\n cartLineErrors: this.cartLinesInvalid,\r\n mixedCart: this.mixedCart,\r\n mixedCartLines: cart?.cart.CartLines || [],\r\n products: this.props.data.products.result,\r\n productAvailabilites: this.props.data.productAvailabilites.result,\r\n productDeliveryOptions: this.props.data.deliveryOptions.result,\r\n imageSettings: imageSettings,\r\n outOfStockThreshold: this.props.context.app.config.outOfStockThreshold || 10,\r\n isStockCheckEnabled: this.props.context.app.config.enableStockCheck || false,\r\n maxCartlineQuantity: this.props.context.app.config.maxQuantityForCartLineItem,\r\n gridSettings: this.props.context.request.gridSettings!,\r\n context: this.props.context,\r\n typeName: this.props.typeName,\r\n id: this.props.id,\r\n resources: {\r\n sizeString: resources.elicitCart__productDimensionTypeSize,\r\n colorString: resources.elicitCart__productDimensionTypeColor,\r\n configString: 'asd',\r\n styleString: resources.elicitCart__productDimensionTypeStyle,\r\n quantityDisplayString: resources.elicitCart__quantityDisplayText,\r\n inputQuantityAriaLabel: resources.elicitCart__inputQuantityAriaLabel,\r\n discountStringText: resources.elicitCart__discountStringText,\r\n\r\n originalPriceText: resources.elicitCart__originalPriceText,\r\n currentPriceText: resources.elicitCart__currentPriceText,\r\n shippingChargesText: resources.elicitCart__shippingCharges,\r\n },\r\n telemetry: telemetry,\r\n addToWishlistButtonText: resources.elicitCart__addToWishlistButtonText,\r\n removeFromWishlistButtonText: resources.elicitCart__removeFromWishlistButtonText,\r\n removeButtonText: resources.elicitCart__removeCartButtonText,\r\n shipItText: resources.elicitCart__shipInsteadDisplayText,\r\n pickitUpText: resources.elicitCart__pickItUpDisplayText,\r\n changeStoreText: resources.elicitCart__changeStoreDisplayText,\r\n storeSelectorStateManager: this.props.data.storeSelectorStateManager.result,\r\n cartState: this.props.data.cart.result,\r\n orgUnitLocations: this.props.data.orgUnitLocations.result,\r\n removeItemClickHandler: this._removeItemFromCartHandler,\r\n moveToWishlistSuccessHandler: this._moveToWishlistSuccessHandler,\r\n updateCartLinesQuantitySuccessHandler: this._updateCartlineQuantity,\r\n wishlists: wishlists,\r\n defaultWishlistName: resources.elicitCart__defaultWishlistName,\r\n pickupDeliveryModeCode: PickupDeliveryModeCode,\r\n showImages: this.props.config.showImages,\r\n invalidProductError: this.props.resources.elicitCart__invalidProductError,\r\n outOfStockError: this.props.resources.elicitCart__outOfStockError,\r\n zeroAvailabilityError: this.props.resources.elicitCart__zeroAvailabilityError,\r\n showDiscountPercent: this.props.config.showDiscountPercent,\r\n productAttributesList: this.productAttributesList\r\n };\r\n\r\n // this ensures that all errors are populated in cart\r\n // the error object gets indirectly populated by the method\r\n _assembleCartlines(\r\n this.props.data.cart.result?.cart.CartLines || [],\r\n this.props.data.products.result || [],\r\n {\r\n ...elicitCartItemProps,\r\n cartlines: this.props.data.cart.result?.cart.CartLines || []\r\n },\r\n this.props.data.cart.result\r\n );\r\n\r\n const viewProps = {\r\n ...this.props,\r\n className: classnames('msc-cart'),\r\n title: this._title,\r\n CartlinesWrapper: { className: 'msc-cart-line' },\r\n OrderSummaryWrapper: { className: 'msc-order-summary' },\r\n OrderSummaryItems: { className: 'msc-order-summary__items' },\r\n cartlines: this.props.data.products && this.props.data.products.result && cart && cart.cart.CartLines && this._contextualLines.length > 0 ?\r\n (\r\n ElicitCartLineItems(elicitCartItemProps)\r\n ) : undefined,\r\n promoCode: cart && (\r\n \r\n ),\r\n\r\n cart: this.props.data.cart.result,\r\n context: this.props.context,\r\n typeName: this.props.typeName,\r\n telemetry: this.props.telemetry,\r\n id: this.props.id,\r\n removePromoAriaLabelFormat: resources.elicitCart__removePromoAriaLabelFormat,\r\n orderSummaryHeading: this.props.data.products && this.props.data.products.result && cart && cart.cart.CartLines && this._displaySummary && cart.cart.CartLines.length > 0 ?\r\n (\r\n

{resources.elicitCart__orderSummaryTitle}

\r\n ) : null,\r\n orderSummaryLineitems: cart && cart.cart && channelConfiguration && cart.cart.CartLines && this._displaySummary && cart.cart.CartLines.length > 0 ?\r\n (\r\n OrderSummary({\r\n cart: cart.cart,\r\n shipmentWarningText: this.props.config.shipmentWarningText as string,\r\n subTotalLabel: resources.elicitCart__itemsWithCountLabel,\r\n shippingLabel: resources.elicitCart__estimatedShippingLabel,\r\n taxLabel: resources.elicitCart__estimatedTaxLabel,\r\n orderTotalLabel: resources.elicitCart__orderTotal,\r\n totalDiscountsLabel: resources.elicitCart__totalDiscountsLabel,\r\n context: this.props.context,\r\n typeName: this.props.typeName,\r\n id: this.props.id,\r\n toBeCalculatedText: resources.elicitCart__yetToBeCalculatedText,\r\n freeText: resources.elicitCart__priceFree,\r\n channelConfiguration: channelConfiguration,\r\n telemetry: telemetry\r\n })\r\n ) :\r\n (\r\n undefined\r\n ),\r\n checkoutAsSignInUserButton: (!isCartREALLYEmpty) ?\r\n (\r\n \r\n ) : null,\r\n checkoutAsGuestButton: (!isCartREALLYEmpty && !isAuthenticated) ?\r\n (\r\n \r\n ) : null,\r\n backToShoppingButton: ,\r\n storeSelector: this.props.slots.storeSelector && this.props.slots.storeSelector.length > 0 ? this.props.slots.storeSelector[0] : null,\r\n removeItemClickHandler: this._removeItemFromCartHandler,\r\n moveToWishlistSuccessHandler: this._moveToWishlistSuccessHandler,\r\n waitingComponent: ,\r\n cartLoadingStatus: this.props.data.cart.status === 'FAILED' ? this.props.resources.elicitCart__cartLoadingErrorMessage : null,\r\n cartDataResult: !this._useForSubscriptions && this.props.data.cart.result && isAllCartEmpty,\r\n\r\n // DG: Additions to disable checkout button if an error is detected\r\n checkoutButtonDisabled: (\r\n \r\n ),\r\n cartLineStatus: this.cartLinesInvalid,\r\n mixedCart: this.mixedCart,\r\n subscriptionHeader: this._useForSubscriptions && !isCartEmpty && (\r\n \r\n ),\r\n subscriptionUpsell: this._useForSubscriptions && !isCartEmpty && (\r\n \r\n ),\r\n shouldShowCheckoutInline: this._shouldShowCheckoutInline\r\n };\r\n\r\n return this.props.renderView(viewProps) as React.ReactElement;\r\n }\r\n\r\n public usePNGImageSetting = (viewports: IImageSettingsViewports): IImageSettingsViewports => {\r\n const modifiedViewports = viewports;\r\n if (modifiedViewports?.xs?.q) {\r\n modifiedViewports.xs.q = modifiedViewports.xs.q.replace('f=jpg', 'f=png');\r\n }\r\n if (modifiedViewports?.sm?.q) {\r\n modifiedViewports.sm.q = modifiedViewports.sm.q.replace('f=jpg', 'f=png');\r\n }\r\n if (modifiedViewports?.md?.q) {\r\n modifiedViewports.md.q = modifiedViewports.md.q.replace('f=jpg', 'f=png');\r\n }\r\n if (modifiedViewports?.lg?.q) {\r\n modifiedViewports.lg.q = modifiedViewports.lg.q.replace('f=jpg', 'f=png');\r\n }\r\n if (modifiedViewports?.xl?.q) {\r\n modifiedViewports.xl.q = modifiedViewports.xl.q.replace('f=jpg', 'f=png');\r\n }\r\n\r\n return modifiedViewports;\r\n };\r\n\r\n private get _shouldShowCheckoutInline(): boolean {\r\n\r\n const lines = filterCartLines(this.props.data.cart.result?.cart);\r\n\r\n if (this._useForSubscriptions) {\r\n // if theres sub items, show\r\n if (lines.subscriptionLines.length > 0) {\r\n return true;\r\n }\r\n return false;\r\n } else {\r\n // if only non sub items, show\r\n if (lines.subscriptionLines.length === 0 && lines.lines.length > 0) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n }\r\n\r\n private _getCheckoutURL(isAuthenticated: boolean, guestCheckoutUrl: string, signInUrl: string): string {\r\n if (isAuthenticated) {\r\n return guestCheckoutUrl;\r\n }\r\n\r\n const absoluteUrlRegExp = new RegExp('^(?:[a-z]+:)?//', 'i');\r\n const isAbsoluteUrl = absoluteUrlRegExp.test(guestCheckoutUrl);\r\n let returnURL = guestCheckoutUrl;\r\n\r\n // tslint:disable-next-line: no-typeof-undefined\r\n if ((typeof window !== 'undefined') && !isAbsoluteUrl) {\r\n returnURL = `${window.location.origin}${guestCheckoutUrl}`;\r\n }\r\n\r\n return `${signInUrl}${signInUrl.indexOf('?') === -1 ? '?' : '&'}ru=${returnURL}`;\r\n }\r\n\r\n private _getImageSettings = (imageSettings: IImageSettings | undefined): IImageSettings => {\r\n return imageSettings || {\r\n viewports: {\r\n xs: { q: `w=80&h=94&m=6`, w: 0, h: 0 },\r\n sm: { q: `w=148&h=174&m=6`, w: 0, h: 0 },\r\n lg: { q: `w=148&h=174&m=6`, w: 0, h: 0 }\r\n },\r\n lazyload: true\r\n };\r\n };\r\n\r\n /**\r\n * contextual line can be either only subscription lines or only item lines\r\n */\r\n private get _contextualLines(): CartLine[] {\r\n return this.props.data.cart.result?.cart.CartLines?.filter(line => {\r\n const isSubLine = isLineSubscriptionLine(line);\r\n if (this._useForSubscriptions) {\r\n return isSubLine;\r\n } else {\r\n return !isSubLine;\r\n }\r\n }) || [];\r\n }\r\n\r\n private get _useForSubscriptions(): boolean {\r\n return !!this.props.config.useForSubscriptions;\r\n }\r\n\r\n private get _displaySummary(): boolean {\r\n return !!this.props.config.displaySummary;\r\n }\r\n\r\n private _removeItemFromCartHandler = (cartlineToRemove: CartLine) => {\r\n\r\n if (this.props.data.cart.result) {\r\n this._generateRemovalAnalyticsEvent(cartlineToRemove);\r\n\r\n delete this.cartLinesInvalid[cartlineToRemove.LineId!.toString()];\r\n\r\n const input = {\r\n cartLineIds: [cartlineToRemove.LineId!.toString()]\r\n };\r\n\r\n this.props.data.cart.result.removeCartLines(input)\r\n .catch((error) => {\r\n this.props.telemetry.warning(error);\r\n this.props.telemetry.debug('Unable to Remove Cart Line');\r\n });\r\n }\r\n };\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n private _generateRemovalAnalyticsEvent(cartlineToRemove: CartLine): void {\r\n const productID = cartlineToRemove.ProductId;\r\n if (!productID) {\r\n return;\r\n }\r\n\r\n const product = this.props.data.products.result?.find(entry => entry.RecordId === productID);\r\n const isSubscription = isLineSubscriptionLine(cartlineToRemove);\r\n\r\n publish('removeFromCart', {\r\n product,\r\n quantity: cartlineToRemove.Quantity,\r\n attributes: this.parsedProductAttributes[productID],\r\n subscription: isSubscription,\r\n frequency: isSubscription && getSubscriptionValues(this.props.data.cart.result?.cart).frequency,\r\n context: this.props.context\r\n });\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n private _generateCheckoutAnalyticsEvent(cart: ICartState, products: SimpleProduct[]): void {\r\n\r\n const subFrequency = getSubscriptionValues(this.props.data.cart.result?.cart).frequency;\r\n\r\n // Convert to the format the analytics module requires\r\n const mappedProducts = cart.cart.CartLines?.map(line => {\r\n const product = products.find(entry => entry.RecordId === line.ProductId);\r\n const isSubscription = isLineSubscriptionLine(line);\r\n\r\n return {\r\n product,\r\n quantity: line.Quantity,\r\n attributes: this.parsedProductAttributes[line.ProductId!],\r\n subscription: isSubscription,\r\n frequency: isSubscription && subFrequency,\r\n discounts: line.DiscountLines,\r\n context: this.props.context,\r\n };\r\n });\r\n\r\n publish('checkout', {\r\n step: 0, // We're counting the cart page as step 0\r\n products: mappedProducts,\r\n coupon: cart.cart.Coupons?.map(coupon => coupon.Code).join(','),\r\n });\r\n }\r\n\r\n private _moveToWishlistSuccessHandler = (result: IWishlistActionSuccessResult, cartline?: CartLine) => {\r\n if (result.status === 'ADDED' && cartline) {\r\n this._removeItemFromCartHandler(cartline);\r\n }\r\n };\r\n\r\n private _updateCartlineQuantity = (cartlineToUpdate: CartLine, quantity: number) => {\r\n if (this.props.data.cart.result) {\r\n delete this.cartLinesInvalid[cartlineToUpdate.LineId!.toString()];\r\n const input = {\r\n cartLineId: cartlineToUpdate.LineId!.toString(),\r\n newQuantity: quantity\r\n };\r\n this.props.data.cart.result.updateCartLineQuantity(input)\r\n .catch((error) => {\r\n this.props.telemetry.warning(error);\r\n this.props.telemetry.debug('Unable to update Cart Line quantity');\r\n });\r\n }\r\n };\r\n\r\n private async _setProductAttributes(): Promise {\r\n const cart = this.props.data.cart?.result?.cart;\r\n if (cart && cart.CartLines) {\r\n this.parsedProductAttributes = await getAttributesForCart(cart?.CartLines, this.props.context.actionContext);\r\n\r\n Object.entries(this.parsedProductAttributes).forEach(([id, productAttribs]) => {\r\n this.productAttributesList[id] = CommerceAttributesParser.unParseAttributes(productAttribs);\r\n });\r\n }\r\n }\r\n\r\n private async _updateSubscriptionName(): Promise {\r\n const values = getSubscriptionValues(this.props.data.cart.result?.cart);\r\n if (!values.name) {\r\n const cartChanges: CommerceProperty[] = [];\r\n cartChanges.push({\r\n Key: SubscriptionCommerceValues.SUBSCRIPTION_NAME,\r\n Value: {\r\n StringValue: SubscriptionCommerceValues.SUBSCRIPTION_DEFAULT_NAME\r\n }\r\n });\r\n await updateSubscription(this.props.data.cart, cartChanges, this.props.context);\r\n return;\r\n }\r\n }\r\n\r\n private get _title(): JSX.Element | null {\r\n const { resources } = this.props;\r\n if (this._useForSubscriptions) {\r\n if (this._contextualLines.length === 0) { return null; }\r\n return

{resources.elicitCart__subCartTitle}

;\r\n }\r\n // special case where the subscription version has both\r\n if (this._contextualLines.length === 0 && filterCartLines(this.props.data.cart.result?.cart).subscriptionLines.length > 0) {\r\n return null;\r\n }\r\n return

{resources.elicitCart__cartTitle}

;\r\n }\r\n}\r\n\r\nexport default ElicitCart;\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport {\r\n IBuyboxAddToCartViewProps,\r\n IBuyboxProductQuantityViewProps\r\n} from '@msdyn365-commerce-modules/buybox/dist/types';\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { AsyncResult } from '@msdyn365-commerce/core';\r\nimport classnames from 'classnames';\r\nimport * as React from 'react';\r\nimport { ISmweBuyboxViewProps } from '../../../modules/smwe-buybox/./smwe-buybox';\r\n\r\nconst SmweBuyboxView: React.FC = props => {\r\n const {\r\n ModuleProps,\r\n MediaGalleryContainerProps,\r\n ProductInfoContainerProps,\r\n addToCart,\r\n quantity,\r\n title,\r\n productDescription,\r\n productTitle,\r\n productPrice,\r\n productClubPrice,\r\n show,\r\n acclaimRatings,\r\n cookbookTagline,\r\n eventSchedule\r\n } = props;\r\n // @ts-ignore\r\n const tableClass: AsyncResult = props.context.actionContext.get('String', 'Generic-SkuSelectorClasses');\r\n const isGiftCard = props.data.product && props.data.product.result ? props.data.product.result.ItemId?.toLowerCase() === 'giftcard' : false;\r\n\r\n return (\r\n \r\n {props.mediaGallery}\r\n \r\n {props.productApellation && (\r\n
{props.productApellation}
\r\n )}\r\n {title}\r\n {productTitle}\r\n {productDescription}\r\n {eventSchedule}\r\n {acclaimRatings}\r\n {cookbookTagline}\r\n {show && _renderTable({\r\n addToCart: addToCart,\r\n quantity: quantity,\r\n productPrice: productPrice,\r\n productClubPrice: productClubPrice,\r\n tableClass: tableClass,\r\n isGiftCard: isGiftCard\r\n })}\r\n {props.content &&\r\n props.content.map(\r\n (contentSlotData: React.ReactNode, index: number) => {\r\n return (\r\n \r\n {contentSlotData}\r\n \r\n );\r\n }\r\n )}\r\n
\r\n
\r\n );\r\n};\r\n\r\nexport interface IRenderTable {\r\n addToCart: IBuyboxAddToCartViewProps;\r\n quantity: IBuyboxProductQuantityViewProps | undefined;\r\n productPrice: React.ReactNode;\r\n productClubPrice: React.ReactNode;\r\n isGiftCard: boolean;\r\n tableClass: AsyncResult;\r\n}\r\n\r\nconst _renderTable = (props: IRenderTable) => {\r\n const { addToCart, quantity, productPrice, productClubPrice, tableClass, isGiftCard } = props;\r\n\r\n return (\r\n
\r\n
\r\n {productPrice &&
{productPrice}
}\r\n {!isGiftCard && productClubPrice &&
{productClubPrice} Club
}\r\n
\r\n
\r\n {quantity &&
{_renderQuantity(quantity)}
}\r\n {addToCart &&
{_renderAddToCart(addToCart)}
}\r\n
\r\n
\r\n );\r\n};\r\n\r\nconst _renderAddToCart = (addToCart: IBuyboxAddToCartViewProps): JSX.Element => {\r\n const { ContainerProps, errorBlock, button } = addToCart;\r\n\r\n return (\r\n \r\n {errorBlock}\r\n {button}\r\n \r\n );\r\n};\r\n\r\nconst _renderQuantity = (quantity: IBuyboxProductQuantityViewProps): JSX.Element => {\r\n const { ContainerProps, LabelContainerProps, input, errors } = quantity;\r\n\r\n return (\r\n \r\n \r\n {errors}\r\n \r\n {input}\r\n \r\n );\r\n};\r\n\r\nexport default SmweBuyboxView;\r\n","import { Button, format } from '@msdyn365-commerce-modules/utilities';\r\nimport { getUrlSync } from '@msdyn365-commerce/core';\r\nimport { CartLine } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport { calculateSavingPercentAmount } from '../../../Utilities/elicit-savings-calculation';\r\nimport { orderSummaryShipmentCalculation } from '../../../Utilities/smwe-order-summary-shipment-calculation';\r\nimport { filterCartLines } from '../../../Utilities/subscription-manager';\r\nimport { ISubscriptionsMinicartData } from '../subscriptions-minicart.data';\r\nimport { ISubscriptionsMinicartProps } from '../subscriptions-minicart.props.autogenerated';\r\ninterface ICartDisplayComponentProps {\r\n subscriptionsProps: ISubscriptionsMinicartProps;\r\n}\r\n\r\n/**\r\n * declaration for display the minicart summary info to the user\r\n */\r\nexport class CartDisplayComponent extends React.Component {\r\n public render(): JSX.Element | null {\r\n const {\r\n subscriptionsProps: {\r\n resources: { subscriptionsMinicart__boxPrice, subscriptionsMinicart__shipping, subscriptionsMinicart__savings, subscriptionsMinicart__goToCart },\r\n data: { cart: { result: cartState } },\r\n context: {\r\n actionContext\r\n }\r\n }\r\n } = this.props;\r\n if (!cartState) { return null; }\r\n const { cart } = cartState;\r\n\r\n const savingPercent = calculateSavingPercentAmount(this._cartFilteredLines.subscriptionLines);\r\n\r\n const formatter = this.props.subscriptionsProps.context.cultureFormatter.formatCurrency;\r\n const cartUrl = getUrlSync('cart', actionContext) || '';\r\n const amount = savingPercent ? this._calculateDiscountedTotalAmount : this._calculateTotalAmount;\r\n return (\r\n
\r\n
\r\n {subscriptionsMinicart__boxPrice}\r\n
{formatter(amount || 0)}
\r\n
\r\n
\r\n {format(subscriptionsMinicart__savings, formatter(((this._calculateTotalAmount || 0) * (savingPercent / 100))), savingPercent)}\r\n
\r\n
{savingPercent}% off
\r\n
\r\n
\r\n
\r\n {subscriptionsMinicart__shipping}\r\n
{formatter(orderSummaryShipmentCalculation({ cart }).price)}
\r\n
\r\n
\r\n \r\n
\r\n
\r\n );\r\n }\r\n\r\n private get _cartFilteredLines(): {\r\n subscriptionLines: CartLine[];\r\n lines: CartLine[];\r\n } {\r\n return filterCartLines(this.props.subscriptionsProps.data.cart.result?.cart);\r\n }\r\n\r\n private get _calculateTotalAmount(): number {\r\n let amount = 0;\r\n this._cartFilteredLines.subscriptionLines.forEach(line => amount += line.NetPrice || 0);\r\n return amount;\r\n }\r\n\r\n private get _calculateDiscountedTotalAmount(): number {\r\n let amount = 0;\r\n this._cartFilteredLines.subscriptionLines.forEach(line => amount += line.TotalAmount || 0);\r\n return amount;\r\n }\r\n}","/* tslint:disable */\r\nimport { IReactComponent } from 'mobx-react/index';\r\nimport React, { Component, ComponentType } from 'react';\r\n\r\ntype subscriptionCallback = (...args: T[]) => void;\r\n\r\ntype subscription = { [uniqueId: string]: subscriptionCallback };\r\n\r\n/**\r\n * A loader that maintains a list of current namespaces. Meant to be later\r\n * singleton'd\r\n */\r\nclass EventBusLoader {\r\n\r\n // list of current buses that are in action\r\n private _buses: { [namespace: string]: BusLoader } = {};\r\n\r\n /**\r\n * get's an existing bus or creating a new bus of that namespace\r\n *\r\n * @param busNamespace the namespace of the bus to retrieve\r\n */\r\n public getBus(busNamespace: string): BusLoader {\r\n // fast return if the bus already exists\r\n if (this._buses[busNamespace]) {\r\n return this._buses[busNamespace];\r\n }\r\n\r\n // create a new bus and do the internal subscription for deleting the entire bus when bus\r\n // is empty\r\n this._buses[busNamespace] = new BusLoader();\r\n this._buses[busNamespace].subscribe('_readyForDeletion', this.deleteBus.bind(this));\r\n return this._buses[busNamespace];\r\n }\r\n\r\n /**\r\n * deletes and purges all events\r\n *\r\n * @param busNamespace the namespace of the bus to delete\r\n */\r\n public deleteBus(busNamespace: string): void {\r\n if (this._buses[busNamespace]) {\r\n this._buses[busNamespace].purge();\r\n }\r\n delete this._buses[busNamespace];\r\n }\r\n}\r\n\r\n/**\r\n * Contains a single namespace of events of the event bus\r\n */\r\nexport class BusLoader {\r\n\r\n // list of all subscriptions within this bus's namespace\r\n private _subscriptions: { [subName: string]: subscription } = {};\r\n\r\n /**\r\n * subscribe to a subscription within this namespace\r\n *\r\n * @param subName event subscription name\r\n * @param onPublish callback that triggers when subscription gets published\r\n */\r\n public subscribe(subName: string, onPublish: subscriptionCallback): { unsubscribe(): void, id: number } {\r\n\r\n // generates an ever-counting up id generator\r\n const nextId = IdGenerator();\r\n\r\n // create a new list if the bus loader contains no subscription\r\n if (!this._subscriptions[subName]) {\r\n this._subscriptions[subName] = {\r\n _readyForDeletion: () => { /* event to notify loader that this is going to be deleted */ }\r\n };\r\n }\r\n\r\n // add the subscription to the list\r\n this._subscriptions[subName][nextId] = onPublish as subscriptionCallback;\r\n\r\n // return an unsubscribe method for deleting this specific subscription\r\n return {\r\n id: nextId,\r\n unsubscribe: () => {\r\n this._purgeById(subName, nextId);\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * remove a subscription from anywhere within the namespace\r\n *\r\n * @param id subscription id\r\n */\r\n public unsubscribe(id: number): boolean {\r\n for (const subName in this._subscriptions) {\r\n if (this._subscriptions[subName][id]) {\r\n this._purgeById(subName, id);\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * publish data to all subscriptions\r\n *\r\n * @param subName subscription name to publish to\r\n * @param args data to pass into the subscribed functions\r\n */\r\n public publish(subName: string, ...args: any): void {\r\n // don't do anything if it doesnt exist and fail\r\n // gracefully\r\n if (!this._subscriptions[subName]) {\r\n return;\r\n }\r\n\r\n Object.keys(this._subscriptions[subName])\r\n .forEach(id => {\r\n this._subscriptions[subName] && this._subscriptions[subName][id] && this._subscriptions[subName][id](...args);\r\n });\r\n }\r\n\r\n /**\r\n * purge all data in the bus loader\r\n */\r\n public purge(): void {\r\n this._subscriptions = {};\r\n }\r\n\r\n /**\r\n * purges a single subscription id endpoint from a subscription\r\n * name\r\n *\r\n * @param subName subscription name\r\n * @param id subscription id\r\n */\r\n private _purgeById(subName: string, id: number) {\r\n delete this._subscriptions[subName][id];\r\n\r\n // not zero because there will always be the internal _readyForDeletion event\r\n if (Object.keys(this._subscriptions[subName]).length === 1) {\r\n this.publish('_readyForDeletion');\r\n delete this._subscriptions[subName];\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * generates a singleton of ids\r\n */\r\nconst IdGenerator = (() => {\r\n let idValue = 0;\r\n\r\n return () => {\r\n idValue += 1;\r\n return idValue;\r\n };\r\n})();\r\n\r\n/**\r\n * generates a singleton of the bus loader\r\n */\r\nconst Loader = (() => {\r\n return new EventBusLoader();\r\n})();\r\n\r\nexport function LoadBus(eventNamespace: string): (newComponent: T) => void {\r\n return (CHILD_COMP: ComponentType) => {\r\n return class extends Component {\r\n constructor(props: any) {\r\n super(props);\r\n\r\n // add to the component the bus\r\n CHILD_COMP.prototype.bus = this.bus;\r\n }\r\n\r\n // the bus's definition\r\n public get bus() { return Loader.getBus(eventNamespace); }\r\n\r\n // we arent decorating anything related to the UI so just return the child with\r\n // all it's props\r\n public render(): JSX.Element {\r\n return ;\r\n }\r\n };\r\n };\r\n}","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport {\r\n IBuyboxAddToCartViewProps,\r\n IBuyboxProductQuantityViewProps\r\n} from '@msdyn365-commerce-modules/buybox/dist/types';\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { AsyncResult } from '@msdyn365-commerce/core';\r\nimport * as React from 'react';\r\nimport Table from 'reactstrap/lib/Table';\r\nimport { ISmweBuyboxViewProps } from '../../../modules/smwe-buybox';\r\n\r\nconst SmweBuyboxView: React.FC = props => {\r\n const {\r\n ModuleProps,\r\n MediaGalleryContainerProps,\r\n ProductInfoContainerProps,\r\n addToCart,\r\n quantity,\r\n title,\r\n productDescription,\r\n productTitle,\r\n productPrice,\r\n productClubPrice,\r\n show,\r\n acclaimRatings,\r\n cookbookTagline,\r\n eventSchedule,\r\n subscriptionButton\r\n } = props;\r\n // @ts-ignore\r\n const tableClass: AsyncResult = props.context.actionContext.get('String', 'Generic-SkuSelectorClasses');\r\n const isGiftCard = props.data.product && props.data.product.result ? props.data.product.result.ItemId?.toLowerCase() === 'giftcard' : false;\r\n\r\n return (\r\n \r\n {props.mediaGallery}\r\n \r\n {props.productApellation && (\r\n
{props.productApellation}
\r\n )}\r\n {title}\r\n {productDescription}\r\n {eventSchedule}\r\n {acclaimRatings}\r\n {cookbookTagline}\r\n {show && _renderTable({\r\n addToCart: addToCart,\r\n quantity: quantity,\r\n productPrice: productPrice,\r\n productClubPrice: productClubPrice,\r\n tableClass: tableClass,\r\n isGiftCard: isGiftCard,\r\n productTitle,\r\n subscriptionButton\r\n })}\r\n {props.content &&\r\n props.content.map(\r\n (contentSlotData: React.ReactNode, index: number) => {\r\n return (\r\n
\r\n {contentSlotData}\r\n
\r\n );\r\n }\r\n )}\r\n
\r\n
\r\n );\r\n};\r\n\r\nexport interface IRenderTable {\r\n subscriptionButton?: IBuyboxAddToCartViewProps;\r\n addToCart: IBuyboxAddToCartViewProps;\r\n quantity: IBuyboxProductQuantityViewProps | undefined;\r\n productTitle: React.ReactNode;\r\n productPrice: React.ReactNode;\r\n productClubPrice: React.ReactNode;\r\n isGiftCard: boolean;\r\n tableClass: AsyncResult;\r\n}\r\n\r\nconst _renderTable = (props: IRenderTable) => {\r\n const { addToCart, quantity, productTitle, productPrice, productClubPrice, tableClass, isGiftCard, subscriptionButton } = props;\r\n\r\n return (\r\n
\r\n \r\n \r\n \r\n {productTitle && }\r\n {productPrice && !isGiftCard && }\r\n {productPrice && isGiftCard && }\r\n {!isGiftCard && productClubPrice && }\r\n {quantity && }\r\n {addToCart && \r\n \r\n \r\n \r\n {productTitle && }\r\n {productPrice && }\r\n {!isGiftCard && productClubPrice && }\r\n {quantity && }\r\n {addToCart && }\r\n {subscriptionButton && }\r\n \r\n \r\n
ProductPriceClub{_renderQuantityHeader(quantity)}}\r\n
{productTitle}{productPrice}{productClubPrice}{_renderQuantity(quantity)}{_renderAddToCart(addToCart)}{_renderAddToCart(subscriptionButton)}
\r\n
\r\n );\r\n};\r\n\r\nconst _renderAddToCart = (addToCart: IBuyboxAddToCartViewProps): JSX.Element => {\r\n const { ContainerProps, errorBlock, button } = addToCart;\r\n\r\n return (\r\n \r\n {errorBlock}\r\n {button}\r\n \r\n );\r\n};\r\n\r\nconst _renderQuantity = (quantity: IBuyboxProductQuantityViewProps): JSX.Element => {\r\n const { ContainerProps, LabelContainerProps, input, errors } = quantity;\r\n\r\n return (\r\n \r\n \r\n {errors}\r\n \r\n {input}\r\n \r\n );\r\n};\r\nconst _renderQuantityHeader = (quantity: IBuyboxProductQuantityViewProps): JSX.Element => {\r\n const { LabelContainerProps } = quantity;\r\n\r\n return (\r\n \r\n QTY\r\n \r\n );\r\n};\r\n\r\nexport default SmweBuyboxView;\r\n","//==============================================================================\r\n// Tools to aid in calculating shipping costs\r\n//\r\n// Generally, shipping is automatically calculated during checkout and left\r\n// as unknown while shopping. Sites like Elicit have a fixed shipping cost\r\n// model which is known during shopping. These tools examine the cart and\r\n// apply the model to determine shipping cost.\r\n// Note that shipping cost during checkout won't match these costs without\r\n// careful ship method setup.\r\n//==============================================================================\r\nimport { Cart } from '@msdyn365-commerce/retail-proxy';\r\nimport { CartUtilities } from './cart-utils';\r\nimport { filterCartLines } from './subscription-manager';\r\n\r\n//==============================================================================\r\n// INTERFACES AND ENUMS\r\n//==============================================================================\r\n\r\n// Incoming cart data used to perform the calculations\r\ninterface IOrderSummaryShipmentCalculation {\r\n cart: Cart;\r\n}\r\n\r\n// Calculated shipping cost information\r\ninterface IShipmentCalculationResult {\r\n price: number;\r\n summary: string;\r\n}\r\n\r\n//----------------------------------------------------------\r\n// Table of shipping charges\r\n//\r\n// legend:\r\n// G = greater than\r\n// GE = greater than / equal to\r\n// L = less than\r\n// LE = less than / equal to\r\n//----------------------------------------------------------\r\nconst CartOrderPriceGuide = {\r\n NONSUBSCRIPTION_LE_3: 10,\r\n NONSUBSCRIPTION_G_3: 20,\r\n\r\n SUBSCRIPTION_LE_3: 10,\r\n SUBSCRIPTION_GE_4_LE_5: 10,\r\n SUBSCRIPTION_GE_6_AND_LE_11: 5,\r\n SUBSCRIPTION_GE_12: 0.01,\r\n\r\n GIFT_CARDS_ONLY: 0,\r\n\r\n MIXED_ADD_PRICE: 5,\r\n};\r\n\r\n//==============================================================================\r\n// EXPORTED FUNCTIONS\r\n//==============================================================================\r\n\r\n//----------------------------------------------------------\r\n// Calculate shipping cost for Elicit-style shipping models\r\n//----------------------------------------------------------\r\nexport function orderSummaryShipmentCalculation({ cart }: IOrderSummaryShipmentCalculation): IShipmentCalculationResult {\r\n\r\n // Split the cart into subscription and non-subscription lines\r\n const filter = filterCartLines(cart);\r\n\r\n // Determine the presense and quantity of subscriptions and non-subscription items (ignoring gift cards)\r\n // This assumes gift card shipping is $0. If that value changes for any reason, this logic will need to be improved.\r\n const subscriptionCartLength = CartUtilities.countCartLineAmountNoGiftCards(filter.subscriptionLines);\r\n const nonSubscriptionCartLength = CartUtilities.countCartLineAmountNoGiftCards(filter.lines);\r\n\r\n if (!subscriptionCartLength && !nonSubscriptionCartLength) {\r\n // Gift Card(s) only\r\n return formatShipmentCalculation('GIFT_CARDS_ONLY');\r\n } else if (subscriptionCartLength && !nonSubscriptionCartLength) {\r\n // Subscription only\r\n return orderSubscriptionBased(subscriptionCartLength);\r\n } else if (!subscriptionCartLength && nonSubscriptionCartLength) {\r\n // Non-subscription only\r\n return orderNonSubscriptionBased(nonSubscriptionCartLength);\r\n } else {\r\n // Mixed cart (subscription + non-subscription)\r\n return orderMixedBased(subscriptionCartLength);\r\n }\r\n}\r\n\r\n//==============================================================================\r\n// INTERNAL FUNCTIONS\r\n//==============================================================================\r\n\r\n//----------------------------------------------------------\r\n// Handle costs for non-subscription items\r\n//----------------------------------------------------------\r\nfunction orderNonSubscriptionBased(cartLength: number): IShipmentCalculationResult {\r\n if (cartLength <= 3) {\r\n return formatShipmentCalculation('NONSUBSCRIPTION_LE_3');\r\n } else {\r\n return formatShipmentCalculation('NONSUBSCRIPTION_G_3');\r\n }\r\n}\r\n\r\n//----------------------------------------------------------\r\n// Only subscription items are in the cart\r\n//----------------------------------------------------------\r\nfunction orderSubscriptionBased(cartLength: number): IShipmentCalculationResult {\r\n if (cartLength <= 3) {\r\n return formatShipmentCalculation('SUBSCRIPTION_LE_3');\r\n } else if (cartLength <= 5) {\r\n return formatShipmentCalculation('SUBSCRIPTION_GE_4_LE_5');\r\n } else if (cartLength <= 11) {\r\n return formatShipmentCalculation('SUBSCRIPTION_GE_6_AND_LE_11');\r\n } else {\r\n return formatShipmentCalculation('SUBSCRIPTION_GE_12');\r\n }\r\n}\r\n\r\n//----------------------------------------------------------\r\n//----------------------------------------------------------\r\nfunction orderMixedBased(cartLength: number): IShipmentCalculationResult {\r\n\r\n // Start with the subscription cost\r\n const shipmentCalculationResult = orderSubscriptionBased(cartLength);\r\n\r\n // Increase the cost by a fixed amount\r\n shipmentCalculationResult.price += CartOrderPriceGuide.MIXED_ADD_PRICE;\r\n\r\n // Update the summary\r\n shipmentCalculationResult.summary = `MIXED_${shipmentCalculationResult.summary}`;\r\n\r\n return shipmentCalculationResult;\r\n}\r\n\r\n//----------------------------------------------------------\r\n// Returns a properly formatted IShipmentCalculationResult\r\n//----------------------------------------------------------\r\nfunction formatShipmentCalculation(shipCostDefinition: keyof typeof CartOrderPriceGuide): IShipmentCalculationResult {\r\n\r\n // Gift cards have a price of 0, so be careful on this check\r\n if (CartOrderPriceGuide[shipCostDefinition] !== undefined) {\r\n return {\r\n price: CartOrderPriceGuide[shipCostDefinition],\r\n summary: shipCostDefinition\r\n };\r\n }\r\n\r\n throw new Error(`Undefined shipping cost definition: ${shipCostDefinition}`);\r\n}","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { DeliveryOption as DeliveryOptionData } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport { ICheckoutDeliveryOption, ICheckoutDeliveryOptionEdit, ICheckoutDeliveryOptionsError, ICheckoutDeliveryOptionsList, ICheckoutDeliveryOptionsViewProps } from './smwe-checkout-delivery-options';\r\ninterface ICheckoutDeliveryOptionsListFiltered extends ICheckoutDeliveryOptionsList {\r\n globalConfig?: {\r\n [x: string]: unknown;\r\n };\r\n options?: DeliveryOptionData[];\r\n}\r\n\r\ntype ModShipping = {\r\n id: number;\r\n amount: number;\r\n}[];\r\n\r\nconst DeliveryOptionList: React.FC = ({\r\n DeliveryOptionsList,\r\n list,\r\n globalConfig,\r\n options\r\n}) => {\r\n if (!list || list.length === 0) {\r\n return null;\r\n }\r\n\r\n const pennyShippingMethodIds = globalConfig?.pennyShippingIds as number[] || [];\r\n const modShippingMethodIds = globalConfig?.modShippingIds as ModShipping || [];\r\n\r\n let localList: ICheckoutDeliveryOptionEdit[] = [];\r\n if (options) {\r\n // maps options with list for sorting\r\n const combinedList: {option: DeliveryOptionData; list: ICheckoutDeliveryOptionEdit}[] = [];\r\n options.map((option, index) => combinedList.push({option: option, list: list[index]}));\r\n // sort list by lowest to highest price\r\n const combinedListSorted = combinedList.sort((a, b) => (a.option.ShippingChargeAmount! > b.option.ShippingChargeAmount!) ? 1 : ((b.option.ShippingChargeAmount! > a.option.ShippingChargeAmount!) ? -1 : 0));\r\n combinedListSorted.forEach((deliveryData) => {\r\n if (deliveryData.list) {\r\n // search to find out if it is a mod shipping method\r\n const isModShippingMethod = modShippingMethodIds.find(modShipping => Number(modShipping.id) === deliveryData.option.RecordId);\r\n // backwards compatibility for penny shipping\r\n const isPennyShippingMethod = pennyShippingMethodIds.find(pennyShipping => Number(pennyShipping) === deliveryData.option.RecordId);\r\n\r\n // Filter out mod shipping methods that are declared\r\n // in the global config, only show shipping methods\r\n // that have a matching mod price for the customer at this current time\r\n // of checkout. If it's not a mod shipping method, always display\r\n // it.\r\n if (isModShippingMethod && deliveryData.option.ShippingChargeAmount === isModShippingMethod.amount) {\r\n localList.push(deliveryData.list);\r\n } else if (isPennyShippingMethod && deliveryData.option.ShippingChargeAmount === 0.01) {\r\n localList.push(deliveryData.list);\r\n } else if (!isModShippingMethod && !isPennyShippingMethod) {\r\n localList.push(deliveryData.list);\r\n }\r\n }\r\n });\r\n }\r\n // just in case options doesn't load in, fail safely back to the original\r\n // list\r\n if (localList.length === 0) { localList = list; }\r\n return (\r\n \r\n {localList.map((deliveryOption: ICheckoutDeliveryOptionEdit) => {\r\n return (\r\n \r\n {deliveryOption.price}\r\n );\r\n })}\r\n \r\n );\r\n};\r\n\r\nconst DeliveryOptionSelected: React.FC = ({\r\n DeliveryOption,\r\n description,\r\n price,\r\n}) => {\r\n\r\n return (\r\n \r\n {description}\r\n {price}\r\n \r\n );\r\n};\r\n\r\nconst ErrorMessage: React.FC = ({\r\n Error,\r\n title,\r\n message,\r\n}) => {\r\n\r\n return (\r\n \r\n {title}\r\n {message}\r\n \r\n );\r\n};\r\n\r\nconst CheckoutDeliveryOptionsView: React.FC = props => {\r\n const { CheckoutDeliveryOptions,\r\n viewState,\r\n deliveryOptions,\r\n deliveryOptionsData,\r\n deliveryOptionSelected,\r\n errorMessage,\r\n waiting,\r\n saveButton,\r\n editButton,\r\n cancelButton } = props;\r\n return (\r\n // TODO: All wrapper div should be provided by viewProps. Once SDK provide the sln, update markup.\r\n \r\n {viewState.isLoading && waiting}\r\n {viewState.isError && errorMessage && }\r\n {viewState.isShowList && deliveryOptions && }\r\n {viewState.isShowSelected && deliveryOptionSelected && }\r\n {viewState.isShowSaveButton && saveButton}\r\n {viewState.isShowEditButton && editButton}\r\n {viewState.isShowCancelButton && cancelButton}\r\n \r\n );\r\n};\r\n\r\nexport default CheckoutDeliveryOptionsView;","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { DeliveryOption as DeliveryOptionData } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport { ICheckoutDeliveryOption, ICheckoutDeliveryOptionEdit, ICheckoutDeliveryOptionsError, ICheckoutDeliveryOptionsList, ICheckoutDeliveryOptionsViewProps } from '../../../modules/smwe-checkout-delivery-options/./smwe-checkout-delivery-options';\r\nimport { orderSummaryShipmentCalculation } from '../../../Utilities/smwe-order-summary-shipment-calculation';\r\ninterface ICheckoutDeliveryOptionsListFiltered extends ICheckoutDeliveryOptionsList {\r\n globalConfig?: {\r\n [x: string]: unknown;\r\n };\r\n options?: DeliveryOptionData[];\r\n props: React.PropsWithChildren;\r\n\r\n}\r\n\r\ntype ModShipping = {\r\n id: number;\r\n amount: number;\r\n}[];\r\n\r\nconst DeliveryOptionList: React.FC = ({\r\n DeliveryOptionsList,\r\n list,\r\n globalConfig,\r\n options,\r\n props\r\n}) => {\r\n const cart = props.checkoutState?.checkoutCart.cart;\r\n if (!list || list.length === 0 || !cart) {\r\n return null;\r\n }\r\n\r\n let cartRequirements = orderSummaryShipmentCalculation({ cart }).summary;\r\n const shippingState = props.checkoutState?.shippingAddress?.State;\r\n if (shippingState === 'AK' || shippingState === 'HI') {\r\n cartRequirements = `${cartRequirements}_AKHI`;\r\n }\r\n\r\n const shippingMethodTiers = globalConfig && globalConfig.shipmentMethodTiers as {} || {};\r\n const allowedShippingMethodIds = shippingMethodTiers[cartRequirements] as string[] || [];\r\n const pennyShippingMethodIds = globalConfig?.pennyShippingIds as number[] || [];\r\n const modShippingMethodIds = globalConfig?.modShippingIds as ModShipping || [];\r\n const localList: ICheckoutDeliveryOptionEdit[] = [];\r\n if (options) {\r\n // maps options with list for sorting\r\n const combinedList: { option: DeliveryOptionData; list: ICheckoutDeliveryOptionEdit }[] = [];\r\n options.map((option, index) => combinedList.push({ option: option, list: list[index] }));\r\n // sort list by lowest to highest price\r\n const combinedListSorted = combinedList.sort((a, b) => (a.option.ShippingChargeAmount! > b.option.ShippingChargeAmount!) ? 1 : ((b.option.ShippingChargeAmount! > a.option.ShippingChargeAmount!) ? -1 : 0));\r\n combinedListSorted.forEach((deliveryData) => {\r\n if (deliveryData.list) {\r\n // search to find out if it is a mod shipping method\r\n const allowedShippingMethod = allowedShippingMethodIds.find(shippingMethodId => Number(shippingMethodId) === deliveryData.option.RecordId);\r\n const isModShippingMethod = modShippingMethodIds.find(modShipping => Number(modShipping.id) === deliveryData.option.RecordId);\r\n // backwards compatibility for penny shipping\r\n const isPennyShippingMethod = pennyShippingMethodIds.find(pennyShipping => Number(pennyShipping) === deliveryData.option.RecordId);\r\n\r\n // Filter out penny shipping methods that are declared\r\n // in the global config, only show shipping methods\r\n // that have a price of 0.01 for the customer at this current time\r\n // of checkout. If it's not a penny shipping method, always display\r\n // it.\r\n if (isModShippingMethod && deliveryData.option.ShippingChargeAmount === isModShippingMethod.amount) {\r\n localList.push(deliveryData.list);\r\n } else if (isPennyShippingMethod && deliveryData.option.ShippingChargeAmount === 0.01) {\r\n localList.push(deliveryData.list);\r\n } else if (!isModShippingMethod && !isPennyShippingMethod && allowedShippingMethod) {\r\n localList.push(deliveryData.list);\r\n }\r\n }\r\n });\r\n }\r\n // in case options doesn't load in or undefined, display error message\r\n if (localList.length === 0) {\r\n return (\r\n
\r\n {props.resources.shippingMethodConfigError}\r\n
\r\n );\r\n }\r\n\r\n const currentMethodAllowed = localList.find((item) => {\r\n return props.selectedItemId === item.code;\r\n });\r\n if (!currentMethodAllowed) {\r\n const event = { currentTarget: { value: localList[0].code } } as React.ChangeEvent;\r\n props.onDeliveryOptionChange(event);\r\n }\r\n\r\n return (\r\n \r\n {localList.map((deliveryOption: ICheckoutDeliveryOptionEdit) => {\r\n return (\r\n \r\n {deliveryOption.price}\r\n );\r\n })}\r\n \r\n );\r\n};\r\n\r\nconst DeliveryOptionSelected: React.FC = ({\r\n DeliveryOption,\r\n description,\r\n price,\r\n}) => {\r\n\r\n return (\r\n \r\n {description}\r\n {price}\r\n \r\n );\r\n};\r\n\r\nconst ErrorMessage: React.FC = ({\r\n Error,\r\n title,\r\n message,\r\n}) => {\r\n\r\n return (\r\n \r\n {title}\r\n {message}\r\n \r\n );\r\n};\r\n\r\nconst CheckoutDeliveryOptionsView: React.FC = props => {\r\n const { CheckoutDeliveryOptions,\r\n viewState,\r\n deliveryOptions,\r\n deliveryOptionsData,\r\n deliveryOptionSelected,\r\n errorMessage,\r\n waiting,\r\n saveButton,\r\n editButton,\r\n cancelButton } = props;\r\n return (\r\n // TODO: All wrapper div should be provided by viewProps. Once SDK provide the sln, update markup.\r\n \r\n {viewState.isLoading && waiting}\r\n {viewState.isError && errorMessage && }\r\n {viewState.isShowList && deliveryOptions && }\r\n {viewState.isShowSelected && deliveryOptionSelected && }\r\n {viewState.isShowSaveButton && saveButton}\r\n {viewState.isShowEditButton && editButton}\r\n {viewState.isShowCancelButton && cancelButton}\r\n \r\n );\r\n};\r\n\r\nexport default CheckoutDeliveryOptionsView;","//==============================================================================\r\n//==============================================================================\r\nimport { get, groupBy, uniq } from 'lodash';\r\n\r\nimport { IActionContext } from '@msdyn365-commerce/core';\r\nimport { searchAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { CartLine, ProductProperty, ProductSearchCriteria } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { IContext } from '@msdyn365-commerce/retail-proxy/dist/Interfaces';\r\n\r\n//==============================================================================\r\n//==============================================================================\r\nexport interface IAttributeList {\r\n [attributeName: string]: string;\r\n}\r\n\r\nexport interface IAttributeBank {\r\n [productId: number]: IAttributeList;\r\n}\r\n\r\n//==============================================================================\r\n//==============================================================================\r\nlet attributeCache: IAttributeBank = {};\r\n\r\n//----------------------------------------------------------\r\n// Given a set of product IDs, return product attributes for\r\n// all of them.\r\n//\r\n// Returns an IAttributeBank, grouped by product ID then\r\n// attribute name.\r\n//----------------------------------------------------------\r\nasync function fetchProductAttributes(productIDs: number[], context: IActionContext): Promise {\r\n\r\n // Fetch product information from retail server\r\n const ctx: IContext = { callerContext: context };\r\n const productSearchCriteria: ProductSearchCriteria = {\r\n Ids: productIDs,\r\n Context: {\r\n ChannelId: context.requestContext.apiSettings.channelId,\r\n CatalogId: context.requestContext.apiSettings.catalogId\r\n },\r\n };\r\n\r\n const result = await searchAsync(ctx, productSearchCriteria);\r\n\r\n // Transform results into a useful format\r\n return result.reduce(\r\n (output, product) => {\r\n const translatedProperties: ProductProperty[] = get(product, 'ProductProperties[0].TranslatedProperties', []);\r\n\r\n // Convert from an array of records to a hash of values\r\n output[product.RecordId] = translatedProperties.reduce(\r\n (attributes, property) => {\r\n if (property.FriendlyName && property.ValueString) {\r\n attributes[property.FriendlyName] = property.ValueString;\r\n }\r\n\r\n return attributes;\r\n },\r\n {} as IAttributeList\r\n );\r\n\r\n return output;\r\n },\r\n {} as IAttributeBank\r\n );\r\n}\r\n\r\n//----------------------------------------------------------\r\n// Given a set of product IDs, return product attributes for\r\n// all of them.\r\n//\r\n// Uses a local cache at the product ID level to prevent\r\n// duplicate requests.\r\n//\r\n// Returns an IAttributeBank, grouped by product ID then\r\n// attribute name.\r\n//----------------------------------------------------------\r\nexport async function getAttributesByProductID(productIDs: number[], context: IActionContext): Promise {\r\n\r\n // Split IDs into cached and uncached groups\r\n const groupedIDs = groupBy(productIDs, id => (attributeCache[id] ? 'cached' : 'uncached'));\r\n\r\n // Fetch products not already in the cache\r\n const uncachedAttributes = groupedIDs.uncached ? await fetchProductAttributes(groupedIDs.uncached, context) : {};\r\n\r\n // Merge new products into the cache\r\n attributeCache = {...attributeCache, ...uncachedAttributes};\r\n\r\n // Add cached entries to the result\r\n const result = uncachedAttributes; // This does nothing except change the name. Referring to the combined result as \"uncached\" is unclear.\r\n groupedIDs.cached && groupedIDs.cached.forEach(id => {\r\n result[id] = attributeCache[id];\r\n });\r\n\r\n return result;\r\n}\r\n\r\n//----------------------------------------------------------\r\n// Given an array of cart lines, return product attributes for\r\n// all products in the cart\r\n//----------------------------------------------------------\r\nexport function getAttributesForCart(cartLines: CartLine[], context: IActionContext): Promise {\r\n\r\n // Create a list of product IDs from the cart lines, removing any duplicates\r\n const productIDs = uniq(cartLines.map(line => line.ProductId!));\r\n\r\n // Fetch the attributes for the requested products\r\n return getAttributesByProductID(productIDs, context);\r\n}","import {\r\n IBuyboxAddToCartViewProps,\r\n IBuyboxProductQuantityViewProps\r\n} from '@msdyn365-commerce-modules/buybox/dist/types';\r\nimport { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { AsyncResult } from '@msdyn365-commerce/core';\r\nimport * as React from 'react';\r\nimport { ISmweBuyboxViewProps } from '../../../modules/smwe-buybox/smwe-buybox';\r\nimport { ISmweBuyboxProps } from '../definition-extensions/smwe-buybox.ext.props.autogenerated';\r\n\r\nconst SmweBuyboxView: React.FC> = props => {\r\n const { subscriptionButton, ModuleProps, MediaGalleryContainerProps, ProductInfoContainerProps, addToCart, quantity, title, productDescription, productPrice, show, acclaimRatings, cookbookTagline, eventSchedule } = props;\r\n // @ts-ignore\r\n const tableClass: AsyncResult = props.context.actionContext.get('String', 'Generic-SkuSelectorClasses');\r\n return (\r\n \r\n
\r\n {props.productApellation && <>{props.productApellation}}\r\n {title}\r\n
\r\n
\r\n \r\n {props.mediaGallery}\r\n \r\n {props.tastingNotes}\r\n
\r\n \r\n {props.productApellation && <>{props.productApellation}}\r\n {title}\r\n {productDescription}\r\n {eventSchedule}\r\n {acclaimRatings}\r\n {cookbookTagline}\r\n {show &&
\r\n {productPrice &&
{productPrice}
}\r\n {quantity &&
{_renderQuantity(quantity)}
}\r\n {addToCart &&
{_renderAddToCart(addToCart)}
}\r\n {subscriptionButton &&
{_renderAddToCart(subscriptionButton)}
}\r\n
}\r\n {props.content &&\r\n props.content.map(\r\n (contentSlotData: React.ReactNode, index: number) => {\r\n return (\r\n \r\n {contentSlotData}\r\n \r\n );\r\n }\r\n )\r\n }\r\n
\r\n {props.slots?.productCollection?.length &&\r\n
\r\n {props.slots.productCollection.map(\r\n (productCollectionSlotData: React.ReactNode, index: number) => {\r\n return (\r\n \r\n {productCollectionSlotData}\r\n \r\n );\r\n }\r\n )\r\n }\r\n
\r\n }\r\n
\r\n );\r\n};\r\n\r\nconst _renderAddToCart = (addToCart: IBuyboxAddToCartViewProps): JSX.Element => {\r\n const { ContainerProps, errorBlock, button } = addToCart;\r\n\r\n return (\r\n \r\n {errorBlock}\r\n {button}\r\n \r\n );\r\n};\r\n\r\nconst _renderQuantity = (quantity: IBuyboxProductQuantityViewProps): JSX.Element => {\r\n const { ContainerProps, LabelContainerProps, input, errors } = quantity;\r\n\r\n return (\r\n \r\n \r\n {errors}\r\n \r\n {input}\r\n \r\n );\r\n};\r\n\r\nexport default SmweBuyboxView;\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { IOrderSummaryLines } from '@msdyn365-commerce-modules/order-summary-utilities';\r\nimport { Alert, INodeProps, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { IDictionary } from '@msdyn365-commerce/core';\r\nimport classnames from 'classnames';\r\nimport * as React from 'react';\r\nimport { IElicitCartlinesViewProps } from './components/elicit-cart-line-items';\r\nimport { IElicitCartViewProps } from './elicit-cart';\r\n\r\nconst _renderCartlines = (\r\n cartLines: IElicitCartlinesViewProps[] | undefined,\r\n cartEmptyText: string,\r\n CartlinesWrapper: INodeProps,\r\n storeSelector: React.ReactNode | undefined,\r\n backToShoppingButton: React.ReactNode,\r\n waitingComponent: React.ReactNode,\r\n cartLoadingStatus: string,\r\n cartDataResult: boolean,\r\n itemsTitle: string,\r\n qtyTitle: string,\r\n unitPriceTitle: string,\r\n totalTitle: string\r\n): JSX.Element[] | JSX.Element => {\r\n if (cartLoadingStatus) {\r\n return <>{cartLoadingStatus};\r\n }\r\n if (cartLines) {\r\n return (\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n {cartLines.map((cartLine, index) => {\r\n return (\r\n
\r\n {cartLine.cartline}\r\n {storeSelector && cartLine.pickUpInStore ? (\r\n \r\n {cartLine.pickUpInStore.defaultComponent}\r\n \r\n ) : null}\r\n
\r\n );\r\n })}\r\n
\r\n \r\n
{itemsTitle}{qtyTitle}{unitPriceTitle}{totalTitle}
\r\n );\r\n } else {\r\n return cartDataResult ? (\r\n
\r\n

{cartEmptyText}

\r\n {backToShoppingButton}\r\n
\r\n ) : (\r\n <>{waitingComponent}\r\n );\r\n }\r\n};\r\n\r\nconst _renderOrderSummarylines = (\r\n orderSummaryLines: IOrderSummaryLines | undefined,\r\n OrderSummaryItems: INodeProps,\r\n props: IElicitCartViewProps\r\n): JSX.Element | null => {\r\n if (!orderSummaryLines) {\r\n return null;\r\n }\r\n return (\r\n \r\n {orderSummaryLines.subtotal}\r\n {orderSummaryLines.shipping}\r\n {orderSummaryLines.tax}\r\n {orderSummaryLines.totalDiscounts\r\n ? orderSummaryLines.totalDiscounts\r\n : null}\r\n {orderSummaryLines.orderTotal}\r\n

{props.resources.elicitCart__conditionsText}

\r\n
\r\n );\r\n};\r\n\r\n// Detect invalid items in the cart. Items are flagged externally via the Comment field\r\nconst _isInvalidCart = (cartLinesInvalid: IDictionary): boolean => {\r\n\r\n for (const lineId of Object.keys(cartLinesInvalid)) {\r\n if (cartLinesInvalid[lineId]) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\n//==================================================\r\n//==================================================\r\nconst ElicitCartView: React.FC = (props: IElicitCartViewProps) => {\r\n const preventCheckout = _isInvalidCart(props.cartLineStatus) || props.mixedCart.isMixedCart;\r\n const { faqLink } = props.config;\r\n\r\n return (\r\n \r\n {props.cartlines && props.title}\r\n {props.subscriptionUpsell}\r\n {props.subscriptionHeader}\r\n \r\n \r\n \r\n \r\n {_renderCartlines(\r\n props.cartlines,\r\n props.resources.elicitCart__emptyCartText,\r\n props.CartlinesWrapper,\r\n props.storeSelector,\r\n props.backToShoppingButton,\r\n props.waitingComponent,\r\n props.cartLoadingStatus,\r\n props.cartDataResult,\r\n props.resources.elicitCart__itemsTitle,\r\n props.resources.elicitCart__qtyTitle,\r\n props.resources.elicitCart__unitPriceTitle,\r\n props.resources.elicitCart__totalTitle\r\n )}\r\n \r\n {props.shouldShowCheckoutInline && (preventCheckout ? props.checkoutButtonDisabled : props.checkoutAsSignInUserButton)}\r\n {props.orderSummaryHeading && (\r\n \r\n
\r\n {props.orderSummaryHeading}\r\n {\r\n faqLink?.linkUrl?.destinationUrl &&\r\n \r\n }\r\n
\r\n {_renderOrderSummarylines(\r\n props.orderSummaryLineitems,\r\n props.OrderSummaryItems,\r\n props\r\n )}\r\n
\r\n {props.promoCode}\r\n
\r\n \r\n {preventCheckout ? props.checkoutButtonDisabled : props.checkoutAsSignInUserButton}\r\n {props.backToShoppingButton}\r\n \r\n
\r\n )}\r\n
\r\n );\r\n};\r\n\r\nexport default ElicitCartView;","import { ICartState } from '@msdyn365-commerce/global-state';\r\nimport debounce from 'lodash/debounce';\r\nimport { observable, reaction } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport * as React from 'react';\r\nimport { CartUtilities } from '../Utilities/cart-utils';\r\nimport { BusLoader, LoadBus } from '../Utilities/event-bus';\r\nimport { filterCartLines } from '../Utilities/subscription-manager';\r\n\r\ninterface IEditSelectComponentProps {\r\n currentQuantity: number;\r\n cartLineId?: string;\r\n isSubLine?: boolean;\r\n cart?: ICartState;\r\n zeroAvailabilityError?: boolean;\r\n shouldDisableQty?: boolean;\r\n _updateQuantityRaw(quantity: number): void;\r\n}\r\n\r\n/**\r\n * edit component\r\n */\r\n@LoadBus('elicit-amount-selector')\r\n@observer\r\nexport class ElicitAmountSelector extends React.Component {\r\n\r\n private bus: BusLoader | undefined;\r\n @observable private _trackedTotal: number | undefined;\r\n\r\n public constructor(constProps: IEditSelectComponentProps) {\r\n super(constProps);\r\n this._setQuantity = debounce(this._setQuantity.bind(this), 500);\r\n this._upQuantity = this._upQuantity.bind(this);\r\n this._downQuantity = this._downQuantity.bind(this);\r\n this._onQuantityChange = this._onQuantityChange.bind(this);\r\n this._postValidateQuantity = this._postValidateQuantity.bind(this);\r\n\r\n if (this.props.isSubLine) {\r\n this._trackedTotal = filterCartLines(this.props.cart?.cart).subscriptionLines.length;\r\n reaction(\r\n () => [this.props.cart, this.props.cart?.cart, this.props.cart?.cart.CartLines],\r\n () => {\r\n const unrelatedLines = filterCartLines(this.props.cart?.cart).subscriptionLines.filter(line => line.LineId !== this.props.cartLineId);\r\n this._trackedTotal = CartUtilities.countCartLineAmount(unrelatedLines);\r\n }\r\n );\r\n\r\n this.bus?.subscribe('added-locally', () => {\r\n this._trackedTotal!++;\r\n });\r\n\r\n this.bus?.subscribe('removed-locally', () => {\r\n this._trackedTotal!--;\r\n });\r\n\r\n this.bus?.subscribe('delta-change-local', (delta: number) => {\r\n this._trackedTotal! -= delta;\r\n });\r\n }\r\n\r\n this.state = { quantityState: this.props.currentQuantity };\r\n }\r\n\r\n public render(): JSX.Element {\r\n return (\r\n
\r\n \r\n { /* tslint:disable-next-line: react-a11y-role-has-required-aria-props react-this-binding-issue */}\r\n \r\n \r\n
\r\n );\r\n }\r\n\r\n private get _canAddMore(): boolean {\r\n if (!this.props.isSubLine) { return true; }\r\n return this.state.quantityState + this._trackedTotal! < 12;\r\n }\r\n\r\n private _upQuantity(): void {\r\n this.setState({ quantityState: this.state.quantityState + 1 });\r\n this.props.isSubLine && this.bus?.publish('added-locally');\r\n this._setQuantity();\r\n }\r\n\r\n private _downQuantity(): void {\r\n if (this.state.quantityState - 1 < 1) { return; }\r\n this.setState({ quantityState: this.state.quantityState - 1 });\r\n this.props.isSubLine && this.bus?.publish('removed-locally');\r\n this._setQuantity();\r\n }\r\n\r\n private _onQuantityChange({ target }: React.ChangeEvent): void {\r\n this.setState({ quantityState: parseInt(target.value, 10) });\r\n }\r\n\r\n private _postValidateQuantity({ target }: React.ChangeEvent): void {\r\n if (this.props.isSubLine) {\r\n if ((this._trackedTotal! + parseInt(target.value, 10)) <= 12) {\r\n this.setState({ quantityState: parseInt(target.value, 10) });\r\n this.bus?.publish('delta-change-local', this._trackedTotal! - parseInt(target.value, 10));\r\n } else {\r\n this.setState({ quantityState: 1 });\r\n }\r\n } else {\r\n if (parseInt(target.value, 10) > 0) {\r\n this.setState({ quantityState: parseInt(target.value, 10) });\r\n } else {\r\n this.setState({ quantityState: 1 });\r\n }\r\n }\r\n this._setQuantity();\r\n }\r\n\r\n private _setQuantity(): void {\r\n this.props._updateQuantityRaw(this.state.quantityState);\r\n }\r\n}\r\n","export * from './dropdown';\r\nexport * from './dropdown.props';","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport * as React from 'react';\r\nimport { ISubscriptionsMinicartViewProps } from './subscriptions-minicart';\r\n\r\nexport default ({\r\n bottleCountComponent,\r\n editBoxComponent,\r\n cartDisplaySummaryComponent,\r\n subscriptionBannerDisplayComponent\r\n}: ISubscriptionsMinicartViewProps) => {\r\n return (\r\n
\r\n
\r\n {subscriptionBannerDisplayComponent}\r\n
\r\n
\r\n {bottleCountComponent}\r\n
\r\n {editBoxComponent}\r\n {cartDisplaySummaryComponent}\r\n
\r\n
\r\n
\r\n );\r\n};\r\n"],"sourceRoot":""}