{"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/modules/smwe-product-collection/smwe-product-collection.props.autogenerated.ts?697c","webpack:///./src/Utilities/single-slide-carousel.tsx?f065","webpack:///./src/modules/smwe-product-collection/smwe-product-collection.tsx?f93a","webpack:///./src/modules/elicit-subscriptions/components/modal.tsx?345a","webpack:///./src/components/elicit-cartlineitem.component.tsx?6a35","webpack:///./src/modules/subscriptions-minicart/components/box-edit.component.tsx?f42a","webpack:///./src/modules/elicit-subscriptions/components/refine-item.tsx?9653","webpack:///./src/modules/smwe-search-result-container/components/title.tsx?b71f","webpack:///./src/modules/smwe-search-result-container/components/utilities.ts?6641","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/elicit-subscriptions/components/link.tsx?679e","webpack:///./src/modules/smwe-buybox/smwe-buybox.view.tsx?fbd7","webpack:///./src/modules/smwe-search-result-container/components/range-refine-item.tsx?65bc","webpack:///./src/modules/elicit-subscriptions/components/utilities.ts?5532","webpack:///./src/modules/elicit-subscriptions/elicit-subscriptions.tsx?b039","webpack:///./src/themes/stemichelle-new/views/smwe-buybox.view.tsx?06b1","webpack:///./src/modules/smwe-search-result-container/components/modal.tsx?afe2","webpack:///./src/Utilities/product-lightbox.tsx?a7c0","webpack:///./src/components/product.component.tsx?d9d6","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/modules/elicit-subscriptions/components/index.ts?cb68","webpack:///../../../src/module-state-manager/module-state.ts?7579","webpack:///../../../src/module-state-manager/with-module-state.tsx?61ca","webpack:///./src/modules/elicit-subscriptions/components/error-message.tsx?eba5","webpack:///./src/modules/elicit-subscriptions/components/choice-summary.tsx?41db","webpack:///./src/modules/elicit-subscriptions/components/refine-submenu.tsx?dbe0","webpack:///./src/modules/smwe-search-result-container/components/refine-pulldown.tsx?8e80","webpack:///./src/modules/smwe-search-result-container/smwe-search-result-container.tsx?8098","webpack:///./src/Utilities/refiners.ts?59e9","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/dataActions/search-result-container/index.ts?e779","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/modules/smwe-search-result-container/components/refine-item.tsx?893c","webpack:///./src/themes/fth/views/smwe-buybox.view.tsx?48ab","webpack:///./src/modules/elicit-subscriptions/components/product-search-result-items.tsx?3d57","webpack:///./src/modules/smwe-search-result-container/components/index.ts?6cb7","webpack:///./src/themes/blend/views/smwe-search-result-container.view.tsx?17e4","webpack:///./src/modules/smwe-search-result-container/components/link.tsx?3108","webpack:///./src/modules/elicit-subscriptions/components/separator.tsx?501c","webpack:///./src/modules/elicit-subscriptions/elicit-subscriptions.view.tsx?e3eb","webpack:///./src/modules/smwe-search-result-container/components/separator.tsx?bafa","webpack:///./src/modules/subscriptions-minicart/components/cart-display.component.tsx?2f3a","webpack:///./src/Utilities/event-bus.tsx?eb5b","webpack:///./src/Utilities/smwe-order-summary-shipment-calculation.tsx?9ab2","webpack:///./src/modules/elicit-subscriptions/components/title.tsx?f8cb","webpack:///./src/themes/emp/views/smwe-search-result-container.view.tsx?c361","webpack:///./src/modules/smwe-search-result-container/smwe-search-result-container.view.tsx?6069","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/modules/smwe-search-result-container/components/choice-summary.tsx?0632","webpack:///./src/themes/elicit/views/smwe-search-result-container.view.tsx?4578","webpack:///./src/Utilities/get-product-attributes.tsx?b745","webpack:///./src/modules/smwe-search-result-container/components/product-search-result-items.tsx?265d","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","webpack:///./src/modules/smwe-product-collection/smwe-product-collection.view.tsx?4b91","webpack:///./src/modules/elicit-subscriptions/components/range-refine-item.tsx?f6b4","webpack:///./src/modules/smwe-search-result-container/components/error-message.tsx?6625","webpack:///./src/modules/smwe-search-result-container/components/refine-submenu.tsx?b934"],"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","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","key","freqLabel","updates","cartChanges","change","Key","StringValue","updateSubscription","_pushUpdateToCart","SUBSCRIPTION_NAME","frequncy","_submitSubscriptionToCart","SUBSCRIPTION_FREQUENCY","__decorate","observable","observer","layout","HeadingTag","SingleSlideCarousel","carouselSize","slideSize","itemSize","_onResized","_onCarouselResized","_nextSlide","_previousSlide","_handleTouchStart","_handleTouchEnd","_onFocus","showPrevious","showNext","offset","activeItem","ref","slideRef","itemRef","direction","parentId","scrollThreshold","touchScrollThreshold","componentDidUpdate","carousel","current","slide","_setSizes","_updateFlippers","vertical","resizeThrottledEventHandler","addThrottledEvent","componentWillUnmount","removeEventListener","isVert","slidePositionStyle","modifiedChildren","_getClonedChildren","carouselClass","carouselSlideClass","overflowClass","previousFlipperGlyph","nextFlipperGlyph","previousFlipperClassName","nextFlipperClassName","disableClassName","onTouchStart","onTouchEnd","Flipper","tabIndex","glyphProps","flipperPrevLabel","displayTooltip","style","role","useTabList","flipperNextLabel","children","child","index","castChild","verticalItemsSelector","itemsSelector","onFocus","_moveSingleSlide","evt","touches","scrollStart","screenY","screenX","changedTouches","delta","_setActiveItem","abs","round","next","currentOffset","getCSS","maxScrollCount","floor","directionModifier","isNaN","maxScrollDistance","distanceToEdge","scrollHeight","scrollWidth","_calculateCarouselSize","carouselStyle","getComputedStyle","padding","parseFloat","paddingTop","paddingBottom","paddingLeft","paddingRight","clientHeight","clientWidth","_canScrollPrevious","_canScrollNext","_scrollItemIntoView","offsetTop","offsetLeft","updateOffset","left","top","setTimeout","parentElement","scrollTop","scrollLeft","currentTarget","min","ProductCollection","_getProduct","imageSettings","showPrice","passedProps","categoryHierarchy","availibity","clubPrice","clubPricing","ProductContainer","productComponent","ProductCard","ratingAriaLabel","AverageRating","parentProps","addToCartMessage","giftCardText","displayQuantitySlider","availability","products","productCollection","_getClubPricing","_getProductavailabilty","impressions","AttributeValues","list","isCarousel","headingComponent","productCollectionViewProps","SingleSlideCarouselComponentProps","flipperPrevious","flipperNext","ProductCollectionContainer","GridComponentProps","projectDomain","ChannelId","CatalogId","catalogId","affiliations","affiliationId","AffiliationId","productIds","clubPricingAll","getActivePricesAsync","callerContext","Date","formattedResponse","getEstimatedAvailabilityAsync","ProductIds","DefaultWarehouseOnly","ProductWarehouseInventoryAvailabilities","PhysicalAvailable","ModalToggle","innerRef","SearchResultModal","modal","modalNode","modalHeader","modalHeaderNode","modalFooter","modalFooterNode","modalBody","ModalBody","Modal","autoFocus","applicationNode","returnFocusRef","returnRef","toggle","onModalToggle","zIndex","ModalHeader","modalTitle","ModalFooter","Button","modalCloseButtonText","SmweCartLine","isSalesLine","productUrl","primaryImageUrl","showImages","gridSettings","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","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","ItemTaxGroupId","cartLineOnChange","updateFormFieldToCartLine","clearTimeout","handleChange","_renderGiftCardPrompt","BoxEditComponent","_popupState","_removeItemFromCartHandler","cartlineToRemove","_generateRemovalAnalyticsEvent","cartLineIds","removeCartLines","warning","debug","productID","entry","subscription","_moveToWishlistSuccessHandler","_updateCartlineQuantity","cartlineToUpdate","updateCartLineQuantity","_onBoxNameChange","_publishBoxNameChange","_togglePopup","_emptyCart","frequencyId","initialValues","_selectedFrequencyId","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","rel","fade","horizontalPosition","verticalPosition","modalClassName","ElicitCartLineItems","editBoxWarning","newName","newFreq","linesToRemove","lineIds","line","onBoxNameChange","onFrequencyChange","availabilityAll","RefineItem","_onClick","preventDefault","parentProductRefinerHierarchy","productRefinerValue","selectedRefinementCriterion","onToggle","isSelecting","anchorType","focus","isChecked","isDisabled","refineItemCommonProps","attrs","LeftValueBoundString","JSON","stringify","isSingleSelect","RefinerTypeValue","ProductRefinerTypeValue","Single","itemTypeClassName","inputType","SourceValue","ProductRefinerSource","Rating","KeyName","LeftValueBoundLocalizedString","_getRefinerUrl","hideCount","moduleId","moduleTypeName","Count","urlBuilder","Title","ProductRefinerValueDataTypeValue","findMatchingRefinementCriterion","refinementCriteria","refinementCriterion","isMatchingRefinementCriterion","RefinerRecordId","RefinerSourceValue","DataTypeValue","Range","getUpdatedRefinementCriteria","itemToggleNotification","currentRefinementCriteria","updatedRefinementCriteria","toggledItemFound","selectedCriterion","rangeStart","RightValueBoundString","rangeEnd","List","Boolean","Values","matchingIndex","findIndex","criterion","splice","formatPrice","amount","currency","locale","trace","priceAmount","Number","Intl","NumberFormat","currencyDisplay","minimumFractionDigits","SubscriptionsMinicart","usePNGImageSetting","modifiedViewports","md","xl","modifiedImageSettings","_boxName","_frequencyId","run","exec","getActiveCartProductsAction","ActiveCartProductsInput","_eventId","bus","subscribe","refreshCart","unsubscribe","renderProps","baseProps","boxName","subscriptionBannerDisplayComponent","SubscriptionBannerDisplayComponent","subscriptionName","editBoxComponent","bottleCountComponent","BottleCountDisplay","subscriptionProps","cartDisplaySummaryComponent","CartDisplayComponent","subscriptionsProps","LoadBus","selectMenu","selectedIndex","selectedValue","innerText","selected","hidden","Link","_renderTable","tableClass","isGiftCard","Table","borderless","responsive","size","scope","_renderQuantity","_renderAddToCart","Node","SmweBuyboxView","get","Module","contentSlotData","RangeRefineItem","_formattedPriceReverseLookup","Map","_onRangeUpdate","_onRangeUpdateEnd","_handleRangeTooltipText","_changeMin","_changeMax","_finishChangeMin","_finishChangeMax","minInput","maxInput","initialMin","initialMax","validationErrorMin","validationErrorMax","selectedMin","selectedMax","touchedMin","touchedMax","UnitText","rangeType","_renderInputFields","_renderSlider","formAttrs","rangeNameFormat","minInputClassName","maxInputClassName","formattedSelectedMin","_getFormattedSelectedValue","formattedSelectedMax","minLabel","maxLabel","placeholderTextMax","sliderId","ariaAttributes","minPrice","_formatPrice","maxPrice","selectedMinPrice","selectedMaxPrice","Slider","inForm","step","orientation","labels","labelId","labelString","labelPositioning","showLabels","showTooltip","sliderThumbs","minValueSliderThumbAriaLabel","currencyCode","ariaValueText","maxValueSliderThumbAriaLabel","onChangeEnd","handleTooltipText","_changeValue","selectedKey","touchedKey","_getInputWithoutFormatting","selectedMinValue","minTouched","maxNum","validationErrorNaN","_focus","_validateRange","selectedMaxValue","maxTouched","minNum","touched","validationError","validationErrorRange","has","set","inputAsNum","sliderChangeNotification","eventType","firstThumbValue","secondThumbValue","_focusOnSliderThumb","element","document","getElementById","tooltip","computed","SmweSearchResultContainer","sortByDropdownOptions","showSortByDropdown","_pageType","urlTokens","pageType","_refinersFiltered","_initialProductResultCount","_addSortByDropdownOptions","showSortingByRelevance","sortOptions","sortByOptionRelevanceDesc","showSortingByName","sortByOptionNameAsc","sortByOptionNameDesc","showSortingByPrice","sortByOptionPriceAsc","sortByOptionPriceDesc","showSortingByRating","sortByOptionRatingDesc","_getSearchResultModal","modalIsOpen","_modalToggleRef","_toggleModal","_getCollectionTitle","collectionTitle","query","SmweSearchResultContainer_1","getFriendlyName","NameTranslations","productCountNumber","productCountText","listPageState","totalProductCount","numberOfProducts","oneProduct","TitleContainer","titlePrefix","searchTextPrefix","titleText","titleCount","_getCategoryHierarchy","CategoryHierarchyContainer","categoryHierarchyList","categoryLinkAriaLabel","Url","categoryHierarchySeparator","Separator","separator","_getSortingDropDown","activeDropdown","_getCurrentlySelectedOption","sortingState","selectedSortByOption","SortingContainer","sortByDropDown","LabeledDropdown","labelClassname","labelText","sortByDropdownLabel","dropdownClassname","toggleColor","dropdownOptions","selectedOption","onSelectOption","_updateSortByDropdown","_sortAndFilterContainerRef","_getPagination","fullUrl","getCurrentUrl","itemsPerPage","skipCount","currentPageNumber","skip","totalItems","previousText","nextText","totalActiveProducts","activeProducts","UncontrolledPagination","paginationAriaLabel","url","qsp","items","startingItem","previousAriaLabel","nextAriaLabel","_getRefineMenu","tempRangeTypeTODO","inputRange","validRefiners","refiners","refiner","activeRefiners","activeFilters","RefineMenuContainer","RefinerSectionContainer","productRefinerHierarchy","RefineSubmenu","highestLevelRefinerText","highestLevelItem","selectedRefinerValues","_refineItemCommonProps","refinerMinimizeText","refinerExpandText","minimizedRefiners","onUpdateRefiners","_onUpdateRefiners","_buildRefinerUrl","isExpandedOnInitialLoad","collapseRefiners","_getChoiceSummary","selectedRefiners","ChoiceSummary","classNames","clearAllText","choiceSummaryLabel","selectedChoices","refinerHierarchy","choiceFormat","choiceRangeValueFormat","onChoiceClicked","_onChoiceClicked","_buildRefinerUrlForChoiceSummary","choiceAriaLabel","requestContext","history","pushState","buildListPageUrl","_getSortColumnFromSelectedOption","transaction","sortingCritera","Columns","searchConfiguration","mappedConfiguration","sortColumn","sortCriteria","activeSortColumn","parseQueryParam","activeMappedConfig","mappedSearchConfig","ColumnName","IsDescending","dropdownOption","newRefinementCriteria","clearAll","dropdownElementId","dropdownElement","selectedChoice","choiceClicked","selectedRefiner","isClearAll","_viewport","device","_updateViewport","checkoutState","pending","validationErrorNotNumber","validationErrorNotRange","querySorting","sorting","parse","decodeURIComponent","pageSize","hydrateRefinersFromUrl","filterInvalidCategories","refinerRemappers","_emitImpressionEvent","GetFullProductsByCollectionInput","Paging","Top","Skip","Sorting","itemId","getCollectionProducts","productResults","nameTranslations","nameTranslation","Language","Text","addEventListener","paragraph","showPagination","errorText","resultCategoryNotFoundText","resultSearchNotFoundText","productsComponent","ProductSearchResultItems","disableQuantitySlider","_shouldDisableQuantityAddition","maxAdditionLimit","_subscriptionQuantityLimit","moduleType","categoryDescription","_getCategoryDescription","searchResultContainerViewProps","TitleViewProps","refineMenu","SearchResultContainer","sortByOptions","showSortBy","pagination","ProductsContainer","ProductSectionContainer","CategoryNavContainer","RefineAndProductSectionContainer","choiceSummary","modalToggle","searchResultModal","isMobile","ErrorMessage","_getViewport","MsDyn365","isBrowser","innerWidth","quantityLimit","filteredLines","checkoutCart","unselectable","ProductLightbox","onMessage","isTrusted","origin","iframeSrcObj","URL","iframeSrc","cartInput","GlobalStateInput","BaseCartState","newCart","getCartState","update","_closeModal","_openModal","lightboxClassName","iframeClassName","iframeId","_launchLightboxButton","buttonText","width","height","qtyAddedToCart","renderAttribute","renderPrice","ProductComponent","msdyn365Commerce","createComponentOverride","component","savingsText","subscriptionBtnText","showStarRating","launchLightboxButtonText","productLightboxHref","productLightboxWidth","productLightboxHeight","productLightboxClassName","productLightboxIframeClassName","cardBanner","recordId","productLightboxProps","domainUrl","urlParts","indexOf","_getEndpoint","requestUrl","appellation","banner","imageProductClass","getProductPageUrlSync","imageUrl","PrimaryImageUrl","giftCardImage","img","imageProps","loadFailureBehavior","renderProductPlacementImage","AcclaimRatingsDisplay","numberToShow","showReviewer","showDate","renderAcclaim","totalRatings","numRatings","renderRating","TotalRatings","Fragment","renderProductLightboxButton","ProductComponentWrapper","Component","_onQuantityChange","_generateQuantityControl","showAsDropdown","disable","cartMessage","_decreaseCartQuantity","_increaseCartQuantity","_onClickAddToCart","_onClickAddToSubscription","addToCartSubId","finishAddToCartSubId","bottleSize","outOfStock","quantityControl","CustomerContextualPrice","_isAdditionInvalid","cartQty","TotalItems","elicitAddItemIdToCart","onAddToCartAction","DeliveryMode","elicitAddSubscriptionItemIdToCart","onSubscribeAction","cartQuantity","lines","_maxBottleCount","_fillBottleList","_generateBottleListFromProducts","bottleList","newBottleIndex","_specializeIndex","rollingIndex","fragments","_getProductFromLine","lineIdx","alt","currentIndex","subscriptionsMinicart__discount10Percent","subscriptionsMinicart__discount15Percent","productCollectionSlotData","getCacheKey","getCacheObjectType","dataCacheType","getModuleStates","ctx","cacheKey","ModuleStatesCacheKey","moduleStates","withModuleState","WrappedComponent","_super","_this","states","_a","hasInitialized","hasError","isRequired","isCancellable","isSubmitContainer","childIds","moduleState","validate","isReady","isUpdating","isPending","isSkipped","isCancelAllowed","shouldSubmitContainer","hasExternalSubmitGroup","hasModuleState","setIsRequired","setIsCancellable","setIsSubmitContainer","setHasError","onReady","onUpdating","onPending","onSkip","onDisable","getModule","getModuleStateManager","getModuleByTypeName","getModuleStateManagerByTypeName","init","options","__assign","_moduleState","modules","source","module","isMatch","allMatched","skipSkippableItem","_validateLeaf","method","childId","_validateContainer","enableControl","initializeState","__extends","ModuleState","closeButtonGlyph","stopPropagation","getAttribute","_getSelectedRefinerChoice","itemClicked","nextItemToFocus","nextSibling","_getKeyForRefinerValue","selectedRefinersMap","listItemProps","overallFormat","rangeFormat","refinerValueName","refinerName","parent","hierarchy","RangeInput","isMinimizedRefiner","_onToggleItem","_onToggleSubmenu","_expandCategoryRefiner","isExpanded","expanded","minimizedRefinersList","some","keyName","_renderChildItems","Collapse","timeout","_renderRange","_renderSingleMultiSelect","listItems","_getSortedValueList","sortedList","sort","nextOption","curOption","curOptionName","nextOptionName","localeCompare","dividedList","topLevel","minimizedElement","buttonElement","textContent","RefinePulldown","_handleClickOutsidePulldown","pulldown","pulldownElement","contains","classList","_getPulldownText","_getActiveRefinersText","spanElement","formatedActiveRefiners","substring","body","subMenus","pulldownRefiners","pulldownButtonText","pulldownText","remappers","categoryRemapper","remapRecord","originalName","categoryRefinerName","categoryRefiners","categoryIDs","CheckoutDeliveryOptionsDescription","CheckoutDeliveryOptionsErrorMessage","CheckoutDeliveryOptionsErrorTitle","CheckoutDeliveryOptionsRadioButton","ariaSetSize","ariaPosInSet","checked","CheckoutDeliveryOptions","selectedItemId","isLoading","onEdit","onCancel","onSubmit","canShip","getCartLinesForShipping","getDeliveryOptionSelected","selectedItem","deliveryOption","DeliveryOption","DescriptionComponent","getErrorMessage","errorMessageTitle","CheckoutDeliveryOptionsError","ErrorTitleComponent","ErrorMessageComponent","getDeliveryOptionList","code","radioButton","RadioButtonComponent","onDeliveryOptionChange","getSaveButton","saveBtnLabel","onSave","getEditButton","editBtnLabel","getCancelButton","cancelBtnLabel","setError","clearError","updateCartDeliverySpecification","savedDeliveryOption","getSavedDeliveryOption","cartLinesForShipping","deliveryModeId","checkout","updateCartDeliverySpecificationInput","shippingAddress","response","genericErrorMessage","ProductType","EventDeliveryMode","getDeliveryOptions","cartId","Id","getDeliveryOptionsAsync","queryResultSettings","deliveryOptionsNotFound","loadDeliveryOptions","isError","isShowList","isShowSelected","deliveryOptionsData","errorMessageData","viewState","isShowSaveButton","isShowEditButton","isShowCancelButton","classname","DeliveryOptionsList","deliveryOptionSelected","waiting","Waiting","saveButton","editButton","cancelButton","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","_assembleCartlines","reactNodes","productTypeInit","check","isMixedProduct","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","deliveryMode","getDeliveryConfiguration","shippingPrice","orderSummaryShipmentCalculation","subtotal","subTotalLabel","tax","taxLabel","orderTotal","orderTotalLabel","shipping","shippingLabel","shipmentWarningText","giftCardAmount","giftCardTotalValue","giftCards","giftCard","Balance","_computeGiftCardAmount","totalAmountAfterGiftCard","loyalty","loyaltyLabel","giftcardLabel","totalDiscounts","totalDiscountsLabel","ElicitPromoCode","_onInputChange","promoCodeInputValue","canApply","_applyPromotion","appliedPromo","addPromoCode","promoCode","duplicatePromoCodeErrorText","invalidPromoCodeErrorText","failedToAddPromoCodeErrorText","_renderForm","promoPlaceholderText","promoCodeApplyButtonText","_removePromotion","removePromoCodes","promoCodes","failedToRemovePromoCodeErrorText","_calculateDiscount","discountAmount","discountLine","DiscountCost","_renderAppliedPromoCode","Coupons","appliedPromoCodeHeadingText","appliedPromoCodeSubheadingText","coupon","removePromoAriaLabelFormat","removePromoText","isCollapseOpen","promoCodeHeadingText","ElicitPromoCodeComponent","createComponent","ElicitSubscriptionUpsell","savingRatioAmount","savingRatio","showUpsell","upsellPercent","upsellBottleCount","_renderUpsellCTA","editSubscriptionLink","link","linkText","ElicitCart","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","useForSubscriptions","displaySummary","isSubscription","subFrequency","mappedProducts","discounts","getAttributesForCart","entries","productAttribs","unParseAttributes","elicitCart__subCartTitle","elicitCart__cartTitle","elicitSubscriptions_buyboxSubscriptionBtnTxt","addToBoxMessagePlp","renderSort","renderRefiner","submenu","createSearchResultModal","modalProps","createModalBody","renderTitle","showResultPrefix","categoryNamePrefix","SmweSearchResultContainerView","showRefiners","showResultCount","renderTitleCount","SearchResultContainerView","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","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","Error","renderRefinerPulldown","activeRefinersText","getActiveRefinersText","dynamicPulldownText","getPulldownText","togglePulldown","DeliveryOptionList","globalConfig","pennyShippingMethodIds","pennyShippingIds","modShippingMethodIds","modShippingIds","localList","combinedList","a","b","ShippingChargeAmount","deliveryData","isModShippingMethod","modShipping","isPennyShippingMethod","pennyShipping","DeliveryOptionSelected","CheckoutDeliveryOptionsView","cartRequirements","shippingState","State","allowedShippingMethodIds","shipmentMethodTiers","allowedShippingMethod","shippingMethodId","shippingMethodConfigError","attributeCache","getAttributesByProductID","productIDs","groupedIDs","uncachedAttributes","uncached","productSearchCriteria","Ids","Context","searchAsync","output","translatedProperties","FriendlyName","ValueString","fetchProductAttributes","cached","addToCartTextPlp","addToCartMessagePlp","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","_postValidateQuantity","_trackedTotal","unrelatedLines","quantityState","_canAddMore","_renderCarousel","carouselContainer","_renderProduct","_renderGrid","gridContainer","ProductCollectionView"],"mappings":"8WAKM,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,EAA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K7M,MAAMgjC,wBAC1B2U,EAAYC,SAASpwC,KAAK+C,GAE1BotC,EAAYzD,QAAQ1sC,KAAK+C,KAI1B,IAAIotC,EAAYC,YAAaD,EAAYzD,SAG5CqC,yBACJ,MAAMsB,EAAmBpb,SAASC,eAAT,mCAAoD7vB,KAAK7M,MAAM8iC,wBAAwB12B,WAC1G0rC,EAAgBrb,SAASC,eAAT,0CAA2D7vB,KAAK7M,MAAM8iC,wBAAwB12B,WAChHyrC,GAAoBC,IACe,gCAA/BD,EAAiBv3C,WACjBu3C,EAAiBv3C,UAAY,+BAC7Bw3C,EAAcC,YAAclrC,KAAK7M,MAAMojC,sBAEvCyU,EAAiBv3C,UAAY,8BAC7Bw3C,EAAcC,YAAclrC,KAAK7M,MAAMqjC,qBAMxCN","file":"static/js/12.98fd604b449ce2e89d89.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) => {\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.txt in the project root for license information.\r\n * ISmweProductCollection contentModule Interface Properties\r\n * THIS FILE IS AUTO-GENERATED - MANUAL MODIFICATIONS WILL BE LOST\r\n */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\nexport const enum layout {\r\n carousel = 'carousel',\r\n grid = 'grid'\r\n}\r\n\r\nexport interface ISmweProductCollectionConfig extends Msdyn365.IModuleConfig {\r\n addToCart?: boolean;\r\n productCollection: Msdyn365.IProductList;\r\n heading?: IHeadingData;\r\n layout?: layout;\r\n imageSettings?: Msdyn365.IImageSettings;\r\n className?: string;\r\n showPrice?: boolean;\r\n showStarRating?: boolean;\r\n launchLightboxButtonText?: string;\r\n productLightboxHref: string;\r\n productLightboxWidth: number;\r\n productLightboxHeight: number;\r\n productLightboxClassName?: string;\r\n productLightboxIframeClassName?: string;\r\n cardBanner?: string;\r\n showQuantityAsDropdown?: boolean;\r\n}\r\n\r\nexport interface ISmweProductCollectionResources {\r\n priceFree: string;\r\n ratingAriaLabel: string;\r\n flipperNext: string;\r\n flipperPrevious: string;\r\n originalPriceText: string;\r\n currentPriceText: string;\r\n addToCartText: string;\r\n addToCartMessage: string;\r\n giftCardText: string;\r\n}\r\n\r\nexport const enum HeadingTag {\r\n h1 = 'h1',\r\n h2 = 'h2',\r\n h3 = 'h3',\r\n h4 = 'h4',\r\n h5 = 'h5',\r\n h6 = 'h6'\r\n}\r\n\r\nexport interface IHeadingData {\r\n text: string;\r\n tag?: HeadingTag;\r\n}\r\n\r\nexport interface ISmweProductCollectionProps extends Msdyn365.IModule {\r\n resources: ISmweProductCollectionResources;\r\n config: ISmweProductCollectionConfig;\r\n}\r\n","import { addThrottledEvent, Flipper, getCSS } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\n\r\ninterface ISingleSlideCarouselState {\r\n showPrevious: boolean;\r\n showNext: boolean;\r\n offset: number;\r\n activeItem: number;\r\n}\r\n\r\ninterface ISingleSlideCarouselProps {\r\n flipperNextLabel?: string;\r\n flipperPrevLabel?: string;\r\n vertical?: boolean;\r\n touchScrollThreshold?: number;\r\n parentId?: string;\r\n useTabList?: boolean;\r\n}\r\n\r\n/**\r\n * SingleSlideCarousel\r\n */\r\nexport default class SingleSlideCarousel extends React.PureComponent {\r\n private static itemsSelector: string = 'msc-ss-carousel-item';\r\n private static verticalItemsSelector: string = 'msc-ss-carousel-vert-item';\r\n private direction: string;\r\n private item: HTMLElement | undefined;\r\n private slide: HTMLElement | undefined;\r\n private carousel: HTMLElement | undefined;\r\n private carouselSize: number = 0;\r\n private slideSize: number = 0;\r\n private itemSize: number = 0;\r\n private resizeThrottledEventHandler?: (event: Event) => void;\r\n private ref: React.RefObject;\r\n private slideRef: React.RefObject;\r\n private itemRef: React.RefObject;\r\n private id: string;\r\n private scrollStart: number | undefined;\r\n private scrollThreshold: number;\r\n\r\n constructor (props: ISingleSlideCarouselProps) {\r\n super(props);\r\n this._nextSlide = this._nextSlide.bind(this);\r\n this._previousSlide = this._previousSlide.bind(this);\r\n this._handleTouchStart = this._handleTouchStart.bind(this);\r\n this._handleTouchEnd = this._handleTouchEnd.bind(this);\r\n this._onFocus = this._onFocus.bind(this);\r\n this._onResized = this._onResized.bind(this);\r\n this.state = { showPrevious: false, showNext: false, offset: 0, activeItem: 0 };\r\n this.ref = React.createRef();\r\n this.slideRef = React.createRef();\r\n this.itemRef = React.createRef();\r\n this.direction = 'left';\r\n this.id = props.parentId || '';\r\n this.scrollThreshold = this.props.touchScrollThreshold !== undefined ? this.props.touchScrollThreshold : 100;\r\n }\r\n\r\n public componentDidUpdate (): void {\r\n this.carousel = this.ref.current!;\r\n this.slide = this.slideRef.current!;\r\n this.item = this.itemRef.current!;\r\n this._setSizes();\r\n this._updateFlippers(this.state.offset);\r\n }\r\n\r\n public componentDidMount (): void {\r\n this.direction = this.props.vertical ? 'top' : 'left';\r\n this.carousel = this.ref.current!;\r\n this.slide = this.slideRef.current!;\r\n this.item = this.itemRef.current!;\r\n this._setSizes();\r\n this.resizeThrottledEventHandler =\r\n window && addThrottledEvent(window, 'resize', this._onResized as EventListener);\r\n this._updateFlippers(0);\r\n }\r\n\r\n public componentWillUnmount (): void {\r\n window && window.removeEventListener('resize', this.resizeThrottledEventHandler!, false);\r\n }\r\n\r\n public render (): JSX.Element {\r\n const isVert: boolean = this.props.vertical === true;\r\n const slidePositionStyle = {} as React.CSSProperties;\r\n const modifiedChildren = this._getClonedChildren(isVert);\r\n slidePositionStyle[this.direction] = `${this.state.offset}px`;\r\n const carouselClass = (isVert) ? 'msc-ss-carousel-vert' : 'msc-ss-carousel';\r\n const carouselSlideClass = (isVert) ? 'msc-ss-carousel-vert-slide' : 'msc-ss-carousel-slide';\r\n const overflowClass = (isVert) ? 'msc-ss-carousel-vert-strip' : 'msc-ss-carousel-strip';\r\n const previousFlipperGlyph = (isVert) ? 'msi-chevron-up' : 'msi-chevron-left';\r\n const nextFlipperGlyph = (isVert) ? 'msi-chevron-down' : 'msi-chevron-right';\r\n const previousFlipperClassName = (isVert) ? 'msc-ss-carousel-vert__flipper' : 'msc-ss-carousel__flipper';\r\n const nextFlipperClassName = (isVert) ? 'msc-ss-carousel-vert__flipper msc-ss-carousel-vert__flipper--next' : 'msc-ss-carousel__flipper msc-ss-carousel__flipper--next';\r\n const disableClassName = !this.state.showPrevious || !this.state.showNext ? 'disabled' : null;\r\n return (\r\n \r\n 0 ? true : false}\r\n />\r\n
\r\n
    \r\n {modifiedChildren}\r\n
\r\n
\r\n 0 ? true : false}\r\n />\r\n
\r\n );\r\n }\r\n\r\n private _getClonedChildren (isVert: boolean): React.DetailedReactHTMLElement, HTMLElement>[] {\r\n return React.Children.map(this.props.children, (child: React.ReactNode, index: number) => {\r\n const castChild = (child as React.ReactChild) as React.ReactElement;\r\n if (index === 1) {\r\n return React.cloneElement(castChild, {\r\n className: `${isVert ? SingleSlideCarousel.verticalItemsSelector : SingleSlideCarousel.itemsSelector} ${(this.state.activeItem) === index ? 'active' : ''} ${castChild.props.className}`,\r\n // @ts-ignore\r\n ref: this.itemRef,\r\n onFocus: this._onFocus\r\n });\r\n }\r\n return React.cloneElement(castChild, {\r\n className: `${isVert ? SingleSlideCarousel.verticalItemsSelector : SingleSlideCarousel.itemsSelector} ${(this.state.activeItem) === index ? 'active' : ''} ${castChild.props.className}`,\r\n // @ts-ignore\r\n onFocus: this._onFocus\r\n });\r\n });\r\n }\r\n\r\n private _nextSlide (): void {\r\n this._moveSingleSlide(true);\r\n }\r\n\r\n private _previousSlide (): void {\r\n this._moveSingleSlide(false);\r\n }\r\n\r\n private _handleTouchStart(evt: React.TouchEvent): void {\r\n if (evt.touches.length === 0) {\r\n this.scrollStart = undefined;\r\n } else {\r\n this.scrollStart = this.props.vertical === true ? evt.touches[0].screenY : evt.touches[0].screenX;\r\n }\r\n }\r\n\r\n private _handleTouchEnd(evt: React.TouchEvent): void {\r\n if (evt.changedTouches.length > 0 && this.scrollStart !== undefined) {\r\n const newTarget: number = this.props.vertical === true ? evt.changedTouches[0].screenY : evt.changedTouches[0].screenX;\r\n\r\n const delta = newTarget - this.scrollStart;\r\n\r\n if (delta > this.scrollThreshold) {\r\n this._previousSlide();\r\n }\r\n\r\n if (delta < -this.scrollThreshold) {\r\n this._nextSlide();\r\n }\r\n }\r\n\r\n this.scrollStart = undefined;\r\n\r\n return;\r\n }\r\n\r\n private _setActiveItem (offset: number): void {\r\n if (offset === 0) {\r\n this.setState({ activeItem: 0 });\r\n } else {\r\n this.setState({ activeItem: Math.abs(Math.round(offset / this.itemSize)) });\r\n }\r\n }\r\n\r\n private _moveSingleSlide (next: boolean): void {\r\n let currentOffset = parseInt(getCSS(this.slide!, this.direction), 10);\r\n const carouselSize = this.carouselSize;\r\n\r\n let maxScrollCount = Math.floor(carouselSize / (this.itemSize));\r\n const directionModifier = next ? -1 : 1;\r\n currentOffset = !isNaN(currentOffset) && typeof currentOffset === 'number' ? currentOffset : 0;\r\n\r\n if (maxScrollCount === 0) {\r\n maxScrollCount = 1;\r\n }\r\n\r\n maxScrollCount = carouselSize % (this.itemSize) === 0 ? maxScrollCount - 1 : maxScrollCount;\r\n maxScrollCount = Math.max(maxScrollCount, 1);\r\n const maxScrollDistance = maxScrollCount * (this.itemSize);\r\n\r\n let distanceToEdge = next ? this.slideSize - carouselSize + currentOffset : Math.abs(currentOffset);\r\n distanceToEdge = Math.max(0, distanceToEdge);\r\n\r\n const offset =\r\n maxScrollDistance <= distanceToEdge\r\n ? maxScrollDistance * directionModifier + currentOffset\r\n : distanceToEdge * directionModifier + currentOffset;\r\n\r\n this._setActiveItem(offset);\r\n this._updateFlippers(offset);\r\n }\r\n\r\n private _setSizes (): void {\r\n const item = this.item;\r\n if (!!item) {\r\n this.itemSize = this.props.vertical ? item.scrollHeight : item.scrollWidth;\r\n } else {\r\n this.itemSize = 0;\r\n }\r\n\r\n this.carouselSize = this._calculateCarouselSize();\r\n this.slideSize = this.slide ? (this.props.vertical ? this.slide.scrollHeight : this.slide.scrollWidth) : 0;\r\n }\r\n\r\n private _calculateCarouselSize (): number {\r\n if (!this.carousel) {\r\n return 0;\r\n }\r\n\r\n const carouselStyle = getComputedStyle(this.carousel);\r\n\r\n const padding = this.props.vertical ? parseFloat(carouselStyle.paddingTop || '') + parseFloat(carouselStyle.paddingBottom || '')\r\n : parseFloat(carouselStyle.paddingLeft || '') + parseFloat(carouselStyle.paddingRight || '');\r\n\r\n return this.props.vertical ? this.carousel.clientHeight - padding : this.carousel.clientWidth - padding;\r\n }\r\n\r\n private _canScrollPrevious (offset: number): boolean {\r\n return !isNaN(offset) && offset !== 0;\r\n }\r\n\r\n private _canScrollNext (offset: number): boolean {\r\n if (this.carouselSize + Math.abs(offset) >= this.slideSize) {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _updateFlippers (offset: number): void {\r\n this.setState({\r\n showPrevious: this._canScrollPrevious(offset),\r\n showNext: this._canScrollNext(offset),\r\n offset: offset\r\n });\r\n }\r\n\r\n private _scrollItemIntoView (item: HTMLElement): void {\r\n const carouselSize = this.carouselSize;\r\n let offset = (this.props.vertical) ? item.offsetTop : item.offsetLeft;\r\n let updateOffset = false;\r\n\r\n const left = parseInt(getCSS(this.slide!, 'left'), 10) || 0;\r\n const top = parseInt(getCSS(this.slide!, 'top'), 10) || 0;\r\n\r\n if (this.props.vertical) {\r\n if (top < 0 && -top > offset) {\r\n if (offset !== 0) {\r\n offset = -offset + 1;\r\n }\r\n updateOffset = true;\r\n } else if (top + offset > carouselSize - this.itemSize) {\r\n offset = carouselSize - this.itemSize - offset - 1;\r\n updateOffset = true;\r\n }\r\n } else if (this.direction === 'left') {\r\n if (left < 0 && -left > offset) {\r\n if (offset !== 0) {\r\n offset = -offset + 1;\r\n }\r\n updateOffset = true;\r\n } else if (left + offset > carouselSize - this.itemSize) {\r\n offset = carouselSize - this.itemSize - offset - 1;\r\n updateOffset = true;\r\n }\r\n }\r\n\r\n if (updateOffset) {\r\n this._updateFlippers(offset);\r\n\r\n if (this.props.vertical) {\r\n setTimeout(() => {\r\n (this.slide as Node).parentElement!.scrollTop = 0;\r\n }, 0);\r\n } else {\r\n setTimeout(() => {\r\n (this.slide as Node).parentElement!.scrollLeft = 0;\r\n }, 0);\r\n }\r\n }\r\n }\r\n\r\n private _onFocus (event: React.FocusEvent): void {\r\n const target = event.currentTarget as HTMLElement;\r\n this._scrollItemIntoView(target);\r\n }\r\n\r\n private _onCarouselResized (): void {\r\n this._setSizes();\r\n let offset = parseInt(getCSS(this.slide!, this.direction), 10);\r\n\r\n // Ensure the carousel slide fits across the entire alotted space\r\n if (!isNaN(offset) && offset < 0 && this.slideSize + offset < this.carouselSize) {\r\n offset = Math.min(0, this.carouselSize - this.slideSize);\r\n }\r\n\r\n this._updateFlippers(offset);\r\n }\r\n\r\n private _onResized = (): void => {\r\n this._onCarouselResized();\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 classnames from 'classnames';\r\nimport * as React from 'react';\r\n\r\nimport { format, Heading, IComponentNodeProps, IModuleProps, INodeProps, ISingleSlideCarouselProps, NodeTag } from '@msdyn365-commerce-modules/utilities';\r\nimport { AffiliationLoyaltyTier, ProductAvailableQuantity, ProductPrice, ProductSearchResult, ProjectionDomain } from '@msdyn365-commerce/retail-proxy';\r\nimport { getActivePricesAsync, getEstimatedAvailabilityAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\n\r\nimport ProductCard from '../../components/product.component';\r\nimport { publish } from '../../Utilities/analytics/analytics-dispatcher';\r\nimport CommerceAttributesParser from '../../Utilities/commerce-attributes-parser';\r\nimport SingleSlideCarousel from '../../Utilities/single-slide-carousel';\r\n\r\nimport { ISmweProductCollectionData } from './smwe-product-collection.data';\r\nimport { ISmweProductCollectionProps, layout } from './smwe-product-collection.props.autogenerated';\r\n\r\nexport interface IProductCollectionViewProps extends ISmweProductCollectionProps {\r\n heading?: React.ReactNode;\r\n ProductCollectionContainer: IModuleProps;\r\n SingleSlideCarouselComponentProps: INodeProps;\r\n GridComponentProps: INodeProps;\r\n products: IProductComponentViewProps[];\r\n isCarousel: boolean;\r\n}\r\n\r\nexport interface IProductComponentViewProps {\r\n ProductContainer: INodeProps;\r\n productComponent: React.ReactNode;\r\n}\r\n\r\nexport interface IProductCollectionState {\r\n clubPricing: ProductPrice[] | undefined;\r\n productAvailability: ProductAvailableQuantity[] | undefined;\r\n}\r\n\r\n/**\r\n * ProductCollection component\r\n */\r\nclass ProductCollection extends React.PureComponent, IProductCollectionState> {\r\n\r\n constructor(props: ISmweProductCollectionProps, state: IProductCollectionState) {\r\n super(props);\r\n\r\n this.state = {\r\n clubPricing: undefined,\r\n productAvailability: undefined\r\n };\r\n }\r\n\r\n public componentDidMount(): void {\r\n const products = this.props.config.productCollection.products;\r\n\r\n if (products && products.length) {\r\n void this._getClubPricing(products);\r\n void this._getProductavailabilty(products);\r\n\r\n const impressions = products.map(product => ({\r\n product,\r\n attributes: CommerceAttributesParser.getParsedAttributes(product.AttributeValues || []),\r\n }));\r\n\r\n publish('impression', {\r\n products: impressions,\r\n\r\n list: 'Product Collection', // Could be Search Results if we ever enable search results pages\r\n category: this.props.config.heading?.text,\r\n context: this.props.context,\r\n });\r\n\r\n }\r\n }\r\n\r\n public render(): JSX.Element | null {\r\n const { heading, productCollection, className } = this.props.config;\r\n const { resources } = this.props;\r\n const products = productCollection && productCollection.products;\r\n const isCarousel = this.props.config.layout === layout.carousel;\r\n const headingComponent = heading && ;\r\n\r\n const productCollectionViewProps = {\r\n ...this.props,\r\n heading: headingComponent,\r\n SingleSlideCarouselComponentProps: {\r\n tag: SingleSlideCarousel,\r\n className: '',\r\n flipperPrevLabel: resources.flipperPrevious,\r\n flipperNextLabel: resources.flipperNext,\r\n parentId: this.props.id\r\n } as IComponentNodeProps,\r\n ProductCollectionContainer: {\r\n moduleProps: this.props,\r\n className: classnames('ms-product-collection ms-search-result-container', className)\r\n },\r\n GridComponentProps: {\r\n tag: 'ul' as NodeTag,\r\n className: 'ms-product-collection__items',\r\n },\r\n isCarousel: isCarousel,\r\n products: products && products.length > 0 && products.map((item: ProductSearchResult, index: number) => this._getProduct(item, index)),\r\n };\r\n return this.props.renderView(productCollectionViewProps) as React.ReactElement;\r\n }\r\n\r\n private async _getClubPricing(products:ProductSearchResult[]): Promise {\r\n const projectDomain: ProjectionDomain = { ChannelId: +this.props.context.request.apiSettings.channelId, CatalogId: +this.props.context.request.apiSettings.catalogId };\r\n let affiliations: AffiliationLoyaltyTier[];\r\n if (this.props.context.app.config.affiliationId) {\r\n affiliations = [\r\n {\r\n AffiliationId: this.props.context.app.config.affiliationId\r\n }\r\n ];\r\n } else {\r\n affiliations = [];\r\n }\r\n const productIds: number[] = [];\r\n products.forEach((product) => {\r\n productIds.push(product.RecordId);\r\n });\r\n const clubPricingAll = await getActivePricesAsync(\r\n { callerContext: this.props.context.actionContext },\r\n projectDomain,\r\n productIds,\r\n new Date(),\r\n '',\r\n affiliations,\r\n true\r\n );\r\n this.setState({clubPricing: clubPricingAll});\r\n }\r\n\r\n private async _getProductavailabilty(products: ProductSearchResult[]): Promise {\r\n if (products && products.length && 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.context.actionContext }, { ProductIds: productIds, DefaultWarehouseOnly: true});\r\n const formattedResponse = availabilityAll.ProductWarehouseInventoryAvailabilities?.map((product) => {\r\n return {ProductId: product.ProductId, AvailableQuantity: product.PhysicalAvailable, ExtensionProperties: product.ExtensionProperties};\r\n }) as ProductAvailableQuantity[];\r\n this.setState({productAvailability: formattedResponse});\r\n }\r\n }\r\n\r\n private _getProduct = (product: ProductSearchResult, index: number): IProductComponentViewProps => {\r\n const { imageSettings, showPrice } = this.props.config;\r\n const addToCart = this.props.config.addToCart || false;\r\n const resources = this.props.resources;\r\n const categoryHierarchy = undefined;\r\n const passedProps = { ...this.props, categoryHierarchy };\r\n const availibity = this.state.productAvailability?.find((item) => {\r\n return item.ProductId === product.RecordId;\r\n });\r\n const clubPrice = this.state.clubPricing?.find((item) => {\r\n return item.ProductId === product.RecordId;\r\n });\r\n const showQuantityAsDropdown = this.props.config.showQuantityAsDropdown || false;\r\n\r\n return {\r\n ProductContainer: {\r\n tag: 'li' as NodeTag,\r\n className: 'ms-product-collection__item ms-product-search-result__item',\r\n role: 'listitem',\r\n key: index,\r\n },\r\n productComponent: (\r\n \r\n )\r\n };\r\n };\r\n}\r\n\r\nexport default ProductCollection;\r\n","import {\r\n Button,\r\n Modal,\r\n ModalBody,\r\n ModalFooter,\r\n ModalHeader\r\n} from '@msdyn365-commerce-modules/utilities';\r\nimport React from 'react';\r\n\r\nexport interface ISearchResultModalViewProps {\r\n modal: React.ReactElement;\r\n modalHeader: React.ReactElement;\r\n modalFooter: React.ReactElement;\r\n modalBody: React.ReactElement;\r\n}\r\n\r\ninterface IModalToggleProps {\r\n innerRef: React.RefObject | undefined;\r\n id: string;\r\n text: string;\r\n ariaLabel: string;\r\n onClick(): void;\r\n}\r\n\r\nexport interface ISearchResultModalResources {\r\n modalTitle: string;\r\n modalCloseButtonText: string;\r\n}\r\n\r\nexport interface ISearchResultModalProps {\r\n resources: ISearchResultModalResources;\r\n isOpen: boolean;\r\n returnRef: React.RefObject | undefined;\r\n onModalToggle():void;\r\n}\r\n\r\nexport const ModalToggle: React.FC = (props: IModalToggleProps) => {\r\n const {text, onClick, ariaLabel, innerRef, id} = props;\r\n return ;\r\n};\r\n\r\nexport const SearchResultModal = (props: ISearchResultModalProps):ISearchResultModalViewProps => {\r\n return {\r\n modal: modalNode(props),\r\n modalHeader: modalHeaderNode(props),\r\n modalFooter: modalFooterNode(props),\r\n modalBody: \r\n };\r\n};\r\n\r\nconst modalNode = (props: ISearchResultModalProps) => {\r\n return (\r\n \r\n );\r\n};\r\n\r\nconst modalHeaderNode = (props: ISearchResultModalProps) => {\r\n return (\r\n \r\n {props.resources.modalTitle}\r\n \r\n );\r\n};\r\n\r\nconst modalFooterNode = (props: ISearchResultModalProps) => {\r\n return (\r\n \r\n \r\n \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 {_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}","import { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { RatingComponent } from '@msdyn365-commerce/components';\r\nimport { ICoreContext } from '@msdyn365-commerce/core';\r\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport { IRefineItemToggleNotification } from './refine-item-toggle-notification';\r\nimport { IRefineItemCommonProps } from './refine-item.props.common';\r\nimport { ProductRefinerSource, ProductRefinerTypeValue } from './utilities';\r\n\r\n/**\r\n * RefineItem properties\r\n */\r\nexport interface IRefineItemProps {\r\n\r\n parentProductRefinerHierarchy: IProductRefinerHierarchy;\r\n productRefinerValue: ProductRefinerValue;\r\n selectedRefinementCriterion: ProductRefinerValue | undefined;\r\n refineItemCommonProps: IRefineItemCommonProps;\r\n isDisabled: boolean;\r\n context: ICoreContext;\r\n moduleId: string;\r\n moduleTypeName: string;\r\n onToggle(notfication: Readonly): void;\r\n urlBuilder(refiner: IRefineItemToggleNotification): string;\r\n}\r\n\r\n/**\r\n * Refine item state\r\n */\r\nexport interface IRefineItemState extends React.ComponentState {\r\n isChecked: boolean;\r\n renderingError?: object;\r\n}\r\n\r\n/**\r\n * Single-select and multi-select refine item component (controlled by RefineSubmenu)\r\n */\r\nexport default class RefineItem extends React.Component {\r\n private anchorType: React.RefObject;\r\n\r\n constructor(props: IRefineItemProps) {\r\n super(props);\r\n this._onClick = this._onClick.bind(this);\r\n this.state = {\r\n isChecked: !!this.props.selectedRefinementCriterion\r\n };\r\n this.anchorType = React.createRef();\r\n }\r\n\r\n public render(): JSX.Element | undefined {\r\n const {\r\n isDisabled,\r\n refineItemCommonProps,\r\n parentProductRefinerHierarchy,\r\n productRefinerValue,\r\n selectedRefinementCriterion,\r\n children,\r\n onToggle,\r\n context,\r\n ...attrs\r\n } = this.props;\r\n if (!productRefinerValue) {\r\n refineItemCommonProps.telemetry.error('[refine-item] Cannot render refineItem without productRefinerValue');\r\n return undefined;\r\n }\r\n if (!productRefinerValue.LeftValueBoundString) {\r\n refineItemCommonProps.telemetry.warning(`[refine-item] RefineItem without LeftValueBoundString: ${JSON.stringify(productRefinerValue)}`);\r\n }\r\n const isSingleSelect = parentProductRefinerHierarchy.RefinerTypeValue === ProductRefinerTypeValue.Single;\r\n let itemTypeClassName = isSingleSelect ? 'single-select' : 'multi-select';\r\n itemTypeClassName = `ms-refine-submenu-item ${itemTypeClassName}`;\r\n const inputType = isSingleSelect ? 'radio' : 'checkbox';\r\n const role = isSingleSelect ? 'radio' : undefined;\r\n itemTypeClassName = !!selectedRefinementCriterion ? `${itemTypeClassName}-checked` : itemTypeClassName;\r\n if (parentProductRefinerHierarchy.SourceValue === ProductRefinerSource.Rating) {\r\n if (productRefinerValue.LeftValueBoundString) {\r\n return (\r\n \r\n \r\n \r\n {productRefinerValue.Count !== undefined && `(${productRefinerValue.Count})`}\r\n \r\n \r\n );\r\n } else {\r\n return undefined;\r\n }\r\n } else {\r\n return (\r\n
  • \r\n \r\n \r\n {productRefinerValue.LeftValueBoundLocalizedString || productRefinerValue.LeftValueBoundString}\r\n \r\n \r\n
  • \r\n );\r\n }\r\n }\r\n\r\n private _getRefinerUrl(): string {\r\n const { urlBuilder, parentProductRefinerHierarchy, productRefinerValue, selectedRefinementCriterion } = this.props;\r\n\r\n if (productRefinerValue) {\r\n return urlBuilder({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: !selectedRefinementCriterion\r\n });\r\n }\r\n\r\n return '';\r\n }\r\n\r\n private _onClick = (e: React.MouseEvent): void => {\r\n e.preventDefault();\r\n\r\n const { parentProductRefinerHierarchy, productRefinerValue, selectedRefinementCriterion } = this.props;\r\n if (productRefinerValue) {\r\n this.props.onToggle({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: !selectedRefinementCriterion\r\n });\r\n\r\n setTimeout(\r\n () => {\r\n this.anchorType.current && this.anchorType.current.focus();\r\n },\r\n 0\r\n );\r\n }\r\n };\r\n}","import * as React from 'react';\r\ninterface ITitle {\r\n className: string;\r\n text: string;\r\n}\r\n\r\nexport const Title: React.FC = ({ text, className }) => ( {text} );\r\n","import { ITelemetry } from '@msdyn365-commerce/core';\r\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\r\nimport { IRefineItemToggleNotification } from './refine-item-toggle-notification';\r\n\r\n/**\r\n * Types of product refiner values\r\n */\r\nexport const enum ProductRefinerValueDataTypeValue {\r\n /**\r\n * Range slider is used for selections like price\r\n */\r\n Range = 1,\r\n\r\n /**\r\n * Range input is a different way to specify ranges and can be expressed with input boxes\r\n * as well as a set of discrete single-select type values\r\n */\r\n RangeInput = 4,\r\n\r\n /**\r\n * This is a discrete list item, either multi-select or single-select\r\n */\r\n List = 5,\r\n\r\n /**\r\n * Boolean types allows only single-select\r\n */\r\n Boolean = 6\r\n}\r\n\r\n/**\r\n * Types of product refiners\r\n */\r\nexport const enum ProductRefinerTypeValue {\r\n /**\r\n * Refiner values are single-select\r\n */\r\n Single = 0,\r\n\r\n /**\r\n * Refiner values are multi-select\r\n */\r\n Multi = 1\r\n}\r\n\r\n/**\r\n * ProductRefinerSource enum type.\r\n */\r\nexport const enum ProductRefinerSource {\r\n /**\r\n * The None member.\r\n */\r\n None = 0,\r\n /**\r\n * The Attribute member.\r\n */\r\n Attribute = 1,\r\n /**\r\n * The Category member.\r\n */\r\n Category = 2,\r\n /**\r\n * The Price member.\r\n */\r\n Price = 3,\r\n /**\r\n * The Rating member.\r\n */\r\n Rating = 4\r\n}\r\n\r\n/**\r\n * Find the refinement criterion associated with this product refiner value\r\n * @param productRefinerValue product refiner value to match\r\n * @param refinementCriteria selected refinement criteria\r\n */\r\nexport function findMatchingRefinementCriterion(\r\n productRefinerValue: ProductRefinerValue,\r\n refinementCriteria: ProductRefinerValue[]\r\n): ProductRefinerValue | undefined {\r\n // if the value is a range, then match only on data type value; otherwise match on item string\r\n return refinementCriteria.find(\r\n (refinementCriterion: ProductRefinerValue) => isMatchingRefinementCriterion(productRefinerValue, refinementCriterion)\r\n );\r\n}\r\n\r\n/**\r\n * Find the refinement criterion associated with this product refiner value\r\n * @param productRefinerValue product refiner value to match\r\n * @param refinementCriteria selected refinement criteria\r\n */\r\nexport function isMatchingRefinementCriterion(\r\n productRefinerValue: ProductRefinerValue,\r\n refinementCriterion: ProductRefinerValue\r\n): boolean {\r\n // if the value is a range, then match only on data type value; otherwise match on item string\r\n return (\r\n refinementCriterion.RefinerRecordId === productRefinerValue.RefinerRecordId &&\r\n refinementCriterion.RefinerSourceValue === productRefinerValue.RefinerSourceValue &&\r\n refinementCriterion.DataTypeValue === productRefinerValue.DataTypeValue &&\r\n (refinementCriterion.DataTypeValue === ProductRefinerValueDataTypeValue.Range ||\r\n refinementCriterion.LeftValueBoundString === productRefinerValue.LeftValueBoundString)\r\n );\r\n}\r\n\r\nexport function getUpdatedRefinementCriteria(\r\n itemToggleNotification: IRefineItemToggleNotification,\r\n currentRefinementCriteria: ProductRefinerValue[]): ProductRefinerValue[] {\r\n const updatedRefinementCriteria: ProductRefinerValue[] = [];\r\n let toggledItemFound = false;\r\n currentRefinementCriteria.forEach((selectedCriterion: ProductRefinerValue) => {\r\n if (isMatchingRefinementCriterion(itemToggleNotification.productRefinerValue, selectedCriterion)) {\r\n toggledItemFound = true;\r\n if (itemToggleNotification.isSelecting) {\r\n const next = {\r\n ...selectedCriterion,\r\n LeftValueBoundString: itemToggleNotification.rangeStart !== undefined && `${itemToggleNotification.rangeStart}` || selectedCriterion.LeftValueBoundString,\r\n RightValueBoundString: itemToggleNotification.rangeEnd !== undefined && `${itemToggleNotification.rangeEnd}` || selectedCriterion.RightValueBoundString,\r\n };\r\n updatedRefinementCriteria.push(next);\r\n\r\n } // else the item is being de-selected, so omit it from the refinement criteria\r\n } else {\r\n // keep existing criterion because it is not in the item toggle notification\r\n updatedRefinementCriteria.push(selectedCriterion);\r\n }\r\n });\r\n\r\n if (!toggledItemFound) {\r\n const next = {\r\n ...itemToggleNotification.productRefinerValue,\r\n LeftValueBoundString: itemToggleNotification.rangeStart !== undefined && `${itemToggleNotification.rangeStart}` || itemToggleNotification.productRefinerValue.LeftValueBoundString,\r\n RightValueBoundString: itemToggleNotification.rangeEnd !== undefined && `${itemToggleNotification.rangeEnd}` || itemToggleNotification.productRefinerValue.RightValueBoundString,\r\n };\r\n updatedRefinementCriteria.push(next);\r\n\r\n // If single select, then deselect any others in the parent refiner group\r\n if ((itemToggleNotification.productRefinerValue.DataTypeValue === ProductRefinerValueDataTypeValue.List || itemToggleNotification.productRefinerValue.DataTypeValue === ProductRefinerValueDataTypeValue.Boolean) &&\r\n itemToggleNotification.parentProductRefinerHierarchy.RefinerTypeValue === ProductRefinerTypeValue.Single) {\r\n itemToggleNotification.parentProductRefinerHierarchy.Values.forEach((child: ProductRefinerValue) => {\r\n if (child.RefinerRecordId === next.RefinerRecordId && child.LeftValueBoundString === next.LeftValueBoundString) {\r\n // do nothing\r\n } else {\r\n const matchingIndex = updatedRefinementCriteria.findIndex((criterion: ProductRefinerValue) => isMatchingRefinementCriterion(child, criterion));\r\n if (matchingIndex > -1) {\r\n updatedRefinementCriteria.splice(matchingIndex, 1);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n return updatedRefinementCriteria;\r\n}\r\n\r\nexport function formatPrice(\r\n amount: string | undefined,\r\n currency: string | undefined,\r\n locale: string | undefined,\r\n telemetry: ITelemetry): string {\r\n if (!amount || !currency) {\r\n telemetry.trace(`[refine-menu.utilities.formatPrice] could not format price for ${amount} ${currency}`);\r\n return amount || '';\r\n }\r\n const priceAmount = (amount && Number(amount)) || 0;\r\n let result: string;\r\n\r\n try {\r\n result = new Intl.NumberFormat(locale, {\r\n style: 'currency',\r\n currencyDisplay: 'symbol',\r\n currency: currency,\r\n minimumFractionDigits: 0\r\n }).format(priceAmount);\r\n } catch (e) {\r\n result = `${priceAmount} ${currency}`;\r\n telemetry.warning(`[refine-menu.utilities.formatPrice] Failed to format price for ${result}: ${e}`);\r\n }\r\n\r\n return result;\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}","import * as React from 'react';\r\ninterface ILink {\r\n className?: string;\r\n text?: string;\r\n href?: string;\r\n ariaLabel?: string;\r\n}\r\n\r\nexport const Link: React.FC = ({ text, className, href, ariaLabel }) => ( {text} );","/*---------------------------------------------------------------------------------------------\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","import { Slider } from '@msdyn365-commerce-modules/utilities';\r\nimport debounce from 'lodash/debounce';\r\nimport { computed } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport * as React from 'react';\r\nimport { formatPrice } from './utilities';\r\n\r\ntype InputType = 'Min' | 'Max';\r\n\r\nimport { IRefineItemProps, IRefineItemState } from './refine-item';\r\n\r\nexport type RangeRefineItemType = 'slider' | 'input';\r\n\r\n/**\r\n * Range refine item properties\r\n */\r\nexport interface IRangeRefineItemProps extends IRefineItemProps {\r\n rangeType: RangeRefineItemType;\r\n minValueSliderThumbAriaLabel?: string;\r\n maxValueSliderThumbAriaLabel?: string;\r\n}\r\n\r\n/**\r\n * Range refine item state\r\n */\r\nexport interface IRangeRefineItemState extends IRefineItemState {\r\n validationErrorMin: string | undefined;\r\n validationErrorMax: string | undefined;\r\n selectedMin: string | undefined;\r\n selectedMax: string | undefined;\r\n touchedMin: boolean;\r\n touchedMax: boolean;\r\n}\r\n\r\n/**\r\n * RangeRefineItem component (controlled by RefineSubmenu)\r\n */\r\n@observer\r\nexport default class RangeRefineItem extends React.Component {\r\n private _formattedPriceReverseLookup: Map = new Map();\r\n\r\n private minInput: React.RefObject;\r\n private maxInput: React.RefObject;\r\n\r\n @computed get currencyCode(): string {\r\n return this.props.productRefinerValue.UnitText || '';\r\n }\r\n\r\n constructor(props: IRangeRefineItemProps) {\r\n super(props);\r\n this._onRangeUpdate = this._onRangeUpdate.bind(this);\r\n this._onRangeUpdateEnd = this._onRangeUpdateEnd.bind(this);\r\n this._handleRangeTooltipText = this._handleRangeTooltipText.bind(this);\r\n this._changeMin = this._changeMin.bind(this);\r\n this._changeMax = this._changeMax.bind(this);\r\n this._finishChangeMin = this._finishChangeMin.bind(this);\r\n this._finishChangeMax = this._finishChangeMax.bind(this);\r\n\r\n this.minInput = React.createRef();\r\n this.maxInput = React.createRef();\r\n\r\n const { selectedRefinementCriterion } = this.props;\r\n const initialMin = selectedRefinementCriterion && selectedRefinementCriterion.LeftValueBoundString || '0';\r\n const initialMax = selectedRefinementCriterion && selectedRefinementCriterion.RightValueBoundString || undefined;\r\n this.state = {\r\n isChecked: false,\r\n validationErrorMin: undefined,\r\n validationErrorMax: undefined,\r\n selectedMin: initialMin,\r\n selectedMax: initialMax,\r\n touchedMin: false,\r\n touchedMax: false\r\n };\r\n }\r\n\r\n public render(): JSX.Element | undefined {\r\n const { productRefinerValue, parentProductRefinerHierarchy, refineItemCommonProps } = this.props;\r\n\r\n if (!productRefinerValue || !parentProductRefinerHierarchy) {\r\n refineItemCommonProps.telemetry.error('Cannot render refine value range without productRefinerValue and parentProductRefinerHierarchy');\r\n return undefined;\r\n }\r\n\r\n if (this.props.rangeType === 'input') {\r\n return this._renderInputFields();\r\n }\r\n\r\n return this._renderSlider();\r\n }\r\n\r\n private _renderInputFields(): JSX.Element | undefined {\r\n const { isDisabled, parentProductRefinerHierarchy, refineItemCommonProps } = this.props;\r\n const { selectedMin, selectedMax, touchedMin, touchedMax, validationErrorMin, validationErrorMax } = this.state;\r\n\r\n const rangeAriaLabel = (refineItemCommonProps.rangeNameFormat || '{0}').replace('{0}', (parentProductRefinerHierarchy.KeyName || ''));\r\n const formAttrs = {\r\n 'aria-label': rangeAriaLabel,\r\n 'aria-disabled': isDisabled\r\n };\r\n\r\n // To enable price formatting of selected fields, this is the approach:\r\n // initial value: min=0 formatted as price, max=undefined\r\n // onFocus/onChange: convert to number (unformat) and mark as touched to indicate value is being edited\r\n // onBlur: validate and format entered value as price\r\n const minInputClassName = `ms-refine-submenu__input-range refine-submenu__input-range-min ${validationErrorMin ? 'refine-submenu__input-range--error' : ''}`;\r\n const maxInputClassName = `ms-refine-submenu__input-range refine-submenu__input-range-max ${validationErrorMax ? 'refine-submenu__input-range--error' : ''}`;\r\n const minLabelClassName = 'ms-refine-submenu__input-range-label refine-submenu__input-range-label-min';\r\n const maxLabelClassName = 'ms-refine-submenu__input-range-label refine-submenu__input-range-label-max';\r\n const formattedSelectedMin = this._getFormattedSelectedValue(selectedMin, touchedMin, validationErrorMin);\r\n const formattedSelectedMax = this._getFormattedSelectedValue(selectedMax, touchedMax, validationErrorMax);\r\n return (\r\n
    \r\n \r\n \r\n {validationErrorMin &&\r\n {validationErrorMin}\r\n }\r\n {validationErrorMax && validationErrorMin !== validationErrorMax &&\r\n {validationErrorMax}\r\n }\r\n
    \r\n );\r\n }\r\n\r\n private _renderSlider(): JSX.Element | undefined {\r\n const { isDisabled, productRefinerValue, parentProductRefinerHierarchy, selectedRefinementCriterion } = this.props;\r\n const min = productRefinerValue.LeftValueBoundString;\r\n const max = productRefinerValue.RightValueBoundString;\r\n const selectedMin = selectedRefinementCriterion && selectedRefinementCriterion.LeftValueBoundString || productRefinerValue.LeftValueBoundString || '0';\r\n const selectedMax = selectedRefinementCriterion && selectedRefinementCriterion.RightValueBoundString || productRefinerValue.RightValueBoundString || max;\r\n const sliderId = `slider_${parentProductRefinerHierarchy.RecordId}_${productRefinerValue.RefinerRecordId}`;\r\n const ariaAttributes = {\r\n 'aria-disabled': isDisabled\r\n };\r\n\r\n const minPrice = this._formatPrice(min);\r\n const maxPrice = this._formatPrice(max);\r\n const selectedMinPrice =this._formatPrice(selectedMin);\r\n const selectedMaxPrice =this._formatPrice(selectedMax);\r\n\r\n return (\r\n \r\n );\r\n }\r\n\r\n private _changeMin(event: React.FocusEvent): void {\r\n this._changeValue(event, 'Min');\r\n }\r\n\r\n private _changeMax(event: React.FocusEvent): void {\r\n this._changeValue(event, 'Max');\r\n }\r\n\r\n private _changeValue(event: React.FocusEvent, inputType: InputType): void {\r\n const selectedKey = `selected${inputType}`;\r\n const touchedKey = `touched${inputType}`;\r\n this.setState({\r\n [selectedKey]: this._getInputWithoutFormatting(event.currentTarget.value),\r\n [touchedKey]: true\r\n });\r\n }\r\n\r\n private _finishChangeMin(event: React.FocusEvent): boolean {\r\n const selectedMinValue = this._getInputWithoutFormatting(event.currentTarget.value);\r\n this.setState({\r\n selectedMin: selectedMinValue,\r\n minTouched: false\r\n });\r\n const minInput = Number(selectedMinValue);\r\n const { onToggle, parentProductRefinerHierarchy, productRefinerValue, refineItemCommonProps, selectedRefinementCriterion } = this.props;\r\n const max = selectedRefinementCriterion && selectedRefinementCriterion.RightValueBoundString || undefined;\r\n\r\n const maxNum = max ? Number(max) : undefined;\r\n\r\n if (isNaN(minInput)) {\r\n this.setState({validationErrorMin: refineItemCommonProps.validationErrorNaN});\r\n this._focus('Min');\r\n return false;\r\n }\r\n\r\n if (this._validateRange(minInput, maxNum)) {\r\n onToggle({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: true,\r\n rangeStart: minInput,\r\n rangeEnd: maxNum\r\n });\r\n return true;\r\n } else {\r\n this._focus('Min');\r\n }\r\n\r\n return false;\r\n }\r\n\r\n private _finishChangeMax(event: React.FocusEvent): boolean {\r\n const selectedMaxValue = this._getInputWithoutFormatting(event.currentTarget.value);\r\n this.setState({\r\n selectedMax: selectedMaxValue,\r\n maxTouched: false\r\n });\r\n const maxInput = Number(selectedMaxValue);\r\n const { onToggle, parentProductRefinerHierarchy, productRefinerValue, refineItemCommonProps, selectedRefinementCriterion } = this.props;\r\n const min = selectedRefinementCriterion && selectedRefinementCriterion.LeftValueBoundString || '0';\r\n\r\n const minNum = Number(min);\r\n\r\n if (isNaN(maxInput)) {\r\n this.setState({validationErrorMax: refineItemCommonProps.validationErrorNaN});\r\n this._focus('Max');\r\n return false;\r\n }\r\n\r\n if (this._validateRange(minNum, maxInput)) {\r\n if (productRefinerValue) {\r\n onToggle({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: true,\r\n rangeStart: minNum,\r\n rangeEnd: maxInput\r\n });\r\n } else {\r\n this._focus('Max');\r\n }\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n private _focus(inputType: InputType): void {\r\n const ref = inputType === 'Max' ? this.maxInput : this.minInput;\r\n\r\n setTimeout(() => {\r\n if (ref && ref.current) {\r\n ref.current.focus();\r\n }\r\n }, 50);\r\n }\r\n\r\n private _getFormattedSelectedValue(selected: string | undefined, touched: boolean, validationError: string | undefined): string | undefined {\r\n if (touched || validationError || selected === undefined) {\r\n return selected;\r\n }\r\n return this._formatPrice(selected);\r\n }\r\n\r\n private _validateRange(min: number, max: number | undefined): boolean {\r\n const { refineItemCommonProps } = this.props;\r\n if (max === undefined) {\r\n return true;\r\n }\r\n\r\n if (min > max) {\r\n this.setState({\r\n validationErrorMin: refineItemCommonProps.validationErrorRange,\r\n validationErrorMax: refineItemCommonProps.validationErrorRange\r\n });\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _formatPrice(amount: string | undefined): string {\r\n const locale = this.props.refineItemCommonProps.locale;\r\n const result = formatPrice(amount, this.currencyCode, locale, this.props.refineItemCommonProps.telemetry);\r\n\r\n if (amount !== undefined && !this._formattedPriceReverseLookup.has(result)) {\r\n this._formattedPriceReverseLookup.set(result, amount);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n private _getInputWithoutFormatting(input: string): string {\r\n // First try to cast raw input to a number\r\n const inputAsNum = Number(input);\r\n if (!isNaN(inputAsNum)) {\r\n return input;\r\n }\r\n\r\n // Otherwise try a reverse lookup and fall back to the raw input if all else fails\r\n const reverseLookupResult = this._formattedPriceReverseLookup.get(input);\r\n return reverseLookupResult || input;\r\n }\r\n\r\n // NOTE: Fix types once Shared Components build pipeline bug fixed\r\n // tslint:disable-next-line:no-any\r\n private _onRangeUpdate(sliderChangeNotification: any): void {\r\n // Need to filter out mousemove events as these cause errors after the menu updates and slider re-renders\r\n if (sliderChangeNotification.eventType !== 'mousemove') {\r\n const { onToggle, parentProductRefinerHierarchy, productRefinerValue } = this.props;\r\n if (productRefinerValue && sliderChangeNotification) {\r\n onToggle({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: true,\r\n rangeStart: sliderChangeNotification.firstThumbValue,\r\n rangeEnd: sliderChangeNotification.secondThumbValue\r\n });\r\n\r\n this._focusOnSliderThumb(sliderChangeNotification);\r\n }\r\n }\r\n }\r\n\r\n // tslint:disable-next-line\r\n private _onRangeUpdateEnd(sliderChangeNotification: any): void {\r\n const { onToggle, parentProductRefinerHierarchy, productRefinerValue } = this.props;\r\n if (productRefinerValue && sliderChangeNotification) {\r\n onToggle({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: true,\r\n rangeStart: sliderChangeNotification.firstThumbValue,\r\n rangeEnd: sliderChangeNotification.secondThumbValue\r\n });\r\n\r\n this._focusOnSliderThumb(sliderChangeNotification);\r\n }\r\n }\r\n\r\n // tslint:disable-next-line\r\n private _focusOnSliderThumb(sliderChangeNotification: any): void {\r\n if (sliderChangeNotification.id) {\r\n const element = document.getElementById(sliderChangeNotification.id);\r\n if (!!element) {\r\n setTimeout(\r\n () => {\r\n element.focus();\r\n }, 0);\r\n }\r\n }\r\n }\r\n\r\n private _handleRangeTooltipText(tooltip: number): string {\r\n return this._formatPrice(`${tooltip}`);\r\n }\r\n}","import { ITelemetry } from '@msdyn365-commerce/core';\r\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\r\nimport { IRefineItemToggleNotification } from './refine-item-toggle-notification';\r\n\r\n/**\r\n * Types of product refiner values\r\n */\r\nexport const enum ProductRefinerValueDataTypeValue {\r\n /**\r\n * Range slider is used for selections like price\r\n */\r\n Range = 1,\r\n\r\n /**\r\n * Range input is a different way to specify ranges and can be expressed with input boxes\r\n * as well as a set of discrete single-select type values\r\n */\r\n RangeInput = 4,\r\n\r\n /**\r\n * This is a discrete list item, either multi-select or single-select\r\n */\r\n List = 5,\r\n\r\n /**\r\n * Boolean types allows only single-select\r\n */\r\n Boolean = 6\r\n}\r\n\r\n/**\r\n * Types of product refiners\r\n */\r\nexport const enum ProductRefinerTypeValue {\r\n /**\r\n * Refiner values are single-select\r\n */\r\n Single = 0,\r\n\r\n /**\r\n * Refiner values are multi-select\r\n */\r\n Multi = 1\r\n}\r\n\r\n/**\r\n * ProductRefinerSource enum type.\r\n */\r\nexport const enum ProductRefinerSource {\r\n /**\r\n * The None member.\r\n */\r\n None = 0,\r\n /**\r\n * The Attribute member.\r\n */\r\n Attribute = 1,\r\n /**\r\n * The Category member.\r\n */\r\n Category = 2,\r\n /**\r\n * The Price member.\r\n */\r\n Price = 3,\r\n /**\r\n * The Rating member.\r\n */\r\n Rating = 4\r\n}\r\n\r\n/**\r\n * Find the refinement criterion associated with this product refiner value\r\n * @param productRefinerValue product refiner value to match\r\n * @param refinementCriteria selected refinement criteria\r\n */\r\nexport function findMatchingRefinementCriterion(\r\n productRefinerValue: ProductRefinerValue,\r\n refinementCriteria: ProductRefinerValue[]\r\n): ProductRefinerValue | undefined {\r\n // if the value is a range, then match only on data type value; otherwise match on item string\r\n return refinementCriteria.find(\r\n (refinementCriterion: ProductRefinerValue) => isMatchingRefinementCriterion(productRefinerValue, refinementCriterion)\r\n );\r\n}\r\n\r\n/**\r\n * Find the refinement criterion associated with this product refiner value\r\n * @param productRefinerValue product refiner value to match\r\n * @param refinementCriteria selected refinement criteria\r\n */\r\nexport function isMatchingRefinementCriterion(\r\n productRefinerValue: ProductRefinerValue,\r\n refinementCriterion: ProductRefinerValue\r\n): boolean {\r\n // if the value is a range, then match only on data type value; otherwise match on item string\r\n return (\r\n refinementCriterion.RefinerRecordId === productRefinerValue.RefinerRecordId &&\r\n refinementCriterion.RefinerSourceValue === productRefinerValue.RefinerSourceValue &&\r\n refinementCriterion.DataTypeValue === productRefinerValue.DataTypeValue &&\r\n (refinementCriterion.DataTypeValue === ProductRefinerValueDataTypeValue.Range ||\r\n refinementCriterion.LeftValueBoundString === productRefinerValue.LeftValueBoundString)\r\n );\r\n}\r\n\r\nexport function getUpdatedRefinementCriteria(\r\n itemToggleNotification: IRefineItemToggleNotification,\r\n currentRefinementCriteria: ProductRefinerValue[]): ProductRefinerValue[] {\r\n const updatedRefinementCriteria: ProductRefinerValue[] = [];\r\n let toggledItemFound = false;\r\n currentRefinementCriteria.forEach((selectedCriterion: ProductRefinerValue) => {\r\n if (isMatchingRefinementCriterion(itemToggleNotification.productRefinerValue, selectedCriterion)) {\r\n toggledItemFound = true;\r\n if (itemToggleNotification.isSelecting) {\r\n const next = {\r\n ...selectedCriterion,\r\n LeftValueBoundString: itemToggleNotification.rangeStart !== undefined && `${itemToggleNotification.rangeStart}` || selectedCriterion.LeftValueBoundString,\r\n RightValueBoundString: itemToggleNotification.rangeEnd !== undefined && `${itemToggleNotification.rangeEnd}` || selectedCriterion.RightValueBoundString,\r\n };\r\n updatedRefinementCriteria.push(next);\r\n\r\n } // else the item is being de-selected, so omit it from the refinement criteria\r\n } else {\r\n // keep existing criterion because it is not in the item toggle notification\r\n updatedRefinementCriteria.push(selectedCriterion);\r\n }\r\n });\r\n\r\n if (!toggledItemFound) {\r\n const next = {\r\n ...itemToggleNotification.productRefinerValue,\r\n LeftValueBoundString: itemToggleNotification.rangeStart !== undefined && `${itemToggleNotification.rangeStart}` || itemToggleNotification.productRefinerValue.LeftValueBoundString,\r\n RightValueBoundString: itemToggleNotification.rangeEnd !== undefined && `${itemToggleNotification.rangeEnd}` || itemToggleNotification.productRefinerValue.RightValueBoundString,\r\n };\r\n updatedRefinementCriteria.push(next);\r\n\r\n // If single select, then deselect any others in the parent refiner group\r\n if ((itemToggleNotification.productRefinerValue.DataTypeValue === ProductRefinerValueDataTypeValue.List || itemToggleNotification.productRefinerValue.DataTypeValue === ProductRefinerValueDataTypeValue.Boolean) &&\r\n itemToggleNotification.parentProductRefinerHierarchy.RefinerTypeValue === ProductRefinerTypeValue.Single) {\r\n itemToggleNotification.parentProductRefinerHierarchy.Values.forEach((child: ProductRefinerValue) => {\r\n if (child.RefinerRecordId === next.RefinerRecordId && child.LeftValueBoundString === next.LeftValueBoundString) {\r\n // do nothing\r\n } else {\r\n const matchingIndex = updatedRefinementCriteria.findIndex((criterion: ProductRefinerValue) => isMatchingRefinementCriterion(child, criterion));\r\n if (matchingIndex > -1) {\r\n updatedRefinementCriteria.splice(matchingIndex, 1);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n return updatedRefinementCriteria;\r\n}\r\n\r\nexport function formatPrice(\r\n amount: string | undefined,\r\n currency: string | undefined,\r\n locale: string | undefined,\r\n telemetry: ITelemetry): string {\r\n if (!amount || !currency) {\r\n telemetry.trace(`[refine-menu.utilities.formatPrice] could not format price for ${amount} ${currency}`);\r\n return amount || '';\r\n }\r\n const priceAmount = (amount && Number(amount)) || 0;\r\n let result: string;\r\n\r\n try {\r\n result = new Intl.NumberFormat(locale, {\r\n style: 'currency',\r\n currencyDisplay: 'symbol',\r\n currency: currency,\r\n minimumFractionDigits: 0\r\n }).format(priceAmount);\r\n } catch (e) {\r\n result = `${priceAmount} ${currency}`;\r\n telemetry.warning(`[refine-menu.utilities.formatPrice] Failed to format price for ${result}: ${e}`);\r\n }\r\n\r\n return result;\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 classnames from 'classnames';\r\nimport { computed, observable, reaction, transaction } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport * as React from 'react';\r\n\r\nimport { ILabeledDropdownOnChangeNotification, ILabeledDropdownOption, IModuleProps, INodeProps, LabeledDropdown, UncontrolledPagination } from '@msdyn365-commerce-modules/utilities';\r\nimport { CategoryHierarchy as CategoryHierarchyData, IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\n// category description 1.0\r\nimport MsDyn365, { IImageDimension, RichText, RichTextComponent } from '@msdyn365-commerce/core';\r\nimport { AsyncResult, format, ProductAvailableQuantity, ProductRefinerValue, ProductSearchResult, SortColumn, TextValueTranslation } from '@msdyn365-commerce/retail-proxy';\r\nimport { getEstimatedAvailabilityAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { ICheckoutState } from '@msdyn365-commerce/global-state';\r\n\r\nimport { ISmweSearchResultContainerParentProps } from '../../components/product.component';\r\nimport { buildListPageUrl, getCollectionProducts, getCurrentUrl, GetFullProductsByCollectionInput, hydrateRefinersFromUrl, IFullProductsSearchResultsWithCount, parseQueryParam, sortOptions } from '../../dataActions/search-result-container';\r\nimport { publish } from '../../Utilities/analytics/analytics-dispatcher';\r\nimport { filterInvalidCategories } from '../../Utilities/refiners';\r\nimport { filterCartLines } from '../../Utilities/subscription-manager';\r\n\r\nimport CommerceAttributesParser from '../../Utilities/commerce-attributes-parser';\r\nimport {\r\n ErrorMessage, getUpdatedRefinementCriteria, IChoiceSummaryClickNotification,\r\n IRefineItemCommonProps, IRefineItemToggleNotification, ISearchResultModalViewProps, isMatchingRefinementCriterion, Link, ModalToggle, ProductSearchResultItems, SearchResultModal, Separator, Title\r\n} from './components';\r\nimport ChoiceSummary from './components/choice-summary';\r\nimport RefineSubmenu from './components/refine-submenu';\r\nimport { IElicitSubscriptionsData } from './elicit-subscriptions.data';\r\nimport { IElicitSubscriptionsProps } from './elicit-subscriptions.props.autogenerated';\r\n\r\nexport interface ISearchResultContainerViewProps extends IElicitSubscriptionsProps<{}> {\r\n products?: React.ReactNode;\r\n className?: string;\r\n SearchResultContainer: IModuleProps;\r\n TitleViewProps: ITitleViewProps;\r\n categoryHierarchy: ICategoryHierarchyViewProps;\r\n pagination?: React.ReactNode;\r\n ProductsContainer: INodeProps;\r\n ProductSectionContainer: INodeProps;\r\n refineMenu: IRefineMenuViewProps;\r\n sortByOptions: ISortByViewProps;\r\n choiceSummary?: React.ReactNode;\r\n modalToggle: React.ReactNode;\r\n searchResultModal: ISearchResultModalViewProps;\r\n isMobile: boolean;\r\n CategoryNavContainer: INodeProps;\r\n RefineAndProductSectionContainer: INodeProps;\r\n errorMessage: React.ReactNode;\r\n categoryDescription: JSX.Element | undefined;\r\n}\r\n\r\nexport interface ITitleViewProps {\r\n TitleContainer: INodeProps;\r\n title: ISearchResultTitle;\r\n}\r\n\r\nexport interface IRefineMenuViewProps {\r\n RefineMenuContainer: INodeProps;\r\n RefinerSectionContainer: INodeProps;\r\n refiners?: React.ReactNode[];\r\n}\r\n\r\nexport interface ICategoryHierarchyViewProps {\r\n categoryHierarchyList?: React.ReactNode[];\r\n categoryHierarchySeparator?: React.ReactNode;\r\n CategoryHierarchyContainer: INodeProps;\r\n}\r\n\r\nexport interface ISortByViewProps {\r\n SortingContainer: INodeProps;\r\n sortByDropDown?: React.ReactNode;\r\n}\r\n\r\nexport type GridSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\r\n\r\n/**\r\n * Title component for search result container\r\n */\r\nexport interface ISearchResultTitle {\r\n titlePrefix?: React.ReactNode;\r\n titleText?: React.ReactNode;\r\n titleCount?: React.ReactNode;\r\n}\r\n\r\nexport interface ISearchResultContainerState {\r\n sortingState: ISortByCollectionState;\r\n modalIsOpen: boolean;\r\n productAvailability: ProductAvailableQuantity[] | undefined;\r\n}\r\n\r\ninterface ISortByCollectionState {\r\n selectedSortByOption: ILabeledDropdownOption;\r\n pending: boolean;\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 * SearchResultContainer component\r\n * @extends {React.Component>}\r\n */\r\n@observer\r\nexport default class SmweSearchResultContainer extends React.Component, ISearchResultContainerState> {\r\n\r\n @computed get isMobile(): boolean {\r\n return (this._viewport === 'xs' || this._viewport === 'sm' || this._viewport === 'md');\r\n }\r\n\r\n private sortByDropdownOptions: ILabeledDropdownOption[] = [];\r\n private showSortByDropdown: boolean = false;\r\n private _refineItemCommonProps: IRefineItemCommonProps;\r\n private _pageType: string | undefined = this.props.context.request.urlTokens.pageType;\r\n @observable\r\n private _viewport: GridSize;\r\n\r\n @observable\r\n private _refinersFiltered: boolean = false;\r\n\r\n private _modalToggleRef: React.RefObject;\r\n private _sortAndFilterContainerRef: React.RefObject;\r\n private _initialProductResultCount: number = 0;\r\n\r\n public static getFriendlyName(locale: string, nameTranslations?: TextValueTranslation[]): string | undefined {\r\n let nameTranslation: TextValueTranslation | undefined;\r\n if (locale && nameTranslations && nameTranslations.length > 0) {\r\n nameTranslation = nameTranslations.find(item => item.Language!.toLowerCase() === locale.toLowerCase());\r\n }\r\n\r\n return nameTranslation && nameTranslation.Text;\r\n }\r\n\r\n // tslint:disable-next-line: max-func-body-length\r\n constructor(props: IElicitSubscriptionsProps) {\r\n super(props);\r\n this._viewport = props.context.request && props.context.request.device && props.context.request.device.Type === 'Mobile' ? 'xs' : 'lg';\r\n this._modalToggleRef = React.createRef();\r\n this._sortAndFilterContainerRef = React.createRef();\r\n this._toggleModal = this._toggleModal.bind(this);\r\n this._updateViewport = this._updateViewport.bind(this);\r\n this._addSortByDropdownOptions();\r\n\r\n this.props.data.checkoutState = this.props.data.checkoutState || {} as AsyncResult;\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 }\r\n }\r\n\r\n this.state = {\r\n sortingState: {\r\n pending: false,\r\n selectedSortByOption: this.sortByDropdownOptions[0]\r\n },\r\n modalIsOpen: false,\r\n productAvailability: undefined\r\n };\r\n const { placeholderTextMax, minLabel, maxLabel, rangeNameFormat } = this.props.resources;\r\n\r\n const locale = this.props.context.request.locale;\r\n const telemetry = this.props.telemetry;\r\n const validationErrorNaN = this.props.resources.validationErrorNotNumber;\r\n const validationErrorRange = this.props.resources.validationErrorNotRange;\r\n this._refineItemCommonProps = {\r\n telemetry,\r\n locale,\r\n placeholderTextMax,\r\n minLabel,\r\n maxLabel,\r\n rangeNameFormat,\r\n validationErrorNaN,\r\n validationErrorRange\r\n };\r\n\r\n reaction(\r\n () => { return [this.props.data.cart.result?.cart.CartLines, this.props.data.cart.result, this.props.data.cart.result?.cart]; },\r\n () => { this.setState({}); }\r\n );\r\n\r\n // Initalization of list page\r\n // Have an ugly promise cascade. Promise.all() does NOT work right here. That causes everything below to run after render instead of before.\r\n void this.props.data.products.then(products => {\r\n void this.props.data.listPageState.then(listPageState => {\r\n void this.props.data.refiners.then(refiners => {\r\n void this.props.data.categoryHierarchy.then(categoryHierarchy => {\r\n if (this._pageType === 'Category') {\r\n listPageState.pageType = 'Category';\r\n } else {\r\n listPageState.pageType = 'Search';\r\n }\r\n let querySorting: SortColumn[] = [];\r\n\r\n if (this.props.context.request.query && this.props.context.request.query.sorting) {\r\n querySorting = JSON.parse(decodeURIComponent(this.props.context.request.query.sorting)) as SortColumn[];\r\n }\r\n\r\n listPageState.currentPageNumber = this.props.context.request.query && (+this.props.context.request.query.skip / (this.props.config.itemsPerPage || 10)) || 0;\r\n listPageState.sortingCritera = { Columns: querySorting };\r\n listPageState.pageSize = this.props.config.itemsPerPage || 10;\r\n listPageState.activeProducts = products.products;\r\n listPageState.totalProductCount = products.count;\r\n this._initialProductResultCount = products.count;\r\n listPageState.activeFilters = hydrateRefinersFromUrl(this.props.context.request);\r\n\r\n filterInvalidCategories(refiners, categoryHierarchy, this.props.context.app.config.refinerRemappers);\r\n this._refinersFiltered = true;\r\n\r\n // tslint:disable-next-line: no-floating-promises\r\n void this._getProductavailabilty(products);\r\n this._emitImpressionEvent(products.products);\r\n\r\n // Initialize reaction based on listPageState properties\r\n reaction(\r\n () => {\r\n return [listPageState.activeFilters && listPageState.activeFilters.length, listPageState.currentPageNumber, listPageState.sortingCritera && listPageState.sortingCritera.Columns && listPageState.sortingCritera.Columns.length];\r\n },\r\n () => {\r\n const input = new GetFullProductsByCollectionInput(\r\n listPageState.pageType,\r\n this.props.context.request.apiSettings,\r\n { Paging: { Top: this.props.config.itemsPerPage, Skip: Math.max((listPageState.pageSize * (listPageState.currentPageNumber || 0)), 0) }, count: true, Sorting: listPageState.sortingCritera || {} },\r\n listPageState.activeFilters || [],\r\n +(this.props.context.request.urlTokens.itemId || 0),\r\n this.props.context.request.query && this.props.context.request.query.q);\r\n\r\n getCollectionProducts(input, this.props.context.actionContext).then(productResults => {\r\n listPageState.activeProducts = productResults.products;\r\n listPageState.totalProductCount = productResults.count || this._initialProductResultCount;\r\n // tslint:disable-next-line: no-floating-promises\r\n void this._getProductavailabilty(productResults);\r\n this._emitImpressionEvent(products.products);\r\n }).catch(e => this.props.telemetry.exception(e));\r\n }\r\n );\r\n });\r\n });\r\n });\r\n });\r\n\r\n this._updateViewport();\r\n }\r\n\r\n public componentDidMount(): void {\r\n // tslint:disable-next-line: no-typeof-undefined\r\n if (typeof window !== 'undefined' && window.addEventListener) {\r\n window.addEventListener('resize', this._updateViewport);\r\n this._updateViewport();\r\n }\r\n }\r\n\r\n public componentWillUnmount(): void {\r\n // tslint:disable-next-line: no-typeof-undefined\r\n if (typeof window !== 'undefined' && window.addEventListener) {\r\n window.removeEventListener('resize', this._updateViewport);\r\n }\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 public render(): JSX.Element {\r\n const { imageSettings, className, paragraph, showPagination } = this.props.config;\r\n const { resources, telemetry, data } = this.props;\r\n const products = (this.props.data.listPageState.result && this.props.data.listPageState.result.activeProducts) || [];\r\n let errorText = '';\r\n if (!products || products.length === 0) {\r\n errorText = this._pageType === 'Category' ? resources.resultCategoryNotFoundText : resources.resultSearchNotFoundText;\r\n }\r\n\r\n const categoryHierarchy = (data.category && data.category.result) || undefined;\r\n const passedProps = { ...this.props, categoryHierarchy };\r\n const productsComponent = (\r\n \r\n );\r\n // category-description 1.0\r\n const categoryDescription = this._getCategoryDescription(paragraph);\r\n\r\n const searchResultContainerViewProps = {\r\n ...this.props,\r\n products: productsComponent,\r\n TitleViewProps: this._getCollectionTitle(),\r\n categoryHierarchy: this._getCategoryHierarchy(),\r\n refineMenu: this._getRefineMenu(),\r\n className: classnames('ms-search-result-container', className),\r\n SearchResultContainer: {\r\n moduleProps: this.props,\r\n className: classnames('ms-search-result-container', className)\r\n },\r\n sortByOptions: this.props.data.listPageState.result && this.props.data.listPageState.result.totalProductCount !== 0 && this.showSortByDropdown && this.props.config.showSortBy ? this._getSortingDropDown() : null,\r\n pagination: showPagination ? this._getPagination() : '',\r\n ProductsContainer: { className: 'ms-search-result-container__Products' },\r\n ProductSectionContainer: { className: 'ms-search-result-container__product-section' },\r\n CategoryNavContainer: { className: 'ms-search-result-container__category-nav-section' },\r\n RefineAndProductSectionContainer: { className: 'ms-search-result-container__refine-product-section' },\r\n choiceSummary: this._getChoiceSummary(),\r\n modalToggle: this.props.data.listPageState.result && this.props.data.listPageState.result.totalProductCount !== 0 ?\r\n (\r\n \r\n ) : null,\r\n searchResultModal: this._getSearchResultModal(),\r\n isMobile: this.isMobile,\r\n errorMessage: errorText && (\r\n \r\n ),\r\n categoryDescription: categoryDescription\r\n };\r\n return this.props.renderView(searchResultContainerViewProps) as React.ReactElement;\r\n }\r\n\r\n private _addSortByDropdownOptions = (): void => {\r\n if (this.props.config.showSortingByRelevance) {\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionRelevanceDesc, value: this.props.resources.sortByOptionRelevanceDesc });\r\n this.showSortByDropdown = true;\r\n }\r\n if (this.props.config.showSortingByName) {\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionNameAsc, value: this.props.resources.sortByOptionNameAsc });\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionNameDesc, value: this.props.resources.sortByOptionNameDesc });\r\n this.showSortByDropdown = true;\r\n }\r\n if (this.props.config.showSortingByPrice) {\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionPriceAsc, value: this.props.resources.sortByOptionPriceAsc });\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionPriceDesc, value: this.props.resources.sortByOptionPriceDesc });\r\n this.showSortByDropdown = true;\r\n }\r\n if (this.props.config.showSortingByRating) {\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionRatingDesc, value: this.props.resources.sortByOptionRatingDesc });\r\n this.showSortByDropdown = true;\r\n }\r\n };\r\n\r\n private _getSearchResultModal = (): ISearchResultModalViewProps => {\r\n const { resources } = this.props;\r\n return SearchResultModal(\r\n {\r\n resources: {\r\n modalCloseButtonText: resources.modalCloseButtonText,\r\n modalTitle: resources.modalTitle\r\n },\r\n isOpen: this.state.modalIsOpen,\r\n returnRef: this._modalToggleRef,\r\n onModalToggle: this._toggleModal\r\n });\r\n };\r\n\r\n private _getCollectionTitle = (): ITitleViewProps => {\r\n const { data, context, resources } = this.props;\r\n\r\n let collectionTitle: string | undefined = '';\r\n if (context && context.request && context.request.query && context.request.query.q) {\r\n collectionTitle = `\"${context.request.query.q}\"`;\r\n } else {\r\n collectionTitle = (data.category.result && SmweSearchResultContainer.getFriendlyName(context.request.locale, data.category.result.NameTranslations)) ||\r\n (data.category.result && data.category.result.Name);\r\n }\r\n let productCountText = '';\r\n let productCountNumber: number | undefined;\r\n if (data.listPageState && data.listPageState.result && data.listPageState.result.totalProductCount !== undefined) {\r\n productCountNumber = data.listPageState.result.totalProductCount;\r\n } else if (data.products && data.products.result) {\r\n productCountNumber = data.products.result.count;\r\n }\r\n\r\n if (productCountNumber && productCountNumber !== 0) {\r\n productCountText = productCountNumber !== 1 ? format(this.props.resources.numberOfProducts, productCountNumber) : this.props.resources.oneProduct;\r\n } else {\r\n productCountText = format(this.props.resources.numberOfProducts, 0);\r\n }\r\n const titlePrefix = ;\r\n const titleText = collectionTitle && <Title className='ms-search-result__collection-title-text' text={collectionTitle} />;\r\n const titleCount = <Title className='ms-search-result__collection-title-count' text={productCountText} />;\r\n\r\n return {\r\n TitleContainer: { className: 'ms-search-result-container__title' },\r\n title: {\r\n titlePrefix: titlePrefix,\r\n titleText: titleText,\r\n titleCount: titleCount\r\n }\r\n };\r\n\r\n };\r\n private _getCategoryHierarchy = (): ICategoryHierarchyViewProps => {\r\n const { data } = this.props;\r\n const categoryHierarchy = data.categoryHierarchy.result;\r\n const categoryLinks =\r\n categoryHierarchy && categoryHierarchy.map((value: CategoryHierarchyData, index: number) => {\r\n\r\n return (\r\n <Link\r\n key={index}\r\n text={value.Name}\r\n ariaLabel={`${this.props.resources.categoryLinkAriaLabel} ${value.Name}`}\r\n href={value.Url}\r\n />\r\n );\r\n });\r\n const categoryLinkSeparator = <Separator separator='/' />;\r\n\r\n return {\r\n CategoryHierarchyContainer: { tag: 'nav', className: 'ms-search-result-container__category-hierarchy' },\r\n categoryHierarchyList: categoryLinks,\r\n categoryHierarchySeparator: categoryLinkSeparator\r\n };\r\n\r\n };\r\n\r\n private _getSortingDropDown = (): ISortByViewProps => {\r\n const { resources } = this.props;\r\n const activeDropdown = this._getCurrentlySelectedOption() || this.state.sortingState.selectedSortByOption;\r\n const dropdown = (\r\n <LabeledDropdown\r\n labelClassname='reviews-list-sort-by'\r\n labelText={resources.sortByDropdownLabel}\r\n dropdownId='categorySortByDropdown'\r\n dropdownClassname='reviews-list-dropdown'\r\n toggleColor='link'\r\n dropdownOptions={this.sortByDropdownOptions}\r\n selectedOption={activeDropdown}\r\n onSelectOption={this._updateSortByDropdown}\r\n ref={this._sortAndFilterContainerRef}\r\n />);\r\n return {\r\n SortingContainer: { className: 'ms-search-result-container__Sort-by-category' },\r\n sortByDropDown: dropdown\r\n };\r\n };\r\n\r\n private _getPagination = (): React.ReactNode => {\r\n const { config, context, data, resources } = this.props;\r\n const listPageState = data && data.listPageState && data.listPageState.result;\r\n const fullUrl = getCurrentUrl(context.request);\r\n const itemsPerPage = config.itemsPerPage || 10;\r\n const skipCount = listPageState && listPageState.currentPageNumber !== null ?\r\n (listPageState.currentPageNumber * (this.props.config.itemsPerPage || 10)) :\r\n ((this.props.context.request.query && +this.props.context.request.query.skip) || 0);\r\n const totalItems = listPageState && listPageState.totalProductCount || 0;\r\n const previousText = resources.flipperPrevious;\r\n const nextText = resources.flipperNext;\r\n const totalActiveProducts = listPageState?.activeProducts?.length || 0;\r\n\r\n if (totalItems <= itemsPerPage) {\r\n return null;\r\n }\r\n if (totalActiveProducts <= 0) {\r\n return null;\r\n }\r\n\r\n return (\r\n <UncontrolledPagination\r\n className='ms-search-result-container__pagination'\r\n role='navigation'\r\n aria-label={resources.paginationAriaLabel}\r\n url={fullUrl.href}\r\n qsp={'skip'}\r\n items={totalItems}\r\n itemsPerPage={itemsPerPage}\r\n startingItem={skipCount}\r\n previousText={<div className='msc-pagination__prev'><span className='ms-search-result__pagination-left' aria-hidden='true' /><span className='prev-text'>{previousText}</span></div>}\r\n nextText={<div className='msc-pagination__next'><span className='next-text'>{nextText}</span><span className='ms-search-result__pagination-right' aria-hidden='true' /></div>}\r\n previousAriaLabel={previousText}\r\n nextAriaLabel={nextText}\r\n />);\r\n };\r\n\r\n private _getRefineMenu = (): IRefineMenuViewProps => {\r\n const { data, context } = this.props;\r\n const tempRangeTypeTODO = context.request.query && context.request.query.inputRange ? 'input' : 'slider';\r\n const validRefiners = this._refinersFiltered && data.refiners.result && data.refiners.result.filter(refiner => {\r\n return refiner.Values.length > 0;\r\n });\r\n\r\n const activeRefiners = (data.listPageState.result && data.listPageState.result.activeFilters) || [];\r\n const subMenus = validRefiners && validRefiners.map((productRefinerHierarchy: IProductRefinerHierarchy, index: number) => {\r\n return (data.listPageState.result?.totalProductCount !== 0 ?\r\n (\r\n <RefineSubmenu\r\n highestLevelRefinerText={this.props.config.highestLevelItem}\r\n productRefinerHierarchy={productRefinerHierarchy}\r\n selectedRefinerValues={activeRefiners}\r\n refineItemCommonProps={this._refineItemCommonProps}\r\n minValueSliderThumbAriaLabel={this.props.resources.minValueSliderThumbAriaLabel}\r\n maxValueSliderThumbAriaLabel={this.props.resources.maxValueSliderThumbAriaLabel}\r\n refinerMinimizeText={this.props.resources.refinerMinimizeText}\r\n refinerExpandText={this.props.resources.refinerExpandText}\r\n minimizedRefiners={this.props.config.minimizedRefiners}\r\n key={index}\r\n onUpdateRefiners={this._onUpdateRefiners}\r\n urlBuilder={this._buildRefinerUrl}\r\n isDisabled={false}\r\n isExpandedOnInitialLoad={this.props.config.collapseRefiners ? false : true}\r\n tempRangeTypeTODO={tempRangeTypeTODO}\r\n context={context}\r\n moduleId={this.props.id}\r\n moduleTypeName={this.props.typeName}\r\n />) : null\r\n );\r\n });\r\n\r\n return {\r\n RefineMenuContainer: { className: 'ms-search-result-container__refine-menu' },\r\n RefinerSectionContainer: { className: 'ms-search-result-container__refiner-section' },\r\n refiners: subMenus || undefined // type shenanigans\r\n };\r\n\r\n };\r\n\r\n private _getChoiceSummary = (): React.ReactNode => {\r\n const { resources, data, telemetry } = this.props;\r\n const selectedRefiners = (data.listPageState.result && data.listPageState.result.activeFilters) || [];\r\n return (\r\n <ChoiceSummary\r\n classNames='ms-choice-summary-by-category'\r\n clearAllText={resources.clearAllText}\r\n label={resources.choiceSummaryLabel}\r\n selectedChoices={selectedRefiners}\r\n // @ts-ignore: NOTE Type-unsafe line below, null refinersByCategoryHierarchy case not handled\r\n refinerHierarchy={data.refiners.result}\r\n choiceFormat={resources.choiceFormat}\r\n choiceRangeValueFormat={resources.choiceRangeValueFormat}\r\n telemetry={telemetry}\r\n onChoiceClicked={this._onChoiceClicked}\r\n urlBuilder={this._buildRefinerUrlForChoiceSummary}\r\n choiceAriaLabel={resources.choiceAriaLabel}\r\n />\r\n );\r\n\r\n };\r\n\r\n private _updateSortByDropdown = (notification: ILabeledDropdownOnChangeNotification): void => {\r\n const { context } = this.props;\r\n const requestContext = context && context.request;\r\n const actionContext = context && context.actionContext;\r\n\r\n if (!requestContext || !actionContext || !this.props.data.listPageState.result) {\r\n const error = `[sort-by-category] cannot sort without context: ${!requestContext ? 'requestContext ' : ''} ${!actionContext ? 'actionContext ' : ''} could not be found`;\r\n this.props.telemetry.warning(error);\r\n }\r\n\r\n window.history.pushState({}, '', buildListPageUrl(getCurrentUrl(this.props.context.request), undefined, [this._getSortColumnFromSelectedOption(notification.selectedOption)], undefined));\r\n transaction(() => {\r\n this.props.data.listPageState.result!.currentPageNumber = 0;\r\n this.props.data.listPageState.result!.sortingCritera = { Columns: [this._getSortColumnFromSelectedOption(notification.selectedOption)] };\r\n });\r\n };\r\n\r\n private _getSortColumnFromSelectedOption = (option: ILabeledDropdownOption): SortColumn => {\r\n const { data } = this.props;\r\n\r\n if (!data.searchConfiguration.result) {\r\n return {};\r\n }\r\n\r\n const mappedConfiguration = data.searchConfiguration.result.find((searchConfiguration) => { return searchConfiguration.key === option.key; });\r\n\r\n if (mappedConfiguration) {\r\n return mappedConfiguration.sortColumn;\r\n }\r\n\r\n return {};\r\n };\r\n\r\n private _getCurrentlySelectedOption = (): ILabeledDropdownOption | undefined => {\r\n const { data } = this.props;\r\n const sortCriteria = data.listPageState.result && data.listPageState.result.sortingCritera;\r\n\r\n const activeSortColumn =\r\n (sortCriteria?.Columns?.length && sortCriteria.Columns[0]) ||\r\n (parseQueryParam<SortColumn[]>('sorting', this.props.context.request) || [])[0];\r\n\r\n if (activeSortColumn && data.searchConfiguration.result) {\r\n const activeMappedConfig = data.searchConfiguration.result.find((mappedSearchConfig) => {\r\n return (mappedSearchConfig.sortColumn.ColumnName === activeSortColumn.ColumnName) &&\r\n (mappedSearchConfig.sortColumn.IsDescending === activeSortColumn.IsDescending);\r\n });\r\n if (activeMappedConfig) {\r\n return this.sortByDropdownOptions.find((dropdownOption) => dropdownOption.key === activeMappedConfig.key);\r\n }\r\n }\r\n\r\n return;\r\n };\r\n\r\n private _onUpdateRefiners = (itemToggleNotification: IRefineItemToggleNotification): void => {\r\n const { context } = this.props;\r\n const requestContext = context && context.request;\r\n const actionContext = context && context.actionContext;\r\n\r\n if (!requestContext || !actionContext || !this.props.data.listPageState.result) {\r\n const error = `Refine menu cannot refine search criteria: ${!requestContext ? 'requestContext ' : ''} ${!actionContext ? 'actionContext ' : ''} could not be found`;\r\n this.props.telemetry.warning(error);\r\n }\r\n\r\n const updatedRefinementCriteria = getUpdatedRefinementCriteria(itemToggleNotification, this.props.data.listPageState.result && this.props.data.listPageState.result.activeFilters || []);\r\n\r\n window.history.pushState({}, '', buildListPageUrl(getCurrentUrl(this.props.context.request), updatedRefinementCriteria));\r\n transaction(() => {\r\n this.props.data.listPageState.result!.currentPageNumber = 0;\r\n this.props.data.listPageState.result!.activeFilters = updatedRefinementCriteria;\r\n });\r\n };\r\n\r\n private _buildRefinerUrl = (itemToggleNotification: IRefineItemToggleNotification): string => {\r\n if (this.props.data.listPageState.result) {\r\n const newRefinementCriteria = getUpdatedRefinementCriteria(itemToggleNotification, this.props.data.listPageState.result.activeFilters || []);\r\n\r\n return buildListPageUrl(getCurrentUrl(this.props.context.request), newRefinementCriteria);\r\n } else {\r\n this.props.telemetry.warning(`[buildRefinerQueryString]List Page State Not available, unable to build refiner URL`);\r\n return '';\r\n }\r\n };\r\n\r\n private _onChoiceClicked = (notification: IChoiceSummaryClickNotification): void => {\r\n const { data, telemetry } = this.props;\r\n\r\n if (!data.listPageState.result) {\r\n telemetry.warning('[choice-summary-by-category._onChoiceClicked]ListPageState unavailable, unable to update refiners.');\r\n return;\r\n }\r\n\r\n let currentRefinementCriteria = (data.listPageState.result && data.listPageState.result.activeFilters) || [];\r\n\r\n if (!notification.clearAll) {\r\n const selectedChoice = notification.choiceClicked;\r\n if (!selectedChoice) {\r\n telemetry.warning('[choice-summary-by-category._onChoiceClicked] Choice could not be determined');\r\n return;\r\n }\r\n currentRefinementCriteria = currentRefinementCriteria.filter(\r\n (selectedCriterion: ProductRefinerValue) => !isMatchingRefinementCriterion(selectedChoice, selectedCriterion)\r\n );\r\n } else {\r\n currentRefinementCriteria = [];\r\n\r\n // set focus to sort and filter\r\n const dropdownElementId = this._sortAndFilterContainerRef.current && this._sortAndFilterContainerRef.current.props.dropdownId;\r\n const dropdownElement = dropdownElementId && document.getElementById(dropdownElementId);\r\n setTimeout(() => {\r\n dropdownElement && dropdownElement.focus();\r\n },\r\n 50);\r\n }\r\n\r\n const fullUrl = getCurrentUrl(this.props.context.request);\r\n window.history.pushState({}, '', buildListPageUrl(fullUrl, currentRefinementCriteria));\r\n data.listPageState.result.currentPageNumber = 0;\r\n data.listPageState.result.activeFilters = currentRefinementCriteria;\r\n };\r\n\r\n private _buildRefinerUrlForChoiceSummary = (selectedRefiner: ProductRefinerValue, isClearAll: boolean): string => {\r\n const { data, telemetry } = this.props;\r\n const fullUrl = getCurrentUrl(this.props.context.request);\r\n\r\n if (!data.listPageState.result) {\r\n telemetry.warning('[choice-summary-by-category._buildRefinerUrl]ListPageState unavailable, unable to create refiner URL.');\r\n return fullUrl.href;\r\n }\r\n\r\n let currentRefinementCriteria = (data.listPageState.result && data.listPageState.result.activeFilters) || [];\r\n\r\n if (!isClearAll) {\r\n if (!selectedRefiner) {\r\n telemetry.warning('[choice-summary-by-category._buildRefinerUrl] URL for Choice could not be determined');\r\n return fullUrl.href;\r\n }\r\n currentRefinementCriteria = currentRefinementCriteria.filter(\r\n (selectedCriterion: ProductRefinerValue) => !isMatchingRefinementCriterion(selectedRefiner, selectedCriterion)\r\n );\r\n } else {\r\n currentRefinementCriteria = [];\r\n }\r\n\r\n return buildListPageUrl(fullUrl, currentRefinementCriteria);\r\n };\r\n\r\n private _getViewport(): GridSize {\r\n const { context } = this.props;\r\n\r\n // always render in mobile viewport on a mobile device\r\n if (context.request && context.request.device && context.request.device.Type === 'Mobile') {\r\n return 'xs';\r\n }\r\n\r\n if (MsDyn365.isBrowser && window.innerWidth) {\r\n const gridSettings = context.request.gridSettings;\r\n if (gridSettings) {\r\n if (gridSettings.xs && window.innerWidth <= gridSettings.xs.w) {\r\n return 'xs';\r\n } else if (gridSettings.sm && window.innerWidth <= gridSettings.sm.w) {\r\n return 'sm';\r\n } else if (gridSettings.md && window.innerWidth <= gridSettings.md.w) {\r\n return 'md';\r\n } else if (gridSettings.lg && window.innerWidth <= gridSettings.lg.w) {\r\n return 'lg';\r\n } else {\r\n return 'xl';\r\n }\r\n }\r\n }\r\n\r\n return 'lg';\r\n }\r\n\r\n private _toggleModal(): void {\r\n this.setState({\r\n modalIsOpen: !this.state.modalIsOpen\r\n });\r\n }\r\n\r\n private _updateViewport(): void {\r\n this._viewport = this._getViewport();\r\n\r\n if (this.state.modalIsOpen && !this.isMobile) {\r\n this._toggleModal();\r\n }\r\n }\r\n\r\n private _getCategoryDescription(paragraph: RichText | undefined): JSX.Element | undefined {\r\n\r\n if (paragraph && paragraph.length > 0) {\r\n return <RichTextComponent className='category-description' text={paragraph} />;\r\n }\r\n return undefined;\r\n }\r\n\r\n private get _subscriptionQuantityLimit(): number {\r\n return this.props.config.quantityLimit || 12; // 12 is default\r\n }\r\n\r\n private get _shouldDisableQuantityAddition(): boolean {\r\n const { checkoutState: { result: checkoutState } } = this.props.data;\r\n if (!checkoutState) { return false; }\r\n const filteredLines = filterCartLines(checkoutState.checkoutCart.cart);\r\n let amount = 0;\r\n filteredLines.subscriptionLines.forEach(line => amount += line.Quantity || 0);\r\n if (amount >= this._subscriptionQuantityLimit) { return false; }\r\n return true;\r\n }\r\n\r\n private async _getProductavailabilty(products: IFullProductsSearchResultsWithCount): Promise<void> {\r\n if (products && products.count && products.count > 0) {\r\n const productIds: number[] = [];\r\n products.products.forEach((product) => {\r\n productIds.push(product.RecordId);\r\n });\r\n const availabilityAll = await getEstimatedAvailabilityAsync({ callerContext: this.props.context.actionContext }, { ProductIds: productIds, DefaultWarehouseOnly: true });\r\n const formattedResponse = availabilityAll.ProductWarehouseInventoryAvailabilities?.map((product) => {\r\n return { ProductId: product.ProductId, AvailableQuantity: product.PhysicalAvailable, ExtensionProperties: product.ExtensionProperties };\r\n }) as ProductAvailableQuantity[];\r\n this.setState({ productAvailability: formattedResponse });\r\n }\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n private _emitImpressionEvent(products: ProductSearchResult[]): void {\r\n const impressions = products.map(product => ({\r\n product,\r\n attributes: CommerceAttributesParser.getParsedAttributes(product.AttributeValues || []),\r\n }));\r\n\r\n publish('impression', {\r\n products: impressions,\r\n\r\n list: 'Category Page', // Could be Search Results if we ever enable search results pages\r\n category: this.props.data.category.result?.Name,\r\n context: this.props.context,\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 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<ISmweBuyboxViewProps> = 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<string> = 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 <Module {...ModuleProps}>\r\n <Node {...MediaGalleryContainerProps}>{props.mediaGallery}</Node>\r\n <Node {...ProductInfoContainerProps}>\r\n {props.productApellation && (\r\n <div>{props.productApellation}</div>\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 <React.Fragment key={index}>\r\n {contentSlotData}\r\n </React.Fragment>\r\n );\r\n }\r\n )}\r\n </Node>\r\n </Module>\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<string>;\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 <div className={classnames('sku-selector', tableClass?.result)}>\r\n <div className='sku-selector__price'>\r\n {productPrice && <div className={classnames('sku-selector__price-default', { 'price-width-adjust': isGiftCard })}>{productPrice}</div>}\r\n {!isGiftCard && productClubPrice && <div className='sku-selector__price-club'>{productClubPrice} Club</div>}\r\n </div>\r\n <div className='sku-selector__cart'>\r\n {quantity && <div className={classnames('sku-selector__cart-quantity', { unselectable: isGiftCard })}>{_renderQuantity(quantity)}</div>}\r\n {addToCart && <div className='sku-selector__cart-button'>{_renderAddToCart(addToCart)}</div>}\r\n </div>\r\n </div>\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 <Node {...ContainerProps}>\r\n {errorBlock}\r\n {button}\r\n </Node>\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 <Node {...ContainerProps}>\r\n <Node {...LabelContainerProps}>\r\n {errors}\r\n </Node>\r\n {input}\r\n </Node>\r\n );\r\n};\r\n\r\nexport default SmweBuyboxView;\r\n","import {\r\n Button,\r\n Modal,\r\n ModalBody,\r\n ModalFooter,\r\n ModalHeader\r\n} from '@msdyn365-commerce-modules/utilities';\r\nimport React from 'react';\r\n\r\nexport interface ISearchResultModalViewProps {\r\n modal: React.ReactElement;\r\n modalHeader: React.ReactElement;\r\n modalFooter: React.ReactElement;\r\n modalBody: React.ReactElement;\r\n}\r\n\r\ninterface IModalToggleProps {\r\n innerRef: React.RefObject<HTMLButtonElement> | undefined;\r\n id: string;\r\n text: string;\r\n ariaLabel: string;\r\n onClick(): void;\r\n}\r\n\r\nexport interface ISearchResultModalResources {\r\n modalTitle: string;\r\n modalCloseButtonText: string;\r\n}\r\n\r\nexport interface ISearchResultModalProps {\r\n resources: ISearchResultModalResources;\r\n isOpen: boolean;\r\n returnRef: React.RefObject<HTMLButtonElement> | undefined;\r\n onModalToggle():void;\r\n}\r\n\r\nexport const ModalToggle: React.FC<IModalToggleProps> = (props: IModalToggleProps) => {\r\n const {text, onClick, ariaLabel, innerRef, id} = props;\r\n return <button id={id} className='msc-button' aria-label={ariaLabel} onClick={onClick} ref={innerRef}>{text}</button>;\r\n};\r\n\r\nexport const SearchResultModal = (props: ISearchResultModalProps):ISearchResultModalViewProps => {\r\n return {\r\n modal: modalNode(props),\r\n modalHeader: modalHeaderNode(props),\r\n modalFooter: modalFooterNode(props),\r\n modalBody: <ModalBody className='msc-review-modal-body'/>\r\n };\r\n};\r\n\r\nconst modalNode = (props: ISearchResultModalProps) => {\r\n return (\r\n <Modal\r\n autoFocus={true}\r\n applicationNode={'renderPage'}\r\n returnFocusRef={props.returnRef}\r\n isOpen={props.isOpen}\r\n toggle={props.onModalToggle}\r\n className={'msc-search-result-modal'}\r\n zIndex={1050}\r\n />\r\n );\r\n};\r\n\r\nconst modalHeaderNode = (props: ISearchResultModalProps) => {\r\n return (\r\n <ModalHeader toggle={props.onModalToggle}>\r\n {props.resources.modalTitle}\r\n </ModalHeader>\r\n );\r\n};\r\n\r\nconst modalFooterNode = (props: ISearchResultModalProps) => {\r\n return (\r\n <ModalFooter>\r\n <Button onClick={props.onModalToggle} className='ms-sort-and-filter-modal-close'>\r\n {props.resources.modalCloseButtonText}\r\n </Button>\r\n </ModalFooter>\r\n );\r\n};","// TODO: Need to find replacement for GetActiveCartInput retail actions in 2.0\r\n// import { getActiveCart, GetActiveCartInput } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\n// TODO: may serve as replacement, need to test functionality\r\nimport { BaseCartState, getCartState, GlobalStateInput, ICartState } from '@msdyn365-commerce/global-state';\r\n\r\nimport { Modal, ModalBody, ModalHeader } from '@msdyn365-commerce-modules/utilities';\r\nimport { ICoreContext } from '@msdyn365-commerce/core';\r\nimport * as React from 'react';\r\nimport Button from 'reactstrap/lib/Button';\r\n\r\nexport interface IProductLightboxProps {\r\n id: string;\r\n width: number;\r\n height: number;\r\n productLightboxHref: string;\r\n iframeSrc?: string;\r\n buttonText?: string;\r\n lightboxClassName?: string;\r\n iframeClassName?: string;\r\n context: ICoreContext;\r\n}\r\n\r\nexport interface IProductAttributeProps {\r\n TextValue: string;\r\n Name: string;\r\n}\r\n\r\ninterface IProductLightboxData {\r\n isOpen: boolean;\r\n}\r\n\r\n/**\r\n * Lightbox Component\r\n */\r\nexport default class ProductLightbox extends React.PureComponent<IProductLightboxProps, IProductLightboxData> {\r\n constructor(props: IProductLightboxProps) {\r\n super(props);\r\n this.state = { isOpen: false };\r\n }\r\n\r\n public componentDidMount(): undefined {\r\n window.addEventListener && window.addEventListener('message', this.onMessage);\r\n return;\r\n }\r\n\r\n public render(): JSX.Element {\r\n const { lightboxClassName, iframeClassName } = this.props;\r\n // @ts-ignore\r\n const iframeSrcObj = (new URL(this.props.iframeSrc));\r\n const iframeId = `iframe-${this.props.id}`;\r\n return (\r\n <div className={lightboxClassName && lightboxClassName !== ''? lightboxClassName : 'product-lightbox'}>\r\n {this._launchLightboxButton(this.props.buttonText)}\r\n {(this.state.isOpen) && <Modal\r\n autoFocus={true}\r\n fade={true}\r\n isOpen={this.state.isOpen}\r\n horizontalPosition={'center'}\r\n verticalPosition={'center'}\r\n zIndex={1000}\r\n toggle={this._closeModal}\r\n applicationNode={'rsg-root'}\r\n aria-labelledby={iframeId}\r\n >\r\n <ModalHeader toggle={this._closeModal}/>\r\n <ModalBody>\r\n <div className={iframeClassName && iframeClassName !== '' ? iframeClassName : 'product-iframe'}>\r\n {/* tslint:disable-next-line: react-iframe-missing-sandbox */}\r\n <iframe\r\n className={iframeClassName && iframeClassName !== '' ? `${iframeClassName}-content` : 'iframe-module-content'}\r\n src={iframeSrcObj.href}\r\n width={this.props.width}\r\n height={this.props.height}\r\n title={this.props.buttonText}\r\n id={iframeId}\r\n />\r\n </div>\r\n </ModalBody>\r\n </Modal>}\r\n </div>\r\n );\r\n }\r\n\r\n private onMessage = async (e: MessageEvent) => {\r\n if (!e.isTrusted || e.origin !== window.origin) {\r\n return;\r\n }\r\n // @ts-ignore\r\n const iframeSrcObj = (new URL(this.props.iframeSrc));\r\n\r\n // TODO: Need to find replacement for GetActiveCartInput retail actions in 2.0\r\n // if (e.data.url === iframeSrcObj.href) {\r\n // setTimeout(async () => {\r\n // const context = this.props.context;\r\n // const cartInput = new GetActiveCartInput(context.request.apiSettings, true);\r\n // const newCart = await getActiveCart(cartInput, context.actionContext);\r\n // context.actionContext.update(cartInput, newCart);\r\n // }, 10);\r\n // }\r\n\r\n // TODO: may work as replacement, need to test\r\n if (e.data.url === iframeSrcObj.href) {\r\n setTimeout(async () => {\r\n const context = this.props.context;\r\n const cartInput = new GlobalStateInput<ICartState>('CARTSTATE', BaseCartState, context.actionContext.requestContext.apiSettings);\r\n const newCart = await getCartState(context.actionContext);\r\n context.actionContext.update(cartInput, newCart);\r\n await newCart.refreshCart({});\r\n }, 10);\r\n }\r\n };\r\n\r\n private _launchLightboxButton(buttonText: string | undefined): JSX.Element | null {\r\n return (<Button id={this.props.id} className='launch-lightbox-button' onClick={this._openModal} aria-label=\"Quick view button, click here to view\">{buttonText ? buttonText : 'Quick View'}</Button>);\r\n }\r\n\r\n private _closeModal = () => {\r\n this.setState(prevState => ({\r\n isOpen: !prevState.isOpen\r\n }));\r\n const quickView: HTMLElement | null = document.getElementById(this.props.id);\r\n quickView!.focus();\r\n };\r\n private _openModal = () => {\r\n this.setState(prevState => ({\r\n isOpen: !prevState.isOpen\r\n }));\r\n };\r\n}","import { getProductPageUrlSync } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { CategoryHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { RatingComponent } from '@msdyn365-commerce/components';\r\nimport { IComponent, IComponentProps, ICoreContext, IGridSettings, IImageData, IImageSettings, Image, msdyn365Commerce, RichTextComponent } from '@msdyn365-commerce/core';\r\nimport { ICartState, ICheckoutState } from '@msdyn365-commerce/global-state';\r\nimport { AsyncResult, AttributeValue, ProductAvailableQuantity, ProductPrice, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\r\nimport classnames from 'classnames';\r\nimport React from 'react';\r\nimport AcclaimRatingsDisplay from '../modules/acclaim-ratings/acclaim-ratings-display';\r\nimport { ISmweProductCollectionProps } from '../modules/smwe-product-collection/smwe-product-collection.props.autogenerated';\r\nimport { ISmweSearchResultContainerProps } from '../modules/smwe-search-result-container/smwe-search-result-container.props.autogenerated';\r\nimport { CartUtilities } from '../Utilities/cart-utils';\r\nimport { BusLoader, LoadBus } from '../Utilities/event-bus';\r\nimport ProductLightbox, { IProductLightboxProps } from '../Utilities/product-lightbox';\r\nimport { filterCartLines } from '../Utilities/subscription-manager';\r\n\r\nexport interface ISmweSearchResultContainerParentProps extends ISmweSearchResultContainerProps<{}> {\r\n categoryHierarchy: CategoryHierarchy | undefined;\r\n}\r\n\r\nexport interface ISmweProductCollectionParentProps extends ISmweProductCollectionProps<{}> {\r\n categoryHierarchy: undefined;\r\n}\r\n\r\nexport interface IProductComponentProps extends IComponentProps<{ product?: ProductSearchResult }> {\r\n checkoutState?: AsyncResult<ICheckoutState>;\r\n cart?: AsyncResult<ICartState>;\r\n displayQuantitySlider?: boolean;\r\n disableQuantitySlider?: boolean;\r\n maxAdditionLimit?: number;\r\n className?: string;\r\n imageSettings?: IImageSettings;\r\n savingsText?: string;\r\n freePriceText?: string;\r\n originalPriceText?: string;\r\n currentPriceText?: string;\r\n ratingAriaLabel?: string;\r\n subscriptionBtnText?: string;\r\n parentProps: ISmweSearchResultContainerParentProps | ISmweProductCollectionParentProps;\r\n addToCart?: boolean;\r\n addToCartText?: string;\r\n giftCardText?: string;\r\n addToCartMessage?: string;\r\n showPrice?: boolean;\r\n availability?: ProductAvailableQuantity | undefined;\r\n clubPrice?: ProductPrice | undefined;\r\n showQuantityAsDropdown?: boolean;\r\n}\r\n\r\nexport interface IProductComponent extends IComponent<IProductComponentProps> { }\r\n\r\nconst PriceComponentActions = {\r\n};\r\nlet qtyAddedToCart: number = 0;\r\n\r\n// tslint:disable-next-line:cyclomatic-complexity\r\nconst ProductCard: React.FC<IProductComponentProps> = ({\r\n data,\r\n context,\r\n imageSettings,\r\n savingsText,\r\n freePriceText,\r\n originalPriceText,\r\n currentPriceText,\r\n ratingAriaLabel,\r\n typeName,\r\n id,\r\n parentProps,\r\n checkoutState,\r\n subscriptionBtnText,\r\n displayQuantitySlider,\r\n showPrice\r\n}) => {\r\n const {\r\n showStarRating,\r\n launchLightboxButtonText,\r\n productLightboxHref,\r\n productLightboxWidth,\r\n productLightboxHeight,\r\n productLightboxClassName,\r\n productLightboxIframeClassName,\r\n cardBanner\r\n } = parentProps.config;\r\n const product = data.product;\r\n const recordId = product?.RecordId;\r\n if (!product) {\r\n return null;\r\n }\r\n\r\n const productLightboxProps: IProductLightboxProps = {\r\n id: '',\r\n buttonText: launchLightboxButtonText,\r\n productLightboxHref: productLightboxHref,\r\n width: productLightboxWidth,\r\n height: productLightboxHeight,\r\n lightboxClassName: productLightboxClassName,\r\n iframeClassName: productLightboxIframeClassName,\r\n context: parentProps.context\r\n };\r\n\r\n if (productLightboxProps) {\r\n productLightboxProps.id = `product-placement-${recordId}`;\r\n const domainUrl = _getEndpoint(context && context.request.url.requestUrl.toString());\r\n if (productLightboxProps.productLightboxHref && productLightboxProps.productLightboxHref.indexOf('?') >= 0) {\r\n productLightboxProps.iframeSrc = `${domainUrl}${productLightboxProps.productLightboxHref}&productId=${recordId}`;\r\n } else {\r\n productLightboxProps.iframeSrc = `${domainUrl}${productLightboxProps.productLightboxHref}?productId=${recordId}`;\r\n }\r\n }\r\n\r\n let tastingNotes: AttributeValue | undefined;\r\n let appellation: AttributeValue | undefined;\r\n let banner: AttributeValue | undefined;\r\n let productType: AttributeValue | undefined;\r\n if (product.AttributeValues) {\r\n product.AttributeValues.forEach(attribute => {\r\n switch (attribute.Name) {\r\n case 'Tasting Notes':\r\n tastingNotes = attribute;\r\n break;\r\n case 'SLR Appellation':\r\n appellation = attribute;\r\n break;\r\n case 'Appellation':\r\n appellation = attribute;\r\n break;\r\n case cardBanner:\r\n banner = attribute;\r\n break;\r\n case 'Product Type':\r\n productType = attribute;\r\n break;\r\n default:\r\n }\r\n });\r\n }\r\n const ariaLabel = `${(appellation && appellation.TextValue) ? appellation.TextValue : ''}\r\n ${product.Name ? product.Name : ''}\r\n ${(tastingNotes && tastingNotes.TextValue) ? tastingNotes.TextValue : ''}`;\r\n const imageProductClass = productType && productType.TextValue ? `product-type-${productType.TextValue.replace(/\\s+/g, '-').toLowerCase()}` : '';\r\n const productUrl = getProductPageUrlSync(product.Name || '', product.RecordId, context && context.actionContext, parentProps.categoryHierarchy);\r\n const isGiftCard = product.ItemId?.toLowerCase() === 'giftcard';\r\n let imageUrl = product.PrimaryImageUrl;\r\n if (isGiftCard && parentProps.app.config.giftCardImage) {\r\n imageUrl = parentProps.app.config.giftCardImage;\r\n }\r\n return (\r\n <>\r\n <a href={productUrl} aria-label={ariaLabel} className={`msc-product__details product-placement-content ${imageProductClass}`}>\r\n <div className='msc-product__image'>\r\n {renderProductPlacementImage(imageSettings, context.request.gridSettings, imageUrl, product.Name)}\r\n <div className='product-details'>\r\n {banner && renderAttribute(banner, 'product-details-banner')}\r\n <i className='fas fa-chevron-right' />\r\n <div className='product-details-header'>\r\n {renderAttribute(appellation, 'product-attribute appellation')}\r\n <h6 className='product-placement__item-title'>{product.Name}</h6>\r\n </div>\r\n {renderAttribute(tastingNotes, 'product-attribute description')}\r\n {showPrice && !displayQuantitySlider && product.Price && renderPrice(product.Price)}\r\n {recordId && renderAcclaim(recordId)}\r\n {showStarRating && renderRating(context, typeName, id, product.AverageRating, product.TotalRatings, ratingAriaLabel)}\r\n </div>\r\n </div>\r\n </a>\r\n {renderProductLightboxButton(productLightboxProps)}\r\n </>\r\n );\r\n};\r\n\r\nfunction renderRating(context: ICoreContext, typeName: string, id: string, avgRating?: number, totalRatings?: number, ariaLabel?: string): JSX.Element | null {\r\n if (!avgRating) {\r\n return null;\r\n }\r\n\r\n const numRatings = totalRatings && totalRatings.toString() || undefined;\r\n\r\n return (\r\n <RatingComponent\r\n context={context}\r\n id={id}\r\n typeName={typeName}\r\n avgRating={avgRating}\r\n ratingCount={numRatings}\r\n readOnly={true}\r\n ariaLabel={ariaLabel || ''}\r\n data={{}}\r\n />\r\n );\r\n}\r\n\r\nfunction renderProductPlacementImage(imageSettings?: IImageSettings, gridSettings?: IGridSettings, imageUrl?: string, altText?: string): JSX.Element | null {\r\n if (!imageUrl || !gridSettings || !imageSettings) {\r\n return null;\r\n }\r\n const img: IImageData = {\r\n src: imageUrl,\r\n altText: altText ? altText : ''\r\n };\r\n const imageProps = {\r\n gridSettings: gridSettings,\r\n imageSettings: imageSettings\r\n };\r\n return (\r\n <Image {...img} {...imageProps} loadFailureBehavior='empty' />\r\n );\r\n}\r\n\r\nfunction renderAttribute(attribute: AttributeValue | undefined, className: string | ''): JSX.Element | null {\r\n return (\r\n <div className={className}>\r\n {attribute && <RichTextComponent\r\n className='product-attribute-value'\r\n text={(attribute.TextValue !== undefined ? attribute.TextValue : '')}\r\n />}\r\n </div>\r\n );\r\n}\r\n\r\n// Render acclaim ratings if any\r\n// @FIXME/dg: Hardcoding the count and date/reviewer settings is bad!\r\nfunction renderAcclaim(recordId: number): JSX.Element | null {\r\n return (\r\n <AcclaimRatingsDisplay productID={recordId} numberToShow={1} showReviewer={true} showDate={false} />\r\n );\r\n}\r\n\r\nfunction renderPrice(price: number, className?: string, clubPrice?: number): JSX.Element | null {\r\n return (\r\n <div className={classnames('product-price', className)}>\r\n <span className='product-component-wrapper-price-default'>${price.toFixed(2).replace(/\\.00$/,'')}</span>\r\n {clubPrice && <span className='product-component-wrapper-price-club'>${clubPrice.toFixed(2).replace(/\\.00$/,'')} Club</span>}\r\n </div>\r\n );\r\n}\r\n\r\nfunction _getEndpoint(url: string | undefined): string | null {\r\n if (url) {\r\n const urlParts = url.split('/');\r\n return url.indexOf('//') > -1 ? `${urlParts[0]}//${urlParts[2]}` : urlParts[0];\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfunction renderProductLightboxButton(productLightboxProps: IProductLightboxProps | undefined): JSX.Element | null {\r\n if (!productLightboxProps) {\r\n return null;\r\n }\r\n\r\n return (\r\n <React.Fragment>\r\n <ProductLightbox {...productLightboxProps} />\r\n </React.Fragment>\r\n );\r\n}\r\n\r\n// @ts-ignore\r\nexport const ProductComponent: React.FunctionComponent<IProductComponentProps> = msdyn365Commerce.createComponentOverride<IProductComponent>(\r\n 'Product',\r\n { component: ProductCard, ...PriceComponentActions }\r\n);\r\n\r\ninterface IProductComponentWrapperData {\r\n quantity: number;\r\n disable: boolean;\r\n cartMessage: string;\r\n}\r\n\r\n/**\r\n * class definition containing product component for\r\n * add to cart state\r\n */\r\n@LoadBus('product-component-wrapper')\r\nclass ProductComponentWrapper extends React.Component<IProductComponentProps, IProductComponentWrapperData> {\r\n\r\n private bus: BusLoader | undefined;\r\n private addToCartSubId: number;\r\n private finishAddToCartSubId: number;\r\n\r\n constructor(props: IProductComponentProps) {\r\n super(props);\r\n this.state = {\r\n quantity: 1,\r\n disable: false,\r\n cartMessage: ''\r\n };\r\n this._decreaseCartQuantity = this._decreaseCartQuantity.bind(this);\r\n this._increaseCartQuantity = this._increaseCartQuantity.bind(this);\r\n this._onQuantityChange = this._onQuantityChange.bind(this);\r\n this._onClickAddToCart = this._onClickAddToCart.bind(this);\r\n this._onClickAddToSubscription = this._onClickAddToSubscription.bind(this);\r\n\r\n this.addToCartSubId = this.bus?.subscribe('adding-to-cart', () => { this.setState({ disable: true }); }).id!;\r\n this.finishAddToCartSubId = this.bus?.subscribe('finished-adding-to-cart', () => { this.setState({ disable: false }); }).id!;\r\n }\r\n\r\n public componentWillUnmount(): void {\r\n this.bus?.unsubscribe(this.addToCartSubId);\r\n this.bus?.unsubscribe(this.finishAddToCartSubId);\r\n }\r\n\r\n // tslint:disable-next-line:cyclomatic-complexity\r\n public render(): JSX.Element | null {\r\n if (this.props.data.product && this.props.data.product.RecordId && this.props.displayQuantitySlider) {\r\n const attributes: AttributeValue[] | undefined = this.props.data.product.AttributeValues;\r\n const productType: AttributeValue | undefined = attributes?.find(attribute => attribute.Name === 'Product Type');\r\n const bottleSize: AttributeValue | undefined = attributes?.find(attribute => attribute.Name === 'Wine Bottle Size');\r\n const imageProductClass = productType?.TextValue ? `product-type-${productType.TextValue.replace(/\\s+/g, '-').toLowerCase()}` : '';\r\n const { subscriptionBtnText } = this.props;\r\n const outOfStock = this.props.availability?.AvailableQuantity === undefined || this.props.availability?.AvailableQuantity > this.props.context.app.config.outOfStockThreshold ? false : true;\r\n const availability = this.props.availability?.AvailableQuantity && this.props.availability.AvailableQuantity - this.props.context.app.config.outOfStockThreshold;\r\n const productUrl = getProductPageUrlSync(this.props.data.product.Name || '', this.props.data.product.RecordId, this.props.context && this.props.context.actionContext, this.props.parentProps.categoryHierarchy);\r\n const showQuantityAsDropdown:boolean = this.props.showQuantityAsDropdown || false;\r\n const maxQuantity: number | undefined = availability || 10;\r\n const quantityControl = this._generateQuantityControl(maxQuantity, this.state.quantity, showQuantityAsDropdown);\r\n\r\n if (this.props.giftCardText && bottleSize && bottleSize.TextValue === 'Gift Card') {\r\n return (\r\n <React.Fragment>\r\n <ProductComponent {...this.props} />\r\n <div className={classnames('product-component-wrapper', imageProductClass, 'product-component-wrapper-giftcard')}>\r\n <a\r\n href={productUrl}\r\n aria-label={this.props.giftCardText}\r\n className='product-component-wrapper-giftcard-link'\r\n >\r\n {this.props.giftCardText}\r\n </a>\r\n </div>\r\n </React.Fragment>\r\n );\r\n }\r\n return (\r\n <React.Fragment>\r\n <ProductComponent {...this.props} />\r\n <div className={classnames('product-component-wrapper', imageProductClass)}>\r\n {this.props.data.product.Price && renderPrice(this.props.data.product.Price, 'product-component-wrapper-price', this.props.clubPrice?.CustomerContextualPrice)}\r\n <div className='product-component-wrapper-quantity-group' hidden={outOfStock}>\r\n <button className='product-component-wrapper-decrease-button' onClick={this._decreaseCartQuantity}>-</button>\r\n {quantityControl}\r\n <button className='product-component-wrapper-increase-button' onClick={this._increaseCartQuantity}>+</button>\r\n </div>\r\n {this.props.addToCart && this.props.addToCartText && (\r\n <div className='product-component-wrapper-add-to-cart'>\r\n <button\r\n className={outOfStock ? 'product-component-wrapper-add-to-cart-out-of-stock' : 'product-component-wrapper-add-to-cart-button'}\r\n disabled={this.state.disable || outOfStock}\r\n onClick={this._onClickAddToCart}\r\n >\r\n {outOfStock ? 'Out of stock' : this.props.addToCartText}\r\n </button>\r\n <div className={`product-component-wrapper-add-to-cart-message ${this.state.cartMessage}`} hidden={!this.state.cartMessage}>\r\n {this.state.cartMessage === 'success' && `${qtyAddedToCart} ${qtyAddedToCart === 1 ? 'item' : 'items'} ${this.props.addToCartMessage}`}\r\n {availability && this.state.cartMessage === 'error' && `Quantity available: ${availability}`}\r\n {/* Start Mixed Cart Bandaid */}\r\n {this.state.cartMessage === 'mixedcart' && 'Gift cards and events may not be combined with wine or merchandise orders. Please remove them from your cart and place a separate order.'}\r\n {/* End Mixed Cart Bandaid */}\r\n </div>\r\n </div>\r\n )\r\n }\r\n {\r\n this.props.checkoutState && subscriptionBtnText && (\r\n <div className='product-component-wrapper-add-to-subscription'>\r\n <button\r\n className={outOfStock ? 'product-component-wrapper-add-to-cart-out-of-stock' : 'product-component-wrapper-add-to-subscription-button'}\r\n disabled={this.state.disable || (this._isAdditionInvalid && !!this.props.disableQuantitySlider) || outOfStock}\r\n onClick={this._onClickAddToSubscription}\r\n >\r\n {outOfStock ? 'Out of stock' : subscriptionBtnText}\r\n </button>\r\n <div className={`product-component-wrapper-add-to-cart-message ${this.state.cartMessage}`} hidden={!this.state.cartMessage}>\r\n {this.state.cartMessage === 'success' && `${qtyAddedToCart} ${qtyAddedToCart === 1 ? 'item' : 'items'} ${this.props.addToCartMessage}`}\r\n {availability && this.state.cartMessage === 'error' && `Quantity available: ${availability}`}\r\n {/* Start Mixed Cart Bandaid */}\r\n {this.state.cartMessage === 'mixedcart' && 'Gift cards and events may not be combined with wine or merchandise orders. Please remove them from your cart and place a separate order.'}\r\n {/* End Mixed Cart Bandaid */}\r\n </div>\r\n </div>\r\n )\r\n }\r\n </div>\r\n </React.Fragment>\r\n );\r\n } else {\r\n return <ProductComponent {...this.props} />;\r\n }\r\n }\r\n\r\n private _generateMenu = (quantity: number | undefined) => {\r\n const nodes = [];\r\n\r\n if (quantity !== undefined) {\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(<option className='product-component__quantity__select-menu__item' value={i}>{i}</option>);\r\n }\r\n }\r\n\r\n return nodes;\r\n };\r\n\r\n private _generateSelectMenu = (maxQuantity: number | undefined, currentQuantity: number): JSX.Element => {\r\n return (\r\n <select className='product-component__quantity__select-menu' value={currentQuantity} onChange={this._onQuantityChange}>\r\n {\r\n this._generateMenu(maxQuantity)\r\n }\r\n </select>\r\n );\r\n };\r\n\r\n private _generateQuantityControl = (maxQuantity: number | undefined, currentQuantity: number, showAsDropdown:boolean = false): JSX.Element => {\r\n if (showAsDropdown) {\r\n return this._generateSelectMenu(maxQuantity, currentQuantity);\r\n } else {\r\n return (\r\n /* tslint:disable-next-line: react-a11y-role-has-required-aria-props react-this-binding-issue */\r\n <input className='product-component-wrapper-quantity' type='number' value={currentQuantity} max={maxQuantity} onChange={this._onQuantityChange} />\r\n );\r\n }\r\n };\r\n\r\n private async _onClickAddToCart(): Promise<void> {\r\n const { data: { product }, context } = this.props;\r\n const cartQty = (this.props.cart?.result?.cart.TotalItems || 0) + this.state.quantity;\r\n qtyAddedToCart = this.state.quantity;\r\n\r\n this.bus?.publish('adding-to-cart');\r\n await onAddToCartAction(context, product!.RecordId, this.state.quantity);\r\n this.bus?.publish('finished-adding-to-cart');\r\n\r\n // Mixed Cart Bandaid - Remove when no longer needed\r\n // Checking if cart contains a gift card. Because gift cards are not added in the PLP, no need to check for the\r\n // other way around. If that changes, mixed cart check needs to be rewritten.\r\n\r\n /* Start Mixed Cart Bandaid */\r\n const mixedCart = !!this.props.cart?.result?.cart?.CartLines?.find(\r\n item => item.IsGiftCardLine ||\r\n item.DeliveryMode === \"40.5\" // 40.5 responds to events i believe, so use it here\r\n );\r\n /* End Mixed Cart Bandaid */\r\n if (cartQty === this.props.cart?.result?.cart.TotalItems) {\r\n this.setState({ cartMessage: 'success' });\r\n setTimeout(() => { this.setState({ cartMessage: '', quantity: 1 }); }, 2000);\r\n /* Start Mixed Cart Bandaid */\r\n } else if (mixedCart) {\r\n this.setState({ cartMessage: 'mixedcart' });\r\n /* End Mixed Cart Bandaid */\r\n } else {\r\n this.setState({ cartMessage: 'error' });\r\n }\r\n }\r\n\r\n private async _onClickAddToSubscription(): Promise<void> {\r\n const { data: { product }, context } = this.props;\r\n const cartQty = (this.props.cart?.result?.cart.TotalItems || 0) + this.state.quantity;\r\n qtyAddedToCart = this.state.quantity;\r\n\r\n this.bus?.publish('adding-to-cart');\r\n await onSubscribeAction(context, product!.RecordId, this.state.quantity, this.props.cart);\r\n this.bus?.publish('finished-adding-to-cart');\r\n\r\n // Mixed Cart Bandaid - Remove when no longer needed\r\n // Checking if cart contains a gift card. Because gift cards are not added in the PLP, no need to check for the\r\n // other way around. If that changes, mixed cart check needs to be rewritten.\r\n\r\n /* Start Mixed Cart Bandaid */\r\n const mixedCart = !!this.props.cart?.result?.cart?.CartLines?.find(\r\n item => item.IsGiftCardLine ||\r\n item.DeliveryMode === \"40.5\" // 40.5 responds to events i believe, so use it here\r\n );\r\n /* End Mixed Cart Bandaid */\r\n\r\n if (cartQty === this.props.cart?.result?.cart.TotalItems) {\r\n this.setState({ cartMessage: 'success' });\r\n setTimeout(() => { this.setState({ cartMessage: '', quantity: 1 }); }, 2000);\r\n /* Start Mixed Cart Bandaid */\r\n } else if (mixedCart) {\r\n this.setState({ cartMessage: 'mixedCart' });\r\n /* End Mixed Cart Bandaid */\r\n } else {\r\n this.setState({ cartMessage: 'error' });\r\n }\r\n }\r\n\r\n private _increaseCartQuantity(): void {\r\n this.setState({ quantity: this.state.quantity + 1 });\r\n }\r\n\r\n private _decreaseCartQuantity(): void {\r\n this.setState({ quantity: this.state.quantity > 1 ? this.state.quantity - 1 : this.state.quantity });\r\n }\r\n\r\n private _onQuantityChange({ target }: React.ChangeEvent<HTMLInputElement> | React.ChangeEvent<HTMLSelectElement>): void {\r\n if (parseInt(target.value, 10) < 1) {\r\n this.setState({ quantity: 1 });\r\n } else {\r\n this.setState({ quantity: parseInt(target.value, 10) });\r\n }\r\n }\r\n\r\n private get _isAdditionInvalid(): boolean {\r\n const cartQuantity = CartUtilities.countCartLineAmount(filterCartLines(this.props.cart?.result?.cart).subscriptionLines);\r\n return (this.state.quantity + cartQuantity) > (this.props.maxAdditionLimit || 12);\r\n }\r\n}\r\n\r\nasync function onAddToCartAction(context: ICoreContext, recordId: number, amount: number | undefined): Promise<void> {\r\n\r\n return CartUtilities.elicitAddItemIdToCart({ recordId, amount, context });\r\n}\r\n\r\nasync function onSubscribeAction(context: ICoreContext, recordId: number, amount?: number, cart?: AsyncResult<ICartState>): Promise<void> {\r\n // fetch attribute list and simple product\r\n\r\n return CartUtilities.elicitAddSubscriptionItemIdToCart({ context, recordId, amount }, cart!);\r\n}\r\n\r\nexport default ProductComponentWrapper;","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<ISubscriptionsMinicartData>;\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<IBottleCountDisplay> {\r\n\r\n private readonly _maxBottleCount: number = 12;\r\n\r\n public render(): JSX.Element {\r\n return (\r\n <div className='subscription-minicart-bottle-display'>\r\n {this._fillBottleList(this._generateBottleListFromProducts().slice(0, this._maxBottleCount))}\r\n </div>\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 <div className='subscription-minicart-bottle-item'>\r\n <div className='subscription-minicart-bottle-item-empty' />\r\n {this._specializeIndex(newBottleIndex)}\r\n </div>\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 <div className='subscription-minicart-bottle-item'>\r\n {gridSettings && product &&\r\n <Image\r\n src={product.PrimaryImageUrl || ''}\r\n alt={product.Name || ''}\r\n imageSettings={this.props.subscriptionProps.config.imageSettings}\r\n gridSettings={gridSettings}\r\n />\r\n }\r\n {this._specializeIndex(rollingIndex)}\r\n </div>\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 <div className='subscription-minicart-bottle-discount'>{subscriptionsMinicart__discount10Percent}</div>;\r\n } else if (currentIndex === 11) {\r\n return <div className='subscription-minicart-bottle-discount'>{subscriptionsMinicart__discount15Percent}</div>;\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<ISmweBuyboxViewProps & ISmweBuyboxProps<{}>> = 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<string> = 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 <Module {...ModuleProps}>\r\n <div className='ms-buybox__mobile-header'>\r\n {props.productApellation && <>{props.productApellation}</>}\r\n {title}\r\n </div>\r\n <div className='ms-buybox__media-gallery-wrapper'>\r\n <Node {...MediaGalleryContainerProps}>\r\n {props.mediaGallery}\r\n </Node>\r\n {props.tastingNotes}\r\n </div>\r\n <Node {...ProductInfoContainerProps}>\r\n {props.productApellation && <>{props.productApellation}</>}\r\n {title}\r\n {productDescription}\r\n {eventSchedule}\r\n {acclaimRatings}\r\n {cookbookTagline}\r\n {show && <div className={`sku-selector ${tableClass && tableClass.result}`}>\r\n <div className='sku-selector__price'>\r\n {productPrice && <div className='sku-selector__product-price'>{productPrice}</div>}\r\n {!isGiftCard && productClubPrice && <div className='sku-selector__product-price-club'>{productClubPrice} Club</div>}\r\n {isGiftCard && addToCart && <div className='sku-selector__add-to-cart'>{_renderAddToCart(addToCart)}</div>}\r\n </div>\r\n {!isGiftCard && quantity && <div className='sku-selector__product-quantity'>{_renderQuantity(quantity)}</div>}\r\n {!isGiftCard && addToCart && <div className='sku-selector__add-to-cart'>{_renderAddToCart(addToCart)}</div>}\r\n {subscriptionButton && <div className='sku-selector__add-to-subscription'>{_renderAddToCart(subscriptionButton)}</div>}\r\n </div>}\r\n {props.content &&\r\n props.content.map(\r\n (contentSlotData: React.ReactNode, index: number) => {\r\n return (\r\n <React.Fragment key={index}>\r\n {contentSlotData}\r\n </React.Fragment>\r\n );\r\n }\r\n )\r\n }\r\n </Node>\r\n {props.slots?.productCollection?.length &&\r\n <div className='ms-buybox__product-collection'>\r\n {props.slots.productCollection.map(\r\n (productCollectionSlotData: React.ReactNode, index: number) => {\r\n return (\r\n <React.Fragment key={index}>\r\n {productCollectionSlotData}\r\n </React.Fragment>\r\n );\r\n }\r\n )\r\n }\r\n </div>\r\n }\r\n </Module>\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 <Node {...ContainerProps}>\r\n {button}\r\n {errorBlock}\r\n </Node>\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 <Node {...ContainerProps}>\r\n <Node {...LabelContainerProps}>\r\n {errors}\r\n </Node>\r\n {input}\r\n </Node>\r\n );\r\n};\r\n\r\nexport default SmweBuyboxView;\r\n","export * from './link';\r\nexport * from './product-search-result-items';\r\nexport * from './title';\r\nexport * from './separator';\r\nexport * from './range-refine-item';\r\nexport * from './refine-item';\r\nexport * from './refine-item-toggle-notification';\r\nexport * from './refine-item.props.common';\r\nexport * from './utilities';\r\nexport * from './choice-summary';\r\nexport * from './choice-summary.props';\r\nexport * from './modal';\r\nexport * from './refine-submenu';\r\nexport * from './error-message';\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 = <IModuleStates>ctx.get<IModuleStates>(cacheKey.getCacheObjectType(), cacheKey.getCacheKey());\n if (moduleStates) {\n return moduleStates;\n }\n ctx.update(cacheKey, {});\n moduleStates = <IModuleStates>ctx.get<IModuleStates>(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 = <P extends IProps>(WrappedComponent: React.ComponentType<P>): React.ComponentType<P> => {\n /**\n *\n * ModuleState component\n * @extends {React.Component<P>}\n */\n @observer\n class ModuleState extends React.Component<P> {\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 <WrappedComponent {...this.props} moduleState={this.getModuleStateManager(id)} />;\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<IModuleState>): 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<IModuleState>): 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<IModuleState>): 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<IModuleState>,\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<IModuleState>, 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;","import * as React from 'react';\r\ninterface IErrorMessage {\r\n text?: string;\r\n}\r\n\r\nexport const ErrorMessage: React.FC<IErrorMessage> = ({ text }) => {\r\n return (\r\n <span className='ms-search-result-container__no-results-message'>\r\n <h5> {text} </h5>\r\n </span>\r\n );\r\n};","import { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\r\nimport classnames from 'classnames';\r\nimport { get } from 'lodash';\r\nimport { computed } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport * as React from 'react';\r\nimport { IChoiceSummaryProps } from './choice-summary.props';\r\nimport { isMatchingRefinementCriterion, ProductRefinerValueDataTypeValue } from './utilities';\r\n\r\ninterface IRefinerMap {\r\n key: string;\r\n value: ProductRefinerValue;\r\n}\r\n\r\n /**\r\n * ChoiceSummary component\r\n */\r\n@observer\r\nexport default class ChoiceSummary extends React.Component<IChoiceSummaryProps> {\r\n private closeButtonGlyph: string = 'msi-close-btn';\r\n\r\n @computed get selectedRefinersMap(): IRefinerMap[] {\r\n const { selectedChoices } = this.props;\r\n return selectedChoices.map((selectedRefiner: ProductRefinerValue) => {\r\n return {\r\n key: this._getKeyForRefinerValue(selectedRefiner),\r\n value: selectedRefiner\r\n } as IRefinerMap;\r\n });\r\n }\r\n\r\n constructor(props: Readonly<IChoiceSummaryProps>) {\r\n super(props);\r\n }\r\n\r\n public render(): JSX.Element {\r\n const { clearAllText, label, classNames, choiceAriaLabel } = this.props;\r\n const items = this.selectedRefinersMap;\r\n return (\r\n <div className='msc-choice-summary'>\r\n {items.length > 0 && label && <span className='msc-choice-summary__label'>{label}</span>}\r\n <ul className={classnames(classNames, 'msc-choice-summary__list', 'list-unstyled')}>\r\n {items.map((item: IRefinerMap, index: number) => {\r\n const listItemProps = {\r\n 'aria-posinset': index,\r\n 'aria-setsize': items.length\r\n };\r\n\r\n return (\r\n <li className='msc-choice-summary__list-item' key={item.key} {...listItemProps}>\r\n <a\r\n className='msc-choice-summary__item'\r\n href={this.props.urlBuilder(item.value, false)}\r\n aria-label={`${item.key} ${choiceAriaLabel}`}\r\n onClick={this._onClick}\r\n >\r\n {item.key}\r\n <span className={`${this.closeButtonGlyph} msc-choice-summary__glyph`} />\r\n </a>\r\n </li>\r\n );\r\n })}\r\n </ul>\r\n {items.length > 0 && clearAllText && <a href={this.props.urlBuilder({}, true)} className={'msc-choice-summary__clear-all'} onClick={this._onClick}>{clearAllText}</a>}\r\n </div>\r\n );\r\n }\r\n\r\n private _getKeyForRefinerValue(productRefinerValue: ProductRefinerValue): string {\r\n const { choiceFormat, choiceRangeValueFormat, refinerHierarchy, telemetry } = this.props;\r\n const overallFormat = choiceFormat || '{1}';\r\n const rangeFormat = choiceRangeValueFormat;\r\n let refinerName = '';\r\n if (refinerHierarchy && refinerHierarchy.find) {\r\n const parent = refinerHierarchy.find(\r\n (hierarchy: IProductRefinerHierarchy) =>\r\n !!hierarchy.Values.find((value: ProductRefinerValue) => isMatchingRefinementCriterion(value, productRefinerValue))\r\n );\r\n\r\n if (!parent) {\r\n telemetry.warning('[choice-summary] could not find parent of selected refiner value');\r\n } else {\r\n refinerName = parent.KeyName || '';\r\n }\r\n }\r\n\r\n let refinerValueName: string;\r\n switch (productRefinerValue.DataTypeValue) {\r\n case ProductRefinerValueDataTypeValue.Range:\r\n case ProductRefinerValueDataTypeValue.RangeInput:\r\n refinerValueName = rangeFormat\r\n .replace('{0}', this._formatPrice(productRefinerValue.LeftValueBoundString, productRefinerValue.UnitText))\r\n .replace('{1}', this._formatPrice(productRefinerValue.RightValueBoundString, productRefinerValue.UnitText));\r\n break;\r\n default:\r\n refinerValueName = productRefinerValue.LeftValueBoundLocalizedString || productRefinerValue.LeftValueBoundString || '';\r\n }\r\n\r\n return overallFormat.replace('{0}', refinerName).replace('{1}', refinerValueName);\r\n }\r\n\r\n private _formatPrice(amount: string | undefined, currency: string | undefined): string {\r\n if (!amount || !currency) {\r\n this.props.telemetry.trace('[choice-summary] could not format price');\r\n return amount || '';\r\n }\r\n const priceAmount = (amount && Number(amount)) || 0;\r\n const locale = get(this.props, 'context.request.locale', 'en-US');\r\n let result: string;\r\n\r\n try {\r\n result = new Intl.NumberFormat(locale, {\r\n style: 'currency',\r\n currencyDisplay: 'symbol',\r\n currency: currency,\r\n minimumFractionDigits: 0\r\n }).format(priceAmount);\r\n } catch (e) {\r\n result = `${priceAmount} ${currency}`;\r\n this.props.telemetry.warning(`Failed to format price for ${result}: ${e}`);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n private _onClick = (e: React.MouseEvent<HTMLAnchorElement>): void => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n const target = e.currentTarget as HTMLElement;\r\n const clearAll = target.getAttribute('class')!.indexOf('choice-summary__clear-all') > -1;\r\n const selectedRefiner = clearAll ? undefined : this._getSelectedRefinerChoice(target);\r\n\r\n if (this.props.onChoiceClicked) {\r\n this.props.onChoiceClicked({\r\n clearAll: clearAll,\r\n itemClicked: target,\r\n choiceClicked: selectedRefiner,\r\n nextItemToFocus: target.nextSibling as HTMLElement\r\n });\r\n }\r\n };\r\n\r\n private _getSelectedRefinerChoice(itemClicked: HTMLElement): ProductRefinerValue | undefined {\r\n const result = this.selectedRefinersMap.find(selected => (itemClicked.innerText && itemClicked.innerText.trim()) === selected.key);\r\n return (result && result.value) || undefined;\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 * as React from 'react';\r\n\r\nimport { Button, Collapse } from '@msdyn365-commerce-modules/utilities';\r\nimport { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { ICoreContext } from '@msdyn365-commerce/core';\r\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\r\nimport RangeRefineItem, { RangeRefineItemType } from './range-refine-item';\r\nimport RefineItem from './refine-item';\r\nimport { IRefineItemToggleNotification } from './refine-item-toggle-notification';\r\nimport { IRefineItemCommonProps } from './refine-item.props.common';\r\nimport { findMatchingRefinementCriterion, ProductRefinerTypeValue, ProductRefinerValueDataTypeValue } from './utilities';\r\n\r\n/**\r\n * Properties associated with the RefineSubmenu component\r\n */\r\nexport interface IRefineSubmenuProps {\r\n tempRangeTypeTODO: RangeRefineItemType;\r\n minValueSliderThumbAriaLabel?: string;\r\n maxValueSliderThumbAriaLabel?: string;\r\n refinerExpandText?: string;\r\n refinerMinimizeText?: string;\r\n minimizedRefiners?: string;\r\n productRefinerHierarchy: IProductRefinerHierarchy;\r\n selectedRefinerValues: ProductRefinerValue[];\r\n refineItemCommonProps: IRefineItemCommonProps;\r\n isDisabled: boolean;\r\n isExpandedOnInitialLoad: boolean;\r\n context: ICoreContext;\r\n moduleId: string;\r\n moduleTypeName: string;\r\n highestLevelRefinerText?: string;\r\n onUpdateRefiners(notfication: Readonly<IRefineItemToggleNotification>): void;\r\n urlBuilder(refiner: IRefineItemToggleNotification): string;\r\n}\r\n\r\n/**\r\n * Refine submenu state\r\n */\r\nexport interface IRefineSubmenuState extends React.ComponentState {\r\n expanded: boolean;\r\n}\r\n\r\n/**\r\n *\r\n * The RefineSubmenu component renders the submenu category and child items.\r\n * This computed observes the stateful category hierarchy object.\r\n * @extends {React.PureComponent<IRefineSubmenuProps>}\r\n */\r\nclass RefineSubmenu extends React.PureComponent<IRefineSubmenuProps, IRefineSubmenuState> {\r\n\r\n private isMinimizedRefiner: boolean = false;\r\n\r\n constructor(props: IRefineSubmenuProps) {\r\n super(props);\r\n\r\n this._onToggleItem = this._onToggleItem.bind(this);\r\n this._onToggleSubmenu = this._onToggleSubmenu.bind(this);\r\n this._expandCategoryRefiner = this._expandCategoryRefiner.bind(this);\r\n\r\n let isExpanded = this.props.isExpandedOnInitialLoad;\r\n if (this.props.productRefinerHierarchy.DataTypeValue === ProductRefinerValueDataTypeValue.Range) {\r\n isExpanded = true;\r\n }\r\n\r\n this.state = {\r\n expanded: isExpanded\r\n };\r\n\r\n if (this.props.minimizedRefiners) {\r\n const minimizedRefinersList = this.props.minimizedRefiners.split(',');\r\n this.isMinimizedRefiner = minimizedRefinersList.some(\r\n keyName => this.props.productRefinerHierarchy.KeyName && (keyName.toLowerCase() === this.props.productRefinerHierarchy.KeyName.toLocaleLowerCase())\r\n );\r\n }\r\n }\r\n\r\n public render(): JSX.Element | null {\r\n const { productRefinerHierarchy, refineItemCommonProps } = this.props;\r\n\r\n if (!productRefinerHierarchy) {\r\n refineItemCommonProps.telemetry.error('Cannot render submenu without refiner hierarchy data');\r\n }\r\n\r\n const isRangeRefiner = (productRefinerHierarchy.DataTypeValue === ProductRefinerValueDataTypeValue.Range);\r\n let key = '';\r\n if (isRangeRefiner) {\r\n const selectedRefinementCriterion = findMatchingRefinementCriterion(productRefinerHierarchy.Values[0], this.props.selectedRefinerValues);\r\n key = selectedRefinementCriterion ? `($${selectedRefinementCriterion.LeftValueBoundString && parseFloat(selectedRefinementCriterion.LeftValueBoundString).toFixed(2)} - $${selectedRefinementCriterion.RightValueBoundString && parseFloat(selectedRefinementCriterion.RightValueBoundString).toFixed(2)})` : '';\r\n }\r\n\r\n if (this.isMinimizedRefiner) {\r\n return (\r\n <div className='ms-refine-submenu list-group'>\r\n <div className='ms-refine-submenu__minimized-header'>{productRefinerHierarchy.KeyName} {key}</div>\r\n {this._renderChildItems(productRefinerHierarchy)}\r\n </div>\r\n );\r\n }\r\n\r\n return (\r\n <div className='ms-refine-submenu list-group'>\r\n <Button\r\n className={this.state.expanded ? 'ms-refine-submenu__toggle_expanded' : 'ms-refine-submenu__toggle_collapsed'}\r\n aria-label={productRefinerHierarchy.KeyName || 'refiner.Name'}\r\n onClick={this._onToggleSubmenu}\r\n aria-expanded={this.state.expanded}\r\n >\r\n {productRefinerHierarchy.KeyName} {key}\r\n </Button>\r\n <Collapse isOpen={this.state.expanded} timeout={350}>\r\n {this._renderChildItems(productRefinerHierarchy)}\r\n </Collapse>\r\n </div>\r\n );\r\n }\r\n\r\n private _renderChildItems(productRefinerHierarchy: IProductRefinerHierarchy): JSX.Element | null {\r\n switch (productRefinerHierarchy.DataTypeValue) {\r\n case ProductRefinerValueDataTypeValue.Range:\r\n case ProductRefinerValueDataTypeValue.RangeInput:\r\n return this._renderRange(productRefinerHierarchy);\r\n default:\r\n return this._renderSingleMultiSelect(productRefinerHierarchy);\r\n }\r\n }\r\n\r\n private _renderSingleMultiSelect(productRefinerHierarchy: IProductRefinerHierarchy): JSX.Element | null {\r\n const { isDisabled, refineItemCommonProps, selectedRefinerValues, context } = this.props;\r\n const isSingleSelect = productRefinerHierarchy.RefinerTypeValue === ProductRefinerTypeValue.Single;\r\n const role = isSingleSelect ? { role: 'radiogroup' } : undefined;\r\n const refinerValuesList = this._getSortedValueList() || [];\r\n\r\n const listItems = refinerValuesList.map((child: ProductRefinerValue, index: number) => {\r\n if (!child) {\r\n refineItemCommonProps.telemetry.error(\r\n `[refine-submenu] Could not render refine item for refiner ${productRefinerHierarchy.RecordId} (${productRefinerHierarchy.KeyName})`\r\n );\r\n return null;\r\n }\r\n\r\n const selectedRefinementCriterion = findMatchingRefinementCriterion(child, selectedRefinerValues);\r\n\r\n return (\r\n <RefineItem\r\n parentProductRefinerHierarchy={productRefinerHierarchy}\r\n productRefinerValue={child}\r\n selectedRefinementCriterion={selectedRefinementCriterion}\r\n refineItemCommonProps={refineItemCommonProps}\r\n onToggle={this._onToggleItem}\r\n urlBuilder={this.props.urlBuilder}\r\n isDisabled={isDisabled}\r\n key={index}\r\n context={context}\r\n moduleId={this.props.moduleId}\r\n moduleTypeName={this.props.moduleTypeName}\r\n />\r\n );\r\n });\r\n if (this.isMinimizedRefiner) {\r\n return (\r\n <div className='ms-refine-submenu__list-min' id={`refine-submenu-minimize__${this.props.productRefinerHierarchy.RecordId}`}>\r\n <ul className='ms-refine-submenu__list' {...role} aria-label={productRefinerHierarchy.KeyName}>\r\n {listItems}\r\n </ul>\r\n <a\r\n onClick={this._expandCategoryRefiner}\r\n className='ms-refine-submenu__expand-button'\r\n role='button'\r\n id={`refine-submenu-minimize-button__${productRefinerHierarchy.RecordId}`}\r\n >\r\n {this.props.refinerExpandText}\r\n </a>\r\n </div>\r\n );\r\n }\r\n return (\r\n <ul className='ms-refine-submenu__list' {...role} aria-label={productRefinerHierarchy.KeyName}>\r\n {listItems}\r\n </ul>\r\n );\r\n }\r\n\r\n private _renderRange(productRefinerHierarchy: IProductRefinerHierarchy): JSX.Element | null {\r\n const { isDisabled, refineItemCommonProps, selectedRefinerValues, context, minValueSliderThumbAriaLabel, maxValueSliderThumbAriaLabel } = this.props;\r\n const submenuClassNamePrefix = 'ms-refine-submenu__item list-group-item refine-submenu__item';\r\n const refinerValuesList = this._getSortedValueList() || [];\r\n const listItems = refinerValuesList.map((child: ProductRefinerValue, index: number) => {\r\n if (!child) {\r\n refineItemCommonProps.telemetry.error(\r\n `Could not render refine item for refiner ${productRefinerHierarchy.RecordId} (${productRefinerHierarchy.KeyName})`\r\n );\r\n return null;\r\n }\r\n\r\n const selectedRefinementCriterion = findMatchingRefinementCriterion(child, selectedRefinerValues);\r\n\r\n // TODO BUGBUG 22424559 determine only from the DataTypeValue once live example is working (can test with the tempRangeTypeTODO derived from QSP until then)\r\n const rangeType = (productRefinerHierarchy.DataTypeValue === ProductRefinerValueDataTypeValue.RangeInput || this.props.tempRangeTypeTODO === 'input') ?\r\n 'input' :\r\n 'slider';\r\n const key = selectedRefinementCriterion ? `${selectedRefinementCriterion.LeftValueBoundString}-${selectedRefinementCriterion.RightValueBoundString}` : `not-selected-${index}`;\r\n return (\r\n <li className={`${submenuClassNamePrefix}--range`} key={index}>\r\n <RangeRefineItem\r\n parentProductRefinerHierarchy={productRefinerHierarchy}\r\n productRefinerValue={child}\r\n selectedRefinementCriterion={selectedRefinementCriterion}\r\n refineItemCommonProps={refineItemCommonProps}\r\n onToggle={this._onToggleItem}\r\n urlBuilder={this.props.urlBuilder}\r\n isDisabled={isDisabled}\r\n rangeType={rangeType}\r\n key={key}\r\n context={context}\r\n minValueSliderThumbAriaLabel={minValueSliderThumbAriaLabel}\r\n maxValueSliderThumbAriaLabel={maxValueSliderThumbAriaLabel}\r\n moduleId={this.props.moduleId}\r\n moduleTypeName={this.props.moduleTypeName}\r\n />\r\n </li>\r\n );\r\n });\r\n return <ul className='ms-refine-submenu__list list-unstyled'>{listItems}</ul>;\r\n }\r\n\r\n private _onToggleItem(itemToggleNotification: IRefineItemToggleNotification): void {\r\n this.props.onUpdateRefiners(itemToggleNotification);\r\n }\r\n\r\n private _onToggleSubmenu(): void {\r\n this.setState(prevState => ({\r\n expanded: !prevState.expanded\r\n }));\r\n }\r\n\r\n private _getSortedValueList(): ProductRefinerValue[] {\r\n const sortedList = this.props.productRefinerHierarchy.Values.sort((nextOption, curOption) => {\r\n const curOptionName =\r\n nextOption.LeftValueBoundString || nextOption.RightValueBoundString || '';\r\n const nextOptionName =\r\n curOption.LeftValueBoundString || curOption.RightValueBoundString || '';\r\n\r\n return curOptionName.localeCompare(nextOptionName);\r\n });\r\n\r\n const dividedList = {\r\n options: [] as ProductRefinerValue[],\r\n topLevel: [] as ProductRefinerValue[]\r\n };\r\n sortedList.forEach(option => {\r\n const optionName = option.LeftValueBoundString || option.RightValueBoundString || '';\r\n\r\n if (optionName === this.props.highestLevelRefinerText) {\r\n dividedList.topLevel.push(option);\r\n } else {\r\n dividedList.options.push(option);\r\n }\r\n });\r\n\r\n return [...dividedList.topLevel, ...dividedList.options];\r\n }\r\n\r\n private _expandCategoryRefiner(): void {\r\n const minimizedElement = document.getElementById(`refine-submenu-minimize__${this.props.productRefinerHierarchy.RecordId}`);\r\n const buttonElement = document.getElementById(`refine-submenu-minimize-button__${this.props.productRefinerHierarchy.RecordId}`);\r\n if (minimizedElement && buttonElement) {\r\n if (minimizedElement.className === 'ms-refine-submenu__list-min') {\r\n minimizedElement.className = 'ms-refine-submenu__list-full';\r\n buttonElement.textContent = this.props.refinerMinimizeText!;\r\n } else {\r\n minimizedElement.className = 'ms-refine-submenu__list-min';\r\n buttonElement.textContent = this.props.refinerExpandText!;\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default RefineSubmenu;","import * as React from 'react';\r\n\r\nimport { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { ICoreContext } from '@msdyn365-commerce/core';\r\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\r\nimport RangeRefineItem, { RangeRefineItemType } from './range-refine-item';\r\nimport RefineItem from './refine-item';\r\nimport { IRefineItemToggleNotification } from './refine-item-toggle-notification';\r\nimport { IRefineItemCommonProps } from './refine-item.props.common';\r\nimport { findMatchingRefinementCriterion, ProductRefinerTypeValue, ProductRefinerValueDataTypeValue } from './utilities';\r\n\r\n/**\r\n * Properties associated with the RefineSubmenu component\r\n */\r\nexport interface IRefinePulldownProps {\r\n tempRangeTypeTODO: RangeRefineItemType;\r\n minValueSliderThumbAriaLabel?: string;\r\n maxValueSliderThumbAriaLabel?: string;\r\n productRefinerHierarchy: IProductRefinerHierarchy;\r\n selectedRefinerValues: ProductRefinerValue[];\r\n refineItemCommonProps: IRefineItemCommonProps;\r\n isDisabled: boolean;\r\n context: ICoreContext;\r\n moduleId: string;\r\n moduleTypeName: string;\r\n highestLevelRefinerText?: string;\r\n buttonText: string | undefined;\r\n onUpdateRefiners(notfication: Readonly<IRefineItemToggleNotification>): void;\r\n urlBuilder(refiner: IRefineItemToggleNotification): string;\r\n}\r\n\r\n/**\r\n *\r\n * The RefineSubmenu component renders the submenu category and child items.\r\n * This computed observes the stateful category hierarchy object.\r\n * @extends {React.PureComponent<IRefineSubmenuProps>}\r\n */\r\nclass RefinePulldown extends React.Component<IRefinePulldownProps> {\r\n\r\n constructor(props: IRefinePulldownProps) {\r\n super(props);\r\n\r\n this._onToggleItem = this._onToggleItem.bind(this);\r\n }\r\n\r\n public componentDidMount(): void {\r\n document.body && document.body.addEventListener('mousedown', this._handleClickOutsidePulldown);\r\n }\r\n\r\n public componentWillUnmount(): void {\r\n document.body && document.body.removeEventListener('mousedown', this._handleClickOutsidePulldown, false);\r\n }\r\n\r\n public render(): JSX.Element | null {\r\n const { productRefinerHierarchy, refineItemCommonProps } = this.props;\r\n\r\n if (!productRefinerHierarchy) {\r\n refineItemCommonProps.telemetry.error('Cannot render submenu without refiner hierarchy data');\r\n }\r\n\r\n const isRangeRefiner = (productRefinerHierarchy.DataTypeValue === ProductRefinerValueDataTypeValue.Range);\r\n let key = '';\r\n if (isRangeRefiner) {\r\n const selectedRefinementCriterion = findMatchingRefinementCriterion(productRefinerHierarchy.Values[0], this.props.selectedRefinerValues);\r\n key = selectedRefinementCriterion ? `($${selectedRefinementCriterion.LeftValueBoundString && parseFloat(selectedRefinementCriterion.LeftValueBoundString).toFixed(2)} - $${selectedRefinementCriterion.RightValueBoundString && parseFloat(selectedRefinementCriterion.RightValueBoundString).toFixed(2)})` : '';\r\n }\r\n\r\n return (\r\n <div className='ms-refine-submenu list-group'>\r\n <div\r\n className={'ms-refine-submenu__toggle_expanded'}\r\n aria-label={productRefinerHierarchy.KeyName || 'refiner.Name'}\r\n >\r\n {productRefinerHierarchy.KeyName} {key}\r\n </div>\r\n {this._renderChildItems(productRefinerHierarchy)}\r\n </div>\r\n );\r\n }\r\n\r\n private _renderChildItems(productRefinerHierarchy: IProductRefinerHierarchy): JSX.Element | null {\r\n switch (productRefinerHierarchy.DataTypeValue) {\r\n case ProductRefinerValueDataTypeValue.Range:\r\n case ProductRefinerValueDataTypeValue.RangeInput:\r\n return this._renderRange(productRefinerHierarchy);\r\n default:\r\n return this._renderSingleMultiSelect(productRefinerHierarchy);\r\n }\r\n }\r\n\r\n private _renderSingleMultiSelect(productRefinerHierarchy: IProductRefinerHierarchy): JSX.Element | null {\r\n const { isDisabled, refineItemCommonProps, selectedRefinerValues, context } = this.props;\r\n const isSingleSelect = productRefinerHierarchy.RefinerTypeValue === ProductRefinerTypeValue.Single;\r\n const role = isSingleSelect ? { role: 'radiogroup' } : undefined;\r\n const refinerValuesList = this._getSortedValueList() || [];\r\n\r\n const listItems = refinerValuesList.map((child: ProductRefinerValue, index: number) => {\r\n if (!child) {\r\n refineItemCommonProps.telemetry.error(\r\n `[refine-submenu] Could not render refine item for refiner ${productRefinerHierarchy.RecordId} (${productRefinerHierarchy.KeyName})`\r\n );\r\n return null;\r\n }\r\n\r\n const selectedRefinementCriterion = findMatchingRefinementCriterion(child, selectedRefinerValues);\r\n\r\n return (\r\n <RefineItem\r\n parentProductRefinerHierarchy={productRefinerHierarchy}\r\n productRefinerValue={child}\r\n selectedRefinementCriterion={selectedRefinementCriterion}\r\n refineItemCommonProps={refineItemCommonProps}\r\n onToggle={this._onToggleItem}\r\n urlBuilder={this.props.urlBuilder}\r\n isDisabled={isDisabled}\r\n key={index}\r\n context={context}\r\n moduleId={this.props.moduleId}\r\n moduleTypeName={this.props.moduleTypeName}\r\n />\r\n );\r\n });\r\n return (\r\n <ul className='ms-refine-submenu__list' {...role} aria-label={productRefinerHierarchy.KeyName}>\r\n {listItems}\r\n </ul>\r\n );\r\n }\r\n\r\n private _renderRange(productRefinerHierarchy: IProductRefinerHierarchy): JSX.Element | null {\r\n const { isDisabled, refineItemCommonProps, selectedRefinerValues, context, minValueSliderThumbAriaLabel, maxValueSliderThumbAriaLabel } = this.props;\r\n const submenuClassNamePrefix = 'ms-refine-submenu__item list-group-item refine-submenu__item';\r\n const refinerValuesList = this._getSortedValueList() || [];\r\n const listItems = refinerValuesList.map((child: ProductRefinerValue, index: number) => {\r\n if (!child) {\r\n refineItemCommonProps.telemetry.error(\r\n `Could not render refine item for refiner ${productRefinerHierarchy.RecordId} (${productRefinerHierarchy.KeyName})`\r\n );\r\n return null;\r\n }\r\n\r\n const selectedRefinementCriterion = findMatchingRefinementCriterion(child, selectedRefinerValues);\r\n\r\n // TODO BUGBUG 22424559 determine only from the DataTypeValue once live example is working (can test with the tempRangeTypeTODO derived from QSP until then)\r\n const rangeType = (productRefinerHierarchy.DataTypeValue === ProductRefinerValueDataTypeValue.RangeInput || this.props.tempRangeTypeTODO === 'input') ?\r\n 'input' :\r\n 'slider';\r\n const key = selectedRefinementCriterion ? `${selectedRefinementCriterion.LeftValueBoundString}-${selectedRefinementCriterion.RightValueBoundString}` : `not-selected-${index}`;\r\n return (\r\n <li className={`${submenuClassNamePrefix}--range`} key={index}>\r\n <RangeRefineItem\r\n parentProductRefinerHierarchy={productRefinerHierarchy}\r\n productRefinerValue={child}\r\n selectedRefinementCriterion={selectedRefinementCriterion}\r\n refineItemCommonProps={refineItemCommonProps}\r\n onToggle={this._onToggleItem}\r\n urlBuilder={this.props.urlBuilder}\r\n isDisabled={isDisabled}\r\n rangeType={rangeType}\r\n key={key}\r\n context={context}\r\n minValueSliderThumbAriaLabel={minValueSliderThumbAriaLabel}\r\n maxValueSliderThumbAriaLabel={maxValueSliderThumbAriaLabel}\r\n moduleId={this.props.moduleId}\r\n moduleTypeName={this.props.moduleTypeName}\r\n />\r\n </li>\r\n );\r\n });\r\n return <ul className='ms-refine-submenu__list list-unstyled'>{listItems}</ul>;\r\n }\r\n\r\n private _onToggleItem(itemToggleNotification: IRefineItemToggleNotification): void {\r\n this.props.onUpdateRefiners(itemToggleNotification);\r\n }\r\n\r\n // tslint:disable-next-line:no-any\r\n private _handleClickOutsidePulldown = (event: any) => {\r\n const pulldown:boolean = event.target.id === 'refiner-pulldown-button';\r\n const pulldownElement = document.getElementById('refiner-pulldown-container');\r\n if (!pulldownElement?.contains(event.target) && !pulldown && pulldownElement?.className !== 'ms-search-result-container__refiner-pulldown-container pulldown-hide') {\r\n const buttonElement = document.getElementById('refiner-pulldown-button');\r\n if (buttonElement) {\r\n buttonElement.classList.toggle('refiner-pulldown-button-expanded');\r\n this._getPulldownText(this._getActiveRefinersText(this.props.selectedRefinerValues), this.props.buttonText);\r\n }\r\n if (pulldownElement) {\r\n pulldownElement.classList.toggle('pulldown-hide');\r\n }\r\n }\r\n };\r\n\r\n private _getPulldownText = (activeRefiners: string, buttonText: string | undefined): string => {\r\n const buttonElement = document.getElementById('refiner-pulldown-button');\r\n const spanElement = document.getElementById('refiner-pulldown-button-content');\r\n if (buttonElement && spanElement) {\r\n if (buttonElement.className === 'ms-search-result-container__refiner-pulldown-button refiner-pulldown-button-expanded' || !activeRefiners) {\r\n return spanElement.innerText = buttonText || '';\r\n } else {\r\n return spanElement.innerText = activeRefiners;\r\n }\r\n }\r\n return '';\r\n };\r\n\r\n private _getActiveRefinersText = (activeRefiners: ProductRefinerValue[]): string => {\r\n let formatedActiveRefiners = '';\r\n activeRefiners.forEach(refiner => {\r\n if (refiner.UnitText === 'USD') {\r\n formatedActiveRefiners += `$${refiner.LeftValueBoundString}-$${refiner.RightValueBoundString} / `;\r\n } else if (refiner.LeftValueBoundString) {\r\n formatedActiveRefiners += `${refiner.LeftValueBoundString} / `;\r\n }\r\n });\r\n // removes trailing slash and whitespace\r\n formatedActiveRefiners = formatedActiveRefiners.substring(0, formatedActiveRefiners.length - 2);\r\n return formatedActiveRefiners;\r\n };\r\n\r\n private _getSortedValueList(): ProductRefinerValue[] {\r\n const sortedList = this.props.productRefinerHierarchy.Values.sort((nextOption, curOption) => {\r\n const curOptionName =\r\n nextOption.LeftValueBoundString || nextOption.RightValueBoundString || '';\r\n const nextOptionName =\r\n curOption.LeftValueBoundString || curOption.RightValueBoundString || '';\r\n\r\n return curOptionName.localeCompare(nextOptionName);\r\n });\r\n\r\n const dividedList = {\r\n options: [] as ProductRefinerValue[],\r\n topLevel: [] as ProductRefinerValue[]\r\n };\r\n sortedList.forEach(option => {\r\n const optionName = option.LeftValueBoundString || option.RightValueBoundString || '';\r\n\r\n if (optionName === this.props.highestLevelRefinerText) {\r\n dividedList.topLevel.push(option);\r\n } else {\r\n dividedList.options.push(option);\r\n }\r\n });\r\n\r\n return [...dividedList.topLevel, ...dividedList.options];\r\n }\r\n}\r\n\r\nexport default RefinePulldown;","/*---------------------------------------------------------------------------------------------\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 classnames from 'classnames';\r\nimport { computed, observable, reaction, transaction } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport * as React from 'react';\r\n\r\nimport { ILabeledDropdownOnChangeNotification, ILabeledDropdownOption, IModuleProps, INodeProps, LabeledDropdown, UncontrolledPagination } from '@msdyn365-commerce-modules/utilities';\r\nimport { CategoryHierarchy as CategoryHierarchyData, IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\n// category description 1.0\r\nimport MsDyn365, { IImageDimension, RichText, RichTextComponent } from '@msdyn365-commerce/core';\r\nimport { format, ProductAvailableQuantity, ProductRefinerValue, ProductSearchResult, SortColumn, TextValueTranslation } from '@msdyn365-commerce/retail-proxy';\r\nimport { getActivePricesAsync, getEstimatedAvailabilityAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport { AffiliationLoyaltyTier, ProductPrice, ProjectionDomain } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n\r\nimport { buildListPageUrl, getCollectionProducts, getCurrentUrl, GetFullProductsByCollectionInput, hydrateRefinersFromUrl, IFullProductsSearchResultsWithCount, parseQueryParam, sortOptions, } from '../../dataActions/search-result-container';\r\nimport { publish } from '../../Utilities/analytics/analytics-dispatcher';\r\nimport CommerceAttributesParser from '../../Utilities/commerce-attributes-parser';\r\nimport { filterInvalidCategories } from '../../Utilities/refiners';\r\n\r\nimport { ErrorMessage, getUpdatedRefinementCriteria, IChoiceSummaryClickNotification,\r\n IRefineItemCommonProps, IRefineItemToggleNotification, ISearchResultModalViewProps, isMatchingRefinementCriterion, Link, ModalToggle, ProductSearchResultItems, SearchResultModal, Separator, Title } from './components';\r\nimport ChoiceSummary from './components/choice-summary';\r\nimport RefinePulldown from './components/refine-pulldown';\r\nimport RefineSubmenu from './components/refine-submenu';\r\nimport { ISmweSearchResultContainerData } from './smwe-search-result-container.data';\r\nimport { ISmweSearchResultContainerProps } from './smwe-search-result-container.props.autogenerated';\r\n\r\nexport interface ISearchResultContainerViewProps extends ISmweSearchResultContainerProps<{}> {\r\n products?: React.ReactNode;\r\n className?: string;\r\n SearchResultContainer: IModuleProps;\r\n TitleViewProps: ITitleViewProps;\r\n categoryHierarchy: ICategoryHierarchyViewProps;\r\n pagination?: React.ReactNode;\r\n ProductsContainer: INodeProps;\r\n ProductSectionContainer: INodeProps;\r\n refineMenu: IRefineMenuViewProps;\r\n sortByOptions: ISortByViewProps;\r\n choiceSummary?: React.ReactNode;\r\n modalToggle: React.ReactNode;\r\n searchResultModal: ISearchResultModalViewProps;\r\n isMobile: boolean;\r\n CategoryNavContainer: INodeProps;\r\n RefineAndProductSectionContainer: INodeProps;\r\n errorMessage: React.ReactNode;\r\n categoryDescription: JSX.Element | undefined;\r\n}\r\n\r\nexport interface ITitleViewProps {\r\n TitleContainer: INodeProps;\r\n title:ISearchResultTitle;\r\n}\r\n\r\nexport interface IRefineMenuViewProps {\r\n RefineMenuContainer: INodeProps;\r\n RefinerSectionContainer: INodeProps;\r\n refiners?: React.ReactNode[];\r\n activeRefiners: ProductRefinerValue[];\r\n pulldownText?: string;\r\n}\r\n\r\nexport interface ICategoryHierarchyViewProps {\r\n categoryHierarchyList?: React.ReactNode[];\r\n categoryHierarchySeparator?: React.ReactNode;\r\n CategoryHierarchyContainer: INodeProps;\r\n}\r\n\r\nexport interface ISortByViewProps {\r\n SortingContainer: INodeProps;\r\n sortByDropDown?:React.ReactNode;\r\n}\r\n\r\nexport type GridSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\r\n\r\n/**\r\n * Title component for search result container\r\n */\r\nexport interface ISearchResultTitle {\r\n titlePrefix?: React.ReactNode;\r\n titleText?: React.ReactNode;\r\n titleCount?: React.ReactNode;\r\n}\r\n\r\nexport interface ISearchResultContainerState {\r\n sortingState: ISortByCollectionState;\r\n modalIsOpen: boolean;\r\n productAvailability: ProductAvailableQuantity[] | undefined;\r\n clubPricing: ProductPrice[] | undefined;\r\n}\r\n\r\ninterface ISortByCollectionState {\r\n selectedSortByOption: ILabeledDropdownOption;\r\n pending: boolean;\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 * SearchResultContainer component\r\n * @extends {React.Component<ISmweSearchResultContainerProps<ISmweSearchResultContainerData>>}\r\n */\r\n@observer\r\nexport default class SmweSearchResultContainer extends React.Component<ISmweSearchResultContainerProps<ISmweSearchResultContainerData>, ISearchResultContainerState> {\r\n\r\n @computed get isMobile(): boolean {\r\n return (this._viewport === 'xs' || this._viewport === 'sm' || this._viewport === 'md');\r\n }\r\n\r\n private sortByDropdownOptions: ILabeledDropdownOption[] = [];\r\n private showSortByDropdown: boolean= false;\r\n private _refineItemCommonProps: IRefineItemCommonProps;\r\n private _pageType: string | undefined = this.props.context.request.urlTokens.pageType;\r\n @observable\r\n private _viewport: GridSize;\r\n\r\n @observable\r\n private _refinersFiltered: boolean = false;\r\n\r\n private _modalToggleRef: React.RefObject<HTMLButtonElement>;\r\n private _sortAndFilterContainerRef: React.RefObject<LabeledDropdown>;\r\n private _initialProductResultCount: number = 0;\r\n\r\n public static getFriendlyName(locale: string, nameTranslations?: TextValueTranslation[]): string | undefined {\r\n let nameTranslation: TextValueTranslation | undefined;\r\n if (locale && nameTranslations && nameTranslations.length > 0) {\r\n nameTranslation = nameTranslations.find(item => item.Language!.toLowerCase() === locale.toLowerCase());\r\n }\r\n\r\n return nameTranslation && nameTranslation.Text;\r\n }\r\n\r\n // tslint:disable-next-line: max-func-body-length\r\n constructor(props: ISmweSearchResultContainerProps<ISmweSearchResultContainerData>, state: ISearchResultContainerState) {\r\n super(props);\r\n this._viewport = props.context.request && props.context.request.device && props.context.request.device.Type === 'Mobile' ? 'xs' : 'lg';\r\n this._modalToggleRef = React.createRef<HTMLButtonElement>();\r\n this._sortAndFilterContainerRef = React.createRef<LabeledDropdown>();\r\n this._toggleModal = this._toggleModal.bind(this);\r\n this._updateViewport = this._updateViewport.bind(this);\r\n this._addSortByDropdownOptions();\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 }\r\n }\r\n\r\n this.state = {\r\n sortingState: {\r\n pending: false,\r\n selectedSortByOption: this.sortByDropdownOptions[0]\r\n },\r\n modalIsOpen: false,\r\n productAvailability: undefined,\r\n clubPricing: undefined\r\n };\r\n const {\r\n placeholderTextMax,\r\n minLabel,\r\n maxLabel,\r\n rangeNameFormat\r\n } = this.props.resources;\r\n\r\n const locale = this.props.context.request.locale;\r\n const telemetry = this.props.telemetry;\r\n const validationErrorNaN = this.props.resources.validationErrorNotNumber;\r\n const validationErrorRange = this.props.resources.validationErrorNotRange;\r\n this._refineItemCommonProps = {\r\n telemetry,\r\n locale,\r\n placeholderTextMax,\r\n minLabel,\r\n maxLabel,\r\n rangeNameFormat,\r\n validationErrorNaN,\r\n validationErrorRange\r\n };\r\n\r\n // Initalization of list page\r\n // Have an ugly promise cascade. Promise.all() does NOT work right here. That causes everything below to run after render instead of before.\r\n void this.props.data.products.then(products => {\r\n void this.props.data.listPageState.then(listPageState => {\r\n void this.props.data.refiners.then(refiners => {\r\n void this.props.data.categoryHierarchy.then(categoryHierarchy => {\r\n if (this._pageType === 'Category') {\r\n listPageState.pageType = 'Category';\r\n } else {\r\n listPageState.pageType = 'Search';\r\n }\r\n\r\n let querySorting: SortColumn[] = [];\r\n\r\n if (this.props.context.request.query && this.props.context.request.query.sorting) {\r\n querySorting = JSON.parse(decodeURIComponent(this.props.context.request.query.sorting)) as SortColumn[];\r\n }\r\n\r\n // This sets off a render cascade\r\n listPageState.currentPageNumber = this.props.context.request.query && (+this.props.context.request.query.skip / (this.props.config.itemsPerPage || 10)) || 0;\r\n listPageState.sortingCritera = { Columns: querySorting };\r\n listPageState.pageSize = this.props.config.itemsPerPage || 10;\r\n listPageState.activeProducts = products.products;\r\n listPageState.totalProductCount = products.count;\r\n this._initialProductResultCount = products.count;\r\n listPageState.activeFilters = hydrateRefinersFromUrl(this.props.context.request);\r\n\r\n filterInvalidCategories(refiners, categoryHierarchy, this.props.context.app.config.refinerRemappers);\r\n this._refinersFiltered = true;\r\n\r\n if (props.config.addToCart) {\r\n // tslint:disable-next-line: no-floating-promises\r\n void this._getProductavailabilty(products);\r\n if (props.context.app.config.affiliationId) {\r\n void this._getClubPricing(products);\r\n }\r\n }\r\n this._emitImpressionEvent(products.products);\r\n\r\n // Initialize reaction based on listPageState properties\r\n reaction(\r\n () => {\r\n return [listPageState.activeFilters && listPageState.activeFilters.length, listPageState.currentPageNumber, listPageState.sortingCritera && listPageState.sortingCritera.Columns && listPageState.sortingCritera.Columns.length];\r\n },\r\n () => {\r\n const input = new GetFullProductsByCollectionInput(\r\n listPageState.pageType,\r\n this.props.context.request.apiSettings,\r\n { Paging: { Top: this.props.config.itemsPerPage, Skip: Math.max((listPageState.pageSize * (listPageState.currentPageNumber || 0)), 0) }, count: true, Sorting: listPageState.sortingCritera || {} },\r\n listPageState.activeFilters || [],\r\n +(this.props.context.request.urlTokens.itemId || 0),\r\n this.props.context.request.query && this.props.context.request.query.q);\r\n\r\n getCollectionProducts(input, this.props.context.actionContext).then(productResults => {\r\n listPageState.activeProducts = productResults.products;\r\n listPageState.totalProductCount = productResults.count || this._initialProductResultCount;\r\n if (props.config.addToCart) {\r\n // tslint:disable-next-line: no-floating-promises\r\n void this._getProductavailabilty(productResults);\r\n if (this.props.context.app.config.affiliationId) {\r\n void this._getClubPricing(productResults);\r\n }\r\n }\r\n this._emitImpressionEvent(productResults.products);\r\n }).catch(e => this.props.telemetry.exception(e));\r\n }\r\n );\r\n });\r\n });\r\n });\r\n });\r\n\r\n this._updateViewport();\r\n }\r\n\r\n public componentDidMount(): void {\r\n // tslint:disable-next-line: no-typeof-undefined\r\n if (typeof window !== 'undefined' && window.addEventListener) {\r\n window.addEventListener('resize', this._updateViewport);\r\n this._updateViewport();\r\n }\r\n }\r\n\r\n public componentWillUnmount(): void {\r\n // tslint:disable-next-line: no-typeof-undefined\r\n if (typeof window !== 'undefined' && window.addEventListener) {\r\n window.removeEventListener('resize', this._updateViewport);\r\n }\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 public render(): JSX.Element {\r\n const { imageSettings, className, paragraph, showPagination, addToCart } = this.props.config;\r\n const { resources, telemetry, data } = this.props;\r\n const products = (this.props.data.listPageState.result && this.props.data.listPageState.result.activeProducts) || [];\r\n let errorText = '';\r\n if(!products || products.length === 0) {\r\n errorText = this._pageType === 'Category'? resources.resultCategoryNotFoundText : resources.resultSearchNotFoundText;\r\n\r\n }\r\n const categoryHierarchy = (data.category && data.category.result) || undefined;\r\n const passedProps = {...this.props, categoryHierarchy };\r\n const showQuantityAsDropdown = this.props.config.showQuantityAsDropdown || false;\r\n const productsComponent = (\r\n <ProductSearchResultItems\r\n cart={this.props.data.cart}\r\n addToCart={addToCart}\r\n products={products}\r\n context={this.props.context}\r\n imageSettings={imageSettings}\r\n telemetry={telemetry}\r\n resources={resources}\r\n moduleType={this.props.typeName}\r\n moduleId={this.props.id}\r\n parentProps={passedProps}\r\n productAvailability={this.state.productAvailability}\r\n clubPricing={this.state.clubPricing}\r\n showQuantityAsDropdown={showQuantityAsDropdown}\r\n />\r\n );\r\n // category-description 1.0\r\n const categoryDescription = this._getCategoryDescription(paragraph);\r\n\r\n const searchResultContainerViewProps = {\r\n ...this.props,\r\n products: productsComponent,\r\n TitleViewProps: this._getCollectionTitle(),\r\n categoryHierarchy: this._getCategoryHierarchy(),\r\n refineMenu: this._getRefineMenu(),\r\n className: classnames('ms-search-result-container', className),\r\n SearchResultContainer: {\r\n moduleProps: this.props,\r\n className: classnames('ms-search-result-container', className)\r\n },\r\n sortByOptions: this.props.data.listPageState.result && this.props.data.listPageState.result.totalProductCount !== 0 && this.showSortByDropdown && this.props.config.showSortBy ? this._getSortingDropDown(): null,\r\n pagination: showPagination ? this._getPagination() : '',\r\n ProductsContainer: { className: 'ms-search-result-container__Products' },\r\n ProductSectionContainer: {className: 'ms-search-result-container__product-section'},\r\n CategoryNavContainer: {className: 'ms-search-result-container__category-nav-section'},\r\n RefineAndProductSectionContainer: {className: 'ms-search-result-container__refine-product-section'},\r\n choiceSummary: this._getChoiceSummary(),\r\n modalToggle: this.props.data.listPageState.result && this.props.data.listPageState.result.totalProductCount !== 0 ?\r\n (\r\n <ModalToggle\r\n text={resources.modalTitle}\r\n ariaLabel={resources.modalTitle}\r\n innerRef={this._modalToggleRef}\r\n onClick={this._toggleModal}\r\n id='search-result-modal'\r\n />\r\n ) : null,\r\n searchResultModal: this._getSearchResultModal(),\r\n isMobile: this.isMobile,\r\n errorMessage: errorText && (\r\n <ErrorMessage text={errorText} />\r\n ),\r\n categoryDescription: categoryDescription\r\n };\r\n return this.props.renderView(searchResultContainerViewProps) as React.ReactElement;\r\n }\r\n\r\n private _addSortByDropdownOptions = ():void => {\r\n if(this.props.config.showSortingByRelevance) {\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionRelevanceDesc, value: this.props.resources.sortByOptionRelevanceDesc });\r\n this.showSortByDropdown = true;\r\n }\r\n if(this.props.config.showSortingByName) {\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionNameAsc, value: this.props.resources.sortByOptionNameAsc });\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionNameDesc, value: this.props.resources.sortByOptionNameDesc });\r\n this.showSortByDropdown = true;\r\n }\r\n if(this.props.config.showSortingByPrice) {\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionPriceAsc, value: this.props.resources.sortByOptionPriceAsc });\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionPriceDesc, value: this.props.resources.sortByOptionPriceDesc });\r\n this.showSortByDropdown = true;\r\n }\r\n if(this.props.config.showSortingByRating) {\r\n this.sortByDropdownOptions.push({ key: sortOptions.sortByOptionRatingDesc, value: this.props.resources.sortByOptionRatingDesc });\r\n this.showSortByDropdown = true;\r\n }\r\n };\r\n\r\n private _getSearchResultModal = (): ISearchResultModalViewProps => {\r\n const {resources} = this.props;\r\n return SearchResultModal(\r\n {\r\n resources:{\r\n modalCloseButtonText: resources.modalCloseButtonText,\r\n modalTitle: resources.modalTitle\r\n },\r\n isOpen:this.state.modalIsOpen,\r\n returnRef: this._modalToggleRef,\r\n onModalToggle: this._toggleModal\r\n });\r\n };\r\n\r\n private _getCollectionTitle = (): ITitleViewProps => {\r\n const { data, context, resources } = this.props;\r\n\r\n let collectionTitle: string | undefined = '';\r\n if (context && context.request && context.request.query && context.request.query.q) {\r\n collectionTitle = `\"${context.request.query.q}\"`;\r\n } else {\r\n collectionTitle = (data.category.result && SmweSearchResultContainer.getFriendlyName(context.request.locale, data.category.result.NameTranslations)) ||\r\n (data.category.result && data.category.result.Name);\r\n }\r\n let productCountText = '';\r\n let productCountNumber: number | undefined;\r\n if (data.listPageState && data.listPageState.result && data.listPageState.result.totalProductCount !== undefined) {\r\n productCountNumber = data.listPageState.result.totalProductCount;\r\n } else if (data.products && data.products.result) {\r\n productCountNumber = data.products.result.count;\r\n }\r\n\r\n if (productCountNumber && productCountNumber !== 0) {\r\n productCountText = productCountNumber !== 1 ? format(this.props.resources.numberOfProducts, productCountNumber) : this.props.resources.oneProduct;\r\n } else {\r\n productCountText = format(this.props.resources.numberOfProducts, 0);\r\n }\r\n const titlePrefix = <Title className='ms-search-result__collection-title-prefix' text={resources.searchTextPrefix} />;\r\n const titleText = collectionTitle && <Title className='ms-search-result__collection-title-text' text={collectionTitle} />;\r\n const titleCount = <Title className='ms-search-result__collection-title-count' text={productCountText} />;\r\n\r\n return {\r\n TitleContainer: { className: 'ms-search-result-container__title' },\r\n title:{\r\n titlePrefix: titlePrefix,\r\n titleText: titleText,\r\n titleCount: titleCount\r\n }\r\n };\r\n\r\n };\r\n private _getCategoryHierarchy = (): ICategoryHierarchyViewProps => {\r\n const { data } = this.props;\r\n const categoryHierarchy = data.categoryHierarchy.result;\r\n const categoryLinks =\r\n categoryHierarchy && categoryHierarchy.map((value: CategoryHierarchyData, index: number) => {\r\n\r\n return (\r\n <Link\r\n key={index}\r\n text={value.Name}\r\n ariaLabel={`${this.props.resources.categoryLinkAriaLabel} ${value.Name}`}\r\n href={value.Url}\r\n />\r\n );\r\n });\r\n const categoryLinkSeparator = <Separator separator='/' />;\r\n\r\n return {\r\n CategoryHierarchyContainer: { tag: 'nav', className: 'ms-search-result-container__category-hierarchy' },\r\n categoryHierarchyList: categoryLinks,\r\n categoryHierarchySeparator: categoryLinkSeparator\r\n };\r\n\r\n };\r\n\r\n private _getSortingDropDown = (): ISortByViewProps => {\r\n const { resources } = this.props;\r\n const activeDropdown = this._getCurrentlySelectedOption() || this.state.sortingState.selectedSortByOption;\r\n const dropdown = (\r\n <LabeledDropdown\r\n labelClassname='reviews-list-sort-by'\r\n labelText={resources.sortByDropdownLabel}\r\n dropdownId='categorySortByDropdown'\r\n dropdownClassname='reviews-list-dropdown'\r\n toggleColor='link'\r\n dropdownOptions={this.sortByDropdownOptions}\r\n selectedOption={activeDropdown}\r\n onSelectOption={this._updateSortByDropdown}\r\n ref={this._sortAndFilterContainerRef}\r\n />);\r\n return {\r\n SortingContainer: { className: 'ms-search-result-container__Sort-by-category' },\r\n sortByDropDown:dropdown\r\n };\r\n };\r\n\r\n private _getPagination = (): React.ReactNode => {\r\n const { config, context, data, resources } = this.props;\r\n const listPageState = data && data.listPageState && data.listPageState.result;\r\n const fullUrl = getCurrentUrl(context.request);\r\n const itemsPerPage = config.itemsPerPage || 10;\r\n const skipCount = listPageState && listPageState.currentPageNumber !== null ?\r\n (listPageState.currentPageNumber * (this.props.config.itemsPerPage || 10)) :\r\n ((this.props.context.request.query && +this.props.context.request.query.skip) || 0);\r\n const totalItems = listPageState && listPageState.totalProductCount || 0;\r\n const previousText = resources.flipperPrevious;\r\n const nextText = resources.flipperNext;\r\n const totalActiveProducts = listPageState?.activeProducts?.length || 0;\r\n\r\n if (totalItems <= itemsPerPage) {\r\n return null;\r\n }\r\n if (totalActiveProducts <= 0) {\r\n return null;\r\n }\r\n\r\n return (\r\n <UncontrolledPagination\r\n className='ms-search-result-container__pagination'\r\n role='navigation'\r\n aria-label={resources.paginationAriaLabel}\r\n url={fullUrl.href}\r\n qsp={'skip'}\r\n items={totalItems}\r\n itemsPerPage={itemsPerPage}\r\n startingItem={skipCount}\r\n previousText={<div className='msc-pagination__prev'><span className='ms-search-result__pagination-left' aria-hidden='true'/><span className='prev-text'>{previousText}</span></div>}\r\n nextText={<div className='msc-pagination__next'><span className='next-text'>{nextText}</span><span className='ms-search-result__pagination-right' aria-hidden='true'/></div>}\r\n previousAriaLabel={previousText}\r\n nextAriaLabel={nextText}\r\n />);\r\n };\r\n\r\n private _getRefineMenu = (): IRefineMenuViewProps => {\r\n const { data, context } = this.props;\r\n const tempRangeTypeTODO = context.request.query && context.request.query.inputRange ? 'input' : 'slider';\r\n const validRefiners = this._refinersFiltered && data.refiners.result && data.refiners.result.filter(refiner => {\r\n return refiner.Values.length > 0;\r\n });\r\n\r\n const activeRefiners = (data.listPageState.result && data.listPageState.result.activeFilters) || [];\r\n let subMenus;\r\n if (validRefiners) {\r\n if (this.props.config.pulldownRefiners) {\r\n subMenus = validRefiners.map((productRefinerHierarchy: IProductRefinerHierarchy, index: number) => {\r\n return (data.listPageState.result!.totalProductCount !== 0 ?\r\n (\r\n <RefinePulldown\r\n highestLevelRefinerText={this.props.config.highestLevelItem}\r\n productRefinerHierarchy={productRefinerHierarchy}\r\n selectedRefinerValues={activeRefiners}\r\n refineItemCommonProps={this._refineItemCommonProps}\r\n minValueSliderThumbAriaLabel={this.props.resources.minValueSliderThumbAriaLabel}\r\n maxValueSliderThumbAriaLabel={this.props.resources.maxValueSliderThumbAriaLabel}\r\n key={index}\r\n onUpdateRefiners={this._onUpdateRefiners}\r\n urlBuilder={this._buildRefinerUrl}\r\n isDisabled={false}\r\n tempRangeTypeTODO={tempRangeTypeTODO}\r\n context={context}\r\n moduleId={this.props.id}\r\n moduleTypeName={this.props.typeName}\r\n buttonText={this.props.config.pulldownButtonText}\r\n />) : null\r\n );\r\n });\r\n } else {\r\n subMenus = validRefiners.map((productRefinerHierarchy: IProductRefinerHierarchy, index: number) => {\r\n return (data.listPageState.result!.totalProductCount !== 0 ?\r\n (\r\n <RefineSubmenu\r\n highestLevelRefinerText={this.props.config.highestLevelItem}\r\n productRefinerHierarchy={productRefinerHierarchy}\r\n selectedRefinerValues={activeRefiners}\r\n refineItemCommonProps={this._refineItemCommonProps}\r\n minValueSliderThumbAriaLabel={this.props.resources.minValueSliderThumbAriaLabel}\r\n maxValueSliderThumbAriaLabel={this.props.resources.maxValueSliderThumbAriaLabel}\r\n refinerMinimizeText={this.props.resources.refinerMinimizeText}\r\n refinerExpandText={this.props.resources.refinerExpandText}\r\n minimizedRefiners={this.props.config.minimizedRefiners}\r\n key={index}\r\n onUpdateRefiners={this._onUpdateRefiners}\r\n urlBuilder={this._buildRefinerUrl}\r\n isDisabled={false}\r\n isExpandedOnInitialLoad={this.props.config.collapseRefiners ? false : true}\r\n tempRangeTypeTODO={tempRangeTypeTODO}\r\n context={context}\r\n moduleId={this.props.id}\r\n moduleTypeName={this.props.typeName}\r\n />) : null\r\n );\r\n });\r\n }\r\n }\r\n\r\n return {\r\n RefineMenuContainer:{className: 'ms-search-result-container__refine-menu' },\r\n RefinerSectionContainer:{className: 'ms-search-result-container__refiner-section'},\r\n refiners: subMenus || undefined, // type shenanigans\r\n activeRefiners: activeRefiners,\r\n pulldownText: this.props.config.pulldownButtonText || 'All Wines'\r\n };\r\n\r\n };\r\n\r\n private _getChoiceSummary = (): React.ReactNode => {\r\n const { resources, data, telemetry } = this.props;\r\n const selectedRefiners = (data.listPageState.result && data.listPageState.result.activeFilters) || [];\r\n return (\r\n <ChoiceSummary\r\n classNames='ms-choice-summary-by-category'\r\n clearAllText={resources.clearAllText}\r\n label={resources.choiceSummaryLabel}\r\n selectedChoices={selectedRefiners}\r\n // @ts-ignore: NOTE Type-unsafe line below, null refinersByCategoryHierarchy case not handled\r\n refinerHierarchy={data.refiners.result}\r\n choiceFormat={resources.choiceFormat}\r\n choiceRangeValueFormat={resources.choiceRangeValueFormat}\r\n telemetry={telemetry}\r\n onChoiceClicked={this._onChoiceClicked}\r\n urlBuilder={this._buildRefinerUrlForChoiceSummary}\r\n choiceAriaLabel={resources.choiceAriaLabel}\r\n />\r\n );\r\n\r\n };\r\n\r\n private _updateSortByDropdown = (notification: ILabeledDropdownOnChangeNotification): void => {\r\n const { context } = this.props;\r\n const requestContext = context && context.request;\r\n const actionContext = context && context.actionContext;\r\n\r\n if (!requestContext || !actionContext || !this.props.data.listPageState.result) {\r\n const error = `[sort-by-category] cannot sort without context: ${!requestContext ? 'requestContext ' : ''} ${!actionContext ? 'actionContext ' : ''} could not be found`;\r\n this.props.telemetry.warning(error);\r\n }\r\n\r\n window.history.pushState({}, '', buildListPageUrl(getCurrentUrl(this.props.context.request), undefined, [this._getSortColumnFromSelectedOption(notification.selectedOption)], undefined));\r\n transaction(() => {\r\n this.props.data.listPageState.result!.currentPageNumber = 0;\r\n this.props.data.listPageState.result!.sortingCritera = { Columns: [this._getSortColumnFromSelectedOption(notification.selectedOption)] };\r\n });\r\n };\r\n\r\n private _getSortColumnFromSelectedOption = (option: ILabeledDropdownOption): SortColumn => {\r\n const { data } = this.props;\r\n\r\n if (!data.searchConfiguration.result) {\r\n return {};\r\n }\r\n\r\n const mappedConfiguration = data.searchConfiguration.result.find((searchConfiguration) => { return searchConfiguration.key === option.key; });\r\n\r\n if (mappedConfiguration) {\r\n return mappedConfiguration.sortColumn;\r\n }\r\n\r\n return {};\r\n };\r\n\r\n private _getCurrentlySelectedOption = (): ILabeledDropdownOption | undefined => {\r\n const { data } = this.props;\r\n const sortCriteria = data.listPageState.result && data.listPageState.result.sortingCritera;\r\n\r\n const activeSortColumn =\r\n (sortCriteria?.Columns?.length && sortCriteria.Columns[0]) ||\r\n (parseQueryParam<SortColumn[]>('sorting', this.props.context.request) || [])[0];\r\n\r\n if (activeSortColumn && data.searchConfiguration.result) {\r\n const activeMappedConfig = data.searchConfiguration.result.find((mappedSearchConfig) => {\r\n return (mappedSearchConfig.sortColumn.ColumnName === activeSortColumn.ColumnName) &&\r\n (mappedSearchConfig.sortColumn.IsDescending === activeSortColumn.IsDescending);\r\n });\r\n if (activeMappedConfig) {\r\n return this.sortByDropdownOptions.find((dropdownOption) => dropdownOption.key === activeMappedConfig.key);\r\n }\r\n }\r\n\r\n return;\r\n };\r\n\r\n private _onUpdateRefiners = (itemToggleNotification: IRefineItemToggleNotification): void => {\r\n const { context } = this.props;\r\n const requestContext = context && context.request;\r\n const actionContext = context && context.actionContext;\r\n\r\n if (!requestContext || !actionContext || !this.props.data.listPageState.result) {\r\n const error = `Refine menu cannot refine search criteria: ${!requestContext ? 'requestContext ' : ''} ${!actionContext ? 'actionContext ' : ''} could not be found`;\r\n this.props.telemetry.warning(error);\r\n }\r\n\r\n const updatedRefinementCriteria = getUpdatedRefinementCriteria(itemToggleNotification, this.props.data.listPageState.result && this.props.data.listPageState.result.activeFilters || []);\r\n\r\n window.history.pushState({}, '', buildListPageUrl(getCurrentUrl(this.props.context.request), updatedRefinementCriteria));\r\n transaction(() => {\r\n this.props.data.listPageState.result!.currentPageNumber = 0;\r\n this.props.data.listPageState.result!.activeFilters = updatedRefinementCriteria;\r\n });\r\n };\r\n\r\n private _buildRefinerUrl = (itemToggleNotification: IRefineItemToggleNotification): string => {\r\n if (this.props.data.listPageState.result) {\r\n const newRefinementCriteria = getUpdatedRefinementCriteria(itemToggleNotification, this.props.data.listPageState.result.activeFilters || []);\r\n\r\n return buildListPageUrl(getCurrentUrl(this.props.context.request), newRefinementCriteria);\r\n } else {\r\n this.props.telemetry.warning(`[buildRefinerQueryString]List Page State Not available, unable to build refiner URL`);\r\n return '';\r\n }\r\n };\r\n\r\n private _onChoiceClicked = (notification: IChoiceSummaryClickNotification): void => {\r\n const { data, telemetry } = this.props;\r\n\r\n if (!data.listPageState.result) {\r\n telemetry.warning('[choice-summary-by-category._onChoiceClicked]ListPageState unavailable, unable to update refiners.');\r\n return;\r\n }\r\n\r\n let currentRefinementCriteria = (data.listPageState.result && data.listPageState.result.activeFilters) || [];\r\n\r\n if (!notification.clearAll) {\r\n const selectedChoice = notification.choiceClicked;\r\n if (!selectedChoice) {\r\n telemetry.warning('[choice-summary-by-category._onChoiceClicked] Choice could not be determined');\r\n return;\r\n }\r\n currentRefinementCriteria = currentRefinementCriteria.filter(\r\n (selectedCriterion: ProductRefinerValue) => !isMatchingRefinementCriterion(selectedChoice, selectedCriterion)\r\n );\r\n } else {\r\n currentRefinementCriteria = [];\r\n\r\n // set focus to sort and filter\r\n const dropdownElementId = this._sortAndFilterContainerRef.current && this._sortAndFilterContainerRef.current.props.dropdownId;\r\n const dropdownElement = dropdownElementId && document.getElementById(dropdownElementId);\r\n setTimeout(() => {\r\n dropdownElement && dropdownElement.focus();\r\n },\r\n 50);\r\n }\r\n\r\n const fullUrl = getCurrentUrl(this.props.context.request);\r\n window.history.pushState({}, '', buildListPageUrl(fullUrl, currentRefinementCriteria));\r\n data.listPageState.result.currentPageNumber = 0;\r\n data.listPageState.result.activeFilters = currentRefinementCriteria;\r\n };\r\n\r\n private _buildRefinerUrlForChoiceSummary = (selectedRefiner: ProductRefinerValue, isClearAll: boolean): string => {\r\n const { data, telemetry } = this.props;\r\n const fullUrl = getCurrentUrl(this.props.context.request);\r\n\r\n if (!data.listPageState.result) {\r\n telemetry.warning('[choice-summary-by-category._buildRefinerUrl]ListPageState unavailable, unable to create refiner URL.');\r\n return fullUrl.href;\r\n }\r\n\r\n let currentRefinementCriteria = (data.listPageState.result && data.listPageState.result.activeFilters) || [];\r\n\r\n if (!isClearAll) {\r\n if (!selectedRefiner) {\r\n telemetry.warning('[choice-summary-by-category._buildRefinerUrl] URL for Choice could not be determined');\r\n return fullUrl.href;\r\n }\r\n currentRefinementCriteria = currentRefinementCriteria.filter(\r\n (selectedCriterion: ProductRefinerValue) => !isMatchingRefinementCriterion(selectedRefiner, selectedCriterion)\r\n );\r\n } else {\r\n currentRefinementCriteria = [];\r\n }\r\n\r\n return buildListPageUrl(fullUrl, currentRefinementCriteria);\r\n };\r\n\r\n private _getViewport(): GridSize {\r\n const { context } = this.props;\r\n\r\n // always render in mobile viewport on a mobile device\r\n if (context.request && context.request.device && context.request.device.Type === 'Mobile') {\r\n return 'xs';\r\n }\r\n\r\n if (MsDyn365.isBrowser && window.innerWidth) {\r\n const gridSettings = context.request.gridSettings;\r\n if (gridSettings) {\r\n if (gridSettings.xs && window.innerWidth <= gridSettings.xs.w) {\r\n return 'xs';\r\n } else if (gridSettings.sm && window.innerWidth <= gridSettings.sm.w) {\r\n return 'sm';\r\n } else if (gridSettings.md && window.innerWidth <= gridSettings.md.w) {\r\n return 'md';\r\n } else if (gridSettings.lg && window.innerWidth <= gridSettings.lg.w) {\r\n return 'lg';\r\n } else {\r\n return 'xl';\r\n }\r\n }\r\n }\r\n\r\n return 'lg';\r\n }\r\n\r\n private _toggleModal(): void {\r\n this.setState({\r\n modalIsOpen: !this.state.modalIsOpen\r\n });\r\n }\r\n\r\n private _updateViewport(): void {\r\n this._viewport = this._getViewport();\r\n\r\n if (this.state.modalIsOpen && !this.isMobile) {\r\n this._toggleModal();\r\n }\r\n }\r\n\r\n private _getCategoryDescription(paragraph: RichText | undefined): JSX.Element | undefined {\r\n\r\n if (paragraph && paragraph.length > 0) {\r\n return <RichTextComponent className='category-description' text={paragraph}/>;\r\n }\r\n return undefined;\r\n }\r\n\r\n private async _getProductavailabilty(products: IFullProductsSearchResultsWithCount): Promise<void> {\r\n if (products && products.count && products.count > 0) {\r\n const productIds: number[] = [];\r\n products.products.forEach((product) => {\r\n productIds.push(product.RecordId);\r\n });\r\n const availabilityAll = await getEstimatedAvailabilityAsync({ callerContext: this.props.context.actionContext }, {ProductIds: productIds, DefaultWarehouseOnly: true});\r\n const formattedResponse = availabilityAll.ProductWarehouseInventoryAvailabilities?.map((product) => {\r\n return {ProductId: product.ProductId, AvailableQuantity: product.PhysicalAvailable, ExtensionProperties: product.ExtensionProperties};\r\n }) as ProductAvailableQuantity[];\r\n this.setState({productAvailability: formattedResponse});\r\n }\r\n }\r\n\r\n private async _getClubPricing(products: IFullProductsSearchResultsWithCount): Promise<void> {\r\n const projectDomain: ProjectionDomain = { ChannelId: +this.props.context.request.apiSettings.channelId, CatalogId: +this.props.context.request.apiSettings.catalogId };\r\n let affiliations: AffiliationLoyaltyTier[];\r\n if (this.props.context.app.config.affiliationId) {\r\n affiliations = [\r\n {\r\n AffiliationId: this.props.context.app.config.affiliationId\r\n }\r\n ];\r\n } else {\r\n affiliations = [];\r\n }\r\n const productIds: number[] = [];\r\n products.products.forEach((product) => {\r\n productIds.push(product.RecordId);\r\n });\r\n const clubPricingAll = await getActivePricesAsync(\r\n { callerContext: this.props.context.actionContext },\r\n projectDomain,\r\n productIds,\r\n new Date(),\r\n '',\r\n affiliations,\r\n true\r\n );\r\n this.setState({clubPricing: clubPricingAll});\r\n }\r\n\r\n //----------------------------------------------------------\r\n //----------------------------------------------------------\r\n private _emitImpressionEvent(products: ProductSearchResult[]): void {\r\n const impressions = products.map(product => ({\r\n product,\r\n attributes: CommerceAttributesParser.getParsedAttributes(product.AttributeValues || []),\r\n }));\r\n\r\n publish('impression', {\r\n products: impressions,\r\n\r\n list: 'Category Page', // Could be Search Results if we ever enable search results pages\r\n category: this.props.data.category.result?.Name,\r\n context: this.props.context,\r\n });\r\n }\r\n}\r\n","import { CategoryHierarchy, IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\n\r\n// Refiner Remappers, stored in global config\r\nexport interface IRemapper {\r\n originalName: string;\r\n newName: string;\r\n}\r\n\r\n//-----------------------------------------------------\r\n// Remove category refiners that aren't in the current\r\n// position within the hierarchy.\r\n//-----------------------------------------------------\r\nexport function filterInvalidCategories(refiners: IProductRefinerHierarchy[], categoryHierarchy: CategoryHierarchy[], remappers: IRemapper[]): void {\r\n // If we don't have any refiners (yet), don't do anything\r\n if (!refiners || !refiners.length) {\r\n return undefined;\r\n }\r\n\r\n // Find the category refiner name\r\n const categoryRemapper = remappers && remappers.find(remapRecord => remapRecord.originalName.toLowerCase() === `category`);\r\n const categoryRefinerName = categoryRemapper ? categoryRemapper.newName : `Category`;\r\n\r\n // Find the category refiners\r\n const categoryRefiners = refiners.find(entry => (entry.KeyName === categoryRefinerName));\r\n\r\n // Filter out invalid entries\r\n if (categoryRefiners) {\r\n // Construct a list of valid categories (note: this only goes one level deep!)\r\n const categoryIDs = {};\r\n\r\n if (categoryHierarchy && categoryHierarchy[0]) {\r\n categoryHierarchy[0].Children?.forEach(entry => categoryIDs[entry.RecordId] = true);\r\n }\r\n\r\n // Remove refiners that aren't in the list of categories\r\n categoryRefiners.Values = categoryRefiners.Values.filter(entry => (entry.RefinerRecordId && categoryIDs[entry.RefinerRecordId]));\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 * 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<ICheckoutDeliveryOptionsDescriptionProps>}\r\n */\r\nconst CheckoutDeliveryOptionsDescription: React.FC<ICheckoutDeliveryOptionsDescriptionProps> = ({\r\n description\r\n}) => {\r\n if (!description) {\r\n return null;\r\n }\r\n\r\n return <span className='ms-checkout-delivery-options__description'>{description}</span>;\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<ICheckoutDeliveryOptionsErrorMessageProps>}\r\n */\r\nconst CheckoutDeliveryOptionsErrorMessage: React.FC<ICheckoutDeliveryOptionsErrorMessageProps> = ({\r\n message\r\n}) => {\r\n if (!message) {\r\n return null;\r\n }\r\n\r\n return (\r\n <p className='ms-checkout-delivery-options__error-message'>{message}</p>\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<ICheckoutDeliveryOptionsErrorTitleProps>}\r\n */\r\nconst CheckoutDeliveryOptionsErrorTitle: React.FC<ICheckoutDeliveryOptionsErrorTitleProps> = ({\r\n title\r\n}) => {\r\n if (!title) {\r\n return null;\r\n }\r\n\r\n return (\r\n <p className='ms-checkout-delivery-options__error-title'>{title}</p>\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<HTMLInputElement>): void;\r\n}\r\n\r\n/**\r\n *\r\n * AddPaymentForm SFC\r\n * @extends {React.FC<ICheckoutDeliveryOptionsRadioButtonProps>}\r\n */\r\nconst CheckoutDeliveryOptionsRadioButton: React.FC<ICheckoutDeliveryOptionsRadioButtonProps> = ({\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 <input\r\n className='ms-checkout-delivery-options__input-radio'\r\n checked={isChecked}\r\n aria-checked={isChecked}\r\n type='radio'\r\n aria-setsize={ariaSetSize}\r\n aria-posinset={ariaPosInSet}\r\n value={value}\r\n name='deliveryOptions'\r\n onChange={onChange}\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<ISmweCheckoutDeliveryOptionsData>, 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<HTMLInputElement>): 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<ISmweCheckoutDeliveryOptionsProps<ISmweCheckoutDeliveryOptionsData>>}\r\n */\r\n// @ts-ignore\r\n@withModuleState\r\n@observer\r\nclass CheckoutDeliveryOptions extends React.Component<ICheckoutDeliveryOptionsModuleProps> {\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<void> {\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: <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: <DescriptionComponent {...{ description: selectedItem.Description }} />,\r\n price: <PriceComponent id={id} typeName={typeName} context={context} className='ms-checkout-delivery-options__price' data={{price: { CustomerContextualPrice: price }}} freePriceText={priceFree} />\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: <ErrorTitleComponent {...{ title: errorMessageTitle }} />,\r\n message: <ErrorMessageComponent {...{ message: this.errorMessage }} />\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 <RadioButtonComponent\r\n {\r\n ...{\r\n isChecked: deliveryOption.Code === this.selectedItemId,\r\n value: deliveryOption.Code,\r\n ariaSetSize: count,\r\n ariaPosInSet: index + 1,\r\n ariaLabel: `${deliveryOption.Description} ${priceFree}`,\r\n onChange: this.onDeliveryOptionChange\r\n }\r\n }\r\n />\r\n ),\r\n description: (\r\n <DescriptionComponent\r\n {\r\n ...{\r\n description: deliveryOption.Description\r\n }\r\n }\r\n />\r\n ),\r\n price: (\r\n <PriceComponent\r\n id={id}\r\n typeName={typeName}\r\n context={context}\r\n className='ms-checkout-delivery-options__price'\r\n data={{ price: { CustomerContextualPrice: get(deliveryOption, 'ShippingChargeAmount', 0) }}}\r\n freePriceText={priceFree}\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 <Button\r\n className='ms-checkout-delivery-options__btn-save'\r\n title={saveBtnLabel}\r\n color='primary'\r\n disabled={!this.selectedItemId}\r\n onClick={this.onSave}\r\n >\r\n {saveBtnLabel}\r\n </Button>\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 <Button\r\n className='ms-checkout-delivery-options__btn-edit'\r\n title={editBtnLabel}\r\n color='primary'\r\n onClick={this.onEdit}\r\n >\r\n {editBtnLabel}\r\n </Button>\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 <Button\r\n className='ms-checkout-delivery-options__btn-cancel'\r\n title={cancelBtnLabel}\r\n color='secondary'\r\n onClick={this.onCancel}\r\n >\r\n {cancelBtnLabel}\r\n </Button>\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<void> => {\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<void> => {\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<HTMLInputElement>) => {\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 <label className='msc-cart-line__bopis-shipping'>\r\n <input\r\n id={`ms-cart-bopis-ship-option-${cartLine.LineId}`}\r\n type='radio'\r\n name={`shippingType ${cartLine.LineId}`}\r\n onChange={() => {_toggleBOPIS(false);}}\r\n value={shipItText}\r\n checked={!bopisSelected}\r\n />\r\n {shipItText}\r\n </label>\r\n <label className='msc-cart-line__bopis-store-pickup'>\r\n <input\r\n id={`ms-cart-bopis-pickup-option-${cartLine.LineId}`}\r\n type='radio'\r\n name={`shippingType ${cartLine.LineId}`}\r\n onChange={() => {_toggleBOPIS(true);}}\r\n value={pickupInStoretext}\r\n checked={bopisSelected}\r\n />\r\n {pickupInStoretext}\r\n </label>\r\n {\r\n cartLine.FulfillmentStoreId ? (\r\n <div className='msc-cart-line__bopis__fullfilment'>\r\n <span className='msc-cart-line__bopis__fullfilment-store'>{orgUnitName}</span>\r\n <button className='msc-cart-line__bopis-changestore btn' onClick={() => {_toggleBOPIS(true);}}>{changeStoreText}</button>\r\n </div>\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<ICartState>(\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<HTMLElement>) => {\r\n removeItemClickHandler(cartline);\r\n };\r\n\r\n return {\r\n cartline: (\r\n <SmweCartLine\r\n templatePercentSavingText={props.templatePercentSavingText!}\r\n templateSavingText={props.templateSavingText!}\r\n percentSaving={props.percentSaving}\r\n data={{\r\n cartLine: cartline,\r\n product: product\r\n }}\r\n currentQuantity={cartline.Quantity}\r\n maxQuantity={maxQuantity}\r\n isOutOfStock={\r\n product.ItemId?.toLowerCase() === props.context.request.channel?.GiftCardItemId?.toLowerCase() ? false :\r\n props.isStockCheckEnabled ? (maxQuantity <= 0 ? true : false) : false\r\n }\r\n gridSettings={gridSettings}\r\n imageSettings={imageSettings}\r\n id={id}\r\n typeName={typeName}\r\n productUrl={getProductUrlSync(\r\n product,\r\n props.context.actionContext,\r\n undefined\r\n )}\r\n context={context}\r\n resources={resources}\r\n key={index}\r\n isQuantityEditable={true}\r\n quantityOnChange={props.updateCartLinesQuantitySuccessHandler}\r\n primaryImageUrl={product.PrimaryImageUrl}\r\n remove={\r\n <Button\r\n className='msc-cart-line__remove-item'\r\n onClick={onRemoveClickHandler}\r\n title={removeButtonText}\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 <Button\r\n className='msc-cart-line__remove-item'\r\n onClick={onRemoveClickHandler}\r\n title={removeButtonText}\r\n >\r\n {removeButtonText}\r\n </Button>\r\n ),\r\n addToWishlist: isAuthenticated ? (\r\n <AddToWishlistComponent\r\n className={'msc-cart-line__add-to-wishlist'}\r\n addToWishlistButtonText={addToWishlistButtonText}\r\n removeFromWishlistButtonText={removeFromWishlistButtonText}\r\n context={context}\r\n id={id}\r\n key={cartline.LineId}\r\n typeName={typeName}\r\n nameOfWishlist={nameOfWishlist}\r\n cartline={cartline}\r\n showButtonText={true}\r\n showStatusMessage={false}\r\n showRemoveButton={false}\r\n showButtonTooltip={false}\r\n data={{\r\n wishlists: wishlists,\r\n product: product\r\n }}\r\n onSuccess={moveToWishlistSuccessHandler}\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 getMappedSearchConfiguration, { MappedSearchInput, sortOptions } from './get-mapped-search-configuration';\r\nimport getCollectionRefinersAction, { RefinersByCollectionInput } from './get-refiners-for-collection';\r\nimport { IFullProductsSearchResultsWithCount } from './IFullProductsSearchResultsWithCount';\r\nimport { IMappedSearchConfiguration } from './IMappedSearchConfiguration';\r\nimport getCollectionProducts, { GetFullProductsByCollectionInput } from './smwe-get-full-products-by-collection';\r\n\r\nexport * from './base-collection-action';\r\nexport * from './url-utils';\r\n\r\nexport {\r\n getCollectionProducts,\r\n getCollectionRefinersAction,\r\n GetFullProductsByCollectionInput,\r\n getMappedSearchConfiguration,\r\n IFullProductsSearchResultsWithCount,\r\n IMappedSearchConfiguration,\r\n MappedSearchInput,\r\n RefinersByCollectionInput,\r\n sortOptions\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<ISmweBuyboxViewProps> = 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<string> = props.context.actionContext.get('String', 'Generic-SkuSelectorClasses');\r\n return (\r\n <Module {...ModuleProps}>\r\n <Node {...MediaGalleryContainerProps}>{props.mediaGallery}</Node>\r\n <Node {...ProductInfoContainerProps}>\r\n {props.productApellation && (\r\n <div>{props.productApellation}</div>\r\n )}\r\n {title}\r\n {productDescription}\r\n {eventSchedule}\r\n {acclaimRatings}\r\n {cookbookTagline}\r\n {show && <div className={`sku-selector-container row ${tableClass && tableClass.result}`}>\r\n <Table borderless responsive size='lg'>\r\n <thead>\r\n <tr>\r\n {productTitle && <th scope='col' className='sku-selector-product-title'>Product</th>}\r\n {productPrice && <th scope='col' className='sku-selector-product-price'>Retail</th>}\r\n {productClubPrice && <th scope='col' className='sku-selector-product-price'>Your Price</th>}\r\n {quantity && <th scope='col' className='sku-selector-product-quantity'>QTY</th>}\r\n {addToCart && <th scope='col' className='sku-selector-add-to-cart' />}\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n {productTitle && <td className='sku-selector-product-title'>{productTitle}</td>}\r\n {productPrice && <td className='sku-selector-product-price'>{productPrice}</td>}\r\n {productClubPrice && <td className='sku-selector-product-price'>{productClubPrice}</td>}\r\n {quantity && <td className='sku-selector-product-quantity'>{_renderQuantity(quantity)}</td>}\r\n {addToCart && <td className='sku-selector-add-to-cart'>{_renderAddToCart(addToCart)}</td>}\r\n {subscriptionButton && <td className='sku-selector-add-to-cart'>{_renderAddToCart(subscriptionButton)}</td>}\r\n </tr>\r\n </tbody>\r\n </Table>\r\n </div>}\r\n {props.content &&\r\n props.content.map(\r\n (contentSlotData: React.ReactNode, index: number) => {\r\n return (\r\n <React.Fragment key={index}>\r\n {contentSlotData}\r\n </React.Fragment>\r\n );\r\n }\r\n )}\r\n\r\n </Node>\r\n </Module>\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 <Node {...ContainerProps}>\r\n {errorBlock}\r\n {button}\r\n </Node>\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 <Node {...ContainerProps}>\r\n <Node {...LabelContainerProps}>\r\n {errors}\r\n </Node>\r\n {input}\r\n </Node>\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<IOrderSummaryLineProps> = ({\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 <p className={`msc-order-summary__line-${cssLabel}`}>\r\n <span className='msc-order-summary__label'>{label}</span>\r\n {price || price === 0 ? (\r\n <PriceComponent\r\n data={{\r\n price: { CustomerContextualPrice: price }\r\n }}\r\n freePriceText={freeText}\r\n context={context}\r\n id={id}\r\n typeName={typeName}\r\n className={'msc-order-summary__value'}\r\n />\r\n ) : (\r\n <span className='msc-order-summary__value'>{toBeCalculatedText}</span>\r\n )}\r\n </p>\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 <OrderSummaryLine\r\n price={price}\r\n label={label}\r\n context={props.context}\r\n id={props.id}\r\n typeName={props.typeName}\r\n toBeCalculatedText={props.toBeCalculatedText}\r\n freeText={props.freeText}\r\n telemetry={props.telemetry}\r\n cssLabel={cssLabel}\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 <React.Fragment>\r\n {_buildOrderSummarySection(props, hasShippingMethod ? freightFee : shippingPrice, props.shippingLabel, 'shipping')}\r\n {props.shipmentWarningText && <RichTextComponent className='msc-order-summary__shipment-warning' text={props.shipmentWarningText} />}\r\n </React.Fragment>\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<IElicitPromoCodeProps> { }\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<IRefineSubmenuProps>}\r\n */\r\nclass ElicitPromoCode extends React.PureComponent<IElicitPromoCodeProps, IElicitPromoCodeState> {\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 <div className='msc-promo-code__heading'>{this.props.promoCodeHeadingText}</div>\r\n {this._renderForm(this.props.promoPlaceholderText, this.props.promoCodeApplyButtonText, this.props.cart)}\r\n <p className={this.state.error ? 'msc-promo-code__error msc-alert-danger' : ''} aria-live='assertive'>{this.state.error}</p>\r\n {this._renderAppliedPromoCode(this.props)}\r\n </>\r\n );\r\n }\r\n\r\n private _onInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\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 <form onSubmit={e => {e.preventDefault(); this._applyPromotion(cartState); }} className='msc-promo-code__form'>\r\n <input\r\n className='msc-promo-code__input'\r\n aria-label={promoPlaceholderText}\r\n onChange={this._onInputChange}\r\n value={this.state.promoCodeInputValue}\r\n placeholder={promoPlaceholderText}\r\n />\r\n <Button\r\n title={promoCodeApplyButtonText}\r\n className='msc-promo-code__btn-apply'\r\n // tslint:disable-next-line:jsx-no-lambda\r\n onClick={() => { this._applyPromotion(cartState); }}\r\n disabled={!this.state.canApply}\r\n >\r\n {promoCodeApplyButtonText}\r\n </Button>\r\n </form>\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 <div className='msc-promo-code__applied'>\r\n <div className='msc-promo-code__applied-heading'>{this.props.appliedPromoCodeHeadingText}</div>\r\n <div className='msc-promo-code__applied-subheading'>{this.props.appliedPromoCodeSubheadingText}</div>\r\n <div className='msc-promo-code__applied-lines'>\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 <div key={coupon.Code} className='msc-promo-code__applied-line'>\r\n <div className='msc-promo-code__applied-line-value'>\r\n <span className='msc-promo-code__applied-line-value-code'>{coupon.Code}</span>\r\n <span className='msc-promo-code__applied-line-value-price'>\r\n {this._calculateDiscount(coupon.Code || '', props.cart) === 0\r\n ? null\r\n : <>\r\n (\r\n <PriceComponent\r\n data={{\r\n price: {\r\n CustomerContextualPrice: this._calculateDiscount(coupon.Code || '', props.cart)\r\n }\r\n }}\r\n context={props.context}\r\n id={props.id}\r\n typeName={props.typeName}\r\n className={'msc-promo-code__applied-line-discount-value'}\r\n />\r\n )\r\n </>\r\n }\r\n </span>\r\n </div>\r\n <Button\r\n title={props.removePromoText}\r\n className={'msc-promo-code__applied-line-btn-remove'}\r\n // tslint:disable-next-line:jsx-no-lambda react-this-binding-issue\r\n onClick={(event) => {this._removePromotion(props.cart, event);}}\r\n data-value={coupon.Code}\r\n aria-label={ariaLabel}\r\n >\r\n {props.removePromoText}\r\n </Button>\r\n </div>\r\n );\r\n })\r\n }\r\n </div>\r\n </div>\r\n );\r\n };\r\n}\r\n\r\n// @ts-ignore\r\nexport const ElicitPromoCodeComponent: React.FunctionComponent<IElicitPromoCodeProps> = msdyn365Commerce.createComponent<IElicitPromoCodeComponent>(\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<ICartState>;\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<IElicitSubscriptionUpsell> {\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 <div />; }\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 <div className='subscription-upsell'>\r\n {showUpsell &&\r\n <div className='subscription-upsell__text'>\r\n Your order includes a subscription for a\r\n <span className='subscription-upsell__text-current-bottles'>{` ${totalBottles} bottle `}</span>\r\n box. Add\r\n <span className='subscription-upsell__text-add-bottles'>{` ${upsellBottleCount} more `}</span>\r\n bottles to your subscription to get\r\n <span className='subscription-upsell__text-discount'>{` ${upsellPercent}% off `}</span>\r\n on your subsequent orders!\r\n </div>\r\n }\r\n {this._renderUpsellCTA(this.props.editSubscriptionLink)}\r\n </div>\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 <a\r\n href={link.linkUrl.destinationUrl}\r\n aria-label={link.ariaLabel}\r\n className='subscription-upsell__button'\r\n >\r\n {link.linkText}\r\n </a>\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<IElicitCartData> {\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<boolean>;\r\n mixedCart: IDictionary<boolean>;\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<IElicitCartProps<IElicitCartData>>}\r\n */\r\n@observer\r\nclass ElicitCart extends React.Component<IElicitCartProps<IElicitCartData>> {\r\n\r\n private cartLinesInvalid: IDictionary<boolean> = {};\r\n private mixedCart: IDictionary<boolean> = {};\r\n\r\n @observable private productAttributesList: { [key: number]: AttributeValue[] } = {};\r\n private parsedProductAttributes: IAttributeBank = {};\r\n\r\n constructor(props: IElicitCartProps<IElicitCartData>) {\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 <ElicitPromoCodeComponent\r\n cart={cart}\r\n promoCodeHeadingText={resources.elicitCart__promoCodeHeadingText}\r\n promoPlaceholderText={resources.elicitCart__promoPlaceholderText}\r\n promoCodeApplyButtonText={resources.elicitCart__promoCodeApplyButtonText}\r\n appliedPromoCodeHeadingText={resources.elicitCart__appliedPromoCodeHeadingText}\r\n appliedPromoCodeSubheadingText={resources.elicitCart__appliedPromoCodeSubheadingText}\r\n collapseTimeOut={350}\r\n removePromoAriaLabelFormat={resources.elicitCart__removePromoAriaLabelFormat}\r\n removePromoText={resources.elicitCart__removePromoText}\r\n invalidPromoCodeErrorText={resources.elicitCart__invalidPromoCodeErrorText}\r\n failedToAddPromoCodeErrorText={resources.elicitCart__failedToAddPromoCodeErrorText}\r\n failedToRemovePromoCodeErrorText={resources.elicitCart__failedToRemovePromoCodeErrorText}\r\n duplicatePromoCodeErrorText={resources.elicitCart__duplicatePromotionErrorText}\r\n context={this.props.context}\r\n id={this.props.id}\r\n typeName={this.props.typeName}\r\n data={{}}\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 <h2 className={'msc-order-summary__heading'}>{resources.elicitCart__orderSummaryTitle}</h2>\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 <Button className={'msc-cart__btn-checkout'} href={checkoutURL} title={resources.elicitCart__checkoutButtonTitle} onClick={this._updateSubscriptionName}>{resources.elicitCart__checkoutButtonTitle}</Button>\r\n ) : null,\r\n checkoutAsGuestButton: (!isCartREALLYEmpty && !isAuthenticated) ?\r\n (\r\n <Button className={'msc-cart__btn-checkout-guest'} href={guestCheckoutUrl} title={resources.elicitCart__guestCheckoutButtonTitle}>{resources.elicitCart__guestCheckoutButtonTitle}</Button>\r\n ) : null,\r\n backToShoppingButton: <Button className={'msc-cart__btn-back'} href={backToShoppingUrl} title={resources.elicitCart__backToShoppingButtonTitle}>{resources.elicitCart__backToShoppingButtonTitle}</Button>,\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: <Waiting className='msc-waiting-circular msc-waiting-lg' />,\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 <Button className={'msc-cart__btn-checkout'} href={checkoutURL} disabled={true} title={resources.elicitCart__checkoutButtonTitle}>{resources.elicitCart__checkoutButtonTitle}</Button>\r\n ),\r\n cartLineStatus: this.cartLinesInvalid,\r\n mixedCart: this.mixedCart,\r\n subscriptionHeader: this._useForSubscriptions && !isCartEmpty && (\r\n <ElicitSubscriptionHeader\r\n cart={this.props.data.cart}\r\n className='cart-subscription-header'\r\n context={this.props.context}\r\n frequencyTable={this.props.config.frequencyTable!}\r\n editSubscriptionLink={this.props.config.editSubscriptionLink}\r\n resources={{\r\n deliveryText: resources.elicitCart_subscriptionDeliveryText,\r\n savingText: resources.elicitCart_subscriptionSavingText,\r\n savingLabel: resources.elicitCart_subscriptionSavingLabel,\r\n wineBottleSummaryCount: resources.elicitCart_subscriptionWineBottleSummaryCount,\r\n boxNamePlaceholder: resources.elicitCart__editBoxNamePlaceholder\r\n }}\r\n />\r\n ),\r\n subscriptionUpsell: this._useForSubscriptions && !isCartEmpty && (\r\n <ElicitSubscriptionUpsell\r\n cart={this.props.data.cart}\r\n editSubscriptionLink={this.props.config.editSubscriptionLink}\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<void> {\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<void> {\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 <h1 className={'msc-cart__heading'}>{resources.elicitCart__subCartTitle}</h1>;\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 <h1 className={'msc-cart__heading'}>{resources.elicitCart__cartTitle}</h1>;\r\n }\r\n}\r\n\r\nexport default ElicitCart;\r\n","import { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { RatingComponent } from '@msdyn365-commerce/components';\r\nimport { ICoreContext } from '@msdyn365-commerce/core';\r\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport { IRefineItemToggleNotification } from './refine-item-toggle-notification';\r\nimport { IRefineItemCommonProps } from './refine-item.props.common';\r\nimport { ProductRefinerSource, ProductRefinerTypeValue } from './utilities';\r\n\r\n/**\r\n * RefineItem properties\r\n */\r\nexport interface IRefineItemProps {\r\n\r\n parentProductRefinerHierarchy: IProductRefinerHierarchy;\r\n productRefinerValue: ProductRefinerValue;\r\n selectedRefinementCriterion: ProductRefinerValue | undefined;\r\n refineItemCommonProps: IRefineItemCommonProps;\r\n isDisabled: boolean;\r\n context: ICoreContext;\r\n moduleId: string;\r\n moduleTypeName: string;\r\n onToggle(notfication: Readonly<IRefineItemToggleNotification>): void;\r\n urlBuilder(refiner: IRefineItemToggleNotification): string;\r\n}\r\n\r\n/**\r\n * Refine item state\r\n */\r\nexport interface IRefineItemState extends React.ComponentState {\r\n isChecked: boolean;\r\n renderingError?: object;\r\n}\r\n\r\n/**\r\n * Single-select and multi-select refine item component (controlled by RefineSubmenu)\r\n */\r\nexport default class RefineItem extends React.Component<IRefineItemProps, IRefineItemState> {\r\n private anchorType: React.RefObject<HTMLAnchorElement>;\r\n\r\n constructor(props: IRefineItemProps) {\r\n super(props);\r\n this._onClick = this._onClick.bind(this);\r\n this.state = {\r\n isChecked: !!this.props.selectedRefinementCriterion\r\n };\r\n this.anchorType = React.createRef();\r\n }\r\n\r\n public render(): JSX.Element | undefined {\r\n const {\r\n isDisabled,\r\n refineItemCommonProps,\r\n parentProductRefinerHierarchy,\r\n productRefinerValue,\r\n selectedRefinementCriterion,\r\n children,\r\n onToggle,\r\n context,\r\n ...attrs\r\n } = this.props;\r\n if (!productRefinerValue) {\r\n refineItemCommonProps.telemetry.error('[refine-item] Cannot render refineItem without productRefinerValue');\r\n return undefined;\r\n }\r\n if (!productRefinerValue.LeftValueBoundString) {\r\n refineItemCommonProps.telemetry.warning(`[refine-item] RefineItem without LeftValueBoundString: ${JSON.stringify(productRefinerValue)}`);\r\n }\r\n const isSingleSelect = parentProductRefinerHierarchy.RefinerTypeValue === ProductRefinerTypeValue.Single;\r\n let itemTypeClassName = isSingleSelect ? 'single-select' : 'multi-select';\r\n itemTypeClassName = `ms-refine-submenu-item ${itemTypeClassName}`;\r\n const inputType = isSingleSelect ? 'radio' : 'checkbox';\r\n const role = isSingleSelect ? 'radio' : undefined;\r\n itemTypeClassName = !!selectedRefinementCriterion ? `${itemTypeClassName}-checked` : itemTypeClassName;\r\n if (parentProductRefinerHierarchy.SourceValue === ProductRefinerSource.Rating) {\r\n if (productRefinerValue.LeftValueBoundString) {\r\n return (\r\n <li\r\n className='ms-refine-submenu-item'\r\n role='radio'\r\n aria-checked='false'\r\n id={`${parentProductRefinerHierarchy.KeyName! }_${productRefinerValue.LeftValueBoundLocalizedString}`}\r\n aria-label={`${parentProductRefinerHierarchy.KeyName!}_${productRefinerValue.LeftValueBoundLocalizedString}`}\r\n >\r\n <a\r\n href={this._getRefinerUrl()}\r\n aria-label={`${parentProductRefinerHierarchy.KeyName!}_${productRefinerValue.LeftValueBoundLocalizedString}`}\r\n onClick={this._onClick}\r\n >\r\n <RatingComponent\r\n avgRating={parseInt(productRefinerValue.LeftValueBoundString, 10)}\r\n ratingCount={productRefinerValue.LeftValueBoundLocalizedString ? productRefinerValue.LeftValueBoundLocalizedString : productRefinerValue.LeftValueBoundString}\r\n hideCount={false}\r\n readOnly={true}\r\n ariaLabel=''\r\n context={context}\r\n id={this.props.moduleId}\r\n typeName={this.props.moduleTypeName}\r\n data={{}}\r\n />\r\n <span className='refine-submenu-item__rating'>{productRefinerValue.Count !== undefined && `(${productRefinerValue.Count})`}</span>\r\n </a>\r\n </li>\r\n );\r\n } else {\r\n return undefined;\r\n }\r\n } else {\r\n return (\r\n <li className='ms-refine-submenu-item' role={role} id={`${parentProductRefinerHierarchy.KeyName!}_${productRefinerValue.LeftValueBoundString}`}>\r\n <a\r\n key={!!selectedRefinementCriterion ? 'true' : 'false'}\r\n ref={this.anchorType}\r\n href={this._getRefinerUrl()}\r\n tabIndex={0}\r\n onClick={this._onClick}\r\n className={itemTypeClassName}\r\n role={inputType}\r\n aria-checked={!!selectedRefinementCriterion}\r\n {...attrs}\r\n >\r\n <span className='ms-refine-submenu-item__label'>\r\n {productRefinerValue.LeftValueBoundLocalizedString || productRefinerValue.LeftValueBoundString}\r\n </span>\r\n </a>\r\n </li>\r\n );\r\n }\r\n }\r\n\r\n private _getRefinerUrl(): string {\r\n const { urlBuilder, parentProductRefinerHierarchy, productRefinerValue, selectedRefinementCriterion } = this.props;\r\n\r\n if (productRefinerValue) {\r\n return urlBuilder({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: !selectedRefinementCriterion\r\n });\r\n }\r\n\r\n return '';\r\n }\r\n\r\n private _onClick = (e: React.MouseEvent<HTMLAnchorElement | HTMLInputElement>): void => {\r\n e.preventDefault();\r\n\r\n const { parentProductRefinerHierarchy, productRefinerValue, selectedRefinementCriterion } = this.props;\r\n if (productRefinerValue) {\r\n this.props.onToggle({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: !selectedRefinementCriterion\r\n });\r\n\r\n setTimeout(\r\n () => {\r\n this.anchorType.current && this.anchorType.current.focus();\r\n },\r\n 0\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 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<ISmweBuyboxViewProps> = 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<string> = 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 <Module {...ModuleProps}>\r\n <Node {...MediaGalleryContainerProps}>{props.mediaGallery}</Node>\r\n <Node {...ProductInfoContainerProps}>\r\n {props.productApellation && (\r\n <div>{props.productApellation}</div>\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 <React.Fragment key={index}>\r\n {contentSlotData}\r\n </React.Fragment>\r\n );\r\n }\r\n )}\r\n </Node>\r\n </Module>\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<string>;\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 <div className={classnames('sku-selector', tableClass?.result)}>\r\n <div className='sku-selector__price'>\r\n {productPrice && <div className={classnames('sku-selector__price-default', { 'price-width-adjust': isGiftCard })}>{productPrice}</div>}\r\n {!isGiftCard && productClubPrice && <div className='sku-selector__price-club'>{productClubPrice} Club</div>}\r\n </div>\r\n <div className='sku-selector__cart'>\r\n {quantity && <div className={classnames('sku-selector__cart-quantity', { unselectable: isGiftCard })}>{_renderQuantity(quantity)}</div>}\r\n {addToCart && <div className='sku-selector__cart-button'>{_renderAddToCart(addToCart)}</div>}\r\n </div>\r\n </div>\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 <Node {...ContainerProps}>\r\n {errorBlock}\r\n {button}\r\n </Node>\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 <Node {...ContainerProps}>\r\n <Node {...LabelContainerProps}>\r\n {errors}\r\n </Node>\r\n {input}\r\n </Node>\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 { ICoreContext, IImageSettings, ITelemetry } from '@msdyn365-commerce/core';\r\nimport { ICartState, ICheckoutState } from '@msdyn365-commerce/global-state';\r\nimport { AsyncResult, ProductAvailableQuantity, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport ProductCard, { ISmweSearchResultContainerParentProps } from '../../../components/product.component';\r\nimport { IElicitSubscriptionsResources } from '../elicit-subscriptions.props.autogenerated';\r\n\r\ninterface IProductSearchResultItems {\r\n products: ProductSearchResult[];\r\n context: ICoreContext;\r\n resources: IElicitSubscriptionsResources;\r\n telemetry: ITelemetry;\r\n imageSettings?: IImageSettings;\r\n moduleType: string;\r\n moduleId: string;\r\n parentProps: ISmweSearchResultContainerParentProps;\r\n checkoutState?: AsyncResult<ICheckoutState>;\r\n disableQuantitySlider?: boolean;\r\n maxAdditionLimit?: number;\r\n cart?: AsyncResult<ICartState>;\r\n productAvailability?: ProductAvailableQuantity[] | undefined;\r\n}\r\n\r\nexport const ProductSearchResultItems: React.FC<IProductSearchResultItems> = ({\r\n products,\r\n context,\r\n imageSettings,\r\n resources,\r\n moduleType,\r\n moduleId,\r\n parentProps,\r\n checkoutState,\r\n disableQuantitySlider,\r\n maxAdditionLimit,\r\n cart,\r\n productAvailability\r\n}) => {\r\n return (\r\n\r\n <ul className='list-unstyled'>\r\n {products.map((product: ProductSearchResult, index: number) => {\r\n const availibity = productAvailability?.find((item) => {\r\n return item.ProductId === product.RecordId;\r\n });\r\n return (\r\n <li className='ms-product-search-result__item' key={index}>\r\n <ProductCard\r\n displayQuantitySlider={true}\r\n cart={cart}\r\n disableQuantitySlider={disableQuantitySlider}\r\n maxAdditionLimit={maxAdditionLimit}\r\n subscriptionBtnText={resources.elicitSubscriptions_buyboxSubscriptionBtnTxt}\r\n checkoutState={checkoutState}\r\n context={context}\r\n imageSettings={imageSettings}\r\n freePriceText={resources.priceFree}\r\n originalPriceText={resources.originalPriceText}\r\n currentPriceText={resources.currentPriceText}\r\n ratingAriaLabel={resources.ratingAriaLabel}\r\n id={moduleId}\r\n typeName={moduleType}\r\n data={{ product: product }}\r\n parentProps={parentProps}\r\n availability={availibity}\r\n addToCartMessage={resources.addToBoxMessagePlp}\r\n />\r\n </li>\r\n );\r\n })}\r\n </ul>\r\n );\r\n\r\n};","export * from './link';\r\nexport * from './product-search-result-items';\r\nexport * from './title';\r\nexport * from './separator';\r\nexport * from './range-refine-item';\r\nexport * from './refine-item';\r\nexport * from './refine-item-toggle-notification';\r\nexport * from './refine-item.props.common';\r\nexport * from './utilities';\r\nexport * from './choice-summary';\r\nexport * from './choice-summary.props';\r\nexport * from './modal';\r\nexport * from './refine-submenu';\r\nexport * from './error-message';\r\n","import { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\nimport { ISearchResultModalViewProps, Title } from '../../../modules/smwe-search-result-container/components';\r\nimport { IRefineMenuViewProps, ISearchResultContainerViewProps, ISortByViewProps, ITitleViewProps } from '../../../modules/smwe-search-result-container/smwe-search-result-container';\r\n\r\nconst renderSort = (props: ISortByViewProps, showSortBy: boolean): JSX.Element | null => {\r\n const { SortingContainer, sortByDropDown } = props;\r\n if (sortByDropDown && showSortBy) {\r\n return (\r\n <Node {...SortingContainer}>\r\n {sortByDropDown}\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderRefiner = (props: IRefineMenuViewProps): JSX.Element | null => {\r\n const { refiners, RefineMenuContainer, RefinerSectionContainer } = props;\r\n if (refiners) {\r\n return (\r\n <Node {...RefinerSectionContainer}>\r\n <Node {...RefineMenuContainer}>\r\n {refiners.map((submenu, index) => (\r\n <React.Fragment key={index}>\r\n {submenu}\r\n </React.Fragment>\r\n ))}\r\n </Node>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst createModalBody = (props: ISearchResultModalViewProps, refineMenu: IRefineMenuViewProps, sortByDropDown: ISortByViewProps, showSortBy: boolean): JSX.Element | null => {\r\n if (sortByDropDown) {\r\n return React.cloneElement(props.modalBody, {}, renderSort(sortByDropDown, showSortBy), renderRefiner(refineMenu));\r\n }\r\n return null;\r\n};\r\n\r\nconst createSearchResultModal = (modalProps: ISearchResultModalViewProps, refineMenu: IRefineMenuViewProps, sortByDropDown: ISortByViewProps, showSortBy: boolean): JSX.Element => {\r\n return React.cloneElement(modalProps.modal, {}, modalProps.modalHeader, createModalBody(modalProps, refineMenu, sortByDropDown, showSortBy), modalProps.modalFooter);\r\n};\r\n\r\nconst renderTitle = (props: ITitleViewProps, showResultPrefix: boolean, categoryNamePrefix: string): JSX.Element | null => {\r\n const { title, TitleContainer } = props;\r\n const titlePrefix = <Title className='ms-search-result__collection-title-prefix' text={categoryNamePrefix} />;\r\n if (title) {\r\n return (\r\n <Node {...TitleContainer}>\r\n <h2>\r\n {showResultPrefix && titlePrefix}\r\n {title.titleText}\r\n </h2>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderTitleCount = (props: ITitleViewProps): JSX.Element | null => {\r\n const { title, TitleContainer } = props;\r\n if (title) {\r\n return (\r\n <Node {...TitleContainer}>\r\n <h5>\r\n {title.titleCount}\r\n </h5>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst SmweSearchResultContainerView: React.FC<ISearchResultContainerViewProps> = props => {\r\n const { SearchResultContainer, products, pagination, ProductsContainer, ProductSectionContainer, choiceSummary, isMobile, modalToggle, searchResultModal, TitleViewProps,\r\n refineMenu, sortByOptions, CategoryNavContainer, RefineAndProductSectionContainer, errorMessage,\r\n categoryDescription } = props;\r\n // customization for 1.0\r\n const { showRefiners, showSortBy, showResultCount, categoryNamePrefix } = props.config;\r\n if (isMobile) {\r\n return (\r\n <Module {...SearchResultContainer}>\r\n <Node {...ProductSectionContainer}>\r\n <div className='ms-search-result-container__title-header'>\r\n {TitleViewProps && renderTitle(TitleViewProps, showResultCount!, categoryNamePrefix!)}\r\n {categoryDescription}\r\n </div>\r\n <div className='ms-search-result-container__filter-sort'>\r\n {showRefiners && choiceSummary}\r\n {showRefiners && modalToggle}\r\n {showRefiners && createSearchResultModal(searchResultModal, refineMenu, sortByOptions, showSortBy!)}\r\n </div>\r\n <Node {...ProductsContainer}>\r\n {errorMessage}\r\n {products}\r\n </Node>\r\n {pagination}\r\n </Node>\r\n </Module>\r\n );\r\n }\r\n return (\r\n <Module {...SearchResultContainer}>\r\n {showResultCount && TitleViewProps && <Node {...CategoryNavContainer}>\r\n {renderTitleCount(TitleViewProps)}\r\n </Node>}\r\n <Node {...RefineAndProductSectionContainer}>\r\n {showRefiners && refineMenu && renderRefiner(refineMenu)}\r\n <Node {...ProductSectionContainer}>\r\n <div className='ms-search-result-container__title-header'>\r\n {TitleViewProps && renderTitle(TitleViewProps, showResultCount!, categoryNamePrefix!)}\r\n {categoryDescription}\r\n </div>\r\n <div className='ms-search-result-container__filter-sort'>\r\n {showRefiners && choiceSummary}\r\n {showSortBy && sortByOptions && renderSort(sortByOptions, showSortBy)}\r\n </div>\r\n <Node {...ProductsContainer}>\r\n {errorMessage}\r\n {products}\r\n </Node>\r\n {pagination}\r\n </Node>\r\n </Node>\r\n </Module>\r\n );\r\n};\r\n\r\nexport default SmweSearchResultContainerView;\r\n","import * as React from 'react';\r\ninterface ILink {\r\n className?: string;\r\n text?: string;\r\n href?: string;\r\n ariaLabel?: string;\r\n}\r\n\r\nexport const Link: React.FC<ILink> = ({ text, className, href, ariaLabel }) => (<a className={className} href={href} aria-label={ariaLabel}> {text} </a>);","import * as React from 'react';\r\ninterface ISeparator {\r\n separator: string;\r\n}\r\n\r\nexport const Separator: React.FC<ISeparator> = ({ separator }) => (<span> {separator} </span>);","import { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\nimport { ISearchResultModalViewProps, Title } from './components';\r\nimport { IRefineMenuViewProps, ISearchResultContainerViewProps, ISortByViewProps, ITitleViewProps } from './elicit-subscriptions';\r\nimport { IElicitSubscriptionsProps } from './elicit-subscriptions.props.autogenerated';\r\n\r\nconst SearchResultContainerView: React.FC<ISearchResultContainerViewProps & IElicitSubscriptionsProps<{}>> = props => {\r\n const { SearchResultContainer, products, pagination, ProductsContainer, ProductSectionContainer, choiceSummary, isMobile, modalToggle, searchResultModal, TitleViewProps,\r\n refineMenu, sortByOptions, CategoryNavContainer, RefineAndProductSectionContainer, errorMessage, categoryDescription } = props;\r\n // customization for 1.0\r\n const { showRefiners, showSortBy, showResultCount, categoryNamePrefix } = props.config;\r\n if (isMobile) {\r\n return (\r\n <Module {...SearchResultContainer}>\r\n <Node {...ProductSectionContainer}>\r\n <div className='ms-search-result-container__title-header'>\r\n {TitleViewProps && renderTitle(TitleViewProps, showResultCount!, categoryNamePrefix!)}\r\n {categoryDescription}\r\n </div>\r\n <div className='ms-search-result-container__filter-sort'>\r\n {showRefiners && choiceSummary}\r\n {showRefiners && modalToggle}\r\n {showRefiners && createSearchResultModal(searchResultModal, refineMenu, sortByOptions, showSortBy!)}\r\n </div>\r\n <Node {...ProductsContainer}>\r\n {errorMessage}\r\n {products}\r\n </Node>\r\n {pagination}\r\n </Node>\r\n </Module>\r\n );\r\n }\r\n return (\r\n <Module {...SearchResultContainer}>\r\n {showResultCount && TitleViewProps && <Node {...CategoryNavContainer}>\r\n {renderTitleCount(TitleViewProps)}\r\n </Node>}\r\n <Node {...RefineAndProductSectionContainer}>\r\n {showRefiners && refineMenu && renderRefiner(refineMenu)}\r\n <Node {...ProductSectionContainer}>\r\n <div className='ms-search-result-container__title-header'>\r\n {TitleViewProps && renderTitle(TitleViewProps, showResultCount!, categoryNamePrefix!)}\r\n {categoryDescription}\r\n </div>\r\n <div className='ms-search-result-container__filter-sort'>\r\n {showRefiners && choiceSummary}\r\n {showSortBy && sortByOptions && renderSort(sortByOptions, showSortBy)}\r\n </div>\r\n <Node {...ProductsContainer}>\r\n {errorMessage}\r\n {products}\r\n </Node>\r\n {pagination}\r\n </Node>\r\n </Node>\r\n </Module>\r\n );\r\n};\r\n\r\nconst createSearchResultModal = (modalProps: ISearchResultModalViewProps, refineMenu: IRefineMenuViewProps, sortByDropDown: ISortByViewProps, showSortBy: boolean): JSX.Element => {\r\n return React.cloneElement(modalProps.modal, {}, modalProps.modalHeader, createModalBody(modalProps, refineMenu, sortByDropDown, showSortBy), modalProps.modalFooter);\r\n};\r\n\r\nconst createModalBody = (props: ISearchResultModalViewProps, refineMenu: IRefineMenuViewProps, sortByDropDown: ISortByViewProps, showSortBy: boolean): JSX.Element | null => {\r\n if (sortByDropDown) {\r\n return React.cloneElement(props.modalBody, {}, renderSort(sortByDropDown, showSortBy), renderRefiner(refineMenu));\r\n }\r\n return null;\r\n};\r\n\r\nconst renderRefiner = (props: IRefineMenuViewProps): JSX.Element | null => {\r\n const { refiners, RefineMenuContainer, RefinerSectionContainer } = props;\r\n if (refiners) {\r\n return (\r\n <Node {...RefinerSectionContainer}>\r\n <Node {...RefineMenuContainer}>\r\n {refiners.map((submenu, index) => (\r\n <React.Fragment key={index}>\r\n {submenu}\r\n </React.Fragment>\r\n ))}\r\n </Node>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderSort = (props: ISortByViewProps, showSortBy: boolean): JSX.Element | null => {\r\n const { SortingContainer, sortByDropDown } = props;\r\n if (sortByDropDown && showSortBy) {\r\n return (\r\n <Node {...SortingContainer}>\r\n {sortByDropDown}\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderTitle = (props: ITitleViewProps, showResultPrefix: boolean, categoryNamePrefix: string): JSX.Element | null => {\r\n const { title, TitleContainer } = props;\r\n const titlePrefix = <Title className='ms-search-result__collection-title-prefix' text={categoryNamePrefix} />;\r\n if (title) {\r\n return (\r\n <Node {...TitleContainer}>\r\n <h2>\r\n {showResultPrefix && titlePrefix}\r\n {title.titleText}\r\n </h2>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderTitleCount = (props: ITitleViewProps): JSX.Element | null => {\r\n const { title, TitleContainer } = props;\r\n if (title) {\r\n return (\r\n <Node {...TitleContainer}>\r\n <h5>\r\n {title.titleCount}\r\n </h5>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nexport default SearchResultContainerView;","import * as React from 'react';\r\ninterface ISeparator {\r\n separator: string;\r\n}\r\n\r\nexport const Separator: React.FC<ISeparator> = ({ separator }) => (<span> {separator} </span>);","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<ISubscriptionsMinicartData>;\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<ICartDisplayComponentProps> {\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 <div className='subscription-minicart-cart-summary'>\r\n <div className='subscription-minicart-amount-summary'>\r\n <span className='subscription-minicart-boxprice'>{subscriptionsMinicart__boxPrice}</span>\r\n <div className='subscription-minicart-amount'>{formatter(amount || 0)}</div>\r\n <div className='subscription-minicart-savings'>\r\n <div className='subscription-minicart-savings-amount'>\r\n {format(subscriptionsMinicart__savings, formatter(((this._calculateTotalAmount || 0) * (savingPercent / 100))), savingPercent)}\r\n </div>\r\n <div className='subscription-minicart-amount-savings'>{savingPercent}% off</div>\r\n </div>\r\n </div>\r\n <div className='subscription-minicart-shipping-summary'>\r\n <span className='subscription-minicart-shipping'>{subscriptionsMinicart__shipping}</span>\r\n <div className='subscription-minicart-shipping-amount'>{formatter(orderSummaryShipmentCalculation({ cart }).price)}</div>\r\n </div>\r\n <div className='subscription-minicart-cart-button-container'>\r\n <Button className='subscription-minicart-cart-button' href={cartUrl}>{subscriptionsMinicart__goToCart}</Button>\r\n </div>\r\n </div>\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<T> = (...args: T[]) => void;\r\n\r\ntype subscription<T> = { [uniqueId: string]: subscriptionCallback<T> };\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<unknown> } = {};\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<T>(subName: string, onPublish: subscriptionCallback<T>): { 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<unknown>;\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<T extends IReactComponent>(eventNamespace: string): <T extends IReactComponent>(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 <CHILD_COMP {...this.props} />;\r\n }\r\n };\r\n };\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}","import * as React from 'react';\r\ninterface ITitle {\r\n className: string;\r\n text: string;\r\n}\r\n\r\nexport const Title: React.FC<ITitle> = ({ text, className }) => (<span className={className}> {text} </span>);\r\n","import { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\nimport { ISearchResultModalViewProps, Title } from '../../../modules/smwe-search-result-container/components';\r\nimport { IRefineMenuViewProps, ISearchResultContainerViewProps, ISortByViewProps, ITitleViewProps } from '../../../modules/smwe-search-result-container/smwe-search-result-container';\r\n\r\nimport { ISmweSearchResultContainerProps } from '../definition-extensions/smwe-search-result-container.ext.props.autogenerated';\r\n\r\nconst renderSort = (props: ISortByViewProps, showSortBy: boolean): JSX.Element | null => {\r\n const { SortingContainer, sortByDropDown } = props;\r\n if (sortByDropDown && showSortBy) {\r\n return (\r\n <Node {...SortingContainer}>\r\n {sortByDropDown}\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderRefiner = (props: IRefineMenuViewProps): JSX.Element | null => {\r\n const { refiners, RefineMenuContainer, RefinerSectionContainer } = props;\r\n if (refiners) {\r\n return (\r\n <Node {...RefinerSectionContainer}>\r\n <Node {...RefineMenuContainer}>\r\n {refiners.map((submenu, index) => (\r\n <React.Fragment key={index}>\r\n {submenu}\r\n </React.Fragment>\r\n ))}\r\n </Node>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst createModalBody = (props: ISearchResultModalViewProps, refineMenu: IRefineMenuViewProps, sortByDropDown: ISortByViewProps, showSortBy: boolean): JSX.Element | null => {\r\n if (sortByDropDown) {\r\n return React.cloneElement(props.modalBody, {}, renderSort(sortByDropDown, showSortBy), renderRefiner(refineMenu));\r\n }\r\n return null;\r\n};\r\n\r\nconst createSearchResultModal = (modalProps: ISearchResultModalViewProps, refineMenu: IRefineMenuViewProps, sortByDropDown: ISortByViewProps, showSortBy: boolean): JSX.Element => {\r\n return React.cloneElement(modalProps.modal, {}, modalProps.modalHeader, createModalBody(modalProps, refineMenu, sortByDropDown, showSortBy), modalProps.modalFooter);\r\n};\r\n\r\nconst renderTitle = (props: ITitleViewProps, showResultPrefix: boolean, categoryNamePrefix: string): JSX.Element | null => {\r\n const { title, TitleContainer } = props;\r\n const titlePrefix = <Title className='ms-search-result__collection-title-prefix' text={categoryNamePrefix} />;\r\n if (title) {\r\n return (\r\n <Node {...TitleContainer}>\r\n <h2>\r\n {showResultPrefix && titlePrefix}\r\n {title.titleText}\r\n </h2>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderTitleCount = (props: ITitleViewProps): JSX.Element | null => {\r\n const { title, TitleContainer } = props;\r\n if (title) {\r\n return (\r\n <Node {...TitleContainer}>\r\n <h5>\r\n {title.titleCount}\r\n </h5>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst SmweSearchResultContainerView: React.FC<ISearchResultContainerViewProps & ISmweSearchResultContainerProps<{}>> = props => {\r\n const { SearchResultContainer, products, pagination, ProductsContainer, ProductSectionContainer, choiceSummary, isMobile, modalToggle, searchResultModal, TitleViewProps,\r\n refineMenu, sortByOptions, CategoryNavContainer, RefineAndProductSectionContainer, errorMessage,\r\n categoryDescription } = props;\r\n // customization for 1.0\r\n const { showRefiners, showSortBy, showResultCount, categoryNamePrefix } = props.config;\r\n if (isMobile) {\r\n return (\r\n <Module {...SearchResultContainer}>\r\n <Node {...ProductSectionContainer}>\r\n <div className='ms-search-result-container__title-header'>\r\n {TitleViewProps && renderTitle(TitleViewProps, showResultCount!, categoryNamePrefix!)}\r\n {categoryDescription}\r\n </div>\r\n <div className='ms-search-result-container__filter-sort'>\r\n {showRefiners && choiceSummary}\r\n {showRefiners && modalToggle}\r\n {showRefiners && createSearchResultModal(searchResultModal, refineMenu, sortByOptions, showSortBy!)}\r\n </div>\r\n <Node {...ProductsContainer}>\r\n {errorMessage}\r\n {products}\r\n </Node>\r\n {pagination}\r\n </Node>\r\n </Module>\r\n );\r\n }\r\n return (\r\n <Module {...SearchResultContainer}>\r\n {showResultCount && TitleViewProps && <Node {...CategoryNavContainer}>\r\n {renderTitleCount(TitleViewProps)}\r\n </Node>}\r\n <Node {...RefineAndProductSectionContainer}>\r\n {showRefiners && refineMenu && renderRefiner(refineMenu)}\r\n <Node {...ProductSectionContainer}>\r\n <div className='ms-search-result-container__title-header'>\r\n {TitleViewProps && renderTitle(TitleViewProps, showResultCount!, categoryNamePrefix!)}\r\n {categoryDescription}\r\n </div>\r\n <div className='ms-search-result-container__filter-sort'>\r\n {showRefiners && choiceSummary}\r\n {showSortBy && sortByOptions && renderSort(sortByOptions, showSortBy)}\r\n </div>\r\n <Node {...ProductsContainer}>\r\n {errorMessage}\r\n {products}\r\n </Node>\r\n {pagination}\r\n </Node>\r\n </Node>\r\n </Module>\r\n );\r\n\r\n};\r\n\r\nexport default SmweSearchResultContainerView;","import { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport { ISearchResultModalViewProps, Title } from './components';\r\nimport { IRefineMenuViewProps, ISearchResultContainerViewProps, ISortByViewProps, ITitleViewProps } from './smwe-search-result-container';\r\nimport { ISmweSearchResultContainerProps } from './smwe-search-result-container.props.autogenerated';\r\n\r\n// tslint:disable-next-line:cyclomatic-complexity\r\nconst SearchResultContainerView: React.FC<ISearchResultContainerViewProps & ISmweSearchResultContainerProps<{}>> = props => {\r\n const { SearchResultContainer, products, pagination, ProductsContainer, ProductSectionContainer, choiceSummary, isMobile, modalToggle, searchResultModal, TitleViewProps,\r\n refineMenu, sortByOptions, CategoryNavContainer, RefineAndProductSectionContainer, errorMessage, categoryDescription } = props;\r\n // customization for 1.0\r\n const { showRefiners, showSortBy, showResultCount, categoryNamePrefix } = props.config;\r\n if (isMobile) {\r\n return (\r\n <Module {...SearchResultContainer}>\r\n {/*TODO remove after final testing */}\r\n {/*categoryHierarchy && renderCategoryHierarchy(categoryHierarchy)*/}\r\n {renderTitle(TitleViewProps, showResultCount!, categoryNamePrefix!)}\r\n {showRefiners && !props.config.pulldownRefiners && choiceSummary}\r\n {showRefiners && !props.config.pulldownRefiners && modalToggle}\r\n {showRefiners && !props.config.pulldownRefiners && createSearchResultModal(searchResultModal, refineMenu, sortByOptions, showSortBy!)}\r\n {showRefiners && props.config.pulldownRefiners && refineMenu && renderRefinerPulldown(refineMenu)}\r\n {categoryDescription}\r\n <Node {...ProductsContainer}>\r\n {errorMessage}\r\n {products}\r\n </Node>\r\n {pagination}\r\n </Module>\r\n );\r\n }\r\n return (\r\n <Module {...SearchResultContainer}>\r\n {showResultCount && TitleViewProps && <Node {...CategoryNavContainer}>\r\n {renderTitleCount(TitleViewProps)}\r\n </Node>}\r\n <Node {...RefineAndProductSectionContainer}>\r\n {showRefiners && !props.config.pulldownRefiners && refineMenu && renderRefiner(refineMenu)}\r\n {showRefiners && props.config.pulldownRefiners && refineMenu && renderRefinerPulldown(refineMenu)}\r\n <Node {...ProductSectionContainer}>\r\n {TitleViewProps && renderTitle(TitleViewProps, showResultCount!, categoryNamePrefix!)}\r\n {showRefiners && choiceSummary}\r\n {showSortBy && sortByOptions && renderSort(sortByOptions, showSortBy)}\r\n {categoryDescription}\r\n <Node {...ProductsContainer}>\r\n {errorMessage}\r\n {products}\r\n </Node>\r\n {pagination}\r\n </Node>\r\n </Node>\r\n </Module>\r\n );\r\n\r\n};\r\n\r\nconst createSearchResultModal = (modalProps: ISearchResultModalViewProps, refineMenu: IRefineMenuViewProps, sortByDropDown: ISortByViewProps, showSortBy: boolean): JSX.Element => {\r\n return React.cloneElement(modalProps.modal, {}, modalProps.modalHeader, createModalBody(modalProps, refineMenu, sortByDropDown, showSortBy), modalProps.modalFooter);\r\n};\r\n\r\nconst createModalBody = (props: ISearchResultModalViewProps, refineMenu: IRefineMenuViewProps, sortByDropDown: ISortByViewProps, showSortBy: boolean): JSX.Element | null => {\r\n if (sortByDropDown) {\r\n return React.cloneElement(props.modalBody, {}, renderSort(sortByDropDown, showSortBy), renderRefiner(refineMenu));\r\n }\r\n return null;\r\n};\r\n\r\nconst renderRefiner = (props: IRefineMenuViewProps): JSX.Element | null => {\r\n const { refiners, RefineMenuContainer, RefinerSectionContainer } = props;\r\n if (refiners) {\r\n return (\r\n <Node {...RefinerSectionContainer}>\r\n <Node {...RefineMenuContainer}>\r\n {refiners.map((submenu, index) => (\r\n <React.Fragment key={index}>\r\n {submenu}\r\n </React.Fragment>\r\n ))}\r\n </Node>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderRefinerPulldown = (props: IRefineMenuViewProps): JSX.Element | null => {\r\n const { refiners, RefineMenuContainer, RefinerSectionContainer, pulldownText, activeRefiners } = props;\r\n const activeRefinersText = getActiveRefinersText(activeRefiners);\r\n const dynamicPulldownText = getPulldownText(activeRefinersText, pulldownText);\r\n if (refiners) {\r\n return (\r\n <Node {...RefinerSectionContainer}>\r\n {/* tslint:disable-next-line:jsx-no-lambda react-this-binding-issue */}\r\n <button onClick={() => togglePulldown(getActiveRefinersText(activeRefiners), pulldownText)} className='ms-search-result-container__refiner-pulldown-button' id='refiner-pulldown-button'>\r\n <span className='ms-search-result-container__refiner-pulldown-button-content' id='refiner-pulldown-button-content'>{dynamicPulldownText}</span>\r\n </button>\r\n <div className='ms-search-result-container__refiner-pulldown-container pulldown-hide' id='refiner-pulldown-container'>\r\n <Node {...RefineMenuContainer}>\r\n {refiners.map((submenu, index) => (\r\n <React.Fragment key={index}>\r\n {submenu}\r\n </React.Fragment>\r\n ))}\r\n </Node>\r\n {/* tslint:disable-next-line:jsx-no-lambda react-this-binding-issue */}\r\n <button onClick={() => togglePulldown(getActiveRefinersText(activeRefiners), pulldownText)} className='ms-search-result-container__refiner-close-pulldown-button'>Close</button>\r\n </div>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst getPulldownText = (activeRefiners: string, buttonText: string | undefined): string => {\r\n const buttonElement = document.getElementById('refiner-pulldown-button');\r\n const spanElement = document.getElementById('refiner-pulldown-button-content');\r\n if (buttonElement && spanElement) {\r\n if (buttonElement.className === 'ms-search-result-container__refiner-pulldown-button refiner-pulldown-button-expanded' || !activeRefiners) {\r\n return spanElement.innerText = buttonText || '';\r\n } else {\r\n return spanElement.innerText = activeRefiners;\r\n }\r\n }\r\n return '';\r\n};\r\n\r\nconst togglePulldown = (activeRefiners: string, buttonText: string | undefined): void => {\r\n const buttonElement = document.getElementById('refiner-pulldown-button');\r\n if (buttonElement) {\r\n buttonElement.classList.toggle('refiner-pulldown-button-expanded');\r\n getPulldownText(activeRefiners, buttonText);\r\n }\r\n const pulldownElement = document.getElementById('refiner-pulldown-container');\r\n if (pulldownElement) {\r\n pulldownElement.classList.toggle('pulldown-hide');\r\n }\r\n\r\n};\r\n\r\nconst getActiveRefinersText = (activeRefiners: ProductRefinerValue[]): string => {\r\n let formatedActiveRefiners = '';\r\n activeRefiners.forEach(refiner => {\r\n if (refiner.UnitText === 'USD') {\r\n formatedActiveRefiners += `$${refiner.LeftValueBoundString}-$${refiner.RightValueBoundString} / `;\r\n } else if (refiner.LeftValueBoundString) {\r\n formatedActiveRefiners += `${refiner.LeftValueBoundString} / `;\r\n }\r\n });\r\n // removes trailing slash and whitespace\r\n formatedActiveRefiners = formatedActiveRefiners.substring(0, formatedActiveRefiners.length - 2);\r\n return formatedActiveRefiners;\r\n};\r\n\r\nconst renderSort = (props: ISortByViewProps, showSortBy: boolean): JSX.Element | null => {\r\n const { SortingContainer, sortByDropDown } = props;\r\n if (sortByDropDown && showSortBy) {\r\n return (\r\n <Node {...SortingContainer}>\r\n {sortByDropDown}\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderTitle = (props: ITitleViewProps, showResultPrefix: boolean, categoryNamePrefix: string): JSX.Element | null => {\r\n const { title, TitleContainer } = props;\r\n const titlePrefix = <Title className='ms-search-result__collection-title-prefix' text={categoryNamePrefix} />;\r\n if (title) {\r\n return (\r\n <Node {...TitleContainer}>\r\n <h2>\r\n {showResultPrefix && titlePrefix}\r\n {title.titleText}\r\n </h2>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderTitleCount = (props: ITitleViewProps): JSX.Element | null => {\r\n const { title, TitleContainer } = props;\r\n if (title) {\r\n return (\r\n <Node {...TitleContainer}>\r\n <h5>\r\n {title.titleCount}\r\n </h5>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nexport default SearchResultContainerView;","/*---------------------------------------------------------------------------------------------\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<ICheckoutDeliveryOptionsListFiltered> = ({\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 <Node {...DeliveryOptionsList}>\r\n {localList.map((deliveryOption: ICheckoutDeliveryOptionEdit) => {\r\n return (<Node {...deliveryOption.DeliveryOption} key={deliveryOption.code}>\r\n <label className='ms-checkout-delivery-options__label'>\r\n {deliveryOption.radioButton}\r\n {deliveryOption.description}\r\n </label>\r\n {deliveryOption.price}\r\n </Node>);\r\n })}\r\n </Node>\r\n );\r\n};\r\n\r\nconst DeliveryOptionSelected: React.FC<ICheckoutDeliveryOption> = ({\r\n DeliveryOption,\r\n description,\r\n price,\r\n}) => {\r\n\r\n return (\r\n <Node {...DeliveryOption}>\r\n {description}\r\n {price}\r\n </Node>\r\n );\r\n};\r\n\r\nconst ErrorMessage: React.FC<ICheckoutDeliveryOptionsError> = ({\r\n Error,\r\n title,\r\n message,\r\n}) => {\r\n\r\n return (\r\n <Node {...Error}>\r\n {title}\r\n {message}\r\n </Node>\r\n );\r\n};\r\n\r\nconst CheckoutDeliveryOptionsView: React.FC<ICheckoutDeliveryOptionsViewProps> = 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 <Module {...CheckoutDeliveryOptions}>\r\n {viewState.isLoading && waiting}\r\n {viewState.isError && errorMessage && <ErrorMessage {...errorMessage} />}\r\n {viewState.isShowList && deliveryOptions && <DeliveryOptionList {...deliveryOptions} globalConfig={props.context.app.config} options={deliveryOptionsData} />}\r\n {viewState.isShowSelected && deliveryOptionSelected && <DeliveryOptionSelected {...deliveryOptionSelected} />}\r\n {viewState.isShowSaveButton && saveButton}\r\n {viewState.isShowEditButton && editButton}\r\n {viewState.isShowCancelButton && cancelButton}\r\n </Module>\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<ICheckoutDeliveryOptionsViewProps>;\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<ICheckoutDeliveryOptionsListFiltered> = ({\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 <div className='ms-checkout-delivery-options__error'>\r\n {props.resources.shippingMethodConfigError}\r\n </div>\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<HTMLInputElement>;\r\n props.onDeliveryOptionChange(event);\r\n }\r\n\r\n return (\r\n <Node {...DeliveryOptionsList}>\r\n {localList.map((deliveryOption: ICheckoutDeliveryOptionEdit) => {\r\n return (<Node {...deliveryOption.DeliveryOption} key={deliveryOption.code}>\r\n <label className='ms-checkout-delivery-options__label'>\r\n {deliveryOption.radioButton}\r\n {deliveryOption.description}\r\n </label>\r\n {deliveryOption.price}\r\n </Node>);\r\n })}\r\n </Node>\r\n );\r\n};\r\n\r\nconst DeliveryOptionSelected: React.FC<ICheckoutDeliveryOption> = ({\r\n DeliveryOption,\r\n description,\r\n price,\r\n}) => {\r\n\r\n return (\r\n <Node {...DeliveryOption}>\r\n {description}\r\n {price}\r\n </Node>\r\n );\r\n};\r\n\r\nconst ErrorMessage: React.FC<ICheckoutDeliveryOptionsError> = ({\r\n Error,\r\n title,\r\n message,\r\n}) => {\r\n\r\n return (\r\n <Node {...Error}>\r\n {title}\r\n {message}\r\n </Node>\r\n );\r\n};\r\n\r\nconst CheckoutDeliveryOptionsView: React.FC<ICheckoutDeliveryOptionsViewProps> = 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 <Module {...CheckoutDeliveryOptions}>\r\n {viewState.isLoading && waiting}\r\n {viewState.isError && errorMessage && <ErrorMessage {...errorMessage} />}\r\n {viewState.isShowList && deliveryOptions && <DeliveryOptionList {...deliveryOptions} globalConfig={props.context.app.config} options={deliveryOptionsData} props={props} />}\r\n {viewState.isShowSelected && deliveryOptionSelected && <DeliveryOptionSelected {...deliveryOptionSelected} />}\r\n {viewState.isShowSaveButton && saveButton}\r\n {viewState.isShowEditButton && editButton}\r\n {viewState.isShowCancelButton && cancelButton}\r\n </Module>\r\n );\r\n};\r\n\r\nexport default CheckoutDeliveryOptionsView;","import { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\r\nimport classnames from 'classnames';\r\nimport { get } from 'lodash';\r\nimport { computed } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport * as React from 'react';\r\nimport { IChoiceSummaryProps } from './choice-summary.props';\r\nimport { isMatchingRefinementCriterion, ProductRefinerValueDataTypeValue } from './utilities';\r\n\r\ninterface IRefinerMap {\r\n key: string;\r\n value: ProductRefinerValue;\r\n}\r\n\r\n /**\r\n * ChoiceSummary component\r\n */\r\n@observer\r\nexport default class ChoiceSummary extends React.Component<IChoiceSummaryProps> {\r\n private closeButtonGlyph: string = 'msi-close-btn';\r\n\r\n @computed get selectedRefinersMap(): IRefinerMap[] {\r\n const { selectedChoices } = this.props;\r\n return selectedChoices.map((selectedRefiner: ProductRefinerValue) => {\r\n return {\r\n key: this._getKeyForRefinerValue(selectedRefiner),\r\n value: selectedRefiner\r\n } as IRefinerMap;\r\n });\r\n }\r\n\r\n constructor(props: Readonly<IChoiceSummaryProps>) {\r\n super(props);\r\n }\r\n\r\n public render(): JSX.Element {\r\n const { clearAllText, label, classNames, choiceAriaLabel } = this.props;\r\n const items = this.selectedRefinersMap;\r\n return (\r\n <div className='msc-choice-summary'>\r\n {items.length > 0 && label && <span className='msc-choice-summary__label'>{label}</span>}\r\n <ul className={classnames(classNames, 'msc-choice-summary__list', 'list-unstyled')}>\r\n {items.map((item: IRefinerMap, index: number) => {\r\n const listItemProps = {\r\n 'aria-posinset': index,\r\n 'aria-setsize': items.length\r\n };\r\n\r\n return (\r\n <li className='msc-choice-summary__list-item' key={item.key} {...listItemProps}>\r\n <a\r\n className='msc-choice-summary__item'\r\n href={this.props.urlBuilder(item.value, false)}\r\n aria-label={`${item.key} ${choiceAriaLabel}`}\r\n onClick={this._onClick}\r\n >\r\n {item.key}\r\n <span className={`${this.closeButtonGlyph} msc-choice-summary__glyph`} />\r\n </a>\r\n </li>\r\n );\r\n })}\r\n </ul>\r\n {items.length > 0 && clearAllText && <a href={this.props.urlBuilder({}, true)} className={'msc-choice-summary__clear-all'} onClick={this._onClick}>{clearAllText}</a>}\r\n </div>\r\n );\r\n }\r\n\r\n private _getKeyForRefinerValue(productRefinerValue: ProductRefinerValue): string {\r\n const { choiceFormat, choiceRangeValueFormat, refinerHierarchy, telemetry } = this.props;\r\n const overallFormat = choiceFormat || '{1}';\r\n const rangeFormat = choiceRangeValueFormat;\r\n let refinerName = '';\r\n if (refinerHierarchy && refinerHierarchy.find) {\r\n const parent = refinerHierarchy.find(\r\n (hierarchy: IProductRefinerHierarchy) =>\r\n !!hierarchy.Values.find((value: ProductRefinerValue) => isMatchingRefinementCriterion(value, productRefinerValue))\r\n );\r\n\r\n if (!parent) {\r\n telemetry.warning('[choice-summary] could not find parent of selected refiner value');\r\n } else {\r\n refinerName = parent.KeyName || '';\r\n }\r\n }\r\n\r\n let refinerValueName: string;\r\n switch (productRefinerValue.DataTypeValue) {\r\n case ProductRefinerValueDataTypeValue.Range:\r\n case ProductRefinerValueDataTypeValue.RangeInput:\r\n refinerValueName = rangeFormat\r\n .replace('{0}', this._formatPrice(productRefinerValue.LeftValueBoundString, productRefinerValue.UnitText))\r\n .replace('{1}', this._formatPrice(productRefinerValue.RightValueBoundString, productRefinerValue.UnitText));\r\n break;\r\n default:\r\n refinerValueName = productRefinerValue.LeftValueBoundLocalizedString || productRefinerValue.LeftValueBoundString || '';\r\n }\r\n\r\n return overallFormat.replace('{0}', refinerName).replace('{1}', refinerValueName);\r\n }\r\n\r\n private _formatPrice(amount: string | undefined, currency: string | undefined): string {\r\n if (!amount || !currency) {\r\n this.props.telemetry.trace('[choice-summary] could not format price');\r\n return amount || '';\r\n }\r\n const priceAmount = (amount && Number(amount)) || 0;\r\n const locale = get(this.props, 'context.request.locale', 'en-US');\r\n let result: string;\r\n\r\n try {\r\n result = new Intl.NumberFormat(locale, {\r\n style: 'currency',\r\n currencyDisplay: 'symbol',\r\n currency: currency,\r\n minimumFractionDigits: 0\r\n }).format(priceAmount);\r\n } catch (e) {\r\n result = `${priceAmount} ${currency}`;\r\n this.props.telemetry.warning(`Failed to format price for ${result}: ${e}`);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n private _onClick = (e: React.MouseEvent<HTMLAnchorElement>): void => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n const target = e.currentTarget as HTMLElement;\r\n const clearAll = target.getAttribute('class')!.indexOf('choice-summary__clear-all') > -1;\r\n const selectedRefiner = clearAll ? undefined : this._getSelectedRefinerChoice(target);\r\n\r\n if (this.props.onChoiceClicked) {\r\n this.props.onChoiceClicked({\r\n clearAll: clearAll,\r\n itemClicked: target,\r\n choiceClicked: selectedRefiner,\r\n nextItemToFocus: target.nextSibling as HTMLElement\r\n });\r\n }\r\n };\r\n\r\n private _getSelectedRefinerChoice(itemClicked: HTMLElement): ProductRefinerValue | undefined {\r\n const result = this.selectedRefinersMap.find(selected => (itemClicked.innerText && itemClicked.innerText.trim()) === selected.key);\r\n return (result && result.value) || undefined;\r\n }\r\n}\r\n","import { Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\nimport { ISearchResultModalViewProps, Title } from '../../../modules/smwe-search-result-container/components';\r\nimport { IRefineMenuViewProps, ISearchResultContainerViewProps, ISortByViewProps, ITitleViewProps } from '../../../modules/smwe-search-result-container/smwe-search-result-container';\r\n\r\nconst renderSort = (props: ISortByViewProps, showSortBy: boolean): JSX.Element | null => {\r\n const { SortingContainer, sortByDropDown } = props;\r\n if (sortByDropDown && showSortBy) {\r\n return (\r\n <Node {...SortingContainer}>\r\n {sortByDropDown}\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderRefiner = (props: IRefineMenuViewProps): JSX.Element | null => {\r\n const { refiners, RefineMenuContainer, RefinerSectionContainer } = props;\r\n if (refiners) {\r\n return (\r\n <Node {...RefinerSectionContainer}>\r\n <Node {...RefineMenuContainer}>\r\n {refiners.map((submenu, index) => (\r\n <React.Fragment key={index}>\r\n {submenu}\r\n </React.Fragment>\r\n ))}\r\n </Node>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst createModalBody = (props: ISearchResultModalViewProps, refineMenu: IRefineMenuViewProps, sortByDropDown: ISortByViewProps, showSortBy: boolean): JSX.Element | null => {\r\n if (sortByDropDown) {\r\n return React.cloneElement(props.modalBody, {}, renderSort(sortByDropDown, showSortBy), renderRefiner(refineMenu));\r\n }\r\n return null;\r\n};\r\n\r\nconst createSearchResultModal = (modalProps: ISearchResultModalViewProps, refineMenu: IRefineMenuViewProps, sortByDropDown: ISortByViewProps, showSortBy: boolean): JSX.Element => {\r\n return React.cloneElement(modalProps.modal, {}, modalProps.modalHeader, createModalBody(modalProps, refineMenu, sortByDropDown, showSortBy), modalProps.modalFooter);\r\n};\r\n\r\nconst renderTitle = (props: ITitleViewProps, showResultPrefix: boolean, categoryNamePrefix: string): JSX.Element | null => {\r\n const { title, TitleContainer } = props;\r\n const titlePrefix = <Title className='ms-search-result__collection-title-prefix' text={categoryNamePrefix} />;\r\n if (title) {\r\n return (\r\n <Node {...TitleContainer}>\r\n <h2>\r\n {showResultPrefix && titlePrefix}\r\n {title.titleText}\r\n </h2>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst renderTitleCount = (props: ITitleViewProps): JSX.Element | null => {\r\n const { title, TitleContainer } = props;\r\n if (title) {\r\n return (\r\n <Node {...TitleContainer}>\r\n <h5>\r\n {title.titleCount}\r\n </h5>\r\n </Node>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst SmweSearchResultContainerView: React.FC<ISearchResultContainerViewProps> = props => {\r\n const { SearchResultContainer, products, pagination, ProductsContainer, ProductSectionContainer, choiceSummary, isMobile, modalToggle, searchResultModal, TitleViewProps,\r\n refineMenu, sortByOptions, CategoryNavContainer, RefineAndProductSectionContainer, errorMessage,\r\n categoryDescription } = props;\r\n // customization for 1.0\r\n const { showRefiners, showSortBy, showResultCount, categoryNamePrefix } = props.config;\r\n if (isMobile) {\r\n return (\r\n <Module {...SearchResultContainer}>\r\n <Node {...ProductSectionContainer}>\r\n <div className='ms-search-result-container__title-header'>\r\n {TitleViewProps && renderTitle(TitleViewProps, showResultCount!, categoryNamePrefix!)}\r\n {categoryDescription}\r\n </div>\r\n <div className='ms-search-result-container__filter-sort'>\r\n {showRefiners && choiceSummary}\r\n {showRefiners && modalToggle}\r\n {showRefiners && createSearchResultModal(searchResultModal, refineMenu, sortByOptions, showSortBy!)}\r\n </div>\r\n <Node {...ProductsContainer}>\r\n {errorMessage}\r\n {products}\r\n </Node>\r\n {pagination}\r\n </Node>\r\n </Module>\r\n );\r\n }\r\n return (\r\n <Module {...SearchResultContainer}>\r\n {showResultCount && TitleViewProps && <Node {...CategoryNavContainer}>\r\n {renderTitleCount(TitleViewProps)}\r\n </Node>}\r\n <Node {...RefineAndProductSectionContainer}>\r\n {showRefiners && refineMenu && renderRefiner(refineMenu)}\r\n <Node {...ProductSectionContainer}>\r\n <div className='ms-search-result-container__title-header'>\r\n {TitleViewProps && renderTitle(TitleViewProps, showResultCount!, categoryNamePrefix!)}\r\n {categoryDescription}\r\n </div>\r\n <div className='ms-search-result-container__filter-sort'>\r\n {showRefiners && choiceSummary}\r\n {showSortBy && sortByOptions && renderSort(sortByOptions, showSortBy)}\r\n </div>\r\n <Node {...ProductsContainer}>\r\n {errorMessage}\r\n {products}\r\n </Node>\r\n {pagination}\r\n </Node>\r\n </Node>\r\n </Module>\r\n );\r\n};\r\n\r\nexport default SmweSearchResultContainerView;\r\n","//==============================================================================\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<IAttributeBank> {\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<IAttributeBank> {\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<IAttributeBank> {\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}","/*---------------------------------------------------------------------------------------------\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 { ICoreContext, IImageSettings, ITelemetry } from '@msdyn365-commerce/core';\r\nimport { ICartState } from '@msdyn365-commerce/global-state';\r\nimport { AsyncResult, ProductAvailableQuantity, ProductPrice, ProductSearchResult } from '@msdyn365-commerce/retail-proxy';\r\nimport * as React from 'react';\r\nimport ProductCard, { ISmweSearchResultContainerParentProps } from '../../../components/product.component';\r\nimport { ISmweSearchResultContainerResources } from '../smwe-search-result-container.props.autogenerated';\r\n\r\ninterface IProductSearchResultItems {\r\n products: ProductSearchResult[];\r\n context: ICoreContext;\r\n resources: ISmweSearchResultContainerResources;\r\n telemetry: ITelemetry;\r\n imageSettings?: IImageSettings;\r\n moduleType: string;\r\n moduleId: string;\r\n parentProps: ISmweSearchResultContainerParentProps;\r\n addToCart?: boolean;\r\n cart?: AsyncResult<ICartState>;\r\n productAvailability?: ProductAvailableQuantity[] | undefined;\r\n clubPricing?: ProductPrice[] | undefined;\r\n showQuantityAsDropdown?: boolean;\r\n}\r\n\r\nexport const ProductSearchResultItems: React.FC<IProductSearchResultItems> = ({\r\n products,\r\n context,\r\n imageSettings,\r\n resources,\r\n moduleType,\r\n moduleId,\r\n parentProps,\r\n addToCart,\r\n cart,\r\n productAvailability,\r\n clubPricing,\r\n showQuantityAsDropdown\r\n}) => {\r\n return (\r\n <ul className='list-unstyled'>\r\n {products.map((product: ProductSearchResult, index: number) => {\r\n const availibity = productAvailability?.find((item) => {\r\n return item.ProductId === product.RecordId;\r\n });\r\n const clubPrice = clubPricing?.find((item) => {\r\n return item.ProductId === product.RecordId;\r\n });\r\n return (\r\n <li className='ms-product-search-result__item' key={index}>\r\n <ProductCard\r\n context={context}\r\n imageSettings={imageSettings}\r\n freePriceText={resources.priceFree}\r\n originalPriceText={resources.originalPriceText}\r\n currentPriceText={resources.currentPriceText}\r\n ratingAriaLabel={resources.ratingAriaLabel}\r\n id={moduleId}\r\n typeName={moduleType}\r\n data={{product: product}}\r\n parentProps={parentProps}\r\n addToCart={addToCart}\r\n addToCartText={resources.addToCartTextPlp}\r\n addToCartMessage={resources.addToCartMessagePlp}\r\n giftCardText={resources.giftCardText}\r\n displayQuantitySlider={addToCart}\r\n cart={cart}\r\n availability={availibity}\r\n clubPrice={clubPrice}\r\n showQuantityAsDropdown={showQuantityAsDropdown || false}\r\n />\r\n </li>\r\n );\r\n })}\r\n </ul>\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<ISmweBuyboxViewProps & ISmweBuyboxProps<{}>> = 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<string> = props.context.actionContext.get('String', 'Generic-SkuSelectorClasses');\r\n return (\r\n <Module {...ModuleProps}>\r\n <div className='ms-buybox__mobile-header'>\r\n {props.productApellation && <>{props.productApellation}</>}\r\n {title}\r\n </div>\r\n <div className='ms-buybox__media-gallery-wrapper'>\r\n <Node {...MediaGalleryContainerProps}>\r\n {props.mediaGallery}\r\n </Node>\r\n {props.tastingNotes}\r\n </div>\r\n <Node {...ProductInfoContainerProps}>\r\n {props.productApellation && <>{props.productApellation}</>}\r\n {title}\r\n {productDescription}\r\n {eventSchedule}\r\n {acclaimRatings}\r\n {cookbookTagline}\r\n {show && <div className={`sku-selector ${tableClass && tableClass.result}`}>\r\n {productPrice && <div className='sku-selector__product-price'>{productPrice}</div>}\r\n {quantity && <div className='sku-selector__product-quantity'>{_renderQuantity(quantity)}</div>}\r\n {addToCart && <div className='sku-selector__add-to-cart'>{_renderAddToCart(addToCart)}</div>}\r\n {subscriptionButton && <div className='sku-selector__add-to-subscription'>{_renderAddToCart(subscriptionButton)}</div>}\r\n </div>}\r\n {props.content &&\r\n props.content.map(\r\n (contentSlotData: React.ReactNode, index: number) => {\r\n return (\r\n <React.Fragment key={index}>\r\n {contentSlotData}\r\n </React.Fragment>\r\n );\r\n }\r\n )\r\n }\r\n </Node>\r\n {props.slots?.productCollection?.length &&\r\n <div className='ms-buybox__product-collection'>\r\n {props.slots.productCollection.map(\r\n (productCollectionSlotData: React.ReactNode, index: number) => {\r\n return (\r\n <React.Fragment key={index}>\r\n {productCollectionSlotData}\r\n </React.Fragment>\r\n );\r\n }\r\n )\r\n }\r\n </div>\r\n }\r\n </Module>\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 <Node {...ContainerProps}>\r\n {errorBlock}\r\n {button}\r\n </Node>\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 <Node {...ContainerProps}>\r\n <Node {...LabelContainerProps}>\r\n {errors}\r\n </Node>\r\n {input}\r\n </Node>\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 <div className='msc-cart-line__header'>\r\n <div className='msc-cart-line__header-details'>{itemsTitle}</div>\r\n <div className='msc-cart-line__header-quantity'>{qtyTitle}</div>\r\n <div className='msc-cart-line__header-unitprice'>{unitPriceTitle}</div>\r\n <div className='msc-cart-line__header-total'>{totalTitle}</div>\r\n </div>\r\n <ul className='msc-cart-line__container'>\r\n {cartLines.map((cartLine, index) => {\r\n return (\r\n <li className='msc-cart-line__item-wrapper' key={index}>\r\n {cartLine.cartline}\r\n {storeSelector && cartLine.pickUpInStore ? (\r\n <Node {...cartLine.pickUpInStore.ContainerProps}>\r\n {cartLine.pickUpInStore.defaultComponent}\r\n </Node>\r\n ) : null}\r\n </li>\r\n );\r\n })}\r\n </ul>\r\n </>\r\n );\r\n } else {\r\n return cartDataResult ? (\r\n <div className='msc-cart__empty-cart'>\r\n <p className='msc-cart__empty-cart-text'>{cartEmptyText}</p>\r\n {backToShoppingButton}\r\n </div>\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 <Node {...OrderSummaryItems}>\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 <p className='msc-order-summary__line-conditions'>{props.resources.elicitCart__conditionsText}</p>\r\n </Node>\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>): 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<IElicitCartViewProps> = (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 <div\r\n className={classnames(props.className, { 'msc-cart__empty': !props.cartlines })}\r\n id={props.id}\r\n {...props.renderModuleAttributes(props)}\r\n >\r\n {props.cartlines && props.title}\r\n {props.subscriptionUpsell}\r\n {props.subscriptionHeader}\r\n <Node {...props.CartlinesWrapper}>\r\n <Alert isOpen={props.cartlines !== undefined && props.mixedCart && props.mixedCart.isMixedCart} className='msc-cart__error' color='danger' assertive={true} >\r\n <div className='msc-cart__error-content' aria-hidden='true'>\r\n <span>{props.resources.elicitCart__mixModeCartError}</span>\r\n </div>\r\n </Alert>\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 </Node>\r\n {props.shouldShowCheckoutInline && (preventCheckout ? props.checkoutButtonDisabled : props.checkoutAsSignInUserButton)}\r\n {props.orderSummaryHeading && (\r\n <Node {...props.OrderSummaryWrapper}>\r\n <div className='msc-order-summary__header'>\r\n {props.orderSummaryHeading}\r\n {\r\n faqLink?.linkUrl?.destinationUrl &&\r\n <a\r\n className='msc-order-summary__faq'\r\n href={faqLink.linkUrl.destinationUrl}\r\n target={faqLink.openInNewTab ? '_blank' : undefined}\r\n aria-label={faqLink.ariaLabel}\r\n role='button' rel=\"noreferrer\"\r\n />\r\n }\r\n </div>\r\n {_renderOrderSummarylines(\r\n props.orderSummaryLineitems,\r\n props.OrderSummaryItems,\r\n props\r\n )}\r\n <div className='msc-promo-code'>\r\n {props.promoCode}\r\n </div>\r\n <Node className='msc-cart__checkout'>\r\n {preventCheckout ? props.checkoutButtonDisabled : props.checkoutAsSignInUserButton}\r\n {props.backToShoppingButton}\r\n </Node>\r\n </Node>\r\n )}\r\n </div>\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<IEditSelectComponentProps, { quantityState: number }> {\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 <div className={`msc-quantity-selector ${(this.props.zeroAvailabilityError || this.props.shouldDisableQty) ? 'msc-quantity-selector__disabled' : ''}`}>\r\n <button className='msc-quantity-selector__button msc-quantity-selector__button-decrease' onClick={this._downQuantity}>-</button>\r\n { /* tslint:disable-next-line: react-a11y-role-has-required-aria-props react-this-binding-issue */}\r\n <input className='msc-quantity-selector__input' type='number' value={this.state.quantityState} onChange={this._onQuantityChange} onBlur={this._postValidateQuantity} />\r\n <button className='msc-quantity-selector__button msc-quantity-selector__button-increase' disabled={!this._canAddMore} onClick={this._upQuantity}>+</button>\r\n </div>\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<HTMLInputElement>): void {\r\n this.setState({ quantityState: parseInt(target.value, 10) });\r\n }\r\n\r\n private _postValidateQuantity({ target }: React.ChangeEvent<HTMLInputElement>): 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 <div className='subscription-minicart'>\r\n <div className='subscription-minicart-header'>\r\n {subscriptionBannerDisplayComponent}\r\n </div>\r\n <div className='subscription-minicart-content'>\r\n {bottleCountComponent}\r\n <div className='subscription-minicart-summary-group'>\r\n {editBoxComponent}\r\n {cartDisplaySummaryComponent}\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n};\r\n","import { INodeProps, Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\nimport { IProductCollectionViewProps, IProductComponentViewProps } from './smwe-product-collection';\r\n\r\nconst ProductCollectionView: React.FC<IProductCollectionViewProps> = props => {\r\n const { heading, ProductCollectionContainer, products, SingleSlideCarouselComponentProps, GridComponentProps, isCarousel } = props;\r\n if (products) {\r\n return (\r\n <Module {...ProductCollectionContainer}>\r\n {heading}\r\n {\r\n isCarousel ? _renderCarousel(SingleSlideCarouselComponentProps, products) : _renderGrid(GridComponentProps, products)\r\n }\r\n </Module>\r\n );\r\n }\r\n return null;\r\n};\r\n\r\nconst _renderCarousel = (carouselContainer: INodeProps, items: IProductComponentViewProps[]): JSX.Element => {\r\n return (\r\n <Node {...carouselContainer}>\r\n {items && items.map(_renderProduct)}\r\n </Node>\r\n );\r\n};\r\n\r\nconst _renderGrid = (gridContainer: INodeProps, items: IProductComponentViewProps[]): JSX.Element => {\r\n return (\r\n <Node {...gridContainer}>\r\n {items && items.map(_renderProduct)}\r\n </Node>\r\n );\r\n};\r\n\r\nconst _renderProduct = (product: IProductComponentViewProps): JSX.Element => {\r\n const { ProductContainer, productComponent } = product;\r\n\r\n return (\r\n <Node {...ProductContainer}>\r\n {productComponent}\r\n </Node>\r\n );\r\n};\r\n\r\nexport default ProductCollectionView;","import { Slider } from '@msdyn365-commerce-modules/utilities';\r\nimport debounce from 'lodash/debounce';\r\nimport { computed } from 'mobx';\r\nimport { observer } from 'mobx-react';\r\nimport * as React from 'react';\r\nimport { formatPrice } from './utilities';\r\n\r\ntype InputType = 'Min' | 'Max';\r\n\r\nimport { IRefineItemProps, IRefineItemState } from './refine-item';\r\n\r\nexport type RangeRefineItemType = 'slider' | 'input';\r\n\r\n/**\r\n * Range refine item properties\r\n */\r\nexport interface IRangeRefineItemProps extends IRefineItemProps {\r\n rangeType: RangeRefineItemType;\r\n minValueSliderThumbAriaLabel?: string;\r\n maxValueSliderThumbAriaLabel?: string;\r\n}\r\n\r\n/**\r\n * Range refine item state\r\n */\r\nexport interface IRangeRefineItemState extends IRefineItemState {\r\n validationErrorMin: string | undefined;\r\n validationErrorMax: string | undefined;\r\n selectedMin: string | undefined;\r\n selectedMax: string | undefined;\r\n touchedMin: boolean;\r\n touchedMax: boolean;\r\n}\r\n\r\n/**\r\n * RangeRefineItem component (controlled by RefineSubmenu)\r\n */\r\n@observer\r\nexport default class RangeRefineItem extends React.Component<IRangeRefineItemProps, IRangeRefineItemState> {\r\n private _formattedPriceReverseLookup: Map<string, string> = new Map();\r\n\r\n private minInput: React.RefObject<HTMLInputElement>;\r\n private maxInput: React.RefObject<HTMLInputElement>;\r\n\r\n @computed get currencyCode(): string {\r\n return this.props.productRefinerValue.UnitText || '';\r\n }\r\n\r\n constructor(props: IRangeRefineItemProps) {\r\n super(props);\r\n this._onRangeUpdate = this._onRangeUpdate.bind(this);\r\n this._onRangeUpdateEnd = this._onRangeUpdateEnd.bind(this);\r\n this._handleRangeTooltipText = this._handleRangeTooltipText.bind(this);\r\n this._changeMin = this._changeMin.bind(this);\r\n this._changeMax = this._changeMax.bind(this);\r\n this._finishChangeMin = this._finishChangeMin.bind(this);\r\n this._finishChangeMax = this._finishChangeMax.bind(this);\r\n\r\n this.minInput = React.createRef<HTMLInputElement>();\r\n this.maxInput = React.createRef<HTMLInputElement>();\r\n\r\n const { selectedRefinementCriterion } = this.props;\r\n const initialMin = selectedRefinementCriterion && selectedRefinementCriterion.LeftValueBoundString || '0';\r\n const initialMax = selectedRefinementCriterion && selectedRefinementCriterion.RightValueBoundString || undefined;\r\n this.state = {\r\n isChecked: false,\r\n validationErrorMin: undefined,\r\n validationErrorMax: undefined,\r\n selectedMin: initialMin,\r\n selectedMax: initialMax,\r\n touchedMin: false,\r\n touchedMax: false\r\n };\r\n }\r\n\r\n public render(): JSX.Element | undefined {\r\n const { productRefinerValue, parentProductRefinerHierarchy, refineItemCommonProps } = this.props;\r\n\r\n if (!productRefinerValue || !parentProductRefinerHierarchy) {\r\n refineItemCommonProps.telemetry.error('Cannot render refine value range without productRefinerValue and parentProductRefinerHierarchy');\r\n return undefined;\r\n }\r\n\r\n if (this.props.rangeType === 'input') {\r\n return this._renderInputFields();\r\n }\r\n\r\n return this._renderSlider();\r\n }\r\n\r\n private _renderInputFields(): JSX.Element | undefined {\r\n const { isDisabled, parentProductRefinerHierarchy, refineItemCommonProps } = this.props;\r\n const { selectedMin, selectedMax, touchedMin, touchedMax, validationErrorMin, validationErrorMax } = this.state;\r\n\r\n const rangeAriaLabel = (refineItemCommonProps.rangeNameFormat || '{0}').replace('{0}', (parentProductRefinerHierarchy.KeyName || ''));\r\n const formAttrs = {\r\n 'aria-label': rangeAriaLabel,\r\n 'aria-disabled': isDisabled\r\n };\r\n\r\n // To enable price formatting of selected fields, this is the approach:\r\n // initial value: min=0 formatted as price, max=undefined\r\n // onFocus/onChange: convert to number (unformat) and mark as touched to indicate value is being edited\r\n // onBlur: validate and format entered value as price\r\n const minInputClassName = `ms-refine-submenu__input-range refine-submenu__input-range-min ${validationErrorMin ? 'refine-submenu__input-range--error' : ''}`;\r\n const maxInputClassName = `ms-refine-submenu__input-range refine-submenu__input-range-max ${validationErrorMax ? 'refine-submenu__input-range--error' : ''}`;\r\n const minLabelClassName = 'ms-refine-submenu__input-range-label refine-submenu__input-range-label-min';\r\n const maxLabelClassName = 'ms-refine-submenu__input-range-label refine-submenu__input-range-label-max';\r\n const formattedSelectedMin = this._getFormattedSelectedValue(selectedMin, touchedMin, validationErrorMin);\r\n const formattedSelectedMax = this._getFormattedSelectedValue(selectedMax, touchedMax, validationErrorMax);\r\n return (\r\n <form className='ms-refine-submenu__input-range-refiner' {...formAttrs}>\r\n <label className={minLabelClassName}>\r\n {refineItemCommonProps.minLabel}\r\n <input\r\n className={minInputClassName}\r\n onChange={this._changeMin}\r\n onFocus={this._changeMin}\r\n onBlur={this._finishChangeMin}\r\n value={formattedSelectedMin}\r\n ref={this.minInput}\r\n />\r\n </label>\r\n <label className={maxLabelClassName}>\r\n {refineItemCommonProps.maxLabel}\r\n <input\r\n className={maxInputClassName}\r\n placeholder={formattedSelectedMax ? undefined : refineItemCommonProps.placeholderTextMax}\r\n onChange={this._changeMax}\r\n onFocus={this._changeMax}\r\n onBlur={this._finishChangeMax}\r\n value={formattedSelectedMax}\r\n ref={this.maxInput}\r\n />\r\n </label>\r\n {validationErrorMin &&\r\n <span className='ms-refine-submenu__input-range-error-text refine-submenu__input-range-min-error-text'>{validationErrorMin}</span>\r\n }\r\n {validationErrorMax && validationErrorMin !== validationErrorMax &&\r\n <span className='ms-refine-submenu__input-range-error-text refine-submenu__input-range-max-error-text'>{validationErrorMax}</span>\r\n }\r\n </form>\r\n );\r\n }\r\n\r\n private _renderSlider(): JSX.Element | undefined {\r\n const { isDisabled, productRefinerValue, parentProductRefinerHierarchy, selectedRefinementCriterion } = this.props;\r\n const min = productRefinerValue.LeftValueBoundString;\r\n const max = productRefinerValue.RightValueBoundString;\r\n const selectedMin = selectedRefinementCriterion && selectedRefinementCriterion.LeftValueBoundString || productRefinerValue.LeftValueBoundString || '0';\r\n const selectedMax = selectedRefinementCriterion && selectedRefinementCriterion.RightValueBoundString || productRefinerValue.RightValueBoundString || max;\r\n const sliderId = `slider_${parentProductRefinerHierarchy.RecordId}_${productRefinerValue.RefinerRecordId}`;\r\n const ariaAttributes = {\r\n 'aria-disabled': isDisabled\r\n };\r\n\r\n const minPrice = this._formatPrice(min);\r\n const maxPrice = this._formatPrice(max);\r\n const selectedMinPrice =this._formatPrice(selectedMin);\r\n const selectedMaxPrice =this._formatPrice(selectedMax);\r\n\r\n return (\r\n <Slider\r\n className={'ms-refine-submenu__range-refiner'}\r\n key={sliderId}\r\n id={sliderId}\r\n inForm={false}\r\n min={min && Number(min) || undefined}\r\n max={max && Number(max) || undefined}\r\n step={1}\r\n orientation={'horizontal'}\r\n labels={[\r\n {\r\n labelId: `${sliderId}_start`,\r\n labelString: `${minPrice}`,\r\n labelPositioning: 'start'\r\n },\r\n {\r\n labelId: `${sliderId}_end`,\r\n labelString: `${maxPrice}`,\r\n labelPositioning: 'end'\r\n }\r\n ]}\r\n showLabels={true}\r\n showTooltip={true}\r\n sliderThumbs={[\r\n {\r\n id: `${sliderId}_slider_thumb_start`,\r\n value: selectedMin && Number(selectedMin) || 0,\r\n ariaLabel: `${this.props.minValueSliderThumbAriaLabel} ${this.currencyCode}`,\r\n ariaValueText: `${selectedMinPrice}`\r\n },\r\n {\r\n id: `${sliderId}_slider_thumb_end`,\r\n value: Number(selectedMax) || Number(maxPrice),\r\n ariaLabel: `${this.props.maxValueSliderThumbAriaLabel} ${this.currencyCode}`,\r\n ariaValueText: `${selectedMaxPrice}`\r\n }\r\n ]}\r\n onChangeEnd={this._onRangeUpdateEnd}\r\n onChange={debounce(this._onRangeUpdate, 500)}\r\n handleTooltipText={this._handleRangeTooltipText}\r\n {...ariaAttributes}\r\n />\r\n );\r\n }\r\n\r\n private _changeMin(event: React.FocusEvent<HTMLInputElement>): void {\r\n this._changeValue(event, 'Min');\r\n }\r\n\r\n private _changeMax(event: React.FocusEvent<HTMLInputElement>): void {\r\n this._changeValue(event, 'Max');\r\n }\r\n\r\n private _changeValue(event: React.FocusEvent<HTMLInputElement>, inputType: InputType): void {\r\n const selectedKey = `selected${inputType}`;\r\n const touchedKey = `touched${inputType}`;\r\n this.setState({\r\n [selectedKey]: this._getInputWithoutFormatting(event.currentTarget.value),\r\n [touchedKey]: true\r\n });\r\n }\r\n\r\n private _finishChangeMin(event: React.FocusEvent<HTMLInputElement>): boolean {\r\n const selectedMinValue = this._getInputWithoutFormatting(event.currentTarget.value);\r\n this.setState({\r\n selectedMin: selectedMinValue,\r\n minTouched: false\r\n });\r\n const minInput = Number(selectedMinValue);\r\n const { onToggle, parentProductRefinerHierarchy, productRefinerValue, refineItemCommonProps, selectedRefinementCriterion } = this.props;\r\n const max = selectedRefinementCriterion && selectedRefinementCriterion.RightValueBoundString || undefined;\r\n\r\n const maxNum = max ? Number(max) : undefined;\r\n\r\n if (isNaN(minInput)) {\r\n this.setState({validationErrorMin: refineItemCommonProps.validationErrorNaN});\r\n this._focus('Min');\r\n return false;\r\n }\r\n\r\n if (this._validateRange(minInput, maxNum)) {\r\n onToggle({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: true,\r\n rangeStart: minInput,\r\n rangeEnd: maxNum\r\n });\r\n return true;\r\n } else {\r\n this._focus('Min');\r\n }\r\n\r\n return false;\r\n }\r\n\r\n private _finishChangeMax(event: React.FocusEvent<HTMLInputElement>): boolean {\r\n const selectedMaxValue = this._getInputWithoutFormatting(event.currentTarget.value);\r\n this.setState({\r\n selectedMax: selectedMaxValue,\r\n maxTouched: false\r\n });\r\n const maxInput = Number(selectedMaxValue);\r\n const { onToggle, parentProductRefinerHierarchy, productRefinerValue, refineItemCommonProps, selectedRefinementCriterion } = this.props;\r\n const min = selectedRefinementCriterion && selectedRefinementCriterion.LeftValueBoundString || '0';\r\n\r\n const minNum = Number(min);\r\n\r\n if (isNaN(maxInput)) {\r\n this.setState({validationErrorMax: refineItemCommonProps.validationErrorNaN});\r\n this._focus('Max');\r\n return false;\r\n }\r\n\r\n if (this._validateRange(minNum, maxInput)) {\r\n if (productRefinerValue) {\r\n onToggle({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: true,\r\n rangeStart: minNum,\r\n rangeEnd: maxInput\r\n });\r\n } else {\r\n this._focus('Max');\r\n }\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n private _focus(inputType: InputType): void {\r\n const ref = inputType === 'Max' ? this.maxInput : this.minInput;\r\n\r\n setTimeout(() => {\r\n if (ref && ref.current) {\r\n ref.current.focus();\r\n }\r\n }, 50);\r\n }\r\n\r\n private _getFormattedSelectedValue(selected: string | undefined, touched: boolean, validationError: string | undefined): string | undefined {\r\n if (touched || validationError || selected === undefined) {\r\n return selected;\r\n }\r\n return this._formatPrice(selected);\r\n }\r\n\r\n private _validateRange(min: number, max: number | undefined): boolean {\r\n const { refineItemCommonProps } = this.props;\r\n if (max === undefined) {\r\n return true;\r\n }\r\n\r\n if (min > max) {\r\n this.setState({\r\n validationErrorMin: refineItemCommonProps.validationErrorRange,\r\n validationErrorMax: refineItemCommonProps.validationErrorRange\r\n });\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _formatPrice(amount: string | undefined): string {\r\n const locale = this.props.refineItemCommonProps.locale;\r\n const result = formatPrice(amount, this.currencyCode, locale, this.props.refineItemCommonProps.telemetry);\r\n\r\n if (amount !== undefined && !this._formattedPriceReverseLookup.has(result)) {\r\n this._formattedPriceReverseLookup.set(result, amount);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n private _getInputWithoutFormatting(input: string): string {\r\n // First try to cast raw input to a number\r\n const inputAsNum = Number(input);\r\n if (!isNaN(inputAsNum)) {\r\n return input;\r\n }\r\n\r\n // Otherwise try a reverse lookup and fall back to the raw input if all else fails\r\n const reverseLookupResult = this._formattedPriceReverseLookup.get(input);\r\n return reverseLookupResult || input;\r\n }\r\n\r\n // NOTE: Fix types once Shared Components build pipeline bug fixed\r\n // tslint:disable-next-line:no-any\r\n private _onRangeUpdate(sliderChangeNotification: any): void {\r\n // Need to filter out mousemove events as these cause errors after the menu updates and slider re-renders\r\n if (sliderChangeNotification.eventType !== 'mousemove') {\r\n const { onToggle, parentProductRefinerHierarchy, productRefinerValue } = this.props;\r\n if (productRefinerValue && sliderChangeNotification) {\r\n onToggle({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: true,\r\n rangeStart: sliderChangeNotification.firstThumbValue,\r\n rangeEnd: sliderChangeNotification.secondThumbValue\r\n });\r\n\r\n this._focusOnSliderThumb(sliderChangeNotification);\r\n }\r\n }\r\n }\r\n\r\n // tslint:disable-next-line\r\n private _onRangeUpdateEnd(sliderChangeNotification: any): void {\r\n const { onToggle, parentProductRefinerHierarchy, productRefinerValue } = this.props;\r\n if (productRefinerValue && sliderChangeNotification) {\r\n onToggle({\r\n parentProductRefinerHierarchy: parentProductRefinerHierarchy,\r\n productRefinerValue: productRefinerValue,\r\n isSelecting: true,\r\n rangeStart: sliderChangeNotification.firstThumbValue,\r\n rangeEnd: sliderChangeNotification.secondThumbValue\r\n });\r\n\r\n this._focusOnSliderThumb(sliderChangeNotification);\r\n }\r\n }\r\n\r\n // tslint:disable-next-line\r\n private _focusOnSliderThumb(sliderChangeNotification: any): void {\r\n if (sliderChangeNotification.id) {\r\n const element = document.getElementById(sliderChangeNotification.id);\r\n if (!!element) {\r\n setTimeout(\r\n () => {\r\n element.focus();\r\n }, 0);\r\n }\r\n }\r\n }\r\n\r\n private _handleRangeTooltipText(tooltip: number): string {\r\n return this._formatPrice(`${tooltip}`);\r\n }\r\n}","import * as React from 'react';\r\ninterface IErrorMessage {\r\n text?: string;\r\n}\r\n\r\nexport const ErrorMessage: React.FC<IErrorMessage> = ({ text }) => {\r\n return (\r\n <span className='ms-search-result-container__no-results-message'>\r\n <h5> {text} </h5>\r\n </span>\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 * as React from 'react';\r\n\r\nimport { Button, Collapse } from '@msdyn365-commerce-modules/utilities';\r\nimport { IProductRefinerHierarchy } from '@msdyn365-commerce/commerce-entities';\r\nimport { ICoreContext } from '@msdyn365-commerce/core';\r\nimport { ProductRefinerValue } from '@msdyn365-commerce/retail-proxy';\r\nimport RangeRefineItem, { RangeRefineItemType } from './range-refine-item';\r\nimport RefineItem from './refine-item';\r\nimport { IRefineItemToggleNotification } from './refine-item-toggle-notification';\r\nimport { IRefineItemCommonProps } from './refine-item.props.common';\r\nimport { findMatchingRefinementCriterion, ProductRefinerTypeValue, ProductRefinerValueDataTypeValue } from './utilities';\r\n\r\n/**\r\n * Properties associated with the RefineSubmenu component\r\n */\r\nexport interface IRefineSubmenuProps {\r\n tempRangeTypeTODO: RangeRefineItemType;\r\n minValueSliderThumbAriaLabel?: string;\r\n maxValueSliderThumbAriaLabel?: string;\r\n refinerExpandText?: string;\r\n refinerMinimizeText?: string;\r\n minimizedRefiners?: string;\r\n productRefinerHierarchy: IProductRefinerHierarchy;\r\n selectedRefinerValues: ProductRefinerValue[];\r\n refineItemCommonProps: IRefineItemCommonProps;\r\n isDisabled: boolean;\r\n isExpandedOnInitialLoad: boolean;\r\n context: ICoreContext;\r\n moduleId: string;\r\n moduleTypeName: string;\r\n highestLevelRefinerText?: string;\r\n onUpdateRefiners(notfication: Readonly<IRefineItemToggleNotification>): void;\r\n urlBuilder(refiner: IRefineItemToggleNotification): string;\r\n}\r\n\r\n/**\r\n * Refine submenu state\r\n */\r\nexport interface IRefineSubmenuState extends React.ComponentState {\r\n expanded: boolean;\r\n}\r\n\r\n/**\r\n *\r\n * The RefineSubmenu component renders the submenu category and child items.\r\n * This computed observes the stateful category hierarchy object.\r\n * @extends {React.PureComponent<IRefineSubmenuProps>}\r\n */\r\nclass RefineSubmenu extends React.Component<IRefineSubmenuProps, IRefineSubmenuState> {\r\n\r\n private isMinimizedRefiner: boolean = false;\r\n\r\n constructor(props: IRefineSubmenuProps) {\r\n super(props);\r\n\r\n this._onToggleItem = this._onToggleItem.bind(this);\r\n this._onToggleSubmenu = this._onToggleSubmenu.bind(this);\r\n this._expandCategoryRefiner = this._expandCategoryRefiner.bind(this);\r\n\r\n let isExpanded = this.props.isExpandedOnInitialLoad;\r\n if (this.props.productRefinerHierarchy.DataTypeValue === ProductRefinerValueDataTypeValue.Range) {\r\n isExpanded = true;\r\n }\r\n\r\n this.state = {\r\n expanded: isExpanded\r\n };\r\n\r\n if (this.props.minimizedRefiners) {\r\n const minimizedRefinersList = this.props.minimizedRefiners.split(',');\r\n this.isMinimizedRefiner = minimizedRefinersList.some(\r\n keyName => this.props.productRefinerHierarchy.KeyName && (keyName.toLowerCase() === this.props.productRefinerHierarchy.KeyName.toLocaleLowerCase())\r\n );\r\n }\r\n }\r\n\r\n public render(): JSX.Element | null {\r\n const { productRefinerHierarchy, refineItemCommonProps } = this.props;\r\n\r\n if (!productRefinerHierarchy) {\r\n refineItemCommonProps.telemetry.error('Cannot render submenu without refiner hierarchy data');\r\n }\r\n\r\n const isRangeRefiner = (productRefinerHierarchy.DataTypeValue === ProductRefinerValueDataTypeValue.Range);\r\n let key = '';\r\n if (isRangeRefiner) {\r\n const selectedRefinementCriterion = findMatchingRefinementCriterion(productRefinerHierarchy.Values[0], this.props.selectedRefinerValues);\r\n key = selectedRefinementCriterion ? `($${selectedRefinementCriterion.LeftValueBoundString && parseFloat(selectedRefinementCriterion.LeftValueBoundString).toFixed(2)} - $${selectedRefinementCriterion.RightValueBoundString && parseFloat(selectedRefinementCriterion.RightValueBoundString).toFixed(2)})` : '';\r\n }\r\n\r\n if (this.isMinimizedRefiner) {\r\n return (\r\n <div className='ms-refine-submenu list-group'>\r\n <div className='ms-refine-submenu__minimized-header'>{productRefinerHierarchy.KeyName} {key}</div>\r\n {this._renderChildItems(productRefinerHierarchy)}\r\n </div>\r\n );\r\n }\r\n\r\n return (\r\n <div className='ms-refine-submenu list-group'>\r\n <Button\r\n className={this.state.expanded ? 'ms-refine-submenu__toggle_expanded' : 'ms-refine-submenu__toggle_collapsed'}\r\n aria-label={productRefinerHierarchy.KeyName || 'refiner.Name'}\r\n onClick={this._onToggleSubmenu}\r\n aria-expanded={this.state.expanded}\r\n >\r\n {productRefinerHierarchy.KeyName} {key}\r\n </Button>\r\n <Collapse isOpen={this.state.expanded} timeout={350}>\r\n {this._renderChildItems(productRefinerHierarchy)}\r\n </Collapse>\r\n </div>\r\n );\r\n }\r\n\r\n private _renderChildItems(productRefinerHierarchy: IProductRefinerHierarchy): JSX.Element | null {\r\n switch (productRefinerHierarchy.DataTypeValue) {\r\n case ProductRefinerValueDataTypeValue.Range:\r\n case ProductRefinerValueDataTypeValue.RangeInput:\r\n return this._renderRange(productRefinerHierarchy);\r\n default:\r\n return this._renderSingleMultiSelect(productRefinerHierarchy);\r\n }\r\n }\r\n\r\n private _renderSingleMultiSelect(productRefinerHierarchy: IProductRefinerHierarchy): JSX.Element | null {\r\n const { isDisabled, refineItemCommonProps, selectedRefinerValues, context } = this.props;\r\n const isSingleSelect = productRefinerHierarchy.RefinerTypeValue === ProductRefinerTypeValue.Single;\r\n const role = isSingleSelect ? { role: 'radiogroup' } : undefined;\r\n const refinerValuesList = this._getSortedValueList() || [];\r\n\r\n const listItems = refinerValuesList.map((child: ProductRefinerValue, index: number) => {\r\n if (!child) {\r\n refineItemCommonProps.telemetry.error(\r\n `[refine-submenu] Could not render refine item for refiner ${productRefinerHierarchy.RecordId} (${productRefinerHierarchy.KeyName})`\r\n );\r\n return null;\r\n }\r\n\r\n const selectedRefinementCriterion = findMatchingRefinementCriterion(child, selectedRefinerValues);\r\n\r\n return (\r\n <RefineItem\r\n parentProductRefinerHierarchy={productRefinerHierarchy}\r\n productRefinerValue={child}\r\n selectedRefinementCriterion={selectedRefinementCriterion}\r\n refineItemCommonProps={refineItemCommonProps}\r\n onToggle={this._onToggleItem}\r\n urlBuilder={this.props.urlBuilder}\r\n isDisabled={isDisabled}\r\n key={index}\r\n context={context}\r\n moduleId={this.props.moduleId}\r\n moduleTypeName={this.props.moduleTypeName}\r\n />\r\n );\r\n });\r\n if (this.isMinimizedRefiner) {\r\n return (\r\n <div className='ms-refine-submenu__list-min' id={`refine-submenu-minimize__${this.props.productRefinerHierarchy.RecordId}`}>\r\n <ul className='ms-refine-submenu__list' {...role} aria-label={productRefinerHierarchy.KeyName}>\r\n {listItems}\r\n </ul>\r\n <a\r\n onClick={this._expandCategoryRefiner}\r\n className='ms-refine-submenu__expand-button'\r\n role='button'\r\n id={`refine-submenu-minimize-button__${productRefinerHierarchy.RecordId}`}\r\n >\r\n {this.props.refinerExpandText}\r\n </a>\r\n </div>\r\n );\r\n }\r\n return (\r\n <ul className='ms-refine-submenu__list' {...role} aria-label={productRefinerHierarchy.KeyName}>\r\n {listItems}\r\n </ul>\r\n );\r\n }\r\n\r\n private _renderRange(productRefinerHierarchy: IProductRefinerHierarchy): JSX.Element | null {\r\n const { isDisabled, refineItemCommonProps, selectedRefinerValues, context, minValueSliderThumbAriaLabel, maxValueSliderThumbAriaLabel } = this.props;\r\n const submenuClassNamePrefix = 'ms-refine-submenu__item list-group-item refine-submenu__item';\r\n const refinerValuesList = this._getSortedValueList() || [];\r\n const listItems = refinerValuesList.map((child: ProductRefinerValue, index: number) => {\r\n if (!child) {\r\n refineItemCommonProps.telemetry.error(\r\n `Could not render refine item for refiner ${productRefinerHierarchy.RecordId} (${productRefinerHierarchy.KeyName})`\r\n );\r\n return null;\r\n }\r\n\r\n const selectedRefinementCriterion = findMatchingRefinementCriterion(child, selectedRefinerValues);\r\n\r\n // TODO BUGBUG 22424559 determine only from the DataTypeValue once live example is working (can test with the tempRangeTypeTODO derived from QSP until then)\r\n const rangeType = (productRefinerHierarchy.DataTypeValue === ProductRefinerValueDataTypeValue.RangeInput || this.props.tempRangeTypeTODO === 'input') ?\r\n 'input' :\r\n 'slider';\r\n const key = selectedRefinementCriterion ? `${selectedRefinementCriterion.LeftValueBoundString}-${selectedRefinementCriterion.RightValueBoundString}` : `not-selected-${index}`;\r\n return (\r\n <li className={`${submenuClassNamePrefix}--range`} key={index}>\r\n <RangeRefineItem\r\n parentProductRefinerHierarchy={productRefinerHierarchy}\r\n productRefinerValue={child}\r\n selectedRefinementCriterion={selectedRefinementCriterion}\r\n refineItemCommonProps={refineItemCommonProps}\r\n onToggle={this._onToggleItem}\r\n urlBuilder={this.props.urlBuilder}\r\n isDisabled={isDisabled}\r\n rangeType={rangeType}\r\n key={key}\r\n context={context}\r\n minValueSliderThumbAriaLabel={minValueSliderThumbAriaLabel}\r\n maxValueSliderThumbAriaLabel={maxValueSliderThumbAriaLabel}\r\n moduleId={this.props.moduleId}\r\n moduleTypeName={this.props.moduleTypeName}\r\n />\r\n </li>\r\n );\r\n });\r\n return <ul className='ms-refine-submenu__list list-unstyled'>{listItems}</ul>;\r\n }\r\n\r\n private _onToggleItem(itemToggleNotification: IRefineItemToggleNotification): void {\r\n this.props.onUpdateRefiners(itemToggleNotification);\r\n }\r\n\r\n private _onToggleSubmenu(): void {\r\n this.setState(prevState => ({\r\n expanded: !prevState.expanded\r\n }));\r\n }\r\n\r\n private _getSortedValueList(): ProductRefinerValue[] {\r\n const sortedList = this.props.productRefinerHierarchy.Values.sort((nextOption, curOption) => {\r\n const curOptionName =\r\n nextOption.LeftValueBoundString || nextOption.RightValueBoundString || '';\r\n const nextOptionName =\r\n curOption.LeftValueBoundString || curOption.RightValueBoundString || '';\r\n\r\n return curOptionName.localeCompare(nextOptionName);\r\n });\r\n\r\n const dividedList = {\r\n options: [] as ProductRefinerValue[],\r\n topLevel: [] as ProductRefinerValue[]\r\n };\r\n sortedList.forEach(option => {\r\n const optionName = option.LeftValueBoundString || option.RightValueBoundString || '';\r\n\r\n if (optionName === this.props.highestLevelRefinerText) {\r\n dividedList.topLevel.push(option);\r\n } else {\r\n dividedList.options.push(option);\r\n }\r\n });\r\n\r\n return [...dividedList.topLevel, ...dividedList.options];\r\n }\r\n\r\n private _expandCategoryRefiner(): void {\r\n const minimizedElement = document.getElementById(`refine-submenu-minimize__${this.props.productRefinerHierarchy.RecordId}`);\r\n const buttonElement = document.getElementById(`refine-submenu-minimize-button__${this.props.productRefinerHierarchy.RecordId}`);\r\n if (minimizedElement && buttonElement) {\r\n if (minimizedElement.className === 'ms-refine-submenu__list-min') {\r\n minimizedElement.className = 'ms-refine-submenu__list-full';\r\n buttonElement.textContent = this.props.refinerMinimizeText!;\r\n } else {\r\n minimizedElement.className = 'ms-refine-submenu__list-min';\r\n buttonElement.textContent = this.props.refinerExpandText!;\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default RefineSubmenu;"],"sourceRoot":""}