@shopgate/engage 7.12.3 → 7.20.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/components/Section/index.js +2 -2
- package/a11y/components/VisuallyHidden/index.js +8 -0
- package/a11y/components/index.js +1 -0
- package/a11y/constants/index.js +1 -0
- package/a11y/helpers/index.js +1 -0
- package/a11y/index.js +1 -4
- package/account/actions/addContacts.js +1 -1
- package/account/actions/deleteContact.js +1 -1
- package/account/actions/deleteCustomer.js +1 -1
- package/account/actions/fetchContacts.js +1 -1
- package/account/actions/fetchCustomer.js +1 -1
- package/account/actions/updateContact.js +1 -1
- package/account/actions/updateCustomer.js +1 -1
- package/account/components/Account/Account.style.js +1 -1
- package/account/components/Profile/Profile.provider.js +3 -3
- package/account/components/ProfileContact/ProfileContact.js +1 -1
- package/app-rating/action-creators/appStart.js +3 -3
- package/app-rating/action-creators/ordersPlaced.js +3 -3
- package/app-rating/action-creators/popup.js +4 -4
- package/app-rating/action-creators/timer.js +3 -3
- package/app-rating/actions/showModal.js +6 -6
- package/app-rating/constants/index.js +2 -2
- package/app-rating/reducers/index.js +2 -2
- package/app-rating/subscriptions/index.js +4 -4
- package/back-in-stock/actions/index.js +14 -0
- package/back-in-stock/components/BackInStockButton/connector.js +1 -0
- package/back-in-stock/components/BackInStockButton/index.js +14 -0
- package/back-in-stock/components/BackInStockButton/style.js +1 -0
- package/back-in-stock/components/CharacteristicsButton/connector.js +3 -0
- package/back-in-stock/components/CharacteristicsButton/index.js +8 -0
- package/back-in-stock/components/ProductInfoBackInStockButton/connector.js +3 -0
- package/back-in-stock/components/ProductInfoBackInStockButton/index.js +10 -0
- package/back-in-stock/components/Subscriptions/components/List/index.js +4 -0
- package/back-in-stock/components/Subscriptions/components/Subscription/index.js +7 -0
- package/back-in-stock/components/Subscriptions/index.js +4 -0
- package/back-in-stock/components/index.js +1 -0
- package/back-in-stock/constants/Actions.js +1 -0
- package/back-in-stock/constants/Common.js +1 -0
- package/back-in-stock/constants/Pipelines.js +1 -0
- package/back-in-stock/constants/Portals.js +9 -0
- package/back-in-stock/constants/index.js +1 -0
- package/back-in-stock/hooks/index.js +4 -0
- package/back-in-stock/providers/BackInStockSubscriptionsProvider.connector.js +7 -0
- package/back-in-stock/providers/BackInStockSubscriptionsProvider.context.js +1 -0
- package/back-in-stock/providers/BackInStockSubscriptionsProvider.js +5 -0
- package/back-in-stock/providers/index.js +1 -0
- package/back-in-stock/reducers/index.js +5 -0
- package/back-in-stock/selectors/index.js +43 -0
- package/back-in-stock/streams/index.js +1 -0
- package/back-in-stock/subscriptions/index.js +11 -0
- package/cart/cart.helpers.js +2 -2
- package/cart/components/CartItem/CartItemCoupon.js +10 -6
- package/cart/components/CartItem/CartItemCouponCode.js +2 -2
- package/cart/components/CartItem/CartItemCouponDelete.js +1 -1
- package/cart/components/CartItem/CartItemCouponFreeShipping.js +1 -1
- package/cart/components/CartItem/CartItemCouponIcon.js +2 -2
- package/cart/components/CartItem/CartItemCouponLayout.style.js +5 -1
- package/cart/components/CartItem/CartItemCouponTitle.js +2 -2
- package/cart/components/CartItem/CartItemProductLayout.js +3 -2
- package/cart/components/CartItem/CartItemProductLayoutWide.style.js +1 -1
- package/cart/components/CartItem/CartItemProductTitle.js +2 -2
- package/cart/components/CartItem/CartItemQuantityPicker.js +26 -14
- package/cart/components/CartItem/CartItemSubstitution.js +1 -1
- package/cart/components/CartItems/CartItemCardReservation.js +1 -1
- package/cart/components/CartItems/CartItemGroupReservation.js +1 -1
- package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.style.js +1 -1
- package/cart/components/PaymentBar/PaymentBar.js +1 -1
- package/cart/components/PaymentBar/PaymentBarCheckoutButton.style.js +1 -1
- package/cart/components/PaymentBar/PaymentBarPromotionCouponMessages.js +1 -1
- package/cart/index.js +1 -1
- package/category/actions/index.js +1 -0
- package/category/components/CategoryList/index.js +7 -0
- package/category/components/CategoryList/style.js +1 -0
- package/category/components/index.js +1 -1
- package/category/constants/index.js +1 -0
- package/category/helpers/index.js +1 -0
- package/category/index.js +1 -6
- package/category/selectors/index.js +2 -0
- package/category/streams/index.js +1 -1
- package/checkout/actions/errorCheckout.js +1 -1
- package/checkout/actions/fetchCheckoutOrder.js +1 -1
- package/checkout/actions/fetchPaymentMethods.js +1 -1
- package/checkout/actions/initializeCheckout.js +1 -1
- package/checkout/actions/prepareCheckout.js +2 -2
- package/checkout/actions/submitCheckoutOrder.js +1 -1
- package/checkout/actions/updateCheckoutOrder.js +1 -1
- package/checkout/components/Checkout/CheckoutSectionMessages.js +1 -1
- package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +1 -1
- package/checkout/components/CheckoutConfirmation/CheckoutConfirmationBilledTo.js +1 -1
- package/checkout/components/PaymentMethodButton/PaymentMethodButton.js +1 -1
- package/checkout/components/ShippingMethods/ShippingMethods.js +4 -4
- package/checkout/paymentMethods/index.js +2 -2
- package/checkout/paymentMethods/paypal/PaypalButtonApp.js +1 -1
- package/checkout/paymentMethods/paypal/PaypalButtonWeb.js +1 -1
- package/checkout/paymentMethods/paypal/PaypalPayButton.js +1 -1
- package/checkout/paymentMethods/paypal/PaypalProvider.js +1 -1
- package/checkout/paymentMethods/stripe/StripeButton.js +2 -2
- package/checkout/paymentMethods/stripe/StripeCreditCard.js +3 -3
- package/checkout/paymentMethods/stripe/StripeProvider.js +8 -8
- package/checkout/paymentMethods/stripe/sdk.js +1 -1
- package/checkout/providers/AddressBookProvider.js +1 -1
- package/checkout/providers/CheckoutProvider.js +8 -8
- package/components/ChipLayout/index.js +38 -0
- package/components/ChipLayout/spec.js +5 -0
- package/components/ChipLayout/style.js +5 -0
- package/components/Footer/Footer.js +7 -7
- package/components/Form/Builder/Builder.js +50 -29
- package/components/Form/Builder/ElementCheckbox.js +1 -1
- package/components/Form/Builder/ElementMultiSelect.js +1 -1
- package/components/Form/Builder/ElementPhoneNumber.js +3 -3
- package/components/Form/Builder/ElementRadio.js +1 -1
- package/components/Form/Builder/ElementSelect.js +1 -1
- package/components/Form/Builder/ElementText.js +3 -3
- package/components/Form/Builder/classes/ActionListener.constants.js +2 -2
- package/components/Form/Builder/classes/ActionListener.js +73 -16
- package/components/Form/Builder/helpers/buildFormElements.js +2 -2
- package/components/Form/Form.js +8 -5
- package/components/IntersectionVisibility/index.js +14 -7
- package/components/Logo/connector.js +4 -0
- package/components/Logo/index.js +4 -0
- package/components/Logo/spec.js +1 -0
- package/components/Logo/style.js +1 -0
- package/components/Menu/components/Position/index.js +5 -5
- package/components/Menu/index.js +9 -9
- package/components/MessageBar/MessageBar.js +1 -1
- package/components/MessageBar/index.js +1 -1
- package/components/NavigationHandler/index.js +4 -4
- package/components/NavigationHandler/spec.js +1 -1
- package/components/Picker/components/Button/index.js +1 -1
- package/components/Picker/components/List/index.js +2 -2
- package/components/Picker/components/Modal/index.js +7 -7
- package/components/Picker/index.js +18 -9
- package/components/PickerUtilize/components/Button/index.js +5 -0
- package/components/PickerUtilize/components/Button/style.js +1 -0
- package/components/PickerUtilize/index.js +17 -0
- package/components/PickerUtilize/spec.js +1 -0
- package/components/PickerUtilize/style.js +1 -0
- package/components/QuantityInput/QuantityInput.js +2 -2
- package/components/Radio/Radio.js +1 -1
- package/components/RadioCard/RadioCard.js +1 -1
- package/components/RangeSlider/components/Handle/index.js +1 -1
- package/components/RangeSlider/index.js +36 -24
- package/components/SheetList/components/Item/index.js +5 -5
- package/components/SheetList/index.js +4 -4
- package/components/SideNavigation/SideNavigationCategories.connector.js +2 -2
- package/components/SnackBarContainer/index.js +5 -0
- package/components/Switch/index.js +12 -0
- package/components/Switch/style.js +1 -0
- package/components/Tabs/components/TabIndicator.js +2 -2
- package/components/Tabs/components/Tabs.js +1 -1
- package/components/TimeBoundary/index.js +8 -6
- package/components/VideoPlayer/index.js +9 -6
- package/components/View/components/Above/index.js +1 -1
- package/components/View/components/Below/index.js +1 -1
- package/components/View/components/Content/index.js +18 -11
- package/components/View/index.js +1 -1
- package/components/View/provider.js +22 -5
- package/components/index.js +2 -2
- package/core/action-creators/app.js +5 -0
- package/core/action-creators/appPermissions.js +9 -0
- package/core/action-creators/index.js +1 -1
- package/core/actions/getGeolocation.js +2 -2
- package/core/actions/grantAppTrackingTransparencyPermission.js +6 -0
- package/core/actions/grantCameraPermissions.js +1 -1
- package/core/actions/grantGeolocationPermissions.js +1 -1
- package/core/actions/grantPermissions.js +13 -6
- package/core/actions/grantPushPermissions.js +22 -0
- package/core/actions/index.js +7 -0
- package/core/actions/requestAppPermission.js +12 -0
- package/core/actions/requestAppPermissionStatus.js +12 -0
- package/core/classes/GeolocationRequest.js +2 -3
- package/core/classes/GeolocationRequestApp.js +6 -6
- package/core/classes/GeolocationRequestBrowser.js +2 -2
- package/core/classes/index.js +1 -0
- package/core/collections/AppInitialization.js +49 -0
- package/core/collections/index.js +1 -0
- package/core/commands/analyticsSetConsent.js +11 -0
- package/core/commands/index.js +1 -0
- package/core/config/ThemeConfigResolver.js +2 -2
- package/core/config/config.action-creators.js +1 -1
- package/core/config/config.actions.js +1 -1
- package/core/config/config.reducers.js +1 -1
- package/core/config/config.subscriptions.js +2 -2
- package/core/config/index.js +1 -1
- package/core/constants/actionTypes.js +1 -0
- package/core/constants/appFeatures.js +1 -0
- package/core/constants/index.js +6 -1
- package/core/contexts/index.js +1 -0
- package/core/helpers/appFeatures.js +14 -0
- package/core/helpers/appPermissions.js +43 -6
- package/core/helpers/baseUrl.js +14 -0
- package/core/helpers/environment.js +4 -0
- package/core/helpers/getFullImageSource.js +1 -1
- package/core/helpers/i18n.js +5 -3
- package/core/helpers/index.js +7 -0
- package/core/hocs/index.js +1 -0
- package/core/hocs/withCurrentProduct.js +6 -6
- package/core/hocs/withTheme.js +2 -2
- package/core/hooks/index.js +1 -0
- package/core/hooks/useAsyncMemo.js +1 -1
- package/core/hooks/useFormState.js +1 -1
- package/core/hooks/useScrollTo.js +1 -1
- package/core/hooks/useTheme.js +2 -2
- package/core/index.js +5 -52
- package/core/initialization/index.js +4 -2
- package/core/providers/AppProvider.js +10 -8
- package/core/providers/index.js +1 -0
- package/core/reducers/app.js +6 -0
- package/core/reducers/index.js +1 -1
- package/core/reducers/merchantSettings.js +1 -1
- package/core/reducers/shopSettings.js +1 -1
- package/core/selectors/app.js +9 -0
- package/core/selectors/index.js +6 -1
- package/core/streams/app.js +8 -0
- package/core/streams/appPermissions.js +19 -0
- package/core/streams/index.js +4 -0
- package/core/subscriptions/app.js +7 -0
- package/favorites/components/Item/Item.js +5 -5
- package/favorites/components/List/List.js +1 -1
- package/favorites/components/Lists/Lists.js +4 -4
- package/filter/components/PriceSlider/index.js +9 -9
- package/filter/helpers/buildFilterParamsForFetchFiltersRequest.js +9 -0
- package/filter/helpers/buildUpdatedFilters.js +1 -1
- package/filter/helpers/index.js +1 -0
- package/filter/helpers/translateFilterLabel.js +6 -0
- package/filter/index.js +1 -1
- package/filter/providers/SortProvider.helpers.js +1 -1
- package/locations/actions/fetchFulfillmentSlots.js +5 -3
- package/locations/actions/fetchInventories.js +5 -4
- package/locations/actions/fetchLocations.js +18 -3
- package/locations/actions/fetchProductInventories.js +4 -2
- package/locations/actions/fetchProductLocations.js +9 -2
- package/locations/actions/index.js +1 -1
- package/locations/actions/setUserGeolocation.js +1 -1
- package/locations/actions/setUserSearchGeolocation.js +1 -1
- package/locations/actions/submitReservation.js +2 -2
- package/locations/components/Cart/CartContextMenuChangeFulfillmentContent.js +1 -1
- package/locations/components/FulfillmentPath/FulfillmentPath.js +1 -1
- package/locations/components/FulfillmentPath/FulfillmentPathItem.js +2 -2
- package/locations/components/FulfillmentSelector/FulfillmentSelectorAddToCart.js +2 -2
- package/locations/components/FulfillmentSelector/FulfillmentSelectorAlternativeLocation.js +1 -1
- package/locations/components/FulfillmentSheet/FulfillmentSheet.js +2 -2
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +1 -1
- package/locations/components/ReserveForm/ReserveForm.js +1 -1
- package/locations/components/ReserveForm/ReserveFormPhone.js +1 -1
- package/locations/components/StockInfo/StockInfo.defaultSettings.js +1 -1
- package/locations/components/StoreFinder/StoreFinderMap.style.js +2 -2
- package/locations/components/StoreList/StoreListSearch.js +2 -2
- package/locations/locations.streams.js +1 -1
- package/locations/providers/FulfillmentProvider.js +4 -4
- package/locations/providers/StoreFinderProvider.js +1 -1
- package/locations/reducers/storage.js +3 -3
- package/locations/selectors/index.js +2 -2
- package/locations/subscriptions.js +13 -13
- package/login/components/ForgotPassword/ForgotPassword.js +1 -1
- package/orders/actions/cancelOrder.js +1 -1
- package/orders/actions/fetchOrderDetails.js +1 -1
- package/orders/constants/status.js +2 -2
- package/orders/providers/OrderDetailsPrivateProvider.js +1 -1
- package/orders/providers/OrderDetailsProvider.js +3 -3
- package/package.json +8 -8
- package/page/actions/index.js +1 -0
- package/page/components/index.js +1 -0
- package/page/constants/index.js +1 -0
- package/page/index.js +2 -4
- package/page/selectors/index.js +1 -0
- package/product/collections/index.js +1 -0
- package/product/components/Availability/Availability.connector.js +4 -5
- package/product/components/Availability/Availability.js +3 -3
- package/product/components/Characteristics/Characteristic/components/Sheet/index.js +20 -0
- package/product/components/Characteristics/Characteristic/components/SheetItem/index.js +10 -0
- package/product/components/Characteristics/Characteristic/components/SheetItem/style.js +1 -0
- package/product/components/Characteristics/Characteristic/index.js +18 -0
- package/product/components/Characteristics/Characteristic/style.js +1 -0
- package/product/components/Characteristics/Swatch/index.js +12 -0
- package/product/components/Characteristics/Swatch/style.js +1 -0
- package/product/components/Characteristics/index.js +12 -0
- package/product/components/Characteristics/transition.js +1 -0
- package/product/components/Description/index.js +2 -2
- package/product/components/EffectivityDates/helpers.js +3 -3
- package/product/components/EffectivityDates/index.js +1 -1
- package/product/components/Header/PriceStriked/connector.js +9 -0
- package/product/components/Header/PriceStriked/index.js +5 -0
- package/product/components/Header/PriceStriked/style.js +1 -0
- package/product/components/Header/Shipping/components/Label/index.js +6 -0
- package/product/components/Header/Shipping/components/Label/style.js +1 -0
- package/product/components/Header/Shipping/connector.js +9 -0
- package/product/components/Header/Shipping/index.js +5 -0
- package/product/components/Header/Shipping/mock.js +1 -0
- package/product/components/Header/Shipping/spec.js +5 -0
- package/product/components/Header/Shipping/style.js +1 -0
- package/product/components/Header/Tiers/components/Tier/index.js +6 -0
- package/product/components/Header/Tiers/components/Tier/spec.js +1 -0
- package/product/components/Header/Tiers/connector.js +10 -0
- package/product/components/Header/Tiers/index.js +5 -0
- package/product/components/Header/Tiers/spec.js +1 -0
- package/product/components/Header/Tiers/style.js +1 -0
- package/product/components/Header/index.js +1 -0
- package/product/components/MapPriceHint/index.js +1 -1
- package/product/components/Media/FeaturedMedia.js +1 -1
- package/product/components/MediaSlider/index.js +1 -1
- package/product/components/Options/components/Content/connector.js +10 -0
- package/product/components/Options/components/Content/index.js +16 -0
- package/product/components/Options/components/Content/spec.js +2 -0
- package/product/components/Options/components/Option/index.js +4 -0
- package/product/components/Options/components/TextOption/components/OptionInfo/index.js +9 -0
- package/product/components/Options/components/TextOption/components/OptionInfo/spec.js +1 -0
- package/product/components/Options/components/TextOption/components/OptionInfo/style.js +1 -0
- package/product/components/Options/components/TextOption/index.js +22 -0
- package/product/components/Options/components/TextOption/style.js +1 -0
- package/product/components/Options/index.js +5 -0
- package/product/components/OrderQuantityHint/index.js +3 -2
- package/product/components/OrderQuantityHint/style.js +1 -1
- package/product/components/PriceDifference/index.js +1 -1
- package/product/components/ProductCard/index.js +2 -2
- package/product/components/ProductCharacteristics/helpers/index.js +1 -1
- package/product/components/ProductCharacteristics/index.js +28 -12
- package/product/components/ProductDiscountBadge/spec.js +1 -1
- package/product/components/ProductGridPrice/index.js +2 -2
- package/product/components/ProductImage/index.js +15 -12
- package/product/components/ProductList/components/Item/index.js +5 -0
- package/product/components/ProductList/components/Item/style.js +2 -0
- package/product/components/ProductList/components/Iterator/index.js +5 -0
- package/product/components/ProductList/components/Iterator/style.js +1 -0
- package/product/components/ProductList/components/Layout/index.js +5 -0
- package/product/components/ProductList/components/Layout/style.js +1 -0
- package/product/components/ProductList/index.js +5 -0
- package/product/components/ProductProperties/Content.js +1 -1
- package/product/components/ProductProperties/GroupedProperties.js +1 -1
- package/product/components/ProductProperties/ListsHTML.js +1 -1
- package/product/components/ProductProperties/ProductProperties.js +1 -1
- package/product/components/ProductProperties/RowHTML.js +1 -1
- package/product/components/ProductProperties/Wrapper.js +1 -1
- package/product/components/ProductProperties/style.js +1 -1
- package/product/components/ProductProvider/connector.js +5 -0
- package/product/components/ProductProvider/index.js +4 -0
- package/product/components/ProductSlider/index.js +4 -0
- package/product/components/ProductSlider/spec.js +1 -0
- package/product/components/ProductSlider/style.js +1 -0
- package/product/components/Rating/connector.js +9 -0
- package/product/components/Rating/index.js +7 -0
- package/product/components/Rating/mock.js +5 -0
- package/product/components/Rating/spec.js +5 -0
- package/product/components/Rating/style.js +1 -0
- package/product/components/Swatch/SwatchContent.js +1 -1
- package/product/components/index.js +1 -0
- package/product/constants/index.js +1 -1
- package/product/contexts/index.js +1 -0
- package/product/helpers/index.js +2 -2
- package/product/helpers/redirects.js +1 -1
- package/product/hocs/index.js +1 -0
- package/product/hocs/withProductListEntryProduct.js +12 -0
- package/product/hooks/index.js +1 -0
- package/product/index.js +4 -11
- package/product/providers/index.js +1 -0
- package/product/selectors/product.js +13 -2
- package/product/selectors/variants.js +2 -2
- package/product/streams/index.js +1 -0
- package/push-opt-in/action-creators/index.js +1 -0
- package/push-opt-in/action-creators/optInTrigger.js +23 -0
- package/push-opt-in/action-creators/pushOptIn.js +7 -0
- package/push-opt-in/actions/index.js +1 -0
- package/push-opt-in/actions/pushOptInModal.js +8 -0
- package/push-opt-in/components/PushOptInModal/connector.js +9 -0
- package/push-opt-in/components/PushOptInModal/index.js +10 -0
- package/push-opt-in/components/PushOptInModal/push-opt-in.svg +62 -0
- package/push-opt-in/components/PushOptInModal/style.js +1 -0
- package/push-opt-in/components/index.js +1 -0
- package/push-opt-in/constants/index.js +1 -0
- package/push-opt-in/constants/optInModal.js +1 -0
- package/push-opt-in/constants/optInTrigger.js +1 -0
- package/push-opt-in/reducers/index.js +1 -0
- package/push-opt-in/reducers/optInModal.js +6 -0
- package/push-opt-in/reducers/optInTrigger.js +6 -0
- package/push-opt-in/selectors/index.js +1 -0
- package/push-opt-in/selectors/optInModal.js +8 -0
- package/push-opt-in/selectors/optInTrigger.js +5 -0
- package/push-opt-in/subscriptions/index.js +1 -0
- package/push-opt-in/subscriptions/optInTrigger.js +14 -0
- package/registration/providers/GuestRegistrationProvider.actions.js +2 -2
- package/registration/providers/GuestRegistrationProvider.js +3 -3
- package/registration/providers/RegistrationProvider.actions.js +3 -3
- package/registration/providers/RegistrationProvider.js +2 -2
- package/registration/subscriptions/index.js +1 -1
- package/reviews/actions/index.js +1 -0
- package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/index.js +1 -1
- package/reviews/components/Reviews/components/List/index.js +3 -3
- package/reviews/components/Reviews/components/List/spec.js +1 -1
- package/reviews/components/Reviews/components/RatingCount/index.js +1 -1
- package/reviews/components/Reviews/components/ReviewsInfo/index.js +1 -2
- package/reviews/components/Reviews/spec.js +1 -1
- package/reviews/components/index.js +1 -0
- package/reviews/constants/index.js +1 -0
- package/reviews/index.js +1 -7
- package/reviews/selectors/index.js +1 -0
- package/reviews/streams/index.js +1 -0
- package/scanner/action-creators/index.js +1 -0
- package/scanner/actions/index.js +1 -0
- package/scanner/classes/index.js +1 -0
- package/scanner/constants/index.js +1 -0
- package/scanner/helpers/index.js +1 -0
- package/scanner/index.js +1 -6
- package/scanner/streams/index.js +1 -0
- package/search/actions/index.js +1 -0
- package/search/constants/index.js +1 -0
- package/search/helpers/index.js +1 -0
- package/search/index.js +1 -6
- package/search/selectors/index.js +1 -0
- package/search/streams/index.js +1 -0
- package/styles/helpers/index.js +1 -0
- package/styles/helpers/initCSSCustomProperties.js +3 -3
- package/styles/helpers/setPageContentWidth.js +2 -1
- package/styles/index.js +1 -1
- package/tracking/components/CookieConsent/CookieConsentContent.js +1 -1
- package/tracking/constants/index.js +2 -1
- package/components/MessageBar/MessageBar.types.js +0 -0
- package/components/MessageBar/style.js +0 -1
- package/product/components/Availability/Availability.types.js +0 -1
- /package/page/{NotFound.js → components/NotFound.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useState,useCallback,useRef}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{RippleButton,SurroundPortals}from'@shopgate/engage/components';import{i18n
|
|
1
|
+
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useState,useCallback,useRef}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{RippleButton,SurroundPortals}from'@shopgate/engage/components';import{hasNewServices}from'@shopgate/engage/core/helpers';import{i18n}from'@shopgate/engage/core';import{appConfig}from'@shopgate/engage';import{getFavoritesLists,isInitialLoading}from'@shopgate/pwa-common-commerce/favorites/selectors';import addFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/addFavoritesList';import updateFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/updateFavoritesList';import removeFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/removeFavoritesList';import{removeFavorites}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';import addProductsToCart from'@shopgate/pwa-common-commerce/cart/actions/addProductsToCart';import{FulfillmentSheet,MULTI_LINE_RESERVE,STAGE_SELECT_STORE}from'@shopgate/engage/locations';import{openSheet}from'@shopgate/engage/locations/providers/FulfillmentProvider';import{getWishlistMode}from'@shopgate/engage/core/selectors/shopSettings';import{WISHLIST_MODE_PERSIST_ON_ADD}from'@shopgate/engage/core/constants/shopSettings';import{getPreferredLocation,getPreferredFulfillmentMethod,getUserSearch}from'@shopgate/engage/locations/selectors';import{responsiveMediaQuery}from'@shopgate/engage/styles';import{makeGetEnabledFulfillmentMethods}from'@shopgate/engage/core/config';import{fetchProductLocations}from'@shopgate/engage/locations/actions';import List from"../List";import ListsModal from"./ListsModal";import CommentDialog from"../CommentDialog";import ItemFulfillmentMethod from"../ItemFulfillmentMethod";import{FAVORITES_LIST_ADD_BUTTON,FAVORITES_LIST}from"../../constants/Portals";var _appConfig$favoritesM=appConfig.favoritesMode,_appConfig$favoritesM2=_appConfig$favoritesM===void 0?{}:_appConfig$favoritesM,hasMultipleFavoritesLists=_appConfig$favoritesM2.hasMultipleFavoritesLists;/**
|
|
2
2
|
* @param {Object} state State
|
|
3
3
|
* @param {Object} props Props
|
|
4
4
|
* @returns {Object}
|
|
@@ -8,18 +8,18 @@ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimi
|
|
|
8
8
|
*/var mapDispatchToProps=function mapDispatchToProps(dispatch){return{addList:function addList(name){return dispatch(addFavoritesList(name));},updateList:function updateList(id,name){return dispatch(updateFavoritesList(id,name));},removeList:function removeList(id){return dispatch(removeFavoritesList(id));},removeItem:function removeItem(listId,productId){return dispatch(removeFavorites(productId,false,listId));},addToCart:function addToCart(){return dispatch(addProductsToCart.apply(void 0,arguments));},fetchLocations:function fetchLocations(productId,params){return dispatch(fetchProductLocations(productId,params));}};};var styles={root:css(_defineProperty({},responsiveMediaQuery('>=md',{webOnly:true}),{margin:8})),addButton:css(_defineProperty({width:'calc(100% - 32px)',margin:16,backgroundColor:'var(--color-primary)',borderRadius:5},responsiveMediaQuery('>=md',{webOnly:true}),{width:240,"float":'right'})).toString()};/**
|
|
9
9
|
* @param {Object} props Props
|
|
10
10
|
* @returns {Object}
|
|
11
|
-
*/var FavoriteLists=function FavoriteLists(_ref){var addList=_ref.addList,updateList=_ref.updateList,removeList=_ref.removeList,_removeItem=_ref.removeItem,addToCart=_ref.addToCart,preferredFulfillmentMethod=_ref.preferredFulfillmentMethod,preferredLocation=_ref.preferredLocation,wishlistMode=_ref.wishlistMode,lists=_ref.lists,isInitializing=_ref.isInitializing,shopFulfillmentMethods=_ref.shopFulfillmentMethods,userSearch=_ref.userSearch,fetchLocations=_ref.fetchLocations
|
|
11
|
+
*/var FavoriteLists=function FavoriteLists(_ref){var addList=_ref.addList,updateList=_ref.updateList,removeList=_ref.removeList,_removeItem=_ref.removeItem,addToCart=_ref.addToCart,preferredFulfillmentMethod=_ref.preferredFulfillmentMethod,preferredLocation=_ref.preferredLocation,wishlistMode=_ref.wishlistMode,lists=_ref.lists,isInitializing=_ref.isInitializing,shopFulfillmentMethods=_ref.shopFulfillmentMethods,userSearch=_ref.userSearch,fetchLocations=_ref.fetchLocations;// Add to cart state.
|
|
12
12
|
var promiseRef=useRef(null);var _useState=useState(null),_useState2=_slicedToArray(_useState,2),activeProductId=_useState2[0],setActiveProductId=_useState2[1];var _useState3=useState([]),_useState4=_slicedToArray(_useState3,2),fulfillmentMethods=_useState4[0],setFulfillmentMethods=_useState4[1];var _useState5=useState(null),_useState6=_slicedToArray(_useState5,2),fulfillmentMethod=_useState6[0],setFulfillmentMethod=_useState6[1];var _useState7=useState(false),_useState8=_slicedToArray(_useState7,2),foMethodChooser=_useState8[0],setFOMethodChooser=_useState8[1];var handleAddToCartWithMethod=useCallback(function(method){// Hide modal if visible.
|
|
13
13
|
setFOMethodChooser(false);// Handle cancellation.
|
|
14
14
|
if(!method){return;}setFulfillmentMethod(method);// Direct ship.
|
|
15
15
|
if(method==='directShip'){addToCart([{productId:activeProductId,quantity:1}]);promiseRef.current.resolve();return;}// Open the sheet
|
|
16
16
|
fetchLocations(activeProductId,userSearch);setTimeout(function(){openSheet({callback:function callback(state){var _promiseRef$current2;if(state){var _promiseRef$current;return(_promiseRef$current=promiseRef.current)===null||_promiseRef$current===void 0?void 0:_promiseRef$current.resolve();}return(_promiseRef$current2=promiseRef.current)===null||_promiseRef$current2===void 0?void 0:_promiseRef$current2.reject();},fulfillmentPath:MULTI_LINE_RESERVE,stage:STAGE_SELECT_STORE});},10);},[activeProductId,addToCart,fetchLocations,userSearch]);var handleAddToCart=useCallback(function(listId,product){var quantity=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;// Create promise to inform add to cart button when ready.
|
|
17
17
|
var promise=new Promise(function(_resolve,reject){promiseRef.current={resolve:function resolve(){// Remove item from wishlist after adding to cart.
|
|
18
|
-
if(wishlistMode!==WISHLIST_MODE_PERSIST_ON_ADD){_removeItem(listId,product.id);}_resolve();},reject:reject};})
|
|
18
|
+
if(wishlistMode!==WISHLIST_MODE_PERSIST_ON_ADD){_removeItem(listId,product.id);}_resolve();},reject:reject};});if(!hasNewServices()){addToCart([{productId:product.id,quantity:quantity}]);promiseRef.current.resolve();return promise;}// Get location.
|
|
19
19
|
var activeLocation=null;if(preferredLocation){activeLocation=preferredLocation;}// Get fulfillment method that is both active for location and product.
|
|
20
20
|
var activeFulfillmentMethod=preferredFulfillmentMethod||fulfillmentMethod;var availableFulfillmentMethods=(shopFulfillmentMethods===null||shopFulfillmentMethods===void 0?void 0:shopFulfillmentMethods.filter(function(s){return product.fulfillmentMethods.indexOf(s)!==-1;}))||[];if(activeLocation&&!activeFulfillmentMethod&&availableFulfillmentMethods.length===1){var _availableFulfillment=_slicedToArray(availableFulfillmentMethods,1);activeFulfillmentMethod=_availableFulfillment[0];}// If all options are already configured immediately add it to the cart.
|
|
21
21
|
if(activeFulfillmentMethod&&activeLocation){addToCart([{productId:product.id,quantity:quantity,fulfillment:{method:activeFulfillmentMethod,location:{code:activeLocation.code,name:activeLocation.name||''}}}]);promiseRef.current.resolve();return promise;}// Location not set but FO method is set.
|
|
22
22
|
setActiveProductId(product.id);if(activeFulfillmentMethod&&!activeLocation){handleAddToCartWithMethod(activeFulfillmentMethod);return promise;}if(!activeFulfillmentMethod&&!activeFulfillmentMethod){// Long path is required <- fo method and location unset.
|
|
23
23
|
setFulfillmentMethods(shopFulfillmentMethods);setFOMethodChooser(true);return promise;}// Short path is required <- fo method is unset.
|
|
24
24
|
setFulfillmentMethods(availableFulfillmentMethods);setFOMethodChooser(true);return promise;},[addToCart,fulfillmentMethod,handleAddToCartWithMethod,preferredFulfillmentMethod,preferredLocation,_removeItem,shopFulfillmentMethods,wishlistMode]);var handleMethodClose=useCallback(function(){setFOMethodChooser(false);promiseRef.current.reject();},[]);// Modal for renaming and adding.
|
|
25
|
-
var _useState9=useState(false),_useState10=_slicedToArray(_useState9,2),modalOpen=_useState10[0],setModalOpen=_useState10[1];var _useState11=useState(null),_useState12=_slicedToArray(_useState11,2),modalType=_useState12[0],setModalType=_useState12[1];var _useState13=useState(null),_useState14=_slicedToArray(_useState13,2),modalTarget=_useState14[0],setModalTarget=_useState14[1];var openAddModal=useCallback(function(){setModalOpen(true);setModalType('add_list');setModalTarget(null);},[]);var openRenameModal=useCallback(function(code){setModalOpen(true);setModalType('rename_list');setModalTarget(code);},[]);var closeModal=useCallback(function(){setModalOpen(false);setModalType(null);setModalTarget(null);},[]);var confirmModal=useCallback(function(name){if(modalType==='add_list'){addList(name);}else if(modalType==='rename_list'){updateList(modalTarget,name);}closeModal();},[addList,closeModal,modalTarget,modalType,updateList]);if(isInitializing){return null;}return React.createElement("div",{className:styles.root},lists.map(function(list){return React.createElement(SurroundPortals,{key:list.id,portalName:FAVORITES_LIST,portalProps:list},React.createElement(List,{id:list.id,name:list.name,rename:openRenameModal,remove:function remove(){return removeList(list.id);},removeItem:function removeItem(productId){return _removeItem(list.id,productId);},addToCart:function addToCart(product,quantity){return handleAddToCart(list.id,product,quantity);}}));}),modalOpen?React.createElement(ListsModal,{type:modalType,onDismiss:closeModal,onConfirm:confirmModal}):null,activeProductId?React.createElement(FulfillmentSheet,{productId:activeProductId,fulfillmentMethod:fulfillmentMethod}):null,React.createElement(CommentDialog,null),React.createElement(ItemFulfillmentMethod,{isOpen:foMethodChooser,methods:fulfillmentMethods,onSelect:handleAddToCartWithMethod,onClose:handleMethodClose}),React.createElement(SurroundPortals,{portalName:FAVORITES_LIST_ADD_BUTTON},
|
|
25
|
+
var _useState9=useState(false),_useState10=_slicedToArray(_useState9,2),modalOpen=_useState10[0],setModalOpen=_useState10[1];var _useState11=useState(null),_useState12=_slicedToArray(_useState11,2),modalType=_useState12[0],setModalType=_useState12[1];var _useState13=useState(null),_useState14=_slicedToArray(_useState13,2),modalTarget=_useState14[0],setModalTarget=_useState14[1];var openAddModal=useCallback(function(){setModalOpen(true);setModalType('add_list');setModalTarget(null);},[]);var openRenameModal=useCallback(function(code){setModalOpen(true);setModalType('rename_list');setModalTarget(code);},[]);var closeModal=useCallback(function(){setModalOpen(false);setModalType(null);setModalTarget(null);},[]);var confirmModal=useCallback(function(name){if(modalType==='add_list'){addList(name);}else if(modalType==='rename_list'){updateList(modalTarget,name);}closeModal();},[addList,closeModal,modalTarget,modalType,updateList]);if(isInitializing){return null;}return React.createElement("div",{className:styles.root},lists.map(function(list){return React.createElement(SurroundPortals,{key:list.id,portalName:FAVORITES_LIST,portalProps:list},React.createElement(List,{id:list.id,name:list.name,rename:openRenameModal,remove:function remove(){return removeList(list.id);},removeItem:function removeItem(productId){return _removeItem(list.id,productId);},addToCart:function addToCart(product,quantity){return handleAddToCart(list.id,product,quantity);}}));}),modalOpen?React.createElement(ListsModal,{type:modalType,onDismiss:closeModal,onConfirm:confirmModal}):null,activeProductId?React.createElement(FulfillmentSheet,{productId:activeProductId,fulfillmentMethod:fulfillmentMethod}):null,React.createElement(CommentDialog,null),React.createElement(ItemFulfillmentMethod,{isOpen:foMethodChooser,methods:fulfillmentMethods,onSelect:handleAddToCartWithMethod,onClose:handleMethodClose}),React.createElement(SurroundPortals,{portalName:FAVORITES_LIST_ADD_BUTTON},hasNewServices()||hasMultipleFavoritesLists?React.createElement(RippleButton,{type:"primary",className:styles.addButton,onClick:openAddModal,disabled:false},i18n.text('favorites.add_list')):null));};FavoriteLists.defaultProps={lists:[],userSearch:{},preferredFulfillmentMethod:null,shopFulfillmentMethods:[],preferredLocation:null,isInitializing:true};export default connect(makeMapStateToProps,mapDispatchToProps)(FavoriteLists);
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function
|
|
1
|
+
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import isEqual from'lodash/isEqual';import{RangeSlider}from'@shopgate/engage/components';import{FilterItem}from'@shopgate/engage/filter';import Label from"./components/Label";import styles from"./style";/**
|
|
2
2
|
* The PriceSlider component.
|
|
3
|
-
*/var PriceSlider=/*#__PURE__*/function(_PureComponent){
|
|
3
|
+
*/var PriceSlider=/*#__PURE__*/function(_PureComponent){/**
|
|
4
4
|
* The constructor.
|
|
5
5
|
* @param {Object} props The component props.
|
|
6
|
-
*/function PriceSlider(props){var
|
|
7
|
-
* Updates the value state.
|
|
8
|
-
* @param {Object} nextProps The next component props.
|
|
9
|
-
*/_createClass(PriceSlider,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(!isEqual(nextProps.value,this.props.value)){this.setState({value:nextProps.value});}}/**
|
|
6
|
+
*/function PriceSlider(props){var _this2;_classCallCheck(this,PriceSlider);_this2=_callSuper(this,PriceSlider,[props]);/**
|
|
10
7
|
* The callback function that is given to the RangeSlider.
|
|
11
8
|
* @param {Array} value The lower and upper boundary of the set range.
|
|
12
|
-
*/},{
|
|
9
|
+
*/_defineProperty(_this2,"onChange",function(value){var roundedValue=[Math.floor(value[0]),Math.ceil(value[1])];_this2.setState({value:value});_this2.props.onChange(_this2.props.id,roundedValue);});var initialValue=props.value||[props.min,props.max];_this2.state={value:initialValue};return _this2;}/**
|
|
10
|
+
* Updates the value state.
|
|
11
|
+
* @param {Object} nextProps The next component props.
|
|
12
|
+
*/_inherits(PriceSlider,_PureComponent);return _createClass(PriceSlider,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(!isEqual(nextProps.value,this.props.value)){this.setState({value:nextProps.value});}}},{key:"render",value:/**
|
|
13
13
|
* Renders the component (template).
|
|
14
14
|
* @returns {JSX}
|
|
15
|
-
*/
|
|
15
|
+
*/function render(){var _this$props=this.props,min=_this$props.min,max=_this$props.max;/**
|
|
16
16
|
* The min and max price need to be rounded before they are passed to the I18n component,
|
|
17
17
|
* since it rounds to the full nearest number when fractions are deactivated.
|
|
18
18
|
*/var priceMin=Math.floor(this.state.value[0]/100);var priceMax=Math.ceil(this.state.value[1]/100);/**
|
|
19
19
|
* Calculate the necessary maximum size for the price value.
|
|
20
20
|
* The size is 2 characters more than the max possible number length
|
|
21
21
|
* to reserve space for the currency symbol and a little spacing around.
|
|
22
|
-
*/var priceLength="".concat((max/100).toString().length+2,"ch");return React.createElement(FilterItem,null,React.createElement("div",{className:styles.wrapper,"data-test-id":"priceRangeSlider"},React.createElement(Label,{priceLength:priceLength,priceMax:priceMax,priceMin:priceMin,onChange:this.onChange}),React.createElement(RangeSlider,{classNames:styles.rangeSlider,easing:this.props.useLinearEasing?'linear':'exponential',factor:3,max:max,min:min,onChange:this.onChange,value:this.state.value})));}}]);
|
|
22
|
+
*/var priceLength="".concat((max/100).toString().length+2,"ch");return React.createElement(FilterItem,null,React.createElement("div",{className:styles.wrapper,"data-test-id":"priceRangeSlider"},React.createElement(Label,{priceLength:priceLength,priceMax:priceMax,priceMin:priceMin,onChange:this.onChange}),React.createElement(RangeSlider,{classNames:styles.rangeSlider,easing:this.props.useLinearEasing?'linear':'exponential',factor:3,max:max,min:min,onChange:this.onChange,value:this.state.value})));}}]);}(PureComponent);_defineProperty(PriceSlider,"defaultProps",{useLinearEasing:false,max:100,min:0,onChange:function onChange(){},value:null});export default PriceSlider;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var _excluded=["useForFetchFilters"],_excluded2=["useForFetchFilters"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import isPlainObject from'lodash/isPlainObject';/**
|
|
2
|
+
* Creates the filter params to be used with a fetchFilters request.
|
|
3
|
+
* @param {Object} filters All configured filters
|
|
4
|
+
* @return {Object}
|
|
5
|
+
*/var buildFilterParamsForFetchFiltersRequest=function buildFilterParamsForFetchFiltersRequest(){var filters=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(!isPlainObject(filters)){return null;}var sanitizedFilters=Object.keys(filters).reduce(function(acc,filterId){var filter=filters[filterId];if(filter===null||filter===void 0?void 0:filter.useForFetchFilters){// flag is set on filter level - remove flag and add to the result object
|
|
6
|
+
var useForFetchFilters=filter.useForFetchFilters,sanitizedFilter=_objectWithoutProperties(filter,_excluded);acc[filterId]=sanitizedFilter;}else if(Array.isArray(filter.value)){// check for flags on value level
|
|
7
|
+
var _sanitizedFilter=_extends({},filter,{value:filter.value.reduce(function(valueAcc,currentValue){var useForFetchFilters=currentValue.useForFetchFilters,sanitizedValue=_objectWithoutProperties(currentValue,_excluded2);if(currentValue===null||currentValue===void 0?void 0:currentValue.useForFetchFilters){// flag is set on value level - consider value for the results object
|
|
8
|
+
valueAcc.push(sanitizedValue);}return valueAcc;},[])});if(_sanitizedFilter.value.length){// only add the filter when it has values that are supposed to be used for a filter request
|
|
9
|
+
acc[filterId]=_sanitizedFilter;}}return acc;},{});return Object.keys(sanitizedFilters).length?sanitizedFilters:null;};export default buildFilterParamsForFetchFiltersRequest;
|
|
@@ -3,6 +3,6 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
|
|
|
3
3
|
* @param {Object} updatedFilters The filters after they where modified.
|
|
4
4
|
* @return {Object}
|
|
5
5
|
*/export default function buildUpdatedFilters(initialFilters,updatedFilters){// Create a set of active filters by combining state and updatedFilters.
|
|
6
|
-
var activeFilters=_extends({},initialFilters,{},updatedFilters);return Object.keys(activeFilters).reduce(function(result,filterId){var filter=activeFilters[filterId];if(filterId==='display_amount'){var _filter$
|
|
6
|
+
var activeFilters=_extends({},initialFilters,{},updatedFilters);return Object.keys(activeFilters).reduce(function(result,filterId){var filter=activeFilters[filterId];if(filterId==='display_amount'){var _filter$value2=_slicedToArray(filter.value,2),min=_filter$value2[0],max=_filter$value2[1];// Take care that the values for the display amount reflect the state of the price slider.
|
|
7
7
|
filter.value=[Math.floor(min/100)*100,Math.ceil(max/100)*100];}if(filter.value.length){// Only add filters with selected values.
|
|
8
8
|
return _extends({},result===null?{}:result,_defineProperty({},filterId,filter));}return result;},null);}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as buildInitialFilters}from"./buildInitialFilters";export{default as buildUpdatedFilters}from"./buildUpdatedFilters";export{default as buildFilterParamsForFetchFiltersRequest}from"./buildFilterParamsForFetchFiltersRequest";export{translateFilterLabel}from"./translateFilterLabel";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{i18n}from"../../core/helpers/i18n";/**
|
|
2
|
+
* Translate filter label
|
|
3
|
+
* @param {Object} id filter id.
|
|
4
|
+
* @param {Object} label filter label.
|
|
5
|
+
* @returns {Object}
|
|
6
|
+
*/export function translateFilterLabel(id,label){return i18n.textWithDefault("filter.label.".concat(id),label);}
|
package/filter/index.js
CHANGED
|
@@ -4,4 +4,4 @@ export*from'@shopgate/pwa-common-commerce/filter/constants/index';export*from'@s
|
|
|
4
4
|
export*from'@shopgate/pwa-common-commerce/filter/selectors';// STREAMS
|
|
5
5
|
export*from'@shopgate/pwa-common-commerce/filter/streams';// COMPONENTS
|
|
6
6
|
export{default as FilterItem}from"./components/FilterItem";export{default as PriceSlider}from"./components/PriceSlider";// HELPERS
|
|
7
|
-
export
|
|
7
|
+
export*from"./helpers";export{SORT_ORDER_RELEVANCE,SORT_ORDER_PRICE_ASC,SORT_ORDER_PRICE_DESC,SORT_ORDER_NAME_ASC,SORT_ORDER_NAME_DESC,SORT_ORDER_RANK_ASC,SORT_ORDER_RANK_DESC,SORT_SCOPE_CATEGORY,SORT_SCOPE_SEARCH}from"./constants";export{makeExtendedSortOptionsSupported,makeGetDefaultSortOrder}from"./selectors";export{SortProvider}from"./providers";export{withSort}from"./hocs";export{useSort}from"./hooks";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{SORT_ORDER_RELEVANCE,SORT_ORDER_PRICE_ASC,SORT_ORDER_PRICE_DESC,SORT_ORDER_NAME_ASC,SORT_ORDER_NAME_DESC,SORT_ORDER_RANK_ASC,SORT_ORDER_RANK_DESC}from"../constants";var labelMapping=_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},SORT_ORDER_RELEVANCE,'filter.sort.most_popular'),SORT_ORDER_PRICE_ASC,'filter.sort.price_asc'),SORT_ORDER_PRICE_DESC,'filter.sort.price_desc'),SORT_ORDER_NAME_ASC,'filter.sort.name_asc'),SORT_ORDER_NAME_DESC,'filter.sort.name_desc'),SORT_ORDER_RANK_ASC,'filter.sort.rank_asc'),SORT_ORDER_RANK_DESC,'filter.sort.rank_desc');// Sort options for the products extension
|
|
2
2
|
var defaultOptions=[SORT_ORDER_RELEVANCE,SORT_ORDER_PRICE_DESC,SORT_ORDER_PRICE_ASC];// Sort options for the catalog extension
|
|
3
3
|
var extendedOptions=[SORT_ORDER_NAME_ASC,SORT_ORDER_NAME_DESC,SORT_ORDER_RANK_ASC,SORT_ORDER_RANK_DESC,SORT_ORDER_PRICE_ASC,SORT_ORDER_PRICE_DESC];/**
|
|
4
4
|
* Creates a list of available sort options for the current sorting scope
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{FETCH_FULFILLMENT_SLOTS_ERROR,FETCH_FULFILLMENT_SLOTS_SUCCESS}from"../constants
|
|
2
|
-
*
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{mutable}from'@shopgate/pwa-common/helpers/redux';import{FETCH_FULFILLMENT_SLOTS_ERROR,FETCH_FULFILLMENT_SLOTS_SUCCESS}from"../constants";/**
|
|
2
|
+
* Fetches fulfillment slots of a location
|
|
3
|
+
* @param {Object} params Function params
|
|
4
|
+
* @param {string} params.locationCode A location code
|
|
3
5
|
* @returns {Function} A redux thunk.
|
|
4
|
-
*/function fetchFulfillmentSlots(_ref){var locationCode=_ref.locationCode;return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var request,
|
|
6
|
+
*/function fetchFulfillmentSlots(_ref){var locationCode=_ref.locationCode;return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var request,_ref4,fulfillmentSlots;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:request=new PipelineRequest('shopgate.storefront.getFulfillmentSlots').setInput({locationCode:locationCode}).dispatch();_context.prev=1;_context.next=4;return request;case 4:_ref4=_context.sent;fulfillmentSlots=_ref4.fulfillmentSlots;dispatch({type:FETCH_FULFILLMENT_SLOTS_SUCCESS,locationCode:locationCode,fulfillmentSlots:fulfillmentSlots});_context.next=12;break;case 9:_context.prev=9;_context.t0=_context["catch"](1);dispatch({type:FETCH_FULFILLMENT_SLOTS_ERROR,locationCode:locationCode});case 12:return _context.abrupt("return",request);case 13:case"end":return _context.stop();}},_callee,null,[[1,9]]);}));return function(_x){return _ref2.apply(this,arguments);};}());}/** @mixes {MutableFunction} */export default mutable(fetchFulfillmentSlots);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import{logger}from'@shopgate/pwa-core/helpers';import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{requestInventories,receiveInventories,errorInventories}from"../action-creators";import{SHOPGATE_STOREFRONT_GET_INVENTORIES}from"../constants";import{getPreferredLocation}from"../selectors";/**
|
|
2
|
-
*
|
|
3
|
-
* @param {string
|
|
1
|
+
import{logger}from'@shopgate/pwa-core/helpers';import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{mutable}from'@shopgate/pwa-common/helpers/redux';import{requestInventories,receiveInventories,errorInventories}from"../action-creators";import{SHOPGATE_STOREFRONT_GET_INVENTORIES}from"../constants";import{getPreferredLocation}from"../selectors";/**
|
|
2
|
+
* Fetches location inventory for a list of products.
|
|
3
|
+
* @param {string[]} productCodes The product IDs to fetch inventories for.
|
|
4
|
+
* @param {string} [locationCode] A location code
|
|
4
5
|
* @returns {Function} A redux thunk.
|
|
5
|
-
*/function fetchInventories(productCodes){var locationCode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;return function(dispatch,getState){var _getPreferredLocation;if(!productCodes||!productCodes.length){return;}var state=getState();var locationFilter=locationCode||((_getPreferredLocation=getPreferredLocation(state))===null||_getPreferredLocation===void 0?void 0:_getPreferredLocation.code);if(!locationFilter){return;}var filters={products:productCodes.map(function(productCode){return{productCode:productCode,locationCode:locationFilter};})};dispatch(requestInventories(productCodes,filters.locationCodes));var request=new PipelineRequest(SHOPGATE_STOREFRONT_GET_INVENTORIES).setInput(filters).dispatch();request.then(function(result){dispatch(receiveInventories(result.productInventories));})["catch"](function(error){logger.error(error);dispatch(errorInventories(productCodes,error));});return request;};}export default fetchInventories;
|
|
6
|
+
*/function fetchInventories(productCodes){var locationCode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;return function(dispatch,getState){var _getPreferredLocation;if(!productCodes||!productCodes.length){return undefined;}var state=getState();var locationFilter=locationCode||((_getPreferredLocation=getPreferredLocation(state))===null||_getPreferredLocation===void 0?void 0:_getPreferredLocation.code);if(!locationFilter){return undefined;}var filters={products:productCodes.map(function(productCode){return{productCode:productCode,locationCode:locationFilter};})};dispatch(requestInventories(productCodes,filters.locationCodes));var request=new PipelineRequest(SHOPGATE_STOREFRONT_GET_INVENTORIES).setInput(filters).dispatch();request.then(function(result){dispatch(receiveInventories(result.productInventories));})["catch"](function(error){logger.error(error);dispatch(errorInventories(productCodes,error));});return request;};}/** @mixes {MutableFunction} */export default mutable(fetchInventories);
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import{logger}from'@shopgate/pwa-core/helpers';import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{requestLocations,receiveLocations,errorLocations}from"../action-creators";import{SHOPGATE_STOREFRONT_GET_LOCATIONS}from"../constants";/**
|
|
2
|
-
*
|
|
1
|
+
import{logger}from'@shopgate/pwa-core/helpers';import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{mutable}from'@shopgate/pwa-common/helpers/redux';import{requestLocations,receiveLocations,errorLocations}from"../action-creators";import{SHOPGATE_STOREFRONT_GET_LOCATIONS}from"../constants";/**
|
|
2
|
+
* Returns a list of locations based on search options & defaults. Including geographical radial
|
|
3
|
+
* distance & other merchant configurations
|
|
4
|
+
* @param {Object} params Function params
|
|
5
|
+
* @param {string} [params.postalCode] A postal code
|
|
6
|
+
* @param {string} [params.countryCode] Indicates to which country the postal code belongs.
|
|
7
|
+
* Is required if the postalCode parameter is set
|
|
8
|
+
* @param {Object} [params.geolocation] A geolocation object
|
|
9
|
+
* @param {string} params.geolocation.longitude Longitude to search by coordinates. Works only in
|
|
10
|
+
* combination with radius and latitude.
|
|
11
|
+
* @param {string} params.geolocation.latitude Latitude to search by coordinates. Works only in
|
|
12
|
+
* combination with radius and longitude.
|
|
13
|
+
* @param {number} [params.radius] Used only with geolocation.longitude & geolocation.latitude.
|
|
14
|
+
* @param {string[]} [params.codes] Search by location codes. This cannot be combined with
|
|
15
|
+
* coordinate search or a postal code search
|
|
16
|
+
* @param {boolean} [params.enableInLocationFinder=false] When set to `true` only locations are
|
|
17
|
+
* returned which are enabled for the location finder.
|
|
3
18
|
* @returns {Function} A redux thunk.
|
|
4
|
-
*/function fetchLocations(params){return function(dispatch){dispatch(requestLocations(params));var filters={countryCode:params.countryCode};if(params.geolocation){filters.longitude=params.geolocation.longitude;filters.latitude=params.geolocation.latitude;}if(params.postalCode){filters.postalCode=params.postalCode;}if(params.enableInLocationFinder){filters.enableInLocationFinder=params.enableInLocationFinder;}if(params.radius){filters.radius=params.radius;}if(params.codes){filters.codes=params.codes;}var request=new PipelineRequest(SHOPGATE_STOREFRONT_GET_LOCATIONS).setInput(filters).dispatch();request.then(function(result){dispatch(receiveLocations(filters,result.locations));})["catch"](function(error){logger.error(error);dispatch(errorLocations(params,error));});return request;};}export default fetchLocations;
|
|
19
|
+
*/function fetchLocations(params){return function(dispatch){dispatch(requestLocations(params));var filters={countryCode:params.countryCode};if(params.geolocation){filters.longitude=params.geolocation.longitude;filters.latitude=params.geolocation.latitude;}if(params.postalCode){filters.postalCode=params.postalCode;}if(params.enableInLocationFinder){filters.enableInLocationFinder=params.enableInLocationFinder;}if(params.radius){filters.radius=params.radius;}if(params.codes){filters.codes=params.codes;}var request=new PipelineRequest(SHOPGATE_STOREFRONT_GET_LOCATIONS).setInput(filters).dispatch();request.then(function(result){dispatch(receiveLocations(filters,result.locations));})["catch"](function(error){logger.error(error);dispatch(errorLocations(params,error));});return request;};}/** @mixes {MutableFunction} */export default mutable(fetchLocations);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import{logger}from'@shopgate/pwa-core/helpers';import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{requestProductInventories,receiveProductInventories,errorProductInventories}from"../action-creators";import{SHOPGATE_STOREFRONT_GET_PRODUCT_INVENTORIES}from"../constants";/**
|
|
1
|
+
import{logger}from'@shopgate/pwa-core/helpers';import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{mutable}from'@shopgate/pwa-common/helpers/redux';import{requestProductInventories,receiveProductInventories,errorProductInventories}from"../action-creators";import{SHOPGATE_STOREFRONT_GET_PRODUCT_INVENTORIES}from"../constants";/**
|
|
2
|
+
* Fetches inventories for a product
|
|
2
3
|
* @param {string} productCode The product ID to fetch inventories for.
|
|
3
4
|
* @param {Object} [params={}] Optional params for the inventories request.
|
|
5
|
+
* @param {string[]} params.locationCodes A list of location codes.
|
|
4
6
|
* @returns {Function} A redux thunk.
|
|
5
|
-
*/function fetchProductInventories(productCode){var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return function(dispatch){var filters={locationCodes:params.locationCodes,productCode:productCode};dispatch(requestProductInventories(productCode,filters.locationCodes));var request=new PipelineRequest(SHOPGATE_STOREFRONT_GET_PRODUCT_INVENTORIES).setInput(filters).dispatch();request.then(function(result){dispatch(receiveProductInventories(productCode,filters.locationCodes,result.inventories));})["catch"](function(error){logger.error(error);dispatch(errorProductInventories(productCode,error.code));});return request;};}export default fetchProductInventories;
|
|
7
|
+
*/function fetchProductInventories(productCode){var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return function(dispatch){var filters={locationCodes:params.locationCodes,productCode:productCode};dispatch(requestProductInventories(productCode,filters.locationCodes));var request=new PipelineRequest(SHOPGATE_STOREFRONT_GET_PRODUCT_INVENTORIES).setInput(filters).dispatch();request.then(function(result){dispatch(receiveProductInventories(productCode,filters.locationCodes,result.inventories));})["catch"](function(error){logger.error(error);dispatch(errorProductInventories(productCode,error.code));});return request;};}/** @mixes {MutableFunction} */export default mutable(fetchProductInventories);
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{requestProductLocations,receiveProductLocations,errorProductLocations}from"../action-creators";import{SHOPGATE_STOREFRONT_GET_PRODUCT_LOCATIONS}from"../constants";/**
|
|
1
|
+
var _excluded=["postalCode","geolocation"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{mutable}from'@shopgate/pwa-common/helpers/redux';import{requestProductLocations,receiveProductLocations,errorProductLocations}from"../action-creators";import{SHOPGATE_STOREFRONT_GET_PRODUCT_LOCATIONS}from"../constants";/**
|
|
2
|
+
* Returns a list of locations and item availability for a given product
|
|
2
3
|
* @param {string} productCode The product ID to fetch locations for.
|
|
3
4
|
* @param {Object} [params={}] Optional params for the location request.
|
|
5
|
+
* @param {string} [params.postalCode] A postal code
|
|
6
|
+
* @param {Object} [params.geolocation] A geolocation object
|
|
7
|
+
* @param {string} params.geolocation.longitude Longitude to search by coordinates. Works only in
|
|
8
|
+
* combination with latitude.
|
|
9
|
+
* @param {string} params.geolocation.latitude Latitude to search by coordinates. Works only in
|
|
10
|
+
* combination with longitude.
|
|
4
11
|
* @returns {Function} A redux thunk.
|
|
5
|
-
*/function fetchProductLocations(productCode){var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return function(dispatch){var postalCode=params.postalCode,geolocation=params.geolocation,restParams=_objectWithoutProperties(params,
|
|
12
|
+
*/function fetchProductLocations(productCode){var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return function(dispatch){var postalCode=params.postalCode,geolocation=params.geolocation,restParams=_objectWithoutProperties(params,_excluded);var filters=_extends({productCode:productCode},restParams);if(geolocation){filters.longitude=params.geolocation.longitude;filters.latitude=params.geolocation.latitude;}if(postalCode){filters.postalCode=params.postalCode;}dispatch(requestProductLocations(productCode,filters));var request=new PipelineRequest(SHOPGATE_STOREFRONT_GET_PRODUCT_LOCATIONS).setInput(filters).dispatch();request.then(function(result){dispatch(receiveProductLocations(productCode,filters,result.locations));})["catch"](function(error){dispatch(errorProductLocations(productCode,error.code));});return request;};}/** @mixes {MutableFunction} */export default mutable(fetchProductLocations);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{SET_LOCATIONS_PENDING}from"../constants/ActionTypes";export{default as fetchLocations}from"./fetchLocations";export{default as fetchProductLocations}from"./fetchProductLocations";export{default as submitReservation}from"./submitReservation";export{default as setUserSearchGeolocation}from"./setUserSearchGeolocation";export{default as setUserGeolocation}from"./setUserGeolocation";/**
|
|
1
|
+
import{SET_LOCATIONS_PENDING}from"../constants/ActionTypes";export{default as fetchFulfillmentSlots}from"./fetchFulfillmentSlots";export{default as fetchInventories}from"./fetchInventories";export{default as fetchLocations}from"./fetchLocations";export{default as fetchProductInventories}from"./fetchProductInventories";export{default as fetchProductLocations}from"./fetchProductLocations";export{default as submitReservation}from"./submitReservation";export{default as setUserSearchGeolocation}from"./setUserSearchGeolocation";export{default as setUserGeolocation}from"./setUserGeolocation";/**
|
|
2
2
|
* Sets pending state of locations
|
|
3
3
|
* @param {boolean} value Value
|
|
4
4
|
* @returns {Object}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{getGeolocation,shouldFetchData}from'@shopgate/engage/core';import{setUserGeolocation}from"../action-creators";import{getUserGeolocation}from"../selectors";export default(function(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref$silent=_ref.silent,silent=_ref$silent===void 0?false:_ref$silent,_ref$useFallback=_ref.useFallback,useFallback=_ref$useFallback===void 0?false:_ref$useFallback;return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch,getState){var geolocation;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{getGeolocation,shouldFetchData}from'@shopgate/engage/core';import{setUserGeolocation}from"../action-creators";import{getUserGeolocation}from"../selectors";export default(function(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref$silent=_ref.silent,silent=_ref$silent===void 0?false:_ref$silent,_ref$useFallback=_ref.useFallback,useFallback=_ref$useFallback===void 0?false:_ref$useFallback;return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch,getState){var geolocation;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:geolocation=getUserGeolocation(getState());if(shouldFetchData(geolocation)){_context.next=3;break;}return _context.abrupt("return",Promise.resolve(geolocation));case 3:_context.prev=3;_context.next=6;return dispatch(getGeolocation({useSettingsModal:!silent,requestPermissions:!useFallback}));case 6:geolocation=_context.sent;dispatch(setUserGeolocation(geolocation,silent));return _context.abrupt("return",geolocation);case 11:_context.prev=11;_context.t0=_context["catch"](3);return _context.abrupt("return",null);case 14:case"end":return _context.stop();}},_callee,null,[[3,11]]);}));return function(_x,_x2){return _ref2.apply(this,arguments);};}());});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{getGeolocation}from'@shopgate/engage/core';import setUserSearchGeolocation from"../action-creators/setUserSearchGeolocation";export default(function(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref$silent=_ref.silent,silent=_ref$silent===void 0?false:_ref$silent,_ref$useFallback=_ref.useFallback,useFallback=_ref$useFallback===void 0?false:_ref$useFallback,_ref$productId=_ref.productId,productId=_ref$productId===void 0?null:_ref$productId,_ref$isStoreFinder=_ref.isStoreFinder,isStoreFinder=_ref$isStoreFinder===void 0?false:_ref$isStoreFinder;return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var geolocation;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{getGeolocation}from'@shopgate/engage/core';import setUserSearchGeolocation from"../action-creators/setUserSearchGeolocation";export default(function(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref$silent=_ref.silent,silent=_ref$silent===void 0?false:_ref$silent,_ref$useFallback=_ref.useFallback,useFallback=_ref$useFallback===void 0?false:_ref$useFallback,_ref$productId=_ref.productId,productId=_ref$productId===void 0?null:_ref$productId,_ref$isStoreFinder=_ref.isStoreFinder,isStoreFinder=_ref$isStoreFinder===void 0?false:_ref$isStoreFinder;return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var geolocation;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return dispatch(getGeolocation({useSettingsModal:!silent,requestPermissions:!useFallback}));case 3:geolocation=_context.sent;dispatch(setUserSearchGeolocation(geolocation,productId,isStoreFinder,silent));return _context.abrupt("return",geolocation);case 8:_context.prev=8;_context.t0=_context["catch"](0);return _context.abrupt("return",null);case 11:case"end":return _context.stop();}},_callee,null,[[0,8]]);}));return function(_x){return _ref2.apply(this,arguments);};}());});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{logger}from'@shopgate/pwa-core/helpers';import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{submitReservationRequest,submitReservationSuccess,submitReservationError}from"../action-creators";import{SHOPGATE_STOREFRONT_CREATE_ORDER}from"../constants";import createOrder from"../helpers/createOrder";/**
|
|
1
|
+
import{logger}from'@shopgate/pwa-core/helpers';import PipelineRequest from'@shopgate/pwa-core/classes/PipelineRequest';import{mutable}from'@shopgate/pwa-common/helpers/redux';import{submitReservationRequest,submitReservationSuccess,submitReservationError}from"../action-creators";import{SHOPGATE_STOREFRONT_CREATE_ORDER}from"../constants";import createOrder from"../helpers/createOrder";/**
|
|
2
2
|
* @param {Object} values The user order.
|
|
3
3
|
* @param {Object} product The current product
|
|
4
4
|
* @returns {Function} A redux thunk.
|
|
5
|
-
*/function submitReservation(values,product){return function(dispatch,getState){dispatch(submitReservationRequest(values));var order=createOrder(values,product,getState);var request=new PipelineRequest(SHOPGATE_STOREFRONT_CREATE_ORDER).setInput({orders:[order]}).dispatch();request.then(function(result){if(result.errors&&result.errors.length>0){logger.error(result.errors);dispatch(submitReservationError(result.errors));return result;}dispatch(submitReservationSuccess(result.orderNumbers));return result;})["catch"](function(error){logger.error(error);dispatch(submitReservationError([error]));return error;});return request;};}export default submitReservation;
|
|
5
|
+
*/function submitReservation(values,product){return function(dispatch,getState){dispatch(submitReservationRequest(values));var order=createOrder(values,product,getState);var request=new PipelineRequest(SHOPGATE_STOREFRONT_CREATE_ORDER).setInput({orders:[order]}).dispatch();request.then(function(result){if(result.errors&&result.errors.length>0){logger.error(result.errors);dispatch(submitReservationError(result.errors));return result;}dispatch(submitReservationSuccess(result.orderNumbers));return result;})["catch"](function(error){logger.error(error);dispatch(submitReservationError([error]));return error;});return request;};}/** @mixes {MutableFunction} */export default mutable(submitReservation);
|
|
@@ -2,4 +2,4 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
|
|
|
2
2
|
* The CartContextMenuChangeFulfillmentContent component renders a context menu which enables
|
|
3
3
|
* switching the active fulfillment method for a cart item.
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/var CartContextMenuChangeFulfillmentContent=function CartContextMenuChangeFulfillmentContent(){var
|
|
5
|
+
*/var CartContextMenuChangeFulfillmentContent=function CartContextMenuChangeFulfillmentContent(){var labelMapping=_defineProperty(_defineProperty(_defineProperty({},DIRECT_SHIP,'cart.change_fulfillment.direct_ship'),ROPIS,'cart.change_fulfillment.ropis'),BOPIS,'cart.change_fulfillment.bopis');var _useFulfillmentState=useFulfillmentState(),fulfillmentMethods=_useFulfillmentState.fulfillmentMethods,enabledFulfillmentMethods=_useFulfillmentState.enabledFulfillmentMethods,cartItem=_useFulfillmentState.meta.cartItem,changeFulfillment=_useFulfillmentState.changeFulfillment;var activeFulfillmentMethod=useMemo(function(){var _cartItem$fulfillment;return((_cartItem$fulfillment=cartItem.fulfillment)===null||_cartItem$fulfillment===void 0?void 0:_cartItem$fulfillment.method)||DIRECT_SHIP;},[cartItem.fulfillment]);var handleChangeFulfillment=useCallback(function(method){changeFulfillment(method,cartItem);},[cartItem,changeFulfillment]);var selectableFulfillmentMethods=useMemo(function(){if(!enabledFulfillmentMethods||!fulfillmentMethods){return[];}return fulfillmentMethods.filter(function(method){return enabledFulfillmentMethods.includes(method)&&method!==activeFulfillmentMethod;});},[activeFulfillmentMethod,enabledFulfillmentMethods,fulfillmentMethods]);var disabled=selectableFulfillmentMethods.length===0;return React.createElement(ContextMenu,{classes:contextMenuClasses,disabled:disabled},selectableFulfillmentMethods.map(function(method){return React.createElement(ContextMenu.Item,{key:method,onClick:function onClick(){return handleChangeFulfillment(method);}},React.createElement(I18n.Text,{string:labelMapping[method]}));}));};export default CartContextMenuChangeFulfillmentContent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useState,useCallback}from'react';import{Availability}from'@shopgate/engage/product';import{RadioGroup}from"../../../components";import{useFulfillmentState}from"../../locations.hooks";import{IN_STORE_PICKUP_BOPIS_LABEL,IN_STORE_PICKUP_ROPIS_LABEL,DIRECT_SHIP_LABEL,DIRECT_SHIP,ROPIS,BOPIS}from"../../constants";import{container,radioGroup}from"./FulfillmentPath.style";import{FulfillmentPathItem}from"./FulfillmentPathItem";/**
|
|
2
2
|
* Renders the fulfillment path selector stage.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/export function FulfillmentPath(){var
|
|
4
|
+
*/export function FulfillmentPath(){var labelMapping=_defineProperty(_defineProperty(_defineProperty({},DIRECT_SHIP,DIRECT_SHIP_LABEL),ROPIS,IN_STORE_PICKUP_ROPIS_LABEL),BOPIS,IN_STORE_PICKUP_BOPIS_LABEL);var _useFulfillmentState=useFulfillmentState(),product=_useFulfillmentState.product,enabledFulfillmentMethods=_useFulfillmentState.enabledFulfillmentMethods,_useFulfillmentState$=_useFulfillmentState.meta,_useFulfillmentState$2=_useFulfillmentState$===void 0?{}:_useFulfillmentState$,_useFulfillmentState$3=_useFulfillmentState$2.cartItem,cartItem=_useFulfillmentState$3===void 0?undefined:_useFulfillmentState$3,changeFulfillment=_useFulfillmentState.changeFulfillment;var _ref=cartItem||{},_ref$fulfillment=_ref.fulfillment,fulfillment=_ref$fulfillment===void 0?{}:_ref$fulfillment,_ref$product=_ref.product,_ref$product2=_ref$product===void 0?{}:_ref$product,_ref$product2$fulfill=_ref$product2.fulfillmentMethods,cartItemFulfillmentMethods=_ref$product2$fulfill===void 0?[]:_ref$product2$fulfill;var _ref2=fulfillment||{},_ref2$method=_ref2.method,activeCartItemFulfillmentMethod=_ref2$method===void 0?DIRECT_SHIP:_ref2$method;var _useState=useState(labelMapping[activeCartItemFulfillmentMethod]),_useState2=_slicedToArray(_useState,2),selection=_useState2[0],setSelection=_useState2[1];var handleChange=useCallback(function(elementName){var method=Object.keys(labelMapping).find(function(key){return labelMapping[key]===elementName;});setSelection(method);changeFulfillment(method,cartItem);},[cartItem,changeFulfillment,labelMapping]);return React.createElement("div",{className:container},React.createElement(RadioGroup,{name:"cartItem.fulfillment_selector",value:selection,onChange:handleChange,className:radioGroup,isControlled:true,direction:"column"},enabledFulfillmentMethods.includes(DIRECT_SHIP)&&React.createElement(FulfillmentPathItem,{name:DIRECT_SHIP_LABEL,attributes:{disabled:!cartItemFulfillmentMethods.includes(DIRECT_SHIP)}},React.createElement(Availability,{productId:product.id,fulfillmentSelection:DIRECT_SHIP})),enabledFulfillmentMethods.includes(BOPIS)&&React.createElement(FulfillmentPathItem,{name:IN_STORE_PICKUP_BOPIS_LABEL,attributes:{disabled:!cartItemFulfillmentMethods.includes(BOPIS)}}),enabledFulfillmentMethods.includes(ROPIS)&&React.createElement(FulfillmentPathItem,{name:IN_STORE_PICKUP_ROPIS_LABEL,attributes:{disabled:!cartItemFulfillmentMethods.includes(ROPIS)}})));}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import*as React from'react';import{i18n}from"../../../core";import{RadioGroupItem}from"../../../components";import{radioItem,itemLabel}from"./FulfillmentPath.style";/**
|
|
1
|
+
var _excluded=["name","children"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import*as React from'react';import{i18n}from"../../../core";import{RadioGroupItem}from"../../../components";import{radioItem,itemLabel}from"./FulfillmentPath.style";/**
|
|
2
2
|
* Renders a RadioItem element to be used by the FulfillmentPathSelector component.
|
|
3
3
|
* This component is meant to be rendered as child of a RadioGroup.
|
|
4
4
|
* @param {Object} props All props required by the RadioGroupItem component to work.
|
|
5
5
|
* @returns {JSX}
|
|
6
|
-
*/export var FulfillmentPathItem=function FulfillmentPathItem(_ref){var name=_ref.name,children=_ref.children,rest=_objectWithoutProperties(_ref,
|
|
6
|
+
*/export var FulfillmentPathItem=function FulfillmentPathItem(_ref){var name=_ref.name,children=_ref.children,rest=_objectWithoutProperties(_ref,_excluded);return React.createElement(RadioGroupItem,_extends({},rest,{name:name,className:radioItem,label:React.createElement("div",{className:itemLabel},React.createElement("span",null,i18n.text(name)),children)}));};FulfillmentPathItem.defaultProps={children:null};
|
|
@@ -6,5 +6,5 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function _defineProp
|
|
|
6
6
|
* @returns {JSX}
|
|
7
7
|
*/export function FulfillmentSelectorAddToCart(){var _useFulfillmentSelect=useFulfillmentSelectorState(),preferredLocation=_useFulfillmentSelect.preferredLocation,inventory=_useFulfillmentSelect.inventory,selectedLocation=_useFulfillmentSelect.selectedLocation,conditioner=_useFulfillmentSelect.conditioner,fulfillmentPaths=_useFulfillmentSelect.fulfillmentPaths,selection=_useFulfillmentSelect.selection,isDirectShipEnabled=_useFulfillmentSelect.isDirectShipEnabled,isROPISEnabled=_useFulfillmentSelect.isROPISEnabled,isBOPISEnabled=_useFulfillmentSelect.isBOPISEnabled;var usedLocation=selectedLocation||preferredLocation;// Add to cart effect to validate inventory
|
|
8
8
|
useEffect(function(){// Add most late conditioner
|
|
9
|
-
conditioner.addConditioner('fulfillment-inventory',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var
|
|
10
|
-
FulfillmentSheet.open({stage:STAGE_RESERVE_FORM});return _context.abrupt("return",false);case 22:return _context.abrupt("return",isProductAvailable(usedLocation,inventory));case 23:case"end":return _context.stop();}}
|
|
9
|
+
conditioner.addConditioner('fulfillment-inventory',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var mapping,selectedPath;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!(isDirectShipEnabled&&selection===DIRECT_SHIP)){_context.next=2;break;}return _context.abrupt("return",true);case 2:mapping=_defineProperty(_defineProperty(_defineProperty({},DIRECT_SHIP,isDirectShipEnabled),ROPIS,isROPISEnabled),BOPIS,isBOPISEnabled);if(!(!selection||!mapping[selection]||!usedLocation)){_context.next=5;break;}return _context.abrupt("return",false);case 5:if(isProductAvailable(usedLocation,inventory)){_context.next=7;break;}return _context.abrupt("return",false);case 7:if(!(fulfillmentPaths.length>1)){_context.next=19;break;}_context.next=10;return promisifiedFulfillmentPathSelector();case 10:selectedPath=_context.sent;if(!(selectedPath==='')){_context.next=13;break;}return _context.abrupt("return",false);case 13:if(!(selectedPath===MULTI_LINE_RESERVE)){_context.next=15;break;}return _context.abrupt("return",true);case 15:if(!(selectedPath===QUICK_RESERVE)){_context.next=18;break;}FulfillmentSheet.open({stage:STAGE_RESERVE_FORM,fulfillmentPath:selectedPath});return _context.abrupt("return",false);case 18:return _context.abrupt("return",false);case 19:if(fulfillmentPaths.includes(MULTI_LINE_RESERVE)){_context.next=22;break;}// Open reservation form. Stop adding to a cart
|
|
10
|
+
FulfillmentSheet.open({stage:STAGE_RESERVE_FORM});return _context.abrupt("return",false);case 22:return _context.abrupt("return",isProductAvailable(usedLocation,inventory));case 23:case"end":return _context.stop();}},_callee);})),100);return function(){return conditioner.removeConditioner('fulfillment-inventory');};},[conditioner,fulfillmentPaths,selection,usedLocation,isDirectShipEnabled,isROPISEnabled,isBOPISEnabled,inventory]);return null;}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React,{useEffect,memo}from'react';import{connect}from'react-redux';import PropTypes from'prop-types';import{withWidgetSettings}from'@shopgate/engage/core';import{Grid,ResponsiveContainer,SurroundPortals}from'@shopgate/engage/components';import{MERCHANT_SETTINGS_PRODUCT_SHOW_ALTERNATIVE_LOCATION}from"../../../core/constants";import{provideProductAlternativeLocation}from"../../action-creators";import{StockInfo}from"../StockInfo";import{locationName,alternativeLocation as gridClassName}from"./FulfillmentSelectorLocation.style";import{itemColumn,itemSpacer}from"./FulfillmentSelectorItem.style";import{useFulfillmentSelectorState}from"./FulfillmentSelector.hooks";import{PRODUCT_FULFILLMENT_SELECTOR_ALTERNATIVE_LOCATION}from"../../constants/Portals";import{getProductAlternativeLocations}from"../../selectors";import{SORT_CLOSEST_LOCATION_WITH_INVENTORY}from"../../constants";/**
|
|
2
2
|
* The FulfillmentSelectorLocation component
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/function FulfillmentSelectorAlternativeLocation(_ref){var productId=_ref.productId,show=_ref.show,alternativeLocations=_ref.alternativeLocations,provideAlternativeLocation=_ref.provideAlternativeLocation,widgetSettings=_ref.widgetSettings;var _useFulfillmentSelect=useFulfillmentSelectorState(),_useFulfillmentSelect2=_useFulfillmentSelect.merchantSettings,merchantSettings=_useFulfillmentSelect2===void 0?{}:_useFulfillmentSelect2,selectedLocation=_useFulfillmentSelect.selectedLocation;var _ref2=widgetSettings||{},_ref2$alternativeLoca=_ref2.alternativeLocationOnPDP
|
|
4
|
+
*/function FulfillmentSelectorAlternativeLocation(_ref){var productId=_ref.productId,show=_ref.show,alternativeLocations=_ref.alternativeLocations,provideAlternativeLocation=_ref.provideAlternativeLocation,widgetSettings=_ref.widgetSettings;var _useFulfillmentSelect=useFulfillmentSelectorState(),_useFulfillmentSelect2=_useFulfillmentSelect.merchantSettings,merchantSettings=_useFulfillmentSelect2===void 0?{}:_useFulfillmentSelect2,selectedLocation=_useFulfillmentSelect.selectedLocation;var _ref2=widgetSettings||{},_ref2$alternativeLoca=_ref2.alternativeLocationOnPDP,_ref2$alternativeLoca2=_ref2$alternativeLoca===void 0?{}:_ref2$alternativeLoca,_ref2$alternativeLoca3=_ref2$alternativeLoca2.radius,radius=_ref2$alternativeLoca3===void 0?50:_ref2$alternativeLoca3;var showAlternative=merchantSettings[MERCHANT_SETTINGS_PRODUCT_SHOW_ALTERNATIVE_LOCATION]||false;useEffect(function(){if(show&&showAlternative&&productId&&!alternativeLocations){provideAlternativeLocation(productId,{sort:SORT_CLOSEST_LOCATION_WITH_INVENTORY,radius:radius});}},[productId,provideAlternativeLocation,alternativeLocations,radius,show,showAlternative]);if(!show||!showAlternative||!productId){return null;}if(!alternativeLocations||!alternativeLocations.length){return null;}var alternativeLocation=alternativeLocations.find(function(l){return l.code!==(selectedLocation===null||selectedLocation===void 0?void 0:selectedLocation.code);});return React.createElement(SurroundPortals,{portalName:PRODUCT_FULFILLMENT_SELECTOR_ALTERNATIVE_LOCATION,portalProps:{productId:productId,location:alternativeLocation}},alternativeLocation&&React.createElement(Grid,{component:"div",className:gridClassName},React.createElement(ResponsiveContainer,{appAlways:true,breakpoint:"xs"},React.createElement(Grid.Item,{className:itemColumn,grow:1,shrink:0,component:"div"},React.createElement("div",{className:locationName},alternativeLocation.name)),React.createElement(Grid.Item,{className:itemColumn,grow:1,shrink:0,component:"div"},React.createElement(StockInfo,{productId:productId,location:alternativeLocation}))),React.createElement(ResponsiveContainer,{webOnly:true,breakpoint:">xs"},React.createElement("div",{className:locationName},alternativeLocation.name,React.createElement("span",{className:itemSpacer},React.createElement(StockInfo,{productId:productId,location:alternativeLocation}))))));}FulfillmentSelectorAlternativeLocation.defaultProps={alternativeLocations:null,productId:null,widgetSettings:null};/**
|
|
5
5
|
* @param {Object} state The current application state.
|
|
6
6
|
* @param {Object} props The component props.
|
|
7
7
|
* @return {Object}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import*as React from'react';import{FulfillmentProvider,openSheet}from"../../providers";import{FulfillmentSheetContent}from"./FulfillmentSheetContent";/**
|
|
1
|
+
var _excluded=["allowClose"];function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import*as React from'react';import{FulfillmentProvider,openSheet}from"../../providers";import{FulfillmentSheetContent}from"./FulfillmentSheetContent";/**
|
|
2
2
|
* Renders the fulfillment sheet.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/export var FulfillmentSheet=function FulfillmentSheet(_ref){var _ref$allowClose=_ref.allowClose,allowClose=_ref$allowClose===void 0?true:_ref$allowClose,props=_objectWithoutProperties(_ref,
|
|
5
|
+
*/export var FulfillmentSheet=function FulfillmentSheet(_ref){var _ref$allowClose=_ref.allowClose,allowClose=_ref$allowClose===void 0?true:_ref$allowClose,props=_objectWithoutProperties(_ref,_excluded);return React.createElement(FulfillmentProvider,props,React.createElement(FulfillmentSheetContent,{allowClose:allowClose}));};FulfillmentSheet.open=openSheet;
|
|
@@ -25,4 +25,4 @@ if(groupedSlots[selectedDate]){return;}setSelectedDate(Object.keys(groupedSlots)
|
|
|
25
25
|
var _useState3=useState(null),_useState4=_slicedToArray(_useState3,2),selectedSlot=_useState4[0],setSelectedSlot=_useState4[1];var _useState5=useState(null),_useState6=_slicedToArray(_useState5,2),slotGroups=_useState6[0],setSlotGroups=_useState6[1];useEffect(function(){if(!groupedSlots||!groupedSlots[selectedDate]){setSlotGroups(null);return;}var slotGroupsNew=Object.keys(RANGES).map(function(rangeName){var _RANGES$rangeName=_slicedToArray(RANGES[rangeName],2),start=_RANGES$rangeName[0],end=_RANGES$rangeName[1];return{name:rangeName,slots:groupedSlots[selectedDate].filter(function(slot){var _slot$from$split$map=slot.from.split(':').map(function(x){return parseInt(x,10);}),_slot$from$split$map2=_slicedToArray(_slot$from$split$map,1),startHour=_slot$from$split$map2[0];return startHour>=start&&startHour<=end;})};}).filter(function(group){return group.slots.length>0;});setSlotGroups(slotGroupsNew);},[selectedDate,groupedSlots]);useEffect(function(){var _groupedSlots$selecte,_groupedSlots$selecte2;if(!selectedDate||!groupedSlots||!groupedSlots[selectedDate]){setSelectedSlot(null);return;}// Only switch if not found.
|
|
26
26
|
if(groupedSlots[selectedDate].find(function(slot){return slot.id===selectedSlot;})){return;}// Select first active slot.
|
|
27
27
|
setSelectedSlot(((_groupedSlots$selecte=groupedSlots[selectedDate])===null||_groupedSlots$selecte===void 0?void 0:(_groupedSlots$selecte2=_groupedSlots$selecte.find(function(slot){return slot.status==='active';}))===null||_groupedSlots$selecte2===void 0?void 0:_groupedSlots$selecte2.id)||null);/* eslint-disable react-hooks/exhaustive-deps */},[selectedDate]);/* eslint-enable react-hooks/exhaustive-deps */ // When opening the selected values are set to active selected content.
|
|
28
|
-
useEffect(function(){if(!isOpen||!fulfillmentSlot||!fulfillmentSlot.date){return;}setSelectedDate(fulfillmentSlot.date);setSelectedSlot(fulfillmentSlot.id);},[fulfillmentSlot,isOpen]);var handleChange=useCallback(function(){onChange(fulfillmentSlots.find(function(slot){return slot.id===selectedSlot;}));},[fulfillmentSlots,onChange,selectedSlot]);return React.createElement(SheetDrawer,{isOpen:isOpen,title:i18n.text('locations.your_current_timeslot.dialog.title'),onDidClose:onClose,allowClose:allowClose},React.createElement("div",{className:styles.root},React.createElement("span",{className:styles.title},i18n.text('locations.your_current_timeslot.dialog.date')),React.createElement("div",{className:styles.row},Object.keys(groupedSlots).map(function(date){return React.createElement("button",{type:"button",key:date,className:classnames(styles.button,styles.buttonDate,_defineProperty({},styles.buttonActive,selectedDate===date)),onClick:function onClick(){return setSelectedDate(date);}},React.createElement("span",{className:styles.buttonLabel},moment(date,'YYYY-MM-DD').format('dddd'),' ',getMonthDay(date)));})),slotGroups&&slotGroups.map(function(group){return React.createElement(Fragment,{key:group.name},React.createElement("span",{className:styles.subtitle},i18n.text("locations.your_current_timeslot.dialog.".concat(group.name))),React.createElement("div",{className:styles.row},group.slots.map(function(slot){
|
|
28
|
+
useEffect(function(){if(!isOpen||!fulfillmentSlot||!fulfillmentSlot.date){return;}setSelectedDate(fulfillmentSlot.date);setSelectedSlot(fulfillmentSlot.id);},[fulfillmentSlot,isOpen]);var handleChange=useCallback(function(){onChange(fulfillmentSlots.find(function(slot){return slot.id===selectedSlot;}));},[fulfillmentSlots,onChange,selectedSlot]);return React.createElement(SheetDrawer,{isOpen:isOpen,title:i18n.text('locations.your_current_timeslot.dialog.title'),onDidClose:onClose,allowClose:allowClose},React.createElement("div",{className:styles.root},React.createElement("span",{className:styles.title},i18n.text('locations.your_current_timeslot.dialog.date')),React.createElement("div",{className:styles.row},Object.keys(groupedSlots).map(function(date){return React.createElement("button",{type:"button",key:date,className:classnames(styles.button,styles.buttonDate,_defineProperty({},styles.buttonActive,selectedDate===date)),onClick:function onClick(){return setSelectedDate(date);}},React.createElement("span",{className:styles.buttonLabel},moment(date,'YYYY-MM-DD').format('dddd'),' ',getMonthDay(date)));})),slotGroups&&slotGroups.map(function(group){return React.createElement(Fragment,{key:group.name},React.createElement("span",{className:styles.subtitle},i18n.text("locations.your_current_timeslot.dialog.".concat(group.name))),React.createElement("div",{className:styles.row},group.slots.map(function(slot){return React.createElement("button",{type:"button",key:"".concat(slot.from,"-").concat(slot.to),onClick:function onClick(){return setSelectedSlot(slot.id);},className:classnames(styles.button,_defineProperty(_defineProperty({},styles.buttonDisabled,slot.status!=='active'),styles.buttonActive,slot.id===selectedSlot))},React.createElement("span",{className:styles.buttonLabelSlot},getRange(slot.from,slot.to)),slot.status!=='active'?React.createElement("div",{className:styles.buttonStrikethrough}):null);})));}),React.createElement("div",{className:styles.buttonScheduleContainer},React.createElement(Button,{className:styles.buttonSchedule,type:"secondary",onClick:handleChange,disabled:!selectedDate||!selectedSlot},i18n.text('locations.your_current_timeslot.dialog.schedule')))));};FulfillmentSlotSheet.defaultProps={isOpen:false,locationCode:null,fulfillmentSlots:[],fulfillmentSlot:null,allowClose:true};export default connect(makeMapStateToProps,mapDispatchToProps)(FulfillmentSlotSheet);
|
|
@@ -7,4 +7,4 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGenera
|
|
|
7
7
|
* @returns {JSX}
|
|
8
8
|
*/function ReserveFormUnwrapped(){var _useContext=useContext(FulfillmentContext),sendReservation=_useContext.sendReservation,userInput=_useContext.userInput;var _useState=useState(determinePickupPerson(userInput)),_useState2=_slicedToArray(_useState,2),picker=_useState2[0],setPicker=_useState2[1];var defaultState={firstName:'',lastName:'',cellPhone:'',email:'',firstName2:'',lastName2:'',cellPhone2:'',email2:''};var validationConstraints=useMemo(function(){return _extends({},constraints,{},picker===PICKUP_PERSON_OTHER&&{firstName2:constraints.firstName,lastName2:constraints.lastName,cellPhone2:constraints.cellPhone,email2:constraints.email});},[picker]);var initialState=userInput?_extends({},defaultState,{},userInput):defaultState;/**
|
|
9
9
|
* @param {Object} values The form values.
|
|
10
|
-
*/var complete=useCallback(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(values){var response;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)
|
|
10
|
+
*/var complete=useCallback(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(values){var response;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:response=values;if(picker===PICKUP_PERSON_ME){response.firstName2=response.firstName;response.lastName2=response.lastName;response.cellPhone2=response.cellPhone;response.email2=response.email;}else{response.firstName2=response.firstName2||response.firstName;response.lastName2=response.lastName2||response.lastName;response.cellPhone2=response.cellPhone2||response.cellPhone;response.email2=response.email2||response.email;}_context.next=4;return sendReservation(response);case 4:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}(),[picker,sendReservation]);var _useFormState=useFormState(initialState,complete,validationConstraints),values=_useFormState.values,handleChange=_useFormState.handleChange,handleSubmit=_useFormState.handleSubmit,changed=_useFormState.changed,valid=_useFormState.valid,_useFormState$validat=_useFormState.validationErrors,validationErrors=_useFormState$validat===void 0?{}:_useFormState$validat,isSubmitting=_useFormState.isSubmitting;var someoneElseRef=useRef(null);useLayoutEffect(function(){if(someoneElseRef.current&&picker===PICKUP_PERSON_OTHER){someoneElseRef.current.scrollIntoView({behavior:'smooth'});}},[picker,someoneElseRef]);return React.createElement(Fragment,null,React.createElement("div",{className:progressBar},React.createElement(ProgressBar,{isVisible:isSubmitting})),React.createElement("form",{onSubmit:handleSubmit,className:form},React.createElement("fieldset",{className:fieldset},React.createElement(TextField,{name:"firstName",value:values.firstName,onChange:handleChange,label:i18n.text('locations.firstName'),className:formField,errorText:i18n.text(validationErrors.firstName)}),React.createElement(TextField,{name:"lastName",value:values.lastName,onChange:handleChange,label:i18n.text('locations.lastName'),className:formField,errorText:i18n.text(validationErrors.lastName)}),React.createElement(ReserveFormPhone,{name:"cellPhone",value:values.cellPhone,onChange:handleChange,label:i18n.text('locations.cellPhone'),errorText:i18n.text(validationErrors.cellPhone)}),React.createElement(TextField,{name:"email",value:values.email,onChange:handleChange,label:i18n.text('locations.emailAddress'),className:formField,errorText:i18n.text(validationErrors.email)})),React.createElement("p",{className:formHeading},i18n.text('locations.who_will_pickup')),React.createElement("div",{className:pickerSwitch},React.createElement(RadioGroup,{name:"picker",direction:"row",value:picker,onChange:setPicker},React.createElement(RadioGroupItem,{label:i18n.text('locations.me'),name:PICKUP_PERSON_ME,className:pickerItem}),React.createElement(RadioGroupItem,{label:i18n.text('locations.someone_else'),name:PICKUP_PERSON_OTHER,className:pickerItem}))),picker===PICKUP_PERSON_OTHER&&React.createElement("fieldset",{className:fieldset,ref:someoneElseRef},React.createElement(TextField,{name:"firstName2",value:values.firstName2,onChange:handleChange,label:i18n.text('locations.firstName'),className:formField,errorText:i18n.text(validationErrors.firstName2)}),React.createElement(TextField,{name:"lastName2",value:values.lastName2,onChange:handleChange,label:i18n.text('locations.lastName'),className:formField,errorText:i18n.text(validationErrors.lastName2)}),React.createElement(ReserveFormPhone,{name:"cellPhone2",value:values.cellPhone2,onChange:handleChange,label:i18n.text('locations.cellPhone'),errorText:i18n.text(validationErrors.cellPhone2)}),React.createElement(TextField,{name:"email2",value:values.email2,onChange:handleChange,label:i18n.text('locations.emailAddress'),className:formField,errorText:i18n.text(validationErrors.email2)})),React.createElement(RippleButton,{type:"secondary",disabled:changed||valid===false||isSubmitting,className:button},i18n.text('locations.place_reservation'))));}export var ReserveForm=hot(ReserveFormUnwrapped);
|
|
@@ -2,4 +2,4 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
|
|
|
2
2
|
* Renders the reserve form phone input maybe with country selection.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX.Element}
|
|
5
|
-
*/var ReserveFormPhoneUnwrapped=React.memo(function(props){var
|
|
5
|
+
*/var ReserveFormPhoneUnwrapped=React.memo(function(props){var name=props.name,value=props.value,onChange=props.onChange,label=props.label,errorText=props.errorText,userLocation=props.userLocation;var _React$useContext=React.useContext(FulfillmentContext),shopSettings=_React$useContext.shopSettings,userInput=_React$useContext.userInput;var initialValue=React.useMemo(function(){return userInput&&userInput[name]?userInput[name]:'';},[name,userInput]);var supportedCountries=React.useMemo(function(){return shopSettings?shopSettings.supportedCountries:[];},[shopSettings]);var countries=React.useMemo(function(){if(!supportedCountries){return builtInCountries;}var sortedCountries=[].concat(builtInCountries);var sanitizedSupportedCountries=supportedCountries.map(function(country){var pieces=country.split('_');return pieces[0];});sanitizedSupportedCountries.forEach(function(country){sortedCountries.splice(sortedCountries.indexOf(country),1);});return[].concat(sanitizedSupportedCountries,sortedCountries);},[supportedCountries]);var countriesNames=useCountriesNames(supportedCountries,locales);var labels=React.useMemo(function(){var output={};if(!countries){return output;}countries.forEach(function(key){var pieces=key.split('_');output[pieces[0]]=countriesNames[key];});return output;},[countries,countriesNames]);var defaultCountry=React.useMemo(function(){if(!initialValue&&!value&&userLocation){return userLocation.country;}var phoneNumber=parsePhoneNumber(value||'');if(phoneNumber&&phoneNumber.country){return phoneNumber.country;}if(userLocation){return userLocation.country;}return i18n.getLang().split('-')[1];},[initialValue,userLocation,value]);var handleChange=React.useCallback(function(phoneValue){onChange(phoneValue,{target:{name:name}});},[name,onChange]);var phoneClasses=classnames(_defineProperty(_defineProperty({},phoneField,true),phoneFieldError,!!errorText));if(!countries||countries.length===0){return React.createElement(TextField,{name:name,value:value,onChange:onChange,label:label,className:formField,errorText:errorText});}return React.createElement("div",{className:phoneClasses},React.createElement(PhoneInput,{defaultCountry:defaultCountry,addInternationalOption:false,flags:flags,name:name,value:value||'',onChange:handleChange,placeholder:label,countries:countries,labels:labels}),!!errorText&&React.createElement("div",{className:phoneFieldErrorText},errorText));});export var ReserveFormPhone=connect(ReserveFormPhoneUnwrapped);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{themeColors}from'@shopgate/pwa-common/helpers/config';import{AVAILABILITY_TYPE_AVAILABLE,AVAILABILITY_TYPE_LIMITED_AVAILABILITY,AVAILABILITY_TYPE_NOT_AVAILABLE,AVAILABILITY_TYPE_CUSTOM_AVAILABILITY,AVAILABILITY_TYPE_COMING_SOON}from'@shopgate/engage/product/constants';export default _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},AVAILABILITY_TYPE_AVAILABLE,{visibleInventoryFrom:11,visibleInventoryTo:null,includeInventoryBlind:false,includeNoRecordStores:false,availabilityText:'locations.stock_info.availableInventory',availabilityTextColor:"var(--color-state-ok, ".concat(themeColors.success,")")}),AVAILABILITY_TYPE_COMING_SOON,{comingSoon:true,visibleInventoryFrom:0,visibleInventoryTo:Number.MAX_VALUE,includeInventoryBlind:true,includeNoRecordStores:true,availabilityText:"locations.stock_info.".concat(AVAILABILITY_TYPE_COMING_SOON),availabilityTextColor:"var(--color-state-warning, ".concat(themeColors.warning,")")}),AVAILABILITY_TYPE_LIMITED_AVAILABILITY,{visibleInventoryFrom:1,visibleInventoryTo:10,includeInventoryBlind:false,includeNoRecordStores:false,availabilityText:"locations.stock_info.".concat(AVAILABILITY_TYPE_LIMITED_AVAILABILITY),availabilityTextColor:"var(--color-state-warning, ".concat(themeColors.warning,")")}),AVAILABILITY_TYPE_NOT_AVAILABLE,{visibleInventoryFrom:0,visibleInventoryTo:0,includeInventoryBlind:false,includeNoRecordStores:false,availabilityText:"locations.stock_info.".concat(AVAILABILITY_TYPE_NOT_AVAILABLE),availabilityTextColor:"var(--color-state-alert, ".concat(themeColors.error,")"),allowOrderingToStore:true}),AVAILABILITY_TYPE_CUSTOM_AVAILABILITY,{visibleInventoryFrom:0,visibleInventoryTo:0,includeInventoryBlind:false,includeNoRecordStores:true,availabilityText:"locations.stock_info.".concat(AVAILABILITY_TYPE_CUSTOM_AVAILABILITY),availabilityTextColor:"var(--color-state-alert, ".concat(themeColors.error,")"),allowOrderingToStore:true}),"maxNumberOfVisibleInventory",100),"aboveMaxExtension",'+');
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
zIndex:10,maxHeight:200})
|
|
1
|
+
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{css}from'glamor';import{responsiveMediaQuery}from'@shopgate/engage/styles';import{themeColors}from'@shopgate/pwa-common/helpers/config';export var container=css(_defineProperty(_defineProperty({height:'100%',width:'100%'},responsiveMediaQuery('>sm',{appAlways:true}),{borderRadius:3,overflow:'hidden'}),responsiveMediaQuery('<=sm',{appAlways:true}),{// position: 'fixed',
|
|
2
|
+
zIndex:10,maxHeight:200}));export var marker=css({' svg':{height:40,width:40,fontSize:'1.5rem',color:"var(--color-text-medium-emphasis, ".concat(themeColors.shade9,")")}}).toString();export var markerSelected=css({' svg':{height:40,width:40,fontSize:'1.5rem',color:"var(--color-primary, ".concat(themeColors.primary,")")}}).toString();var pulseAnimation=css.keyframes({'0%':{boxShadow:'0 0 0 0px rgba(0, 0, 0, 0.2)'},'100%':{boxShadow:'0 0 0 10px rgba(0, 0, 0, 0)'}});export var userPosition=css({' div':{background:'var(--color-secondary)',border:'3px solid #fff',borderRadius:25,height:20,width:20,animation:"".concat(pulseAnimation," 2s infinite")}}).toString();
|
|
@@ -3,7 +3,7 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGenera
|
|
|
3
3
|
* @param {Function} storeSearch .
|
|
4
4
|
* @param {Object} search .
|
|
5
5
|
* @returns {JSX}
|
|
6
|
-
*/function StoreListSearch(_ref){var postalCode=_ref.postalCode,countryCode=_ref.countryCode,setPostalCode=_ref.setPostalCode,setCountryCode=_ref.setCountryCode,setGeolocation=_ref.setGeolocation,isStoreFinder=_ref.isStoreFinder;var _useContext=useContext(isStoreFinder?StoreFinderContext:FulfillmentContext),isLoading=_useContext.isLoading,setIsLoading=_useContext.setIsLoading,locations=_useContext.locations,_useContext$shopSetti=_useContext.shopSettings
|
|
6
|
+
*/function StoreListSearch(_ref){var postalCode=_ref.postalCode,countryCode=_ref.countryCode,setPostalCode=_ref.setPostalCode,setCountryCode=_ref.setCountryCode,setGeolocation=_ref.setGeolocation,isStoreFinder=_ref.isStoreFinder;var _useContext=useContext(isStoreFinder?StoreFinderContext:FulfillmentContext),isLoading=_useContext.isLoading,setIsLoading=_useContext.setIsLoading,locations=_useContext.locations,_useContext$shopSetti=_useContext.shopSettings,_useContext$shopSetti2=_useContext$shopSetti===void 0?{}:_useContext$shopSetti,supportedCountries=_useContext$shopSetti2.supportedCountries,product=_useContext.product;var _useState=useState(''),_useState2=_slicedToArray(_useState,2),message=_useState2[0],setMessage=_useState2[1];var _useState3=useState(postalCode||''),_useState4=_slicedToArray(_useState3,2),inputPostalCode=_useState4[0],setInputPostalCode=_useState4[1];var isMounted=useRef(false);var productId=(product===null||product===void 0?void 0:product.id)||null;var inputEl=useRef(null);useEffect(function(){isMounted.current=true;return function cleanup(){isMounted.current=false;};});useLayoutEffect(function(){if(!isLoading&&(!locations||locations.length===0)){// Set a message when a location search resulted in zero locations.
|
|
7
7
|
setMessage('locations.error_no_store_found');}else{setMessage('');}},[isLoading,locations,message]);/**
|
|
8
8
|
* Triggers an update when the value of the country selector changed.
|
|
9
9
|
* @param {SyntheticEvent} event A React event object.
|
|
@@ -15,7 +15,7 @@ setMessage('locations.error_no_store_found');}else{setMessage('');}},[isLoading,
|
|
|
15
15
|
*/var handlePostalCodeBlur=useCallback(function(){setPostalCode(inputPostalCode,productId,isStoreFinder);},[inputPostalCode,isStoreFinder,productId,setPostalCode]);/**
|
|
16
16
|
* Triggers an update when the locate me button was pressed. Also clears the local state for the
|
|
17
17
|
* postal code input.
|
|
18
|
-
*/var handleLocateMeButton=useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)
|
|
18
|
+
*/var handleLocateMeButton=useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:setInputPostalCode('');setIsLoading(true);_context.next=4;return setGeolocation({productId:productId,isStoreFinder:isStoreFinder});case 4:setIsLoading(false);case 5:case"end":return _context.stop();}},_callee);})),[isStoreFinder,productId,setGeolocation,setIsLoading]);/**
|
|
19
19
|
* Updates the local state for the postal code input.
|
|
20
20
|
* @param {SyntheticEvent} event A React event object
|
|
21
21
|
*/var handlePostalCodeChange=function handlePostalCodeChange(event){setInputPostalCode(event.target.value);};var countries=useCountriesNames(supportedCountries);var hasSupportedCountries=supportedCountries&&supportedCountries.length>1;return React.createElement(SurroundPortals,{portalName:FULFILLMENT_SHEET_SEARCH,portalProps:{product:product}},React.createElement("div",{className:container},hasSupportedCountries&&React.createElement("div",{className:countriesCell},React.createElement("div",{className:selectContainer},React.createElement("select",{name:"countryCode",value:countryCode,onChange:handleCountrySelectChange,className:select},Object.keys(countries).map(function(key){return React.createElement("option",{className:"option",value:key,key:key},countries[key]);})))),React.createElement("div",{className:inputCell},React.createElement("div",{className:inputContainer},React.createElement("span",{className:inputIcon,"aria-hidden":true},React.createElement(MagnifierIcon,null)),React.createElement("input",{ref:inputEl,name:"postalCode",className:input,value:inputPostalCode,onChange:handlePostalCodeChange,onBlur:handlePostalCodeBlur,onKeyDown:handlePostalCodeSubmitKeyDown,disabled:isLoading,type:"search",autoComplete:"off",autoCorrect:"off",placeholder:i18n.text('locations.search_placeholder')}),React.createElement("button",{onClick:handleLocateMeButton,type:"button",className:inputIcon,"aria-label":i18n.text('locations.stores_near.location')},React.createElement(LocatorIcon,null)))),React.createElement("div",{className:radiusCell},isStoreFinder&&React.createElement(StoreListSearchRadius,null))),message&&React.createElement(MessageBar,{messages:[{type:'error',message:message,icon:InfoIcon}],classNames:{icon:iconClass}}));}StoreListSearch.defaultProps={postalCode:null,isStoreFinder:false};export default connect(memo(StoreListSearch));
|