@shopgate/engage 7.12.7-beta.1 → 7.20.0-beta.10
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 +2 -2
- package/account/actions/deleteContact.js +2 -2
- package/account/actions/deleteCustomer.js +2 -2
- package/account/actions/fetchContacts.js +2 -2
- package/account/actions/fetchCustomer.js +2 -2
- package/account/actions/updateContact.js +2 -2
- package/account/actions/updateCustomer.js +2 -2
- package/account/components/Account/Account.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/account/reducers/index.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.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 +9 -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 +4 -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 +3 -2
- package/cart/streams/index.js +1 -0
- 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/CheckoutPickupContactForm.config.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/GuestCheckout/GuestCheckoutPickupNotes.config.js +1 -1
- package/checkout/components/PaymentMethodButton/PaymentMethodButton.js +1 -1
- package/checkout/components/ShippingMethods/ShippingMethods.js +4 -4
- package/checkout/components/index.js +1 -1
- package/checkout/constants/index.js +1 -1
- package/checkout/index.js +3 -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 +3 -2
- 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/ConditionalWrapper/ConditionalWrapper.js +7 -2
- 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 +5 -4
- 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/ResponsiveContainer/ResponsiveContainer.js +2 -6
- package/components/ResponsiveContainer/breakpoints.js +2 -1
- package/components/ResponsiveContainer/hooks.js +20 -0
- package/components/ScrollHeader/index.js +2 -2
- package/components/ScrollHeader/style.js +1 -1
- 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 +15 -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 +7 -7
- package/favorites/components/List/List.js +18 -7
- package/favorites/components/List/ListAccordionLabel.js +4 -0
- package/favorites/components/List/ListContent.js +8 -0
- package/favorites/components/List/ListItemWrapper.js +6 -0
- package/favorites/components/List/styles.js +1 -0
- package/favorites/components/Lists/Lists.js +5 -5
- package/favorites/components/Lists/ListsModal.js +3 -2
- package/favorites/constants/index.js +1 -0
- package/filter/actions/index.js +1 -0
- package/filter/components/PriceSlider/index.js +9 -9
- package/filter/components/PriceSlider/style.js +1 -3
- package/filter/components/index.js +1 -0
- package/filter/constants/index.js +1 -1
- package/filter/helpers/buildFilterParamsForFetchFiltersRequest.js +9 -0
- package/filter/helpers/buildInitialFilters.js +1 -1
- 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 +2 -7
- package/filter/providers/SortProvider.helpers.js +1 -1
- package/filter/selectors/index.js +1 -1
- package/filter/streams/index.js +1 -0
- package/i18n/locale/cs-cz/countries.json +255 -0
- package/i18n/locale/de-de/countries.json +26 -28
- package/i18n/locale/el-gr/countries.json +255 -0
- package/i18n/locale/en-us/countries.json +12 -14
- package/i18n/locale/es-es/countries.json +65 -67
- package/i18n/locale/fi-fi/countries.json +255 -0
- package/i18n/locale/fr-fr/countries.json +85 -87
- package/i18n/locale/hu-hu/countries.json +255 -0
- package/i18n/locale/it-it/countries.json +11 -13
- package/i18n/locale/nl-nl/countries.json +42 -44
- package/i18n/locale/pl-pl/countries.json +255 -0
- package/i18n/locale/pt-pt/countries.json +128 -130
- package/i18n/locale/ro-ro/countries.json +255 -0
- package/i18n/locale/sv-se/countries.json +255 -0
- package/locations/action-creators/receiveInventories.js +3 -5
- package/locations/actions/fetchFulfillmentSlots.js +1 -1
- package/locations/actions/fetchProductLocations.js +2 -2
- package/locations/actions/setUserGeolocation.js +1 -1
- package/locations/actions/setUserSearchGeolocation.js +1 -1
- 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 +5 -3
- 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/index.js +1 -1
- 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 +7 -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/ProductSlider/index.js +4 -0
- package/product/components/ProductSlider/spec.js +1 -0
- package/product/components/ProductSlider/style.js +1 -0
- package/product/components/QuantityPicker/hooks.js +5 -0
- package/product/components/QuantityPicker/index.js +2 -2
- 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/UnitQuantityPicker/CartUnitQuantityPicker.js +2 -2
- package/product/components/UnitQuantityPicker/ProductUnitQuantityPicker.js +3 -2
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +6 -3
- package/product/components/UnitQuantityPicker/UnitQuantityPickerWithSection.js +7 -0
- package/product/components/UnitQuantityPicker/index.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/hooks/index.js +1 -0
- package/product/index.js +4 -11
- package/product/providers/Product/connector.js +5 -0
- package/product/providers/Product/index.js +4 -0
- package/product/providers/index.js +1 -0
- package/product/selectors/product.js +24 -3
- 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 +9 -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 +12 -0
- package/registration/components/index.js +1 -0
- package/registration/index.js +1 -1
- 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/Header/components/ReviewsExcerpt/style.js +1 -2
- 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/RatingCount/style.js +1 -2
- 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 +3 -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/loadCustomStyles.js +2 -2
- package/styles/helpers/setPageBackgroundColor.js +2 -1
- package/styles/helpers/setPageContentWidth.js +2 -1
- package/styles/index.js +1 -1
- package/tracking/action-creators/cookieConsent.js +24 -0
- package/tracking/action-creators/index.js +1 -4
- package/tracking/actions/cookieConsent.js +21 -0
- package/tracking/actions/index.js +1 -0
- package/tracking/components/CookieConsentModal/connector.js +6 -0
- package/tracking/components/CookieConsentModal/index.js +9 -0
- package/tracking/components/CookieConsentModal/style.js +1 -0
- package/tracking/components/CookieConsentModal/tracking-opt-in.svg +18 -0
- package/tracking/components/PrivacySettings/connector.js +6 -0
- package/tracking/components/PrivacySettings/index.js +4 -0
- package/tracking/components/PrivacySettings/style.js +1 -0
- package/tracking/components/index.js +1 -1
- package/tracking/constants/index.js +1 -1
- package/tracking/reducers/cookieConsentModal.js +6 -0
- package/tracking/reducers/cookieSettings.js +6 -0
- package/tracking/reducers/index.js +1 -0
- package/tracking/selectors/cookieConsent.js +35 -0
- package/tracking/selectors/index.js +1 -4
- package/tracking/streams/cookieConsent.js +46 -0
- package/tracking/streams/index.js +1 -1
- package/tracking/subscriptions/analytics.js +11 -0
- package/tracking/subscriptions/cookieConsent.js +13 -0
- package/tracking/subscriptions/index.js +1 -4
- package/components/MessageBar/MessageBar.types.js +0 -0
- package/components/MessageBar/style.js +0 -1
- package/i18n/locale/ru-ru/countries.json +0 -251
- package/product/components/Availability/Availability.types.js +0 -1
- package/product/components/QuantityPicker/helpers.js +0 -5
- package/tracking/components/CookieConsent/CookieConsent.connector.js +0 -4
- package/tracking/components/CookieConsent/CookieConsent.js +0 -4
- package/tracking/components/CookieConsent/CookieConsentButtons.js +0 -3
- package/tracking/components/CookieConsent/CookieConsentCheckboxes.js +0 -3
- package/tracking/components/CookieConsent/CookieConsentContent.js +0 -4
- package/tracking/components/CookieConsent/CookieConsentMessage.js +0 -4
- package/tracking/components/CookieConsent/index.js +0 -1
- package/tracking/helpers/index.js +0 -7
- package/tracking/hooks/index.js +0 -4
- package/tracking/index.js +0 -1
- package/tracking/providers/CookieConsentProvider.connector.js +0 -4
- package/tracking/providers/CookieConsentProvider.js +0 -8
- /package/{tracking/providers/CookieConsentProvider.context.js → back-in-stock/providers/BackInStockSubscriptionsProvider.context.js} +0 -0
- /package/page/{NotFound.js → components/NotFound.js} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2017-present, Shopgate, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache 2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/ // FEATURES
|
|
7
|
+
var NAV_MENU='nav-menu';var PRODUCT='product';// CONTENTS
|
|
8
|
+
var BACK_IN_STOCK='back-in-stock';// POSITIONS
|
|
9
|
+
var BEFORE='before';var AFTER='after';export var NAV_MENU_BACK_IN_STOCK_BEFORE="".concat(NAV_MENU,".").concat(BACK_IN_STOCK,".").concat(BEFORE);export var NAV_MENU_BACK_IN_STOCK="".concat(NAV_MENU,".").concat(BACK_IN_STOCK);export var NAV_MENU_BACK_IN_STOCK_AFTER="".concat(NAV_MENU,".").concat(BACK_IN_STOCK,".").concat(AFTER);export var PRODUCT_BACK_IN_STOCK_BEFORE="".concat(PRODUCT,".").concat(BACK_IN_STOCK,".").concat(BEFORE);export var PRODUCT_BACK_IN_STOCK="".concat(PRODUCT,".").concat(BACK_IN_STOCK);export var PRODUCT_BACK_IN_STOCK_AFTER="".concat(PRODUCT,".").concat(BACK_IN_STOCK,".").concat(AFTER);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./Actions";export*from"./Common";export*from"./Pipelines";export*from"./Portals";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from'react';import{BackInStockSubscriptionsProviderContext}from'@shopgate/engage/back-in-stock/providers';/**
|
|
2
|
+
* Gives access to the values which the context BackInStockSubscriptionsProvider provide
|
|
3
|
+
* @returns {JSX}
|
|
4
|
+
*/export var useBackInStockSubscriptions=function useBackInStockSubscriptions(){return React.useContext(BackInStockSubscriptionsProviderContext);};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{connect}from'react-redux';import{getBackInStockSubscriptions,getBackInStockSubscriptionsFetching,getBackInStockSubscriptionsInitial,getAreBackInStockRequestsPossible}from'@shopgate/engage/back-in-stock/selectors';import{addBackInStockSubscription,removeBackInStockSubscription}from'@shopgate/engage/back-in-stock/actions';/**
|
|
2
|
+
* @return {Function} The extended component props.
|
|
3
|
+
*/function makeMapStateToProps(){/**
|
|
4
|
+
* @param {Object} state The application state.
|
|
5
|
+
* @param {Object} props The component props
|
|
6
|
+
* @returns {Object}
|
|
7
|
+
*/return function(state,props){return{subscriptions:getBackInStockSubscriptions(state,props),isFetching:getBackInStockSubscriptionsFetching(state,props),isInitial:getBackInStockSubscriptionsInitial(state,props),requestsPossible:getAreBackInStockRequestsPossible(state,props)};};}var mapDispatchToProps={addBackInStockSubscription:addBackInStockSubscription,removeBackInStockSubscription:removeBackInStockSubscription};export default connect(makeMapStateToProps,mapDispatchToProps);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React,{useMemo}from'react';import PropTypes from'prop-types';import Context from"./BackInStockSubscriptionsProvider.context";import connect from"./BackInStockSubscriptionsProvider.connector";/**
|
|
2
|
+
* Back in Stock Provider
|
|
3
|
+
* @returns {JSX}
|
|
4
|
+
*/var BackInStockSubscriptionsProvider=function BackInStockSubscriptionsProvider(_ref){var subscriptions=_ref.subscriptions,children=_ref.children,addBackInStockSubscription=_ref.addBackInStockSubscription,isFetching=_ref.isFetching,isInitial=_ref.isInitial,removeBackInStockSubscription=_ref.removeBackInStockSubscription,requestsPossible=_ref.requestsPossible;var groupedSubscriptions=useMemo(function(){return subscriptions.reduce(function(acc,subscription){var status=subscription.status;var groupingStatus=status==='inactive'||status==='triggered'?'past':status;acc[groupingStatus].push(subscription);return acc;},{active:[],past:[]});},[subscriptions]);// Create memoized context value.
|
|
5
|
+
var value=useMemo(function(){return{subscriptions:subscriptions,groupedSubscriptions:groupedSubscriptions,addBackInStockSubscription:addBackInStockSubscription,removeBackInStockSubscription:removeBackInStockSubscription,isFetching:isFetching,isInitial:isInitial&&requestsPossible};},[addBackInStockSubscription,groupedSubscriptions,isFetching,isInitial,removeBackInStockSubscription,subscriptions,requestsPossible]);return React.createElement(Context.Provider,{value:value},children);};BackInStockSubscriptionsProvider.defaultProps={children:null,isFetching:false,isInitial:true,requestsPossible:false};export default connect(BackInStockSubscriptionsProvider);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as BackInStockSubscriptionsProviderContext}from"./BackInStockSubscriptionsProvider.context";export{default as BackInStockSubscriptionsProvider}from"./BackInStockSubscriptionsProvider";
|
|
@@ -0,0 +1,5 @@
|
|
|
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);}import{PERMISSION_ID_PUSH,APP_PERMISSION_STATUS_RECEIVED}from'@shopgate/engage/core/constants';import{ADD_BACK_IN_STOCK_SUBSCRIPTION,ADD_BACK_IN_STOCK_SUBSCRIPTION_ERROR,ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS,FETCH_BACK_IN_STOCK_SUBSCRIPTIONS,FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_ERROR,FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_SUCCESS,REMOVE_BACK_IN_STOCK_SUBSCRIPTION,REMOVE_BACK_IN_STOCK_SUBSCRIPTION_ERROR,REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS}from'@shopgate/engage/back-in-stock/constants';var initialState={isFetching:false,isInitial:true,subscriptions:[],pushPermissionStatus:null};/**
|
|
2
|
+
* @param {Object} state The application state.
|
|
3
|
+
* @param {Object} action The redux action.
|
|
4
|
+
* @returns {Object}
|
|
5
|
+
*/export default(function(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:initialState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case FETCH_BACK_IN_STOCK_SUBSCRIPTIONS:{return _extends({},state,{isFetching:true});}case FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_SUCCESS:{return _extends({},state,{isInitial:false,isFetching:false,subscriptions:action.subscriptions});}case FETCH_BACK_IN_STOCK_SUBSCRIPTIONS_ERROR:{return _extends({},state,{isFetching:false});}case ADD_BACK_IN_STOCK_SUBSCRIPTION:{return _extends({},state,{isFetching:true});}case ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS:{return _extends({},state,{isFetching:false});}case ADD_BACK_IN_STOCK_SUBSCRIPTION_ERROR:{return _extends({},state,{isFetching:false});}case REMOVE_BACK_IN_STOCK_SUBSCRIPTION:{return _extends({},state,{isFetching:true});}case REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS:{return _extends({},state,{isFetching:false});}case REMOVE_BACK_IN_STOCK_SUBSCRIPTION_ERROR:{return _extends({},state,{isFetching:false});}case APP_PERMISSION_STATUS_RECEIVED:{if(action.permissionId!==PERMISSION_ID_PUSH){return state;}return _extends({},state,{pushPermissionStatus:action.status});}default:return state;}});
|
|
@@ -0,0 +1,43 @@
|
|
|
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;}import{createSelector}from'reselect';import{makeGetProductByCharacteristics}from'@shopgate/engage/product';import{appConfig}from'@shopgate/engage';import{hasNewServices,hasSGJavaScriptBridge,hasWebBridge}from'@shopgate/engage/core/helpers';import{getClientInformation}from'@shopgate/engage/core/selectors';import{PERMISSION_STATUS_GRANTED,PERMISSION_STATUS_NOT_SUPPORTED}from'@shopgate/engage/core/constants';/**
|
|
2
|
+
* @param {Object} state The application state.
|
|
3
|
+
* @returns {Object}
|
|
4
|
+
*/export var getBackInStockState=function getBackInStockState(state){return state.backInStock;};/**
|
|
5
|
+
* Selector to retrieve the back-in-stock subscriptions list
|
|
6
|
+
* @returns {Array}
|
|
7
|
+
*/export var getBackInStockSubscriptions=createSelector(getBackInStockState,function(state){return state.subscriptions;});/**
|
|
8
|
+
* Selector to retrieve the current fetching state of back-in-stock subscriptions
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/export var getBackInStockSubscriptionsFetching=createSelector(getBackInStockState,function(state){return state.isFetching;});/**
|
|
11
|
+
* Selector to determine if back-in-stock subscriptions have been fetched before
|
|
12
|
+
* @returns {boolean}
|
|
13
|
+
*/export var getBackInStockSubscriptionsInitial=createSelector(getBackInStockState,function(state){return state.isInitial;});/**
|
|
14
|
+
* Selector to retrieve the current status of the push app permission
|
|
15
|
+
* @returns {string}
|
|
16
|
+
*/export var getBackInStockPushPermissionStatus=createSelector(getBackInStockState,function(state){return state.pushPermissionStatus;});/**
|
|
17
|
+
* Creates a selector that retrieves the subscription of
|
|
18
|
+
* a product / variant or null by its variantId / productId
|
|
19
|
+
* @param {Object} params Params
|
|
20
|
+
* @param {string} params.status Get subscription for a specific status
|
|
21
|
+
* @returns {Function}
|
|
22
|
+
*/export var makeGetSubscriptionByProduct=function makeGetSubscriptionByProduct(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},status=_ref.status;return createSelector(function(state){var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return props.variantId?props.variantId:props.productId;},getBackInStockSubscriptions,function(requestedProductCode,subscriptions){if(!requestedProductCode){return false;}return subscriptions.find(function(_ref2){var productCode=_ref2.productCode,subscriptionStatus=_ref2.status;var match=productCode===requestedProductCode;if(match&&status){// When the selector factory is created for a specific status, the subscription also
|
|
23
|
+
// needs to fulfill this condition
|
|
24
|
+
match=subscriptionStatus===status;}return match;})||null;});};/**
|
|
25
|
+
* Creates a selector that retrieves the subscription of
|
|
26
|
+
* a product / variant by its characteristics
|
|
27
|
+
* @returns {Function}
|
|
28
|
+
*/export var makeGetSubscriptionByCharacteristics=function makeGetSubscriptionByCharacteristics(){var getProductByCharacteristics=makeGetProductByCharacteristics();return createSelector(getProductByCharacteristics,getBackInStockSubscriptions,function(product,subscriptions){if(!product){return null;}return subscriptions.find(function(_ref3){var productCode=_ref3.productCode;return productCode===product.id;})||null;});};/**
|
|
29
|
+
* Selector to determine if the back-in-stock feature is enabled
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/export var getIsBackInStockEnabled=createSelector(getClientInformation,getBackInStockPushPermissionStatus,function(clientInformation,pushPermissionStatus){// Feature is not supported with the new services right now, since non ROPE inventory is
|
|
32
|
+
// not fully supported.
|
|
33
|
+
if(hasNewServices()||hasWebBridge()){return false;}// Perform app version checks when PWA runs outside the browser
|
|
34
|
+
if(hasSGJavaScriptBridge()){var _clientInformation$co2=clientInformation.codebaseVersion,codebaseVersion=_clientInformation$co2===void 0?'0.0.0':_clientInformation$co2;var _codebaseVersion$spli3=codebaseVersion.split('.'),_codebaseVersion$spli4=_slicedToArray(_codebaseVersion$spli3,1),major=_codebaseVersion$spli4[0];/**
|
|
35
|
+
* The feature can be enabled on react-native-engage based apps (>= 11.0.0) with proper
|
|
36
|
+
* support for push permissions checks
|
|
37
|
+
*/if(parseInt(major,10)<11||pushPermissionStatus===PERMISSION_STATUS_NOT_SUPPORTED){return false;}}return(appConfig===null||appConfig===void 0?void 0:appConfig.showBackInStock)||false;});/**
|
|
38
|
+
* Selector to determine if back-in-stock related requests are currently possible.
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/export var getAreBackInStockRequestsPossible=createSelector(getIsBackInStockEnabled,getBackInStockPushPermissionStatus,function(featureEnabled,pushPermissionStatus){return featureEnabled&&pushPermissionStatus===PERMISSION_STATUS_GRANTED;});/**
|
|
41
|
+
* Returns if subscription list is in use
|
|
42
|
+
* @returns {boolean}
|
|
43
|
+
*/export var getHasBackInStockSubscriptions=createSelector(getBackInStockSubscriptions,function(subscriptions){return!!subscriptions.length;});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{appDidStart$,main$,routeDidEnter$}from'@shopgate/engage/core/streams';import{productWillEnter$}from'@shopgate/engage/product/streams';import{ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS,REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS,BACK_IN_STOCK_PATTERN}from'@shopgate/engage/back-in-stock/constants';export var backInStockRemindersDidEnter$=routeDidEnter$.filter(function(_ref){var action=_ref.action;return action.route.pattern===BACK_IN_STOCK_PATTERN;});export var addBackInStockReminderSuccess$=main$.filter(function(_ref2){var action=_ref2.action;return action.type===ADD_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS;});export var removeBackInStockReminderSuccess$=main$.filter(function(_ref3){var action=_ref3.action;return action.type===REMOVE_BACK_IN_STOCK_SUBSCRIPTION_SUCCESS;});export var backInStockReminderNeedsFetch$=addBackInStockReminderSuccess$.merge(appDidStart$,removeBackInStockReminderSuccess$,backInStockRemindersDidEnter$,productWillEnter$);
|
|
@@ -0,0 +1,11 @@
|
|
|
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{appWillInit$}from'@shopgate/engage/core/streams';import{PERMISSION_ID_PUSH}from'@shopgate/engage/core/constants';import{appInitialization}from'@shopgate/engage/core/collections';import{requestAppPermissionStatus,showModal}from'@shopgate/engage/core/actions';import{fetchBackInStockSubscriptions}from'@shopgate/engage/back-in-stock/actions';import{addBackInStockReminderSuccess$,backInStockReminderNeedsFetch$}from'@shopgate/engage/back-in-stock/streams';import{getIsBackInStockEnabled,getAreBackInStockRequestsPossible}from'@shopgate/engage/back-in-stock/selectors';/**
|
|
2
|
+
* @param {Function} subscribe The subscribe function.
|
|
3
|
+
*/export default function backInStock(subscribe){subscribe(appWillInit$,function(){/**
|
|
4
|
+
* Back-in-stock requests are only possible when users granted push permissions. Otherwise
|
|
5
|
+
* the backend will not be able to assign the subscriptions to a device.
|
|
6
|
+
*
|
|
7
|
+
* So in the next block we register a new handler to the "appInitialization" collection which
|
|
8
|
+
* will retrieve the current status of the push permission before the React app starts.
|
|
9
|
+
*
|
|
10
|
+
* The back-in-stock reducer will store the status, so that selectors can work with it.
|
|
11
|
+
*/appInitialization.set('back-in-stock',/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref){var dispatch,getState,isEnabled;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:dispatch=_ref.dispatch,getState=_ref.getState;isEnabled=getIsBackInStockEnabled(getState());if(!isEnabled){_context.next=5;break;}_context.next=5;return dispatch(requestAppPermissionStatus({permissionId:PERMISSION_ID_PUSH}));case 5:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref2.apply(this,arguments);};}());});subscribe(backInStockReminderNeedsFetch$,function(_ref3){var dispatch=_ref3.dispatch,getState=_ref3.getState;var requestsPossible=getAreBackInStockRequestsPossible(getState());if(requestsPossible){dispatch(fetchBackInStockSubscriptions());}});subscribe(addBackInStockReminderSuccess$,function(_ref4){var dispatch=_ref4.dispatch;dispatch(showModal({title:'back_in_stock.add_back_in_stock_success_modal.title',message:'back_in_stock.add_back_in_stock_success_modal.message',confirm:'modal.confirm',dismiss:null}));});}
|
package/cart/cart.helpers.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
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);}import groupBy from'lodash/groupBy';import{ROPIS,BOPIS}from"../locations";/**
|
|
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);}import groupBy from'lodash/groupBy';import{hasNewServices}from'@shopgate/engage/core/helpers';import{ROPIS,BOPIS}from"../locations";/**
|
|
2
2
|
* @param {Array} cartItems The cart items to sort.
|
|
3
3
|
* @returns {Array}
|
|
4
4
|
*/export function sortCartItems(cartItems){var grouped=groupBy(cartItems,'type');var sorted=Object.keys(grouped).reduce(function(acc,key){return[].concat(acc,grouped[key].sort(function(a,b){return Math.sign(!!b.fulfillment-!!a.fulfillment);}));},[]);var ropeItem=sorted.filter(function(item){return item.fulfillment&&[ROPIS,BOPIS].includes(item.fulfillment.method);}).sort(function(a,b){if(a.fulfillment.location.code<b.fulfillment.location.code)return 1;if(a.fulfillment.location.code>b.fulfillment.location.code)return-1;return 0;});var directItem=sorted.filter(function(item){return!item.fulfillment||![ROPIS,BOPIS].includes(item.fulfillment.method);});var merged=[].concat(ropeItem,directItem);// Group splitted line items - try to keep the original order intact as much as possible
|
|
5
5
|
var groupedByBaseLineItemId=groupBy(merged,function(e){return e.baseLineItemId||e.id;});merged=merged.reduce(function(acc,_ref){var id=_ref.id;var group=groupedByBaseLineItemId===null||groupedByBaseLineItemId===void 0?void 0:groupedByBaseLineItemId[id];if(group){return[].concat(acc,group);}return acc;},[]);var enhanced=merged.map(function(item){if(!item.fulfillment||![ROPIS,BOPIS].includes(item.fulfillment.method)){return _extends({},item,{fulfillmentLocationId:null,fulfillmentMethod:null});}return _extends({},item,{fulfillmentLocationId:item.fulfillment.location.code,fulfillmentMethod:item.fulfillment.method});});return enhanced;}/**
|
|
6
6
|
* @param {Object} cartItem A cart item
|
|
7
7
|
* @returns {Object}
|
|
8
|
-
*/export var createCartItemPrices=function createCartItemPrices(){var cartItem=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{}
|
|
8
|
+
*/export var createCartItemPrices=function createCartItemPrices(){var cartItem=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};/**
|
|
9
|
+
* When PWA doesn't run with new services and uses a "shopgate.cart.getCart.v1" pipeline from one
|
|
10
|
+
* of the available cart extensions, we return a price array based on the response of those
|
|
11
|
+
* pipelines.
|
|
12
|
+
*/if(!hasNewServices()){var _cartItem$product3=cartItem.product,_cartItem$product4=_cartItem$product3===void 0?{}:_cartItem$product3,_cartItem$product2$pr2=_cartItem$product4.price,_price=_cartItem$product2$pr2===void 0?{}:_cartItem$product2$pr2;return{price:[],subtotal:typeof(_price===null||_price===void 0?void 0:_price.special)==='number'&&_price.special!==_price["default"]?[{price:_price["default"]},{price:_price.special}]:[{price:_price["default"]}]};}/**
|
|
13
|
+
* When running with the new services, the "shopgate.cart.getCart.v1" pipeline returns entities
|
|
14
|
+
* with different price properties. Those are handled here.
|
|
15
|
+
*/var _cartItem$product5=cartItem.product,product=_cartItem$product5===void 0?{}:_cartItem$product5,quantity=cartItem.quantity,price=cartItem.price,promoAmount=cartItem.promoAmount,extendedPrice=cartItem.extendedPrice,unitPromoAmount=cartItem.unitPromoAmount,unitDiscountAmount=cartItem.unitDiscountAmount;var _ref2=(product===null||product===void 0?void 0:product.price)||{},unit=_ref2.unit,unitSale=_ref2.unitSale,unitEffective=_ref2.unitEffective;var prices={price:[{price:unit}],subtotal:[]};if(unitSale&&unitSale!==unit){prices.price.push({price:unitSale});prices.subtotal.push({price:unit*quantity});}prices.subtotal.push({price:price});if(unitPromoAmount){prices.price.push({price:unitEffective+unitPromoAmount,isPromo:true});prices.subtotal.push({price:price+promoAmount,isPromo:true});}if(unitDiscountAmount){prices.price.push({price:unitEffective+unitPromoAmount+unitDiscountAmount,isCoupon:true});prices.subtotal.push({price:extendedPrice,isCoupon:true});}return prices;};
|
|
@@ -1,16 +1,20 @@
|
|
|
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*as React from'react';import PT from'prop-types';import Transition from'react-transition-group/Transition';import{getAbsoluteHeight}from'@shopgate/pwa-common/helpers/dom';import{CART_PATH}from'@shopgate/pwa-common-commerce/cart/constants';import{CART_ITEM_TYPE_COUPON}from'@shopgate/pwa-common-commerce/cart';import{getPageSettings}from'@shopgate/engage/core/config';import{MessageBar,CardList}from'@shopgate/engage/components';import{container,cartItemTransitionDuration as duration,getCartItemTransitionStyle as getTransitionStyle}from"./CartItemCoupon.style";import{messagesContainerCard,messagesCard,messagesContainerLine,messagesLine}from"./CartItem.style";import connect from"./CartItemCoupon.connector";import{CartItemCouponLayout}from"./CartItemCouponLayout";var messageStyles={card:{container:messagesContainerCard,message:messagesCard},line:{container:messagesContainerLine,message:messagesLine}};/**
|
|
2
2
|
* The Coupon component.
|
|
3
|
-
*/var CartItemCoupon=/*#__PURE__*/function(_React$Component){
|
|
3
|
+
*/var CartItemCoupon=/*#__PURE__*/function(_React$Component){/**
|
|
4
4
|
* Constructor.
|
|
5
5
|
* @param {Object} props The component props.
|
|
6
|
-
*/function CartItemCoupon(props){var
|
|
6
|
+
*/function CartItemCoupon(props){var _this2;_classCallCheck(this,CartItemCoupon);_this2=_callSuper(this,CartItemCoupon,[props]);/**
|
|
7
|
+
* Sets this coupon to be invisible via its state.
|
|
8
|
+
*/_defineProperty(_this2,"transitionOut",function(){_this2.setState({visible:false});});/**
|
|
9
|
+
* Deletes the coupon from the cart.
|
|
10
|
+
*/_defineProperty(_this2,"deleteCoupon",function(){_this2.props.deleteCoupon(_this2.props.id);});_this2.state={visible:true};return _this2;}/**
|
|
7
11
|
* Expose props to the descendant components to use them for the portals.
|
|
8
12
|
* @return {Object}
|
|
9
|
-
*/_createClass(CartItemCoupon,[{key:"getChildContext",value:function getChildContext(){return{cartItemId:this.props.id,type:CART_ITEM_TYPE_COUPON,editable:this.props.editable};}/**
|
|
13
|
+
*/_inherits(CartItemCoupon,_React$Component);return _createClass(CartItemCoupon,[{key:"getChildContext",value:function getChildContext(){return{cartItemId:this.props.id,type:CART_ITEM_TYPE_COUPON,editable:this.props.editable};}/**
|
|
10
14
|
* We need to set the element height explicitly so that we can animate it later.
|
|
11
15
|
*/},{key:"componentDidMount",value:function componentDidMount(){this.transitionElement.style.height="".concat(getAbsoluteHeight(this.cardElement),"px");}/**
|
|
12
16
|
* We need to set the element height explicitly so that we can animate it later.
|
|
13
|
-
*/},{key:"componentDidUpdate",value:function componentDidUpdate(){this.transitionElement.style.height="".concat(getAbsoluteHeight(this.cardElement),"px");}},{key:"render"
|
|
17
|
+
*/},{key:"componentDidUpdate",value:function componentDidUpdate(){this.transitionElement.style.height="".concat(getAbsoluteHeight(this.cardElement),"px");}},{key:"render",value:/**
|
|
14
18
|
* Render Function.
|
|
15
19
|
* @returns {JSX}
|
|
16
|
-
*/
|
|
20
|
+
*/function render(){var _this3=this;var _getPageSettings=getPageSettings(CART_PATH),_getPageSettings$cart=_getPageSettings.cartItemsDisplay,cartItemsDisplay=_getPageSettings$cart===void 0?'line':_getPageSettings$cart;return React.createElement(Transition,{"in":this.state.visible,timeout:duration,onExited:this.deleteCoupon},function(state){return React.createElement("div",{ref:function ref(element){if(element)_this3.transitionElement=element;},key:_this3.props.id,style:getTransitionStyle(state)},React.createElement("div",{className:container,ref:function ref(element){if(element)_this3.cardElement=element;}},React.createElement(CardList.Item,null,_this3.props.messages.length>0&&React.createElement(MessageBar,{messages:_this3.props.messages,classNames:messageStyles[cartItemsDisplay]}),React.createElement(CartItemCouponLayout,{handleDelete:_this3.transitionOut,coupon:_this3.props.coupon,currency:_this3.props.currency}))));});}}]);}(React.Component);_defineProperty(CartItemCoupon,"childContextTypes",{cartItemId:PT.string,type:PT.string,editable:PT.bool});_defineProperty(CartItemCoupon,"defaultProps",{deleteCoupon:function deleteCoupon(){}});CartItemCoupon.defaultProps={editable:true};export default connect(CartItemCoupon);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from'react';import{i18n}from'@shopgate/engage/core';/**
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{i18n}from'@shopgate/engage/core/helpers';import{Ellipsis}from'@shopgate/engage/components';/**
|
|
2
2
|
* The Coupon Code component.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/export var CartItemCouponCode=function CartItemCouponCode(_ref){var value=_ref.value;return React.createElement(
|
|
5
|
+
*/export var CartItemCouponCode=function CartItemCouponCode(_ref){var value=_ref.value;return React.createElement(Ellipsis,{rows:2},"".concat(i18n.text('cart.coupon_code'),": ").concat(value));};CartItemCouponCode.defaultProps={value:''};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from'react';import{CrossIcon}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import styles from"./CartItemCouponDelete.style";/**
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{CrossIcon}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import styles from"./CartItemCouponDelete.style";/**
|
|
2
2
|
* The Coupon Delete component.
|
|
3
3
|
* @param {Object} props The component properties.
|
|
4
4
|
* @returns {JSX}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from'react';import{i18n}from'@shopgate/engage/core';/**
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{i18n}from'@shopgate/engage/core';/**
|
|
2
2
|
* The Coupon Free Shipping component.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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);}import React from'react';import{themeConfig}from'@shopgate/engage';import{useWidgetSettings}from'@shopgate/engage/core/hooks';import{Icon,CartCouponIcon}from'@shopgate/engage/components';/**
|
|
2
2
|
* Renders the cart item coupon icon.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/export var CartItemCouponIcon=function CartItemCouponIcon(){return React.createElement(Icon,{viewBox:
|
|
4
|
+
*/export var CartItemCouponIcon=function CartItemCouponIcon(){var _useWidgetSettings=useWidgetSettings('@shopgate/engage/components/CartCouponIcon'),viewBox=_useWidgetSettings.viewBox,color=_useWidgetSettings.color;if(!themeConfig.icons.cartCoupon){return React.createElement(CartCouponIcon,null);}return React.createElement(Icon,_extends({},viewBox&&{viewBox:viewBox},{content:themeConfig.icons.cartCoupon,color:color}));};
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export var item=css({fontSize:'0.875rem',padding:"".concat(variables.gap.small/2,"px ").concat(variables.gap.big,"px")}).toString();export var icon=css({fontSize:'3rem',flexShrink:0,margin:'5px 12px 0 12px'}).toString();export var content=css({display:'flex',flexDirection:'column',paddingLeft:variables.gap.big,paddingTop:variables.gap.small,paddingBottom:variables.gap.small
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export var item=css({fontSize:'0.875rem',padding:"".concat(variables.gap.small/2,"px ").concat(variables.gap.big,"px")}).toString();export var icon=css({fontSize:'3rem',flexShrink:0,margin:'5px 12px 0 12px'}).toString();export var content=css({display:'flex',flexDirection:'column',paddingLeft:variables.gap.big,paddingTop:variables.gap.small,paddingBottom:variables.gap.small,// took from https://stackoverflow.com/a/36247448
|
|
2
|
+
// in order to prevent the long coupon codes from
|
|
3
|
+
// breaking the ui, we need to reset the default
|
|
4
|
+
// flexbox settings (taken from CCP-2475)
|
|
5
|
+
minWidth:0}).toString();export var contentLast=css({alignItems:'flex-end'}).toString();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React,{useMemo}from'react';import PropTypes from'prop-types';import{i18n}from'@shopgate/engage/core';import styles from"./CartItemCouponTitle.style";/**
|
|
2
2
|
* The CouponTitle component.
|
|
3
3
|
* @param {Object} props The component properties.
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/export function CartItemCouponTitle(_ref){var value=_ref.value;var title=
|
|
5
|
+
*/export function CartItemCouponTitle(_ref){var value=_ref.value;var title=useMemo(function(){return value||i18n.text('cart.default_coupon_label');},[value]);return React.createElement("div",{className:styles},title);}CartItemCouponTitle.defaultProps={value:null};
|
|
@@ -1,4 +1,6 @@
|
|
|
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 React,{useMemo}from'react';import classNames from'classnames';import{Grid,Link,TextLink,ProductProperties,SurroundPortals,ConditionalWrapper,I18n}from'@shopgate/engage/components';import{CART_ITEM_IMAGE,CART_ITEM_QUANTITY_PICKER}from'@shopgate/
|
|
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;}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);}import React,{useMemo}from'react';import classNames from'classnames';import{Grid,Link,TextLink,ProductProperties,SurroundPortals,ConditionalWrapper,I18n}from'@shopgate/engage/components';import{CART_ITEM_IMAGE,CART_ITEM_LINK,CART_ITEM_PROPERTIES,CART_ITEM_QUANTITY_PICKER}from'@shopgate/engage/cart';import{showTaxDisclaimer}from'@shopgate/engage/market';import{bin2hex}from'@shopgate/engage/core/helpers';import{useWidgetSettings}from'@shopgate/engage/core/hooks';import{ProductImage,PriceInfo,ITEM_PATH}from'@shopgate/engage/product';import{CartItemProductChangeLocation,CartChangeFulfillmentMethod}from'@shopgate/engage/locations';import{getLineItemActiveStatus}from'@shopgate/engage/orders';import{CartItemQuantityPicker}from"./CartItemQuantityPicker";import{CartItemProductTitle}from"./CartItemProductTitle";import CartItemProductOrderDetails from"./CartItemProductOrderDetails";import CartItemProductPriceList from"./CartItemProductPriceList";import{useCartItem,useCartItemProduct}from"./CartItem.hooks";import styles from"./CartItemProductLayout.style";/**
|
|
2
2
|
* The Cart Product Layout component.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/export function CartItemProductLayout(){
|
|
4
|
+
*/export function CartItemProductLayout(){// Added with PWA 6 - CCP-2372
|
|
5
|
+
var _useWidgetSettings=useWidgetSettings('@shopgate/engage/components/TaxDisclaimer'),show=_useWidgetSettings.show;// use widget setting if set to true/false, otherwise use market logic
|
|
6
|
+
var showDisclaimer=typeof show==='boolean'?show:showTaxDisclaimer;var _useCartItem=useCartItem(),registerFulfillmentAction=_useCartItem.registerFulfillmentAction,isOrderDetails=_useCartItem.isOrderDetails,isCheckoutConfirmation=_useCartItem.isCheckoutConfirmation;var context=useCartItemProduct();var cartItem=context.cartItem,product=context.product,currency=context.currency,editMode=context.editMode,handleUpdate=context.handleUpdate,toggleEditMode=context.toggleEditMode,isEditable=context.isEditable;var portalProps=useMemo(function(){return _extends({},context,{isOrderDetails:isOrderDetails,isCheckoutConfirmation:isCheckoutConfirmation,quantity:cartItem.quantity});},[cartItem.quantity,context,isCheckoutConfirmation,isOrderDetails]);var isActive=!isOrderDetails?true:getLineItemActiveStatus(cartItem===null||cartItem===void 0?void 0:cartItem.status,cartItem===null||cartItem===void 0?void 0:cartItem.subStatus);var showLineItemPromotions=useMemo(function(){if(isOrderDetails||isCheckoutConfirmation){return false;}return((cartItem===null||cartItem===void 0?void 0:cartItem.appliedPromotions)||[]).length>0;},[cartItem,isCheckoutConfirmation,isOrderDetails]);return React.createElement(React.Fragment,null,React.createElement(Grid,{className:classNames(styles.item,_defineProperty({},styles.itemInactive,!isActive))},React.createElement(Grid.Item,{className:styles.content,grow:1},React.createElement(ConditionalWrapper,{condition:isEditable,wrapper:function wrapper(children){return React.createElement(TextLink,{href:"".concat(ITEM_PATH,"/").concat(bin2hex(product.id))},children);}},React.createElement(SurroundPortals,{portalName:CART_ITEM_LINK,portalProps:portalProps},React.createElement(CartItemProductTitle,{value:product.name}))),React.createElement(Grid,{className:styles.info},React.createElement(Grid.Item,{grow:1,className:styles.properties},React.createElement(SurroundPortals,{portalName:CART_ITEM_PROPERTIES,portalProps:portalProps},React.createElement(ProductProperties,{properties:product.properties,lineClamp:2})),isOrderDetails&&React.createElement(CartItemProductOrderDetails,null)),React.createElement(Grid.Item,{grow:1,className:styles.price},isOrderDetails&&React.createElement(I18n.Text,{string:"cart.subtotal",className:styles.orderDetailsSubtotalLabel}),!showLineItemPromotions&&React.createElement(React.Fragment,null,React.createElement(CartItemProductPriceList,{isSubtotal:true}),React.createElement(PriceInfo,{product:product,currency:currency,className:styles.priceInfo}))),showDisclaimer&&React.createElement(Grid.Item,{className:styles.disclaimerSpacer,grow:0,shrink:0})),showLineItemPromotions&&React.createElement(Grid,{className:classNames(styles.info,styles.promotionLine)},React.createElement(Grid.Item,null),React.createElement(Grid.Item,{className:styles.promotionLineItem},React.createElement(CartItemProductPriceList,{isSubtotal:true,showLabels:true}),React.createElement(PriceInfo,{product:product,currency:currency,className:styles.priceInfo})))),React.createElement(Grid.Item,{className:styles.leftColumn},React.createElement("div",{className:styles.image,"aria-hidden":true},React.createElement(ConditionalWrapper,{condition:isEditable,wrapper:function wrapper(children){return React.createElement(Link,{tagName:"a",href:"".concat(ITEM_PATH,"/").concat(bin2hex(product.id))},children);}},React.createElement(SurroundPortals,{portalName:CART_ITEM_IMAGE,portalProps:portalProps},React.createElement(ProductImage,{src:product.featuredImageBaseUrl||product.featuredImageUrl})))),!isOrderDetails&&React.createElement(SurroundPortals,{portalName:CART_ITEM_QUANTITY_PICKER,portalProps:portalProps},React.createElement(CartItemQuantityPicker,{unit:product.unit,hasCatchWeight:product.hasCatchWeight,quantity:cartItem.quantity,editMode:editMode,onChange:handleUpdate,onToggleEditMode:toggleEditMode,disabled:!isEditable})))),React.createElement(CartItemProductChangeLocation,{cartItem:cartItem,registerAction:registerFulfillmentAction}),React.createElement(CartChangeFulfillmentMethod,{cartItem:cartItem,registerAction:registerFulfillmentAction}));}
|
|
@@ -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{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export var container=css({display:'flex',flexDirection:'row',justifyContent:'space-between',padding:variables.gap.big}).toString();export var imageColumn=css({width:120,height:120,marginRight:variables.gap.small,flexShrink:0,flexGrow:0});export var column=css({display:'flex',alignItems:'center',flexDirection:'column',flexShrink:1,flexGrow:1,flexBasis:0,padding:"0 ".concat(variables.gap.small,"px"),':last-child':{paddingRight:0}});export var detailsColumn=css(column,{flexShrink:1,flexGrow:3,alignItems:'flex-start'});export var priceColumnWide=css(column,{flexGrow:4,alignItems:'flex-end'});export var locationColumn=css(column,{fontSize:'1.25rem',lineHeight:'1.625rem',fontWeight:500,flexGrow:2});export var statusColumn=css(column,{fontSize:'1.25rem',lineHeight:'1.625rem'});export var productName=css({fontSize:'1.25rem',lineHeight:'1.5rem',fontWeight:500,wordBreak:['keep-all','break-word'],hyphens:'auto'}).toString();export var productProperties=css({paddingTop:variables.gap.small,color:'var(--color-text-low-emphasis)',fontSize:'1rem'}).toString();export var quantityPicker=css({width:140}).toString();export var quantityPickerDisabled=css({padding:"0 ".concat(variables.gap.small,"px"),textAlign:'center',fontSize:'1.25rem',lineHeight:'1.625rem',height:28,width:'100%',fontWeight:500,color:'var(--color-text-high-emphasis)',whiteSpace:'nowrap'}).toString();export var containerInactive=css(_defineProperty(_defineProperty({color:'var(--color-text-low-emphasis)'}," .".concat(quantityPickerDisabled),{color:'var(--color-text-low-emphasis)'})," .".concat(imageColumn),{opacity:0.7})).toString();export var price=css({fontSize:'1.25rem !important',lineHeight:'1.625rem !important'}).toString();export var priceListEntry=css({flexDirection:'column-reverse !important'}).toString();export var priceListPromo=css({paddingRight:0,alignSelf:'flex-end'}).toString();export var priceInfo=css({wordBreak:'break-word',fontSize:'0.75rem',lineHeight:'0.875rem',color:'var(--color-text-low-emphasis)',padding:"".concat(variables.gap.xsmall,"px 0")}).toString();export var contextMenu=css({marginTop:"-".concat(variables.gap.xsmall*3,"px"),marginRight:"-".concat(variables.gap.big,"px")}).toString();export var messageContainer=css({marginTop:0}).toString();export var messageContainerRope=css({marginTop:0,marginBottom:0}).toString();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React,{useCallback}from'react';import{Grid,I18n,ContextMenu}from'@shopgate/engage/components';import{CART_ITEM_NAME}from'@shopgate/
|
|
1
|
+
import React,{useCallback}from'react';import PropTypes from'prop-types';import{Grid,I18n,ContextMenu,SurroundPortals}from'@shopgate/engage/components';import{CART_ITEM_CONTEXT_MENU,CART_ITEM_CONTEXT_MENU_ITEM_EDIT,CART_ITEM_CONTEXT_MENU_ITEM_REMOVE,CART_ITEM_NAME}from'@shopgate/engage/cart';import{CartContextMenuItemChangeLocation,CartContextMenuItemChangeFulfillment}from'@shopgate/engage/locations';import{ProductName}from'@shopgate/engage/product';import{useCartItem,useCartItemProduct}from"./CartItem.hooks";import{menuToggleButton,menuToggleContainer,title,menuContainer}from"./CartItemProductTitle.style";var contextMenuClasses={button:menuToggleButton,container:menuToggleContainer};/**
|
|
2
2
|
* The Cart Product Title component.
|
|
3
3
|
* @param {Object} props The component properties.
|
|
4
4
|
* @param {Object} context The component context.
|
|
5
5
|
* @returns {JSX}
|
|
6
|
-
*/export function CartItemProductTitle(
|
|
6
|
+
*/export function CartItemProductTitle(_ref){var value=_ref.value;var _useCartItem=useCartItem(),invokeFulfillmentAction=_useCartItem.invokeFulfillmentAction;var context=useCartItemProduct();var handleRemove=context.handleRemove,toggleEditMode=context.toggleEditMode,cartItem=context.cartItem,isEditable=context.isEditable;var handleToggleEditMode=useCallback(function(){if(toggleEditMode){toggleEditMode(true);}},[toggleEditMode]);var handleChangeLocationClick=useCallback(function(){if(!cartItem||!cartItem.fulfillment||!cartItem.fulfillment.method){return;}var method=cartItem.fulfillment.method;invokeFulfillmentAction('changeLocation',method);},[cartItem,invokeFulfillmentAction]);var handleChangeFulfillmentClick=useCallback(function(){invokeFulfillmentAction('changeFulfillment');},[invokeFulfillmentAction]);return React.createElement(Grid,null,React.createElement(Grid.Item,{grow:1},React.createElement(ProductName,{name:value,className:title,portalName:CART_ITEM_NAME,portalProps:context,testId:value,ellipsis:false})),isEditable&&React.createElement(Grid.Item,{className:menuContainer,shrink:0},React.createElement(SurroundPortals,{portalName:CART_ITEM_CONTEXT_MENU,portalProps:{context:context,handleRemove:handleRemove,toggleEditMode:toggleEditMode}},React.createElement(ContextMenu,{classes:contextMenuClasses},React.createElement(SurroundPortals,{portalName:CART_ITEM_CONTEXT_MENU_ITEM_REMOVE,portalProps:{context:context,handleRemove:handleRemove}},React.createElement("div",{"data-test-id":"cartItemContextMenuItemRemove"},React.createElement(ContextMenu.Item,{onClick:handleRemove},React.createElement(I18n.Text,{string:"cart.remove"})))),React.createElement(SurroundPortals,{portalName:CART_ITEM_CONTEXT_MENU_ITEM_EDIT,portalProps:{context:context,toggleEditMode:toggleEditMode}},React.createElement("div",{"data-test-id":"cartItemContextMenuItemEdit"},React.createElement(ContextMenu.Item,{onClick:handleToggleEditMode},React.createElement(I18n.Text,{string:"cart.edit"})))),React.createElement(CartContextMenuItemChangeLocation,{cartItem:context.cartItem,onClick:handleChangeLocationClick}),React.createElement(CartContextMenuItemChangeFulfillment,{cartItem:context.cartItem,onClick:handleChangeFulfillmentClick})))));}
|
|
@@ -1,26 +1,38 @@
|
|
|
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*as React from'react';import{i18n}from'@shopgate/engage/core';import QuantityInput from'@shopgate/engage/components/QuantityInput';import{inputStyle}from"./CartItemQuantityPicker.style";/**
|
|
2
2
|
* The Quantity Picker component.
|
|
3
|
-
*/export var CartItemQuantityPicker=/*#__PURE__*/function(_React$Component){
|
|
3
|
+
*/export var CartItemQuantityPicker=/*#__PURE__*/function(_React$Component){/**
|
|
4
4
|
* Constructor.
|
|
5
5
|
* @param {Object} props The component props.
|
|
6
|
-
*/function CartItemQuantityPicker(props){var
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
*/function CartItemQuantityPicker(props){var _this2;_classCallCheck(this,CartItemQuantityPicker);_this2=_callSuper(this,CartItemQuantityPicker,[props]);/**
|
|
7
|
+
* The default quantity.
|
|
8
|
+
* @type {number}
|
|
9
|
+
*/_defineProperty(_this2,"defaultQuantity",1);/**
|
|
10
|
+
* Event handler for the the onClick event of the input.
|
|
11
|
+
* @param {Object} event The event object.
|
|
12
|
+
*/_defineProperty(_this2,"handleInputClick",function(event){// Prevent the native focus event ...
|
|
13
|
+
event.stopPropagation();event.preventDefault();if(_this2.props.onToggleEditMode){_this2.props.onToggleEditMode(true);}});/**
|
|
14
|
+
* Event handler for the the onFocus event of the input.
|
|
15
|
+
*/_defineProperty(_this2,"handleInputFocus",function(){if(_this2.props.onToggleEditMode){_this2.props.onToggleEditMode(true);}});/**
|
|
16
|
+
* Event handler for the onSubmit event of the form which wraps the input.
|
|
17
|
+
* @param {Object} event The event object.
|
|
18
|
+
*/_defineProperty(_this2,"handleSubmitForm",function(event){event.preventDefault();if(_this2.input.current){_this2.input.current.blur();}});/**
|
|
19
|
+
* Event handler for the the onBlur event of the input.
|
|
20
|
+
* @param {Object} event The event object.
|
|
21
|
+
* @param {number} newQuantity The event object.
|
|
22
|
+
*/_defineProperty(_this2,"handleInputBlur",function(event,newQuantity){var onChange=_this2.props.onChange;// Deactivate the edit mode
|
|
23
|
+
if(_this2.props.onToggleEditMode){_this2.props.onToggleEditMode(false);}if(_this2.props.quantity!==newQuantity){if(onChange){onChange(newQuantity);}}});_this2.regex=/^([0-9.,]+)$/;_this2.input=React.createRef();return _this2;}/**
|
|
9
24
|
* Called after mount. Focuses the input if the edit mode is active.
|
|
10
|
-
*/_createClass(CartItemQuantityPicker,[{key:"componentDidMount",value:function componentDidMount(){if(this.props.editMode&&this.input.current){this.input.current.focus();}if(this.input.current){/**
|
|
25
|
+
*/_inherits(CartItemQuantityPicker,_React$Component);return _createClass(CartItemQuantityPicker,[{key:"componentDidMount",value:function componentDidMount(){if(this.props.editMode&&this.input.current){this.input.current.focus();}if(this.input.current){/**
|
|
11
26
|
* Prevent the opening of the context menu when this
|
|
12
27
|
* input is focused and the value is selected.
|
|
13
28
|
*/this.input.current.addEventListener('contextmenu',function(event){event.preventDefault();event.stopPropagation();return false;});}}/**
|
|
14
29
|
* The componentWillReceiveProps lifecycle hook. I will bring the input into the correct state.
|
|
15
30
|
* @param {Object} nextProps The next set of props.
|
|
16
|
-
*/},{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(this.input.current){if(nextProps.editMode){this.input.current.focus();}else{this.input.current.blur();}}}},{key:"
|
|
17
|
-
* Renders the component.
|
|
18
|
-
* @return {JSX}
|
|
19
|
-
*/value:function render(){var _this$props=this.props,unit=_this$props.unit,hasCatchWeight=_this$props.hasCatchWeight;var hasCustomUnit=unit&&hasCatchWeight||false;return React.createElement("form",{onSubmit:this.handleSubmitForm},React.createElement(QuantityInput,{ref:this.input,className:inputStyle.toString(),value:this.props.quantity,onClick:this.handleInputClick,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,unit:hasCustomUnit?unit:null,maxDecimals:hasCustomUnit?2:0,"data-test-id":"quantityPicker",disabled:this.props.disabled,"aria-label":i18n.text('product.quantity')}));}},{key:"initialQuantity",/**
|
|
31
|
+
*/},{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(this.input.current){if(nextProps.editMode){this.input.current.focus();}else{this.input.current.blur();}}}},{key:"initialQuantity",get:/**
|
|
20
32
|
* Returns the initial quantity based on the props.
|
|
21
33
|
* If the props are set to 0 or lower, it will fall back to 1.
|
|
22
34
|
* @return {number}
|
|
23
|
-
*/
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
26
|
-
*/
|
|
35
|
+
*/function get(){if(this.props.quantity&&(this.props.quantity===0||this.props.quantity<this.defaultQuantity)){return this.defaultQuantity;}return this.props.quantity||this.defaultQuantity;}},{key:"render",value:/**
|
|
36
|
+
* Renders the component.
|
|
37
|
+
* @return {JSX}
|
|
38
|
+
*/function render(){var _this$props=this.props,unit=_this$props.unit,hasCatchWeight=_this$props.hasCatchWeight;var hasCustomUnit=unit&&hasCatchWeight||false;return React.createElement("form",{onSubmit:this.handleSubmitForm,className:"theme__cart__product__quantity-picker"},React.createElement(QuantityInput,{ref:this.input,className:inputStyle.toString(),value:this.props.quantity,onClick:this.handleInputClick,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,unit:hasCustomUnit?unit:null,maxDecimals:hasCustomUnit?2:0,"data-test-id":"quantityPicker",disabled:this.props.disabled,"aria-label":i18n.text('product.quantity')}));}}]);}(React.Component);_defineProperty(CartItemQuantityPicker,"defaultProps",{editMode:false,onChange:function onChange(){},unit:null,quantity:1,onToggleEditMode:function onToggleEditMode(){},disabled:false,hasCatchWeight:false});
|
|
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import{i18n}from'@sho
|
|
|
2
2
|
* Renders the cart reservation card label.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/var CartItemSubstitution=function CartItemSubstitution(_ref){var setSubstitutionAllowed=_ref.setSubstitutionAllowed,editable=_ref.editable;var _useCartItem=useCartItem(),_useCartItem$cartItem=_useCartItem.cartItem,id=_useCartItem$
|
|
5
|
+
*/var CartItemSubstitution=function CartItemSubstitution(_ref){var setSubstitutionAllowed=_ref.setSubstitutionAllowed,editable=_ref.editable;var _useCartItem=useCartItem(),_useCartItem$cartItem=_useCartItem.cartItem,_useCartItem$cartItem2=_useCartItem$cartItem===void 0?{}:_useCartItem$cartItem,id=_useCartItem$cartItem2.id,substitutionAllowed=_useCartItem$cartItem2.substitutionAllowed,fulfillment=_useCartItem$cartItem2.fulfillment;if(![ROPIS,BOPIS].includes((fulfillment===null||fulfillment===void 0?void 0:fulfillment.method)||[])){return null;}return React.createElement(SubstitutionWrapper,null,React.createElement(Substitution,{className:root,id:"substitution-".concat(id),label:i18n.text('cart.allow_substitution'),checked:substitutionAllowed,onChange:function onChange(){return setSubstitutionAllowed(id,!substitutionAllowed);},disabled:!editable}));};CartItemSubstitution.defaultProps={editable:false};export default connect(CartItemSubstitution);
|
|
@@ -2,4 +2,4 @@ import _isEmpty from"lodash/isEmpty";import _every from"lodash/every";import*as
|
|
|
2
2
|
* Renders the cart item card reservation block,
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX.Element}
|
|
5
|
-
*/function CartItemCardReservation(_ref){var location=_ref.location,fulfillmentMethod=_ref.fulfillmentMethod;var _useCartItem=useCartItem(),isOrderDetails=_useCartItem.isOrderDetails;if(!location){return null;}var operationHours=location.operationHours,_location$address=location.address
|
|
5
|
+
*/function CartItemCardReservation(_ref){var location=_ref.location,fulfillmentMethod=_ref.fulfillmentMethod;var _useCartItem=useCartItem(),isOrderDetails=_useCartItem.isOrderDetails;if(!location){return null;}var operationHours=location.operationHours,_location$address=location.address,_location$address2=_location$address===void 0?{}:_location$address,phoneNumber=_location$address2.phoneNumber;if((!operationHours||_every(operationHours,_isEmpty))&&!phoneNumber&&(!location.address||!location.address.street)){return React.createElement("div",{className:accordionToggle},React.createElement(CartItemCardReservationLabel,{location:location,fulfillmentMethod:fulfillmentMethod}));}return React.createElement(React.Fragment,null,React.createElement(ResponsiveContainer,{webOnly:true,breakpoint:">xs"},!isOrderDetails&&React.createElement(CartItemCardReservationAccordion,{openWithChevron:true,location:location,fulfillmentMethod:fulfillmentMethod,operationHours:operationHours})),React.createElement(ResponsiveContainer,{appAlways:true,breakpoint:"<=xs"},!isOrderDetails&&React.createElement(CartItemCardReservationAccordion,{location:location,fulfillmentMethod:fulfillmentMethod,operationHours:operationHours})));}export default connect(CartItemCardReservation);
|
|
@@ -2,4 +2,4 @@ import _isEmpty from"lodash/isEmpty";import _every from"lodash/every";import Rea
|
|
|
2
2
|
* Renders the product group.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX.Element}
|
|
5
|
-
*/function CartItemGroupReservation(_ref){var location=_ref.location,fulfillmentMethod=_ref.fulfillmentMethod;if(!location){return null;}var operationHours=location.operationHours,_location$address=location.address
|
|
5
|
+
*/function CartItemGroupReservation(_ref){var location=_ref.location,fulfillmentMethod=_ref.fulfillmentMethod;if(!location){return null;}var operationHours=location.operationHours,_location$address=location.address,_location$address2=_location$address===void 0?{}:_location$address,phoneNumber=_location$address2.phoneNumber;if((!operationHours||_every(operationHours,_isEmpty))&&!phoneNumber){return React.createElement(CardListItem,{className:simpleLabel.toString()},React.createElement(CartItemGroupReservationLabel,{location:location,fulfillmentMethod:fulfillmentMethod}));}return React.createElement(CardListItem,null,React.createElement(Accordion,{renderLabel:function renderLabel(){return React.createElement(CartItemGroupReservationLabel,{location:location,fulfillmentMethod:fulfillmentMethod});},className:accordionToggle},React.createElement("div",{className:addressDetails},React.createElement(StoreOpeningHours,{hours:operationHours}),React.createElement(StorePhoneNumber,{phone:phoneNumber}))));}CartItemGroupReservation.defaultProps={location:null,fulfillmentMethod:null};export default connect(CartItemGroupReservation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;export var container=css({display:'flex',flexDirection:'column'});export var button=css({width:'100%',background:"var(--color-
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;export var container=css({display:'flex',flexDirection:'column'});export var button=css({width:'100%',background:"var(--color-button-cta, ".concat(colors.cta,")"),color:"var(--color-button-cta-contrast, ".concat(colors.ctaContrast,")!important"),borderRadius:4,margin:"".concat(variables.gap.big,"px 0")}).toString();export var disabledButton=css({background:colors.shade7,color:"".concat(colors.shade4,"!important")}).toString();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as React from'react';import{hot}from'react-hot-loader/root';import{createPortal}from'react-dom';import PaymentBarContent from"./PaymentBarContent";/**
|
|
1
|
+
import*as React from'react';import PropTypes from'prop-types';import{hot}from'react-hot-loader/root';import{createPortal}from'react-dom';import PaymentBarContent from"./PaymentBarContent";/**
|
|
2
2
|
* The cart payment bar component.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;export var button=css({width:'100%',background:"var(--color-
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;export var button=css({width:'100%',background:"var(--color-button-cta, ".concat(colors.cta,")"),color:"var(--color-button-cta-contrast, ".concat(colors.ctaContrast,")!important")}).toString();export var disabledButton=css({width:'100%',background:colors.shade7,color:"".concat(colors.shade4,"!important")}).toString();
|
|
@@ -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 React,{Fragment,useContext}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{css}from'glamor';import CartTotalLine from'@shopgate/pwa-ui-shared/CartTotalLine';import{errorBehavior}from'@shopgate/engage/core';import{responsiveMediaQuery}from'@shopgate/engage/styles';import{CartContext}from"../../cart.context";import{spacer}from"./PaymentBarContent.style";var styles={line:css(_defineProperty({justifyContent:'start'},responsiveMediaQuery('<=xs',{appAlways:true}),{fontSize:'0.75rem',paddingBottom:3})).toString(),message:css({order:2}).toString(),error:css({color:'var(--color-state-alert)'}).toString(),warning:css({color:'var(--color-state-warning)'}).toString(),info:css({color:'var(--color-state-ok)'}).toString(),loading:css({opacity:0.4}).toString()};/**
|
|
2
2
|
* @param {Object} props The components props
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/var PaymentBarPromotionCouponMessages=function PaymentBarPromotionCouponMessages(_ref){var messages=_ref.messages;var _useContext=useContext(CartContext),isLoading=_useContext.isLoading;if(!messages.length){return null;}return messages.map(function(_ref2){var
|
|
4
|
+
*/var PaymentBarPromotionCouponMessages=function PaymentBarPromotionCouponMessages(_ref){var messages=_ref.messages;var _useContext=useContext(CartContext),isLoading=_useContext.isLoading;if(!messages.length){return null;}return messages.map(function(_ref2){var message=_ref2.message,additionalParams=_ref2.additionalParams,type=_ref2.type;return React.createElement(CartTotalLine,{className:styles.line,key:message},React.createElement(Fragment,null,React.createElement(CartTotalLine.Spacer,{className:spacer}),React.createElement("div",{className:classNames(styles.message,_defineProperty(_defineProperty(_defineProperty(_defineProperty({},styles.loading,isLoading),styles.error,type==='error'),styles.warning,type==='warning'),styles.info,type==='info'))},errorBehavior.getErrorMessage(message,additionalParams))));});};PaymentBarPromotionCouponMessages.defaultProps={messages:[]};export default PaymentBarPromotionCouponMessages;
|
package/cart/index.js
CHANGED
|
@@ -3,8 +3,9 @@ export{default as addCouponsToCart}from'@shopgate/pwa-common-commerce/cart/actio
|
|
|
3
3
|
export{default as setCouponFieldError}from'@shopgate/pwa-common-commerce/cart/action-creators/setCouponFieldError';export{default as setCouponFieldValue}from'@shopgate/pwa-common-commerce/cart/action-creators/setCouponFieldValue';// CONSTANTS
|
|
4
4
|
export*from'@shopgate/pwa-common-commerce/cart/constants/index';export*from'@shopgate/pwa-common-commerce/cart/constants/PipelineErrors';export*from'@shopgate/pwa-common-commerce/cart/constants/Pipelines';export*from'@shopgate/pwa-common-commerce/cart/constants/Portals';export{FLAG_ORDERABLE,FLAG_COUPONS,FLAG_TAX_INCLUDED,FLAG_MULTI_LINE_RESERVE,CART_MAX_ITEMS,CART_INPUT_AUTO_SCROLL_DELAY}from"./cart.constants";// HELPERS
|
|
5
5
|
export*from'@shopgate/pwa-common-commerce/cart/helpers';export*from'@shopgate/pwa-common-commerce/cart/helpers/config';export{default as createPipelineErrorList}from'@shopgate/pwa-common-commerce/cart/helpers/createPipelineErrorList';export*from'@shopgate/pwa-common-commerce/cart/helpers/shipping';export*from'@shopgate/pwa-common-commerce/cart/helpers/tax';export{sortCartItems}from"./cart.helpers";// SELECTORS
|
|
6
|
-
export
|
|
7
|
-
|
|
6
|
+
export*from'@shopgate/pwa-common-commerce/cart/selectors';export{makeIsAddToCartButtonDisabled,getAppliedPromotionsWithoutCoupons,getPromotionCoupons,hasLineItemPromotions,hasDirectShipItems,isDirectShipOnly}from"./cart.selectors";// STREAMS
|
|
7
|
+
// eslint-disable-next-line import/export
|
|
8
|
+
export*from"./streams";// CONTEXTS
|
|
8
9
|
export{CartContext}from"./cart.context";// COMPONENTS
|
|
9
10
|
export{PaymentBar}from"./components/PaymentBar";export{CartItemGroup,CartItems}from"./components/CartItems";export{CartItem}from"./components/CartItem";export{CartHeaderWide}from"./components/CartHeaderWide";export{default as CartSummaryWide}from"./components/CartSummaryWide/CartSummaryWide";export{SupplementalContent}from"./components/SupplementalContent";export{default as CartItemsSubstitution}from"./components/CartItems/CartItemsSubstitution";// HOOKS
|
|
10
11
|
export{useCartContext}from"./cart.hooks";// TYPES
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from'@shopgate/pwa-common-commerce/cart/streams';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as fetchCategory}from'@shopgate/pwa-common-commerce/category/actions/fetchCategory';export{default as fetchCategoryOrRootCategories}from'@shopgate/pwa-common-commerce/category/actions/fetchCategoryOrRootCategories';export{default as fetchCategoryChildren}from'@shopgate/pwa-common-commerce/category/actions/fetchCategoryChildren';export{default as fetchCategoryProducts}from'@shopgate/pwa-common-commerce/category/actions/fetchCategoryProducts';export{default as fetchRootCategories}from'@shopgate/pwa-common-commerce/category/actions/fetchRootCategories';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import{bin2hex}from'@shopgate/pwa-common/helpers/data';import{CATEGORY_PATH}from'@shopgate/pwa-common-commerce/category/constants';import Portal from'@shopgate/pwa-common/components/Portal';import{Placeholder}from'@shopgate/pwa-ui-shared';import{CATEGORY_ITEM}from'@shopgate/pwa-common-commerce/category/constants/Portals';import{i18n}from'@shopgate/engage/core';import{getShowAllProductsFilters}from'@shopgate/engage/category';import{SheetList,TextLink}from'@shopgate/engage/components';import CategoryImage from"../CategoryImage";import styles from"./style";/**
|
|
2
|
+
* The CategoryList component.
|
|
3
|
+
* @param {Object} props The component props.
|
|
4
|
+
* @param {Array} props.categories The categories to display.
|
|
5
|
+
* @param {Array} props.categories The number of rows to prerender.
|
|
6
|
+
* @returns {JSX}
|
|
7
|
+
*/var CategoryList=function CategoryList(_ref){var categories=_ref.categories,parentCategory=_ref.parentCategory,prerender=_ref.prerender,showAllProducts=_ref.showAllProducts,showImages=_ref.showImages;if(!categories||!categories.length){if(prerender===0){return null;}return React.createElement(SheetList,{className:classNames(styles.sheet,'engage__category__category-list')},Array(Math.min(prerender,8)).fill('').map(function(val,index){var key="placeholder-".concat(index);return React.createElement(Placeholder,{height:20,key:key,left:0,top:18,width:220});}));}var filters=getShowAllProductsFilters(parentCategory);return React.createElement(SheetList,{className:classNames(styles.sheet,'engage__category__category-list')},showAllProducts?React.createElement("div",{className:classNames(styles.showAllProducts,'engage__category__category-show-all-products')},React.createElement(Portal,{key:parentCategory.id,name:"category.show-all-products",props:{categoryId:parentCategory.id}},React.createElement(SheetList.Item,{link:"".concat(CATEGORY_PATH,"/").concat(bin2hex(parentCategory.id),"/all"),title:i18n.text('category.showAllProducts.label'),linkState:{categoryName:parentCategory.name,categoryId:parentCategory.id,filters:filters},testId:"showAllProducts",linkComponent:TextLink}))):null,categories.map(function(category){return React.createElement(Portal,{key:category.id,name:CATEGORY_ITEM,props:{categoryId:category.id}},React.createElement(SheetList.Item,{link:"".concat(CATEGORY_PATH,"/").concat(bin2hex(category.id)),title:category.name,description:category.description,linkState:{categoryId:category.id,title:category.name},testId:category.name,rightComponent:showImages?React.createElement(CategoryImage,{className:styles.image,src:category.imageUrl}):null,linkComponent:TextLink}));}));};CategoryList.defaultProps={categories:null,parentCategory:null,prerender:0,showAllProducts:false,showImages:false};export default CategoryList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;var sheet=css({background:colors.light}).toString();var showAllProducts=css({fontWeight:700}).toString();var image=css({display:'none',background:'red',borderRadius:20}).toString();export default{sheet:sheet,showAllProducts:showAllProducts,image:image};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as CategoryImage}from"./CategoryImage";
|
|
1
|
+
export{default as CategoryImage}from"./CategoryImage";export{default as CategoryList}from"./CategoryList";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from'@shopgate/pwa-common-commerce/category/constants/index';export*from'@shopgate/pwa-common-commerce/category/constants/Pipelines';export*from'@shopgate/pwa-common-commerce/category/constants/Portals';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from'@shopgate/pwa-common-commerce/category/helpers';
|
package/category/index.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
/** @module category */
|
|
2
|
-
export{default as fetchCategory}from'@shopgate/pwa-common-commerce/category/actions/fetchCategory';export{default as fetchCategoryChildren}from'@shopgate/pwa-common-commerce/category/actions/fetchCategoryChildren';export{default as fetchCategoryProducts}from'@shopgate/pwa-common-commerce/category/actions/fetchCategoryProducts';export{default as fetchRootCategories}from'@shopgate/pwa-common-commerce/category/actions/fetchRootCategories';export{default as getCategory}from'@shopgate/pwa-common-commerce/category/actions/getCategory';// CONSTANTS
|
|
3
|
-
export*from'@shopgate/pwa-common-commerce/category/constants/index';export*from'@shopgate/pwa-common-commerce/category/constants/Pipelines';export*from'@shopgate/pwa-common-commerce/category/constants/Portals';// SELECTORS
|
|
4
|
-
export*from'@shopgate/pwa-common-commerce/category/selectors';// STREAMS
|
|
5
|
-
export*from'@shopgate/pwa-common-commerce/category/streams';// HELPERS
|
|
6
|
-
export*from'@shopgate/pwa-common-commerce/category/helpers';export{CategoryImage}from"./components";
|
|
1
|
+
/** @module category */ /* eslint-disable import/export */export*from"./actions";export*from"./components";export*from"./constants";export*from"./helpers";export*from"./selectors";export*from"./streams";/* eslint-enable import/export */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{preferredLocationDidUpdate$,preferredLocationDidUpdateGlobalNotOnCategory$,preferredLocationDidUpdateGlobalOnCategory$}from'@shopgate/engage/locations';import{categoryDidBackEnter$,categoryFiltersDidUpdate$}from'@shopgate/pwa-common-commerce/category/streams';export var categoryProductsNeedUpdate$=preferredLocationDidUpdate$.merge(preferredLocationDidUpdateGlobalNotOnCategory$).switchMap(function(){return categoryDidBackEnter$.first();}).merge(categoryFiltersDidUpdate$).merge(preferredLocationDidUpdateGlobalOnCategory$);
|
|
1
|
+
import{preferredLocationDidUpdate$,preferredLocationDidUpdateGlobalNotOnCategory$,preferredLocationDidUpdateGlobalOnCategory$}from'@shopgate/engage/locations/locations.streams';import{categoryDidBackEnter$,categoryFiltersDidUpdate$}from'@shopgate/pwa-common-commerce/category/streams';export*from'@shopgate/pwa-common-commerce/category/streams';export var categoryProductsNeedUpdate$=preferredLocationDidUpdate$.merge(preferredLocationDidUpdateGlobalNotOnCategory$).switchMap(function(){return categoryDidBackEnter$.first();}).merge(categoryFiltersDidUpdate$).merge(preferredLocationDidUpdateGlobalOnCategory$);
|