@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,5 @@
|
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import styles from"./style";/**
|
|
2
|
+
* The Picker Button component.
|
|
3
|
+
* @param {Object} props The component props.
|
|
4
|
+
* @return {JSX}
|
|
5
|
+
*/var Button=function Button(_ref){var disabled=_ref.disabled,label=_ref.label,openList=_ref.openList,value=_ref.value;return React.createElement("button",{className:"".concat(disabled?styles.buttonDisabled:styles.button),onClick:openList,type:"button"},React.createElement("span",{className:styles.label},label),value&&React.createElement("span",{className:styles.value},value));};Button.defaultProps={disabled:false,openList:function openList(){}};export default Button;
|
|
@@ -0,0 +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{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;var buttonDefaults={display:'block',width:'100%',padding:"".concat(variables.gap.small,"px ").concat(variables.gap.big,"px"),fontFamily:'inherit',textAlign:'left',lineHeight:1.2,outline:'none',background:colors.shade8};var button=css(_extends({},buttonDefaults)).toString();var buttonDisabled=css(_extends({},buttonDefaults,{color:colors.shade4})).toString();var label=css({display:'block',fontWeight:500,':not(:only-child)':{fontWeight:400,fontSize:'0.75rem',marginBottom:4}}).toString();var value=css({display:'block',fontWeight:500}).toString();export default{button:button,buttonDisabled:buttonDisabled,label:label,value:value};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var _excluded=["hasButton","sheetProps"];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 _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import{SheetList,Picker as BasePicker,Sheet}from'@shopgate/engage/components';import{ViewContext}from'@shopgate/engage/components/View';import Button from"./components/Button";import styles from"./style";/**
|
|
2
|
+
* The template version of the Picker component.
|
|
3
|
+
* @param {Object} props The same component props as in the base Picker component.
|
|
4
|
+
*/var PickerUtilize=/*#__PURE__*/function(_Component){/**
|
|
5
|
+
* Constructor
|
|
6
|
+
* @param {Object} props Props of the component
|
|
7
|
+
*/function PickerUtilize(props){var _this2;_classCallCheck(this,PickerUtilize);_this2=_callSuper(this,PickerUtilize,[props]);/**
|
|
8
|
+
* Focuses the picker button for screen readers.
|
|
9
|
+
*/_defineProperty(_this2,"onDidOpen",function(){_this2.props.setViewAriaHidden(true);if(_this2.firstSelectableItemRef.current){_this2.firstSelectableItemRef.current.focus();}});/**
|
|
10
|
+
* Focuses the first selectable item for screen readers.
|
|
11
|
+
*/_defineProperty(_this2,"onClose",function(){_this2.props.setViewAriaHidden(false);if(_this2.pickerRef.current){_this2.pickerRef.current.focus();}});_this2.modalComponent=function(sheetProps){return React.createElement(Sheet,_extends({},_extends({},_this2.props.sheetProps,{},sheetProps),{title:_this2.props.label,onDidOpen:_this2.onDidOpen}));};_this2.pickerRef=React.createRef();_this2.firstSelectableItemRef=React.createRef();_this2.listComponent=function(prps){return React.createElement(SheetList,null,prps.items.map(function(item,index){return React.createElement(SheetList.Item,{key:item.value,title:item.label,onClick:function onClick(){setTimeout(function(){prps.onSelect(item.value);prps.onClose();},_this2.props.clickDelay);},isDisabled:item.disabled,isSelected:index===prps.selectedIndex,rightComponent:item.rightComponent,testId:item.label,ref:index===prps.selectedIndex?_this2.firstSelectableItemRef:null});}));};return _this2;}_inherits(PickerUtilize,_Component);return _createClass(PickerUtilize,[{key:"render",value:/**
|
|
12
|
+
* Render
|
|
13
|
+
* @returns {JSX}
|
|
14
|
+
*/function render(){var _this$props=this.props,hasButton=_this$props.hasButton,ignore=_this$props.sheetProps,restProps=_objectWithoutProperties(_this$props,_excluded);return React.createElement(BasePicker,_extends({},restProps,{className:"".concat(hasButton?styles:''," engage__picker-utilize"),modalComponent:this.modalComponent,buttonProps:this.props.buttonProps,buttonComponent:this.props.buttonComponent||Button,listComponent:this.listComponent,onClose:this.onClose,ref:this.pickerRef}));}}]);}(Component);_defineProperty(PickerUtilize,"defaultProps",{buttonComponent:null,buttonProps:{},/**
|
|
15
|
+
* Time in ms that delays picker interaction in order
|
|
16
|
+
* to let animations complete first.
|
|
17
|
+
*/clickDelay:150,hasButton:true,sheetProps:{}});export default(function(props){return React.createElement(ViewContext.Consumer,null,function(_ref){var setAriaHidden=_ref.setAriaHidden;return React.createElement(PickerUtilize,_extends({},props,{setViewAriaHidden:setAriaHidden}));});});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import React from'react';import{mount}from'enzyme';import Picker from"./index";jest.mock('@shopgate/engage/components/View');describe('<Picker />',function(){it('should render the picker',function(){var label='Picker label';var wrapper=mount(React.createElement(Picker,{label:label}));expect(wrapper).toMatchSnapshot();});});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export default css({display:'flex',marginBottom:variables.gap.small,minHeight:56}).toString();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import React,{useRef,useState,useCallback,useLayoutEffect,useEffect,forwardRef}from'react';import PropTypes from'prop-types';import{isIOs}from'@shopgate/pwa-core';import{parseFloatString,formatFloat}from"./helper";/**
|
|
1
|
+
var _excluded=["className","onChange","onFocus","onBlur","value","maxDecimals","unit","minValue","maxValue","onKeyDown"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import React,{useRef,useState,useCallback,useLayoutEffect,useEffect,forwardRef}from'react';import PropTypes from'prop-types';import noop from'lodash/noop';import{isIOs}from'@shopgate/pwa-core';import{parseFloatString,formatFloat}from"./helper";/**
|
|
2
2
|
* A Quantity Input with unit support.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/var QuantityInput=forwardRef(function(_ref,outerInputRef){var className=_ref.className,onChange=_ref.onChange,customOnFocus=_ref.onFocus,customOnBlur=_ref.onBlur,value=_ref.value,maxDecimals=_ref.maxDecimals,unit=_ref.unit,minValue=_ref.minValue,maxValue=_ref.maxValue,inputProps=_objectWithoutProperties(_ref,
|
|
5
|
-
if(Number.isNaN(parseFloat(inputValue))){setInputValue(formatFloat(value,maxDecimals));return;}if(newValue!==value){onChange(newValue);}customOnBlur(event,newValue);},[customOnBlur,inputValue,maxDecimals,onChange,value]);var handleChange=useCallback(function(event){var newValue=event.target.value;
|
|
4
|
+
*/var QuantityInput=forwardRef(function(_ref,outerInputRef){var className=_ref.className,onChange=_ref.onChange,customOnFocus=_ref.onFocus,customOnBlur=_ref.onBlur,value=_ref.value,maxDecimals=_ref.maxDecimals,unit=_ref.unit,minValue=_ref.minValue,maxValue=_ref.maxValue,onKeyDown=_ref.onKeyDown,inputProps=_objectWithoutProperties(_ref,_excluded);var inputRef=outerInputRef||useRef();var _useState=useState(formatFloat(value,maxDecimals)),_useState2=_slicedToArray(_useState,2),inputValue=_useState2[0],setInputValue=_useState2[1];var _useState3=useState(false),_useState4=_slicedToArray(_useState3,2),isFocused=_useState4[0],setIsFocused=_useState4[1];var onFocus=useCallback(function(event){customOnFocus(event);setIsFocused(true);},[customOnFocus]);var onBlur=useCallback(function(event){var newValue=parseFloatString(inputValue,maxDecimals);setIsFocused(false);// If invalid switch to old value.
|
|
5
|
+
if(Number.isNaN(parseFloat(inputValue))){setInputValue(formatFloat(value,maxDecimals));return;}if(minValue&&newValue<minValue){newValue=minValue;}if(maxValue&&newValue>maxValue){newValue=maxValue;}setInputValue("".concat(newValue));if(newValue!==value){onChange(newValue);}customOnBlur(event,newValue);},[customOnBlur,inputValue,maxDecimals,maxValue,minValue,onChange,value]);var handleChange=useCallback(function(event){var newValue=event.target.value;setInputValue(newValue);},[]);var handleKeyDown=useCallback(function(event){if(event.key==='Enter'){// Prevents false positive validation error when enter key is pressed inside input
|
|
6
|
+
event.preventDefault();if(inputRef.current){inputRef.current.blur();}}if(typeof onKeyDown==='function'){onKeyDown(event);}},[inputRef,onKeyDown]);// Select the current input value after focus.
|
|
6
7
|
useLayoutEffect(function(){if(isFocused&&isIOs){inputRef.current.select();}},[inputRef,isFocused]);// Sync actual float value with displayed content.
|
|
7
8
|
useEffect(function(){setInputValue(formatFloat(value,maxDecimals));},[maxDecimals,value]);// Stop the context menu from opening.
|
|
8
|
-
useLayoutEffect(function(){inputRef.current.addEventListener('contextmenu',function(event){event.preventDefault();event.stopPropagation();return false;});},[inputRef]);var displayedValue=!isFocused&&unit?"".concat(inputValue," ").concat(unit):inputValue;return React.createElement("input",_extends({ref:inputRef},inputProps,{inputMode:maxDecimals>0?'decimal':'numeric'/* Pattern signals some browsers to use specialized keyboard (if inputmode not supported */,pattern:maxDecimals>0?'[0-9.,]*':'[0–9]*',onFocus:onFocus,onBlur:onBlur,className:className,value:displayedValue,onChange:handleChange,onClick:function onClick(event){event.preventDefault();event.stopPropagation();if(inputRef.current){inputRef.current.focus();}}}));});QuantityInput.defaultProps={className:'',maxDecimals:2,unit:null,minValue:null,maxValue:null,onFocus:
|
|
9
|
+
useLayoutEffect(function(){inputRef.current.addEventListener('contextmenu',function(event){event.preventDefault();event.stopPropagation();return false;});},[inputRef]);var displayedValue=!isFocused&&unit?"".concat(inputValue," ").concat(unit):inputValue;return React.createElement("input",_extends({ref:inputRef},inputProps,{inputMode:maxDecimals>0?'decimal':'numeric'/* Pattern signals some browsers to use specialized keyboard (if inputmode not supported */,pattern:maxDecimals>0?'[0-9.,]*':'[0–9]*',onFocus:onFocus,onBlur:onBlur,className:className,value:displayedValue,onChange:handleChange,onKeyDown:handleKeyDown,onClick:function onClick(event){event.preventDefault();event.stopPropagation();if(inputRef.current){inputRef.current.focus();}}}));});QuantityInput.defaultProps={className:'',maxDecimals:2,unit:null,minValue:null,maxValue:null,onFocus:noop,onChange:noop,onBlur:noop,onKeyDown:noop};export default QuantityInput;
|
|
@@ -2,4 +2,4 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
|
|
|
2
2
|
* The Radio component
|
|
3
3
|
* @param {Object} props The component props
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/var Radio=function Radio(_ref){var
|
|
5
|
+
*/var Radio=function Radio(_ref){var classes=_ref.classes,nameProp=_ref.name,onChangeProp=_ref.onChange,checkedProp=_ref.checked,disabledProp=_ref.disabled,valueProp=_ref.value,attributes=_ref.attributes;var radioGroup=useRadioGroup();var name=nameProp;var checked=checkedProp;var onChange=onChangeProp;if(radioGroup){if(checked===null){checked=radioGroup.value===valueProp;}if(typeof radioGroup.name!=='undefined'){name=radioGroup.name;}if(typeof radioGroup.onChange!=='undefined'){onChange=radioGroup.onChange;}}return React.createElement("span",{className:classNames(styles.root,classes.root)},React.createElement(Ripple,{className:styles.ripple,color:"var(--color-primary)"},React.createElement("input",_extends({className:styles.input,type:"radio",name:name,value:valueProp,checked:checked,onChange:onChange,disabled:disabledProp,id:"".concat(name,"_").concat(valueProp)},attributes)),React.createElement("div",{className:classNames(styles.radioContainer,_defineProperty(_defineProperty({},styles.radioDisabled,disabledProp),classes.disabled,disabledProp))},checked&&React.createElement(CheckedIcon,{className:classNames(styles.radio,styles.radioChecked,classes.radioChecked,'checkedIcon')}),!checked&&React.createElement(UncheckedIcon,{className:classNames(styles.radio,classes.radioUnchecked,'uncheckedIcon')}))));};Radio.defaultProps={classes:{},checked:null,disabled:false,onChange:null,name:null,value:null,attributes:null};export default hot(Radio);
|
|
@@ -6,4 +6,4 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
|
|
|
6
6
|
* The RadioCard component
|
|
7
7
|
* @param {Object} props The component props
|
|
8
8
|
* @returns {JSX}
|
|
9
|
-
*/var RadioCard=function RadioCard(_ref2){var
|
|
9
|
+
*/var RadioCard=function RadioCard(_ref2){var children=_ref2.children,nameProp=_ref2.name,onChange=_ref2.onChange,checked=_ref2.checked,disabledProp=_ref2.disabled,value=_ref2.value,attributes=_ref2.attributes,classes=_ref2.classes,RenderCard=_ref2.renderCard;var radioGroup=useRadioGroup();var name=nameProp;var disabled=disabledProp;if(radioGroup){if(typeof radioGroup.name!=='undefined'){name=radioGroup.name;}if(typeof radioGroup.disabled!=='undefined'){disabled=radioGroup.disabled;}}return React.createElement(RenderCard,{className:classes.root},React.createElement(Radio,{name:name,value:value,onChange:onChange,disabled:disabled,checked:checked,attributes:attributes,classes:{root:styles.radio}}),React.createElement("label",{htmlFor:"".concat(name,"_").concat(value),className:classNames(styles.content,_defineProperty(_defineProperty({},styles.contentDisabled,disabled),classes.disabled,disabled))},children));};RadioCard.defaultProps={children:null,checked:null,classes:{},disabled:false,onChange:null,name:null,value:null,attributes:null,renderCard:CardComponent};export default hot(RadioCard);
|
|
@@ -6,4 +6,4 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
6
6
|
* @param {Function} props.onTouchStart The touch start event callback.
|
|
7
7
|
* @param {Object} props.classNames (Optional) An additional style classes for the handle.
|
|
8
8
|
* @returns {JSX}
|
|
9
|
-
*/var RangeSliderHandle=function RangeSliderHandle(props){var active=props.active,index=props.index,onTouchStart=props.onTouchStart,classNames=props.classNames,useMouseEvents=props.useMouseEvents;var style={zIndex:Number(active)||0};var eventHandler=_defineProperty({},useMouseEvents?'onMouseDown':'onTouchStart',function(event){return onTouchStart(event,index);});return React.createElement("div",_extends({className:cxs(classNames.handleOuter,styles),style:style},eventHandler),React.createElement("div",{className:classNames.handleInner}));};RangeSliderHandle.defaultProps={active:false,classNames:{handleOuter:null,handleInner:null}};export default RangeSliderHandle;
|
|
9
|
+
*/var RangeSliderHandle=function RangeSliderHandle(props){var active=props.active,index=props.index,onTouchStart=props.onTouchStart,classNames=props.classNames,useMouseEvents=props.useMouseEvents;var style={zIndex:Number(active)||0};var eventHandler=_defineProperty({},useMouseEvents?'onMouseDown':'onTouchStart',function(event){return onTouchStart(event,index);});return React.createElement("div",_extends({className:cxs(classNames.handleOuter,styles,'engage__range-slider__handle'),style:style},eventHandler),React.createElement("div",{className:classNames.handleInner}));};RangeSliderHandle.defaultProps={active:false,classNames:{handleOuter:null,handleInner:null}};export default RangeSliderHandle;
|
|
@@ -1,42 +1,54 @@
|
|
|
1
|
-
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function
|
|
1
|
+
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import cxs from'classnames';import styles from"./style";import Handle from"./components/Handle";import{isTouchDevice}from"../../core";import{generateLinearEasingCallback,generateExponentialEasingCallback,getRangeStyle,getTouchPositionX,getAbsoluteValue,getRelativeValue}from"./helper";/**
|
|
2
2
|
* The range slider component.
|
|
3
|
-
*/var RangeSlider=/*#__PURE__*/function(_PureComponent){
|
|
3
|
+
*/var RangeSlider=/*#__PURE__*/function(_PureComponent){/**
|
|
4
4
|
* Constructor
|
|
5
5
|
* @param {Object} props The component properties
|
|
6
|
-
*/function RangeSlider(props){var
|
|
6
|
+
*/function RangeSlider(props){var _this2;_classCallCheck(this,RangeSlider);_this2=_callSuper(this,RangeSlider,[props]);/**
|
|
7
|
+
* Processes touch start events on handles.
|
|
8
|
+
* @param {Object} event The touch event
|
|
9
|
+
* @param {number} index The index of the touched handle.
|
|
10
|
+
*/_defineProperty(_this2,"handleTouchStart",function(event,index){_this2.addEventListeners();_this2.draggedHandle=index;// Calculate the relative offset to the handles center
|
|
7
11
|
var handleDOMElement=event.target;// Get the handles bounding rectangle ...
|
|
8
12
|
var handleRect=handleDOMElement.getBoundingClientRect();// ... and calculate its absolute center.
|
|
9
13
|
var handleCenterX=handleRect.left+handleDOMElement.offsetWidth/2;// Store the signed distanced between the current touch offset and the handle center.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
_this2.touchOffset=getTouchPositionX(event)-handleCenterX;});/**
|
|
15
|
+
* Processes move events on handles.
|
|
16
|
+
* @param {Object} event The touch event
|
|
17
|
+
*/_defineProperty(_this2,"handleTouchMove",function(event){if(_this2.props.min===_this2.props.max){return;}if(_this2.draggedHandle===null){return;}var _this2$domElement$cur=_this2.domElement.current.getBoundingClientRect(),offsetWidth=_this2$domElement$cur.width,offsetLeft=_this2$domElement$cur.left;// Calculate the absolute offset where the element was touched...
|
|
18
|
+
var deltaX=getTouchPositionX(event)-offsetLeft-_this2.touchOffset;// ...and convert it into a relative value between [0...1].
|
|
19
|
+
deltaX=Math.max(0,Math.min(1,deltaX/offsetWidth));var stateUpdate={};if(_this2.draggedHandle===1){// Right handle dragged
|
|
20
|
+
if(_this2.state.rangeMin<deltaX){stateUpdate.rangeMax=Math.min(1,deltaX);_this2.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMax-_this2.state.rangeMax);}else{// Not in valid range, swap handles
|
|
21
|
+
_this2.draggedHandle=0;stateUpdate.rangeMax=_this2.state.rangeMin;stateUpdate.rangeMin=deltaX;_this2.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMin-_this2.state.rangeMin);}}else if(_this2.draggedHandle===0){// Left handle dragged
|
|
22
|
+
if(_this2.state.rangeMax>deltaX){stateUpdate.rangeMin=Math.max(0,deltaX);_this2.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMin-_this2.state.rangeMin);}else{// Not in valid range, swap handles
|
|
23
|
+
_this2.draggedHandle=1;stateUpdate.rangeMin=_this2.state.rangeMax;stateUpdate.rangeMax=deltaX;_this2.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMax-_this2.state.rangeMax);}}_this2.draggedHandlePixelOffset*=offsetWidth;_this2.setState(stateUpdate,_this2.triggerChangeCallback);});/**
|
|
24
|
+
* Processes global touch end events for handles.
|
|
25
|
+
* @param {Object} e The touch event
|
|
26
|
+
*/_defineProperty(_this2,"handleTouchEnd",function(){_this2.removeEventListeners();_this2.touchOffset=0;_this2.draggedHandle=null;});/**
|
|
27
|
+
* Processes outer range touch end events.
|
|
28
|
+
* @param {Object} event The touch event
|
|
29
|
+
*/_defineProperty(_this2,"handleRangeTouch",function(event){var _this2$domElement$cur2=_this2.domElement.current.getBoundingClientRect(),offsetWidth=_this2$domElement$cur2.width,offsetLeft=_this2$domElement$cur2.left;var dx=(getTouchPositionX(event)-offsetLeft)/offsetWidth;var d0=Math.abs(_this2.state.rangeMin-dx);var d1=Math.abs(_this2.state.rangeMax-dx);if(d0<d1){_this2.draggedHandle=0;}else{_this2.draggedHandle=1;}_this2.handleTouchMove(event);});/**
|
|
30
|
+
* Processes the input field values.
|
|
31
|
+
* @param {Object} event The change event.
|
|
32
|
+
*/_defineProperty(_this2,"handleInputChange",function(event){var max=_this2.props.max;var _event$target=event.target,value=_event$target.value,id=_event$target.id;var delta=Math.max(0,Math.min(1,value/(max/100)));var state=id==='price_from'?{rangeMin:delta}:{rangeMax:delta};_this2.setState(state);});_this2.draggedHandle=null;// 0 for left handle, 1 for right handle or null
|
|
33
|
+
_this2.domElement=React.createRef();_this2.touchOffset=0;_this2.draggedHandlePixelOffset=0;// The absolute pixel delta of the last handle move event.
|
|
34
|
+
_this2.state=_this2.getRange(props);_this2.useMouseEvents=!isTouchDevice();return _this2;}/**
|
|
19
35
|
* Updates the component properties.
|
|
20
36
|
* @param {Object} newProps The new component properties.
|
|
21
|
-
*/_createClass(RangeSlider,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(newProps){this.setState(this.getRange(newProps));}/**
|
|
37
|
+
*/_inherits(RangeSlider,_PureComponent);return _createClass(RangeSlider,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(newProps){this.setState(this.getRange(newProps));}/**
|
|
22
38
|
* Get the easing function.
|
|
23
|
-
*/},{key:"
|
|
39
|
+
*/},{key:"ease",get:function get(){return{linear:generateLinearEasingCallback(this.props.resolution),exponential:generateExponentialEasingCallback(this.props.factor)}[this.props.easing];}/**
|
|
40
|
+
* Get the function to invert an eased value to it's original value.
|
|
41
|
+
*/},{key:"invertedEase",get:function get(){return{linear:generateLinearEasingCallback(this.props.resolution),exponential:generateExponentialEasingCallback(1/this.props.factor)}[this.props.easing];}/**
|
|
24
42
|
* Adds event listeners
|
|
25
|
-
*/value:function addEventListeners(){if(this.useMouseEvents){document.addEventListener('mouseup',this.handleTouchEnd);document.addEventListener('mousemove',this.handleTouchMove);}else{document.addEventListener('touchend',this.handleTouchEnd);document.addEventListener('touchmove',this.handleTouchMove);}}/**
|
|
43
|
+
*/},{key:"addEventListeners",value:function addEventListeners(){if(this.useMouseEvents){document.addEventListener('mouseup',this.handleTouchEnd);document.addEventListener('mousemove',this.handleTouchMove);}else{document.addEventListener('touchend',this.handleTouchEnd);document.addEventListener('touchmove',this.handleTouchMove);}}/**
|
|
26
44
|
* Removes event listeners
|
|
27
45
|
*/},{key:"removeEventListeners",value:function removeEventListeners(){if(this.useMouseEvents){document.removeEventListener('mouseup',this.handleTouchEnd);document.removeEventListener('mousemove',this.handleTouchMove);}else{document.removeEventListener('touchend',this.handleTouchEnd);document.removeEventListener('touchmove',this.handleTouchMove);}}/**
|
|
28
46
|
* Get range min and max from props.
|
|
29
47
|
* @param {Object} props The component props.
|
|
30
48
|
* @returns {Object} The new state
|
|
31
|
-
*/},{key:"getRange",value:function getRange(props){var value=props.value,min=props.min,max=props.max;return{rangeMin:this.invertedEase(getRelativeValue(value[0],min,max)),rangeMax:this.invertedEase(getRelativeValue(value[1],min,max))};}
|
|
32
|
-
* Processes touch start events on handles.
|
|
33
|
-
* @param {Object} event The touch event
|
|
34
|
-
* @param {number} index The index of the touched handle.
|
|
35
|
-
*/},{key:"triggerChangeCallback",/**
|
|
49
|
+
*/},{key:"getRange",value:function getRange(props){var value=props.value,min=props.min,max=props.max;return{rangeMin:this.invertedEase(getRelativeValue(value[0],min,max)),rangeMax:this.invertedEase(getRelativeValue(value[1],min,max))};}},{key:"triggerChangeCallback",value:/**
|
|
36
50
|
* Calls the change callback in case of a state update.
|
|
37
|
-
*/
|
|
51
|
+
*/function triggerChangeCallback(){var _this$props=this.props,value=_this$props.value,onChange=_this$props.onChange,min=_this$props.min,max=_this$props.max;if(!onChange){return;}var newRange=[getAbsoluteValue(this.ease(this.state.rangeMin),min,max,true),getAbsoluteValue(this.ease(this.state.rangeMax),min,max,true)];if(newRange!==value){onChange(newRange);}}/**
|
|
38
52
|
* Renders the component.
|
|
39
53
|
* @returns {JSX}
|
|
40
|
-
*/},{key:"render",value:function render(){var _this$props2=this.props,classNames=_this$props2.classNames,animationSpeed=_this$props2.animationSpeed;var speed=Math.round(1000/animationSpeed*this.draggedHandlePixelOffset);var rangeStyle=getRangeStyle(this.state.rangeMin,this.state.rangeMax,speed>10?speed:0);return React.createElement("div",{className:cxs(classNames.container),onMouseDown:this.handleRangeTouch,"aria-hidden":true},React.createElement("div",{className:cxs(classNames.outerRange,styles.outerRange),ref:this.domElement},React.createElement("div",{className:cxs(classNames.range,styles.range),style:rangeStyle},React.createElement(Handle,{index:0,onTouchStart:this.handleTouchStart,active:this.draggedHandle===0,classNames:classNames,useMouseEvents:this.useMouseEvents}),React.createElement(Handle,{index:1,onTouchStart:this.handleTouchStart,active:this.draggedHandle===1,classNames:classNames,useMouseEvents:this.useMouseEvents}))));}},
|
|
41
|
-
* Get the function to invert an eased value to it's original value.
|
|
42
|
-
*/},{key:"invertedEase",get:function get(){return{linear:generateLinearEasingCallback(this.props.resolution),exponential:generateExponentialEasingCallback(1/this.props.factor)}[this.props.easing];}}]);return RangeSlider;}(PureComponent);_defineProperty(RangeSlider,"defaultProps",{animationSpeed:500,classNames:{},easing:'linear',factor:2,max:100,min:0,resolution:1,value:[0,100],onChange:null});export default RangeSlider;
|
|
54
|
+
*/},{key:"render",value:function render(){var _this$props2=this.props,classNames=_this$props2.classNames,animationSpeed=_this$props2.animationSpeed;var speed=Math.round(1000/animationSpeed*this.draggedHandlePixelOffset);var rangeStyle=getRangeStyle(this.state.rangeMin,this.state.rangeMax,speed>10?speed:0);return React.createElement("div",{className:cxs(classNames.container,'engage__range-slider'),onMouseDown:this.handleRangeTouch,"aria-hidden":true},React.createElement("div",{className:cxs(classNames.outerRange,styles.outerRange),ref:this.domElement},React.createElement("div",{className:cxs(classNames.range,styles.range),style:rangeStyle},React.createElement(Handle,{index:0,onTouchStart:this.handleTouchStart,active:this.draggedHandle===0,classNames:classNames,useMouseEvents:this.useMouseEvents}),React.createElement(Handle,{index:1,onTouchStart:this.handleTouchStart,active:this.draggedHandle===1,classNames:classNames,useMouseEvents:this.useMouseEvents}))));}}]);}(PureComponent);_defineProperty(RangeSlider,"defaultProps",{animationSpeed:500,classNames:{},easing:'linear',factor:2,max:100,min:0,resolution:1,value:[0,100],onChange:null});export default RangeSlider;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import PropTypes from'prop-types';import{useResponsiveValue}from"./hooks";/**
|
|
2
2
|
* Renders a responsive container that allows to render based on width.
|
|
3
3
|
* @param {Object} props Component props.
|
|
4
4
|
* @returns {React.Node}
|
|
5
|
-
*/var ResponsiveContainer=function ResponsiveContainer(_ref){var breakpoint=_ref.breakpoint,webOnly=_ref.webOnly,webAlways=_ref.webAlways,appOnly=_ref.appOnly,appAlways=_ref.appAlways,children=_ref.children
|
|
6
|
-
var _useState=useState(null),_useState2=_slicedToArray(_useState,2),activeBreakpoint=_useState2[0],setActiveBreakpoint=_useState2[1];// Calculate if should render due to visibility.
|
|
7
|
-
/* eslint-disable react-hooks/exhaustive-deps */var breakpointSafe=useMemo(function(){var parsed=parser(comparators,breakpoint,{breakpoint:breakpoint,webOnly:webOnly,webAlways:webAlways,appOnly:appOnly,appAlways:appAlways});return parsed;},[activeBreakpoint,breakpoint]);/* eslint-enable react-hooks/exhaustive-deps */ // Watch for resize changes.
|
|
8
|
-
useEffect(function(){return addListener(function(newBreakpoint){setActiveBreakpoint(newBreakpoint);});},[]);// Ignore rendering if one of given condition applies.
|
|
9
|
-
if(!breakpointSafe){return null;}return children;};ResponsiveContainer.propTypes={appAlways:PropTypes.bool,appOnly:PropTypes.bool,breakpoint:PropTypes.string,// eslint-disable-next-line react/forbid-prop-types
|
|
5
|
+
*/var ResponsiveContainer=function ResponsiveContainer(_ref){var breakpoint=_ref.breakpoint,webOnly=_ref.webOnly,webAlways=_ref.webAlways,appOnly=_ref.appOnly,appAlways=_ref.appAlways,children=_ref.children;var render=useResponsiveValue(breakpoint,{webOnly:webOnly,webAlways:webAlways,appOnly:appOnly,appAlways:appAlways});if(!render){return null;}return children;};ResponsiveContainer.propTypes={appAlways:PropTypes.bool,appOnly:PropTypes.bool,breakpoint:PropTypes.string,// eslint-disable-next-line react/forbid-prop-types
|
|
10
6
|
children:PropTypes.any,webAlways:PropTypes.bool,webOnly:PropTypes.bool};ResponsiveContainer.defaultProps={children:null,breakpoint:'>=xs',appAlways:false,webAlways:false,webOnly:false,appOnly:false};export default ResponsiveContainer;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// Ugly imports to avoid breaking tests due to circular dependencies
|
|
2
|
+
import{isIOSTheme}from'@shopgate/engage/core/helpers/isIOSTheme';import{hasWebBridge}from'@shopgate/engage/core/helpers/bridge';var iosThemeActive=isIOSTheme();/* eslint-disable extra-rules/no-single-line-objects */var breakpoints=[{name:'xs',from:0,to:600},{name:'sm',from:600,to:960},{name:'md',from:960,to:1280},{name:'lg',from:1280,to:1920},{name:'xl',from:1920,to:Number.MAX_VALUE}];/* eslint-enable extra-rules/no-single-line-objects */ /**
|
|
2
3
|
* Generates a media query for different breakpoints and platform.
|
|
3
4
|
* @param {Object} comparators Comparators.
|
|
4
5
|
* @param {string} breakpoint Breakpoint rule.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _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{useState,useMemo,useEffect}from'react';import{addListener}from"./listener";import{parser}from"./breakpoints";var comparators={'>=':function _(from,to,width){return width>=from;},'>':function _(from,to,width){return width>=to;},'<':function _(from,to,width){return width<from;},'<=':function _(from,to,width){return width<to;},'':function _(from,to,width){return width>=from&&width<to;}};/**
|
|
2
|
+
* Custom hook to determine the visibility or value based on the current active breakpoint
|
|
3
|
+
* and provided conditions.
|
|
4
|
+
* It listens for changes in the viewport or platform breakpoints and returns a value.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} [breakpoint=">=xs"] - The breakpoint condition to match (e.g., '>=md', '<lg').
|
|
7
|
+
* @param {Object} [options={}] - Additional options for customizing behavior.
|
|
8
|
+
* @param {*} [options.valueMatch=true] - Return value when the provided conditions match.
|
|
9
|
+
* @param {*} [options.valueMiss=false] - Return value when the provided conditions do not match.
|
|
10
|
+
* @param {boolean} [options.webOnly=false] If true, the hook will only match in PWA website mode.
|
|
11
|
+
* @param {boolean} [options.webAlways=false] If true, the hook will always match in PWA website
|
|
12
|
+
* mode regardless of the breakpoint.
|
|
13
|
+
* @param {boolean} [options.appOnly=false] If true, the hook will only match in PWA app mode.
|
|
14
|
+
* @param {boolean} [options.appAlways=false] If true, the hook will always match in PWA app mode,
|
|
15
|
+
* regardless of the breakpoint.
|
|
16
|
+
* @returns {boolean}
|
|
17
|
+
*/export var useResponsiveValue=function useResponsiveValue(){var breakpoint=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'>=xs';var options=arguments.length>1?arguments[1]:undefined;var _valueMatch$valueMiss=_extends({valueMatch:true,valueMiss:false,appAlways:false,appOnly:false,webAlways:false,webOnly:false},options),webOnly=_valueMatch$valueMiss.webOnly,webAlways=_valueMatch$valueMiss.webAlways,appOnly=_valueMatch$valueMiss.appOnly,appAlways=_valueMatch$valueMiss.appAlways,valueMiss=_valueMatch$valueMiss.valueMiss,valueMatch=_valueMatch$valueMiss.valueMatch;// Active breakpoint used for triggering rerenders on resize.
|
|
18
|
+
var _useState=useState(null),_useState2=_slicedToArray(_useState,2),activeBreakpoint=_useState2[0],setActiveBreakpoint=_useState2[1];// Calculate if we have a match for the conditions
|
|
19
|
+
/* eslint-disable react-hooks/exhaustive-deps */var isMatch=useMemo(function(){var parsed=parser(comparators,breakpoint,{breakpoint:breakpoint,webOnly:webOnly,webAlways:webAlways,appOnly:appOnly,appAlways:appAlways});return parsed;},[activeBreakpoint,breakpoint]);/* eslint-enable react-hooks/exhaustive-deps */ // Watch for resize changes.
|
|
20
|
+
useEffect(function(){return addListener(function(newBreakpoint){setActiveBreakpoint(newBreakpoint);});},[]);return isMatch?valueMatch:valueMiss;};
|
|
@@ -1,5 +1,5 @@
|
|
|
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 React,{useState,
|
|
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 _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 React,{useState,useCallback,useEffect}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{viewScroll$}from'@shopgate/engage/core/streams';import{root,scrolledIn,scrolledOut,transition}from"./style";/**
|
|
2
2
|
* Scroll Header component
|
|
3
3
|
* @param {Object} props props
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/function ScrollHeader(_ref){var className=_ref.className,children=_ref.children
|
|
5
|
+
*/function ScrollHeader(_ref){var className=_ref.className,children=_ref.children,hideOnScroll=_ref.hideOnScroll,scrollOffset=_ref.scrollOffset;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),shouldHideHeader=_useState2[0],setShouldHideHeader=_useState2[1];var onScroll=useCallback(function(scrollEvent){var scrollTop=scrollEvent.scrollTop,scrolled=scrollEvent.scrolled,scrollOut=scrollEvent.scrollOut,scrollIn=scrollEvent.scrollIn;if(!scrolled){return;}if(!shouldHideHeader&&scrollOut&&scrollTop>=scrollOffset){setShouldHideHeader(true);}if(shouldHideHeader&&scrollIn){setShouldHideHeader(false);}},[scrollOffset,shouldHideHeader]);useEffect(function(){if(hideOnScroll){var subscription=viewScroll$.subscribe(onScroll);return function(){return subscription.unsubscribe();};}return undefined;});return React.createElement("div",{className:classNames(root,transition,className,_defineProperty(_defineProperty({},scrolledIn,!shouldHideHeader),scrolledOut,shouldHideHeader))},children);}ScrollHeader.defaultProps={className:null,hideOnScroll:true,scrollOffset:100};export default ScrollHeader;
|
|
@@ -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{responsiveMediaQuery}from'@shopgate/engage/styles';export var
|
|
1
|
+
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{css}from'glamor';import{responsiveMediaQuery}from'@shopgate/engage/styles';export var root=css(_defineProperty({position:'sticky',left:0,backgroundColor:'#fff'},responsiveMediaQuery('<=xs',{appAlways:true}),{boxShadow:'rgba(0, 0, 0, 0.118) 0px 1px 6px, rgba(0, 0, 0, 0.118) 0px 1px 4px'}));export var scrolledIn=css({'&&':{transform:'translateY(0%)'}});export var scrolledOut=css({'&&':{transform:'translateY(-250%)'}});export var transition=css({transition:'transform 0.2s ease,transform 0.2s'});
|
|
@@ -1,17 +1,17 @@
|
|
|
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 _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{withForwardedRef}from'@shopgate/engage/core';import Grid from'@shopgate/pwa-common/components/Grid';import Link from'@shopgate/pwa-common/components/Link';import Glow from'@shopgate/pwa-ui-shared/Glow';import styles from"./style";/**
|
|
1
|
+
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{withForwardedRef}from'@shopgate/engage/core';import Grid from'@shopgate/pwa-common/components/Grid';import Link from'@shopgate/pwa-common/components/Link';import Glow from'@shopgate/pwa-ui-shared/Glow';import styles from"./style";/**
|
|
2
2
|
* The list item component.
|
|
3
|
-
*/var Item=/*#__PURE__*/function(_Component){
|
|
3
|
+
*/var Item=/*#__PURE__*/function(_Component){function Item(){_classCallCheck(this,Item);return _callSuper(this,Item,arguments);}_inherits(Item,_Component);return _createClass(Item,[{key:"shouldComponentUpdate",value:/**
|
|
4
4
|
* Should only update what the `selected` or `disabled` props change.
|
|
5
5
|
* @param {Object} nextProps The next set of component props.
|
|
6
6
|
* @returns {JSX}
|
|
7
|
-
*/
|
|
7
|
+
*/function shouldComponentUpdate(nextProps){return this.props.isSelected!==nextProps.isSelected||this.props.isDisabled!==nextProps.isDisabled;}/**
|
|
8
8
|
* Renders the bulk of the content.
|
|
9
9
|
* @param {boolean} [isNested=true] Tells if the content is rendered nested.
|
|
10
10
|
* @returns {JSX}
|
|
11
|
-
*/},{key:"renderContent",value:function renderContent(){var
|
|
11
|
+
*/},{key:"renderContent",value:function renderContent(){var isNested=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var _this$props=this.props,isDisabled=_this$props.isDisabled,isSelected=_this$props.isSelected,title=_this$props.title,image=_this$props.image,rightComponent=_this$props.rightComponent,forwardedRef=_this$props.forwardedRef,description=_this$props.description;var gridStyles=_defineProperty(_defineProperty({},styles.grid,true),styles.selected,isSelected);var titleStyles=_defineProperty(_defineProperty({},styles.title,true),styles.disabled,isDisabled);var ref=isNested?null:forwardedRef;return React.createElement("div",{"data-test-id":this.props.testId,ref:ref,className:"engage__sheet-list__item"},React.createElement(Grid,{className:classNames(gridStyles),component:"div"},image!==null&&React.createElement("div",{className:styles.image},image),React.createElement(Grid.Item,{className:classNames(titleStyles),component:"div",grow:1},React.createElement("div",null,title),description&&React.createElement("div",{className:styles.description,dangerouslySetInnerHTML:{__html:description}})),rightComponent!==null&&React.createElement(Grid.Item,{component:"div",grow:1},rightComponent)));}/**
|
|
12
12
|
* @returns {JSX}
|
|
13
13
|
*/},{key:"render",value:function render(){var _this$props2=this.props,link=_this$props2.link,linkState=_this$props2.linkState,LinkComponent=_this$props2.linkComponent,onClick=_this$props2.onClick,className=_this$props2.className,isDisabled=_this$props2.isDisabled,testId=_this$props2.testId,forwardedRef=_this$props2.forwardedRef,isSelected=_this$props2.isSelected;/**
|
|
14
14
|
* If this item is disabled, selected or doesn't have a valid
|
|
15
15
|
* link or click handler then wrap the content with other components.
|
|
16
16
|
*/if(isDisabled||!link&&!onClick){return this.renderContent(false);}// Wrap with a <Link> if the `link` prop is set.
|
|
17
|
-
if(link){return React.createElement(Glow,{ref:forwardedRef,className:className,styles:{hover:styles.glowHover}},React.createElement(LinkComponent,{href:link,onClick:onClick,state:linkState,tabIndex:0},this.renderContent()));}return React.createElement("div",{onKeyPress:function onKeyPress(){},onClick:onClick,"data-test-id":testId,ref:forwardedRef,tabIndex:0,role:"option","aria-selected":isSelected},React.createElement(Glow,{className:className,styles:{hover:styles.glowHover}},this.renderContent()));}}]);
|
|
17
|
+
if(link){return React.createElement(Glow,{ref:forwardedRef,className:className,styles:{hover:styles.glowHover}},React.createElement(LinkComponent,{href:link,onClick:onClick,state:linkState,tabIndex:0},this.renderContent()));}return React.createElement("div",{onKeyPress:function onKeyPress(){},onClick:onClick,"data-test-id":testId,ref:forwardedRef,tabIndex:0,role:"option","aria-selected":isSelected},React.createElement(Glow,{className:className,styles:{hover:styles.glowHover}},this.renderContent()));}}]);}(Component);_defineProperty(Item,"defaultProps",{className:null,description:null,forwardedRef:null,image:null,isDisabled:false,isSelected:false,link:null,linkState:null,onClick:null,rightComponent:null,linkComponent:Link,testId:null});export default withForwardedRef(Item);
|
|
@@ -1,9 +1,9 @@
|
|
|
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 _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import List from'@shopgate/pwa-common/components/List';import Item from"./components/Item";import styles from"./style";/**
|
|
1
|
+
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import List from'@shopgate/pwa-common/components/List';import Item from"./components/Item";import styles from"./style";/**
|
|
2
2
|
* The SheetList component.
|
|
3
3
|
* Styled sheet for List component
|
|
4
|
-
*/var SheetList=/*#__PURE__*/function(_Component){
|
|
4
|
+
*/var SheetList=/*#__PURE__*/function(_Component){function SheetList(){_classCallCheck(this,SheetList);return _callSuper(this,SheetList,arguments);}_inherits(SheetList,_Component);return _createClass(SheetList,[{key:"render",value:/**
|
|
5
5
|
* Renders the component.
|
|
6
6
|
* @returns {JSX}
|
|
7
|
-
*/
|
|
7
|
+
*/function render(){var _this$props=this.props,children=_this$props.children,className=_this$props.className,hasImages=_this$props.hasImages,testId=_this$props.testId;if(!React.Children.count(children)){return null;}var itemClasses=_defineProperty(_defineProperty({},styles.item,true),styles.itemWithImage,hasImages);return React.createElement(List,{className:"".concat(className," engage__sheet-list"),role:"listbox"},React.Children.map(children,function(child,index){if(!React.isValidElement(child)){return null;}// The key for each child.
|
|
8
8
|
var key="child-".concat(index);// Selected state for the child.
|
|
9
|
-
var isSelected=child.props.isSelected;var childClasses=(
|
|
9
|
+
var isSelected=child.props.isSelected;var childClasses=_defineProperty(_defineProperty({},styles.itemSelected,isSelected),styles.itemNotLast,!isSelected);return React.createElement(List.Item,{className:classNames(itemClasses,childClasses),isSelected:isSelected,key:key,tabIndex:0},React.createElement("div",{className:styles.innerContainer,"data-test-id":testId},child));}));}}]);}(Component);_defineProperty(SheetList,"Item",Item);_defineProperty(SheetList,"defaultProps",{children:null,className:null,hasImages:false,testId:null});export default SheetList;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{connect}from'react-redux';import
|
|
1
|
+
import{connect}from'react-redux';import{fetchCategoryOrRootCategories}from'@shopgate/engage/category';import{makeGetAreRootCategoriesFetching,makeGetSubcategoriesByCategoryId}from"./selectors";/**
|
|
2
2
|
* Creates the mapStateToProps connector function.
|
|
3
3
|
* @returns {Function}
|
|
4
4
|
*/var makeMapStateToProps=function makeMapStateToProps(){var getAreRootCategoriesFetching=makeGetAreRootCategoriesFetching();var getSubcategoriesByCategoryId=makeGetSubcategoriesByCategoryId();return function(state,_ref){var categoryId=_ref.categoryId;return{rootCategoriesFetching:getAreRootCategoriesFetching(state),subcategories:getSubcategoriesByCategoryId(state,{categoryId:categoryId})};};};/**
|
|
5
5
|
* Maps the contents of the state to the component props.
|
|
6
6
|
* @param {Function} dispatch The redux dispatch function.
|
|
7
7
|
* @return {Object} The extended component props.
|
|
8
|
-
*/var mapDispatchToProps=function mapDispatchToProps(dispatch){return{fetchCategory:function fetchCategory(id){return dispatch(
|
|
8
|
+
*/var mapDispatchToProps=function mapDispatchToProps(dispatch){return{fetchCategory:function fetchCategory(id){return dispatch(fetchCategoryOrRootCategories(id));}};};export default connect(makeMapStateToProps,mapDispatchToProps);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from'react';import{createPortal}from'react-dom';import{SnackBar}from'@shopgate/pwa-ui-material';/**
|
|
2
|
+
* The SnackBarContainer component.
|
|
3
|
+
* @param {Object} props The component props.
|
|
4
|
+
* @returns {JSX}
|
|
5
|
+
*/function SnackBarContainer(props){if(!props.toasts.length){return null;}return createPortal(React.createElement(SnackBar,props),document.getElementById('portals'));}export default SnackBarContainer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React,{useMemo}from'react';import PropTypes from'prop-types';import{VisuallyHidden}from'@shopgate/engage/a11y/components';import styles from"./style";/**
|
|
2
|
+
* The Switch component.
|
|
3
|
+
* @param {Object} props The component props.
|
|
4
|
+
* @param {React.ReactNode} [children=null] Component children are rendered as the checkbox label
|
|
5
|
+
* @param {boolean} [props.checked=false] Whether the checkbox is checked
|
|
6
|
+
* @param {boolean} [props.disabled=false] Whether the checkbox is disabled
|
|
7
|
+
* @param {Function} [props.onChange] Callback invoked when the checkbox changes
|
|
8
|
+
* @param {string} [props.a11yFallbackText=null] Optional text to be presented to screen readers
|
|
9
|
+
* when issues with the regular label are expected e.g. due to problematic layout.
|
|
10
|
+
* @param {string} [props.id=null] Optional custom id for checkbox input and label
|
|
11
|
+
* @returns {JSX.Element}
|
|
12
|
+
*/var Switch=function Switch(_ref){var disabled=_ref.disabled,checked=_ref.checked,onChange=_ref.onChange,id=_ref.id,a11yFallbackText=_ref.a11yFallbackText,children=_ref.children;var switchId=useMemo(function(){return id||Math.random();},[id]);return React.createElement("div",{className:styles.container},React.createElement("input",{type:"checkbox",disabled:disabled,checked:checked,onChange:onChange,className:styles.input,id:switchId}),children&&React.createElement("label",{htmlFor:switchId},React.createElement("span",{"aria-hidden":!!a11yFallbackText},children),a11yFallbackText&&React.createElement(VisuallyHidden,null,a11yFallbackText)));};Switch.defaultProps={children:null,disabled:false,a11yFallbackText:null,checked:false,onChange:null,id:null};export default Switch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var container=css({display:'flex',flex:1,textAlign:'left',justifyContent:'space-between',flexDirection:'row-reverse',gap:'32px'});var input=css({display:'flex',flexShrink:0,appearance:'none',width:'40px',height:'20px',backgroundColor:'#ccc',borderRadius:'10px',position:'relative',cursor:'pointer',':before':{content:'""',position:'absolute',top:'2px',left:'2px',width:'16px',height:'16px',backgroundColor:'white',borderRadius:'50%',transition:'transform 0.3s'},':checked':{backgroundColor:themeConfig.colors.accent},':checked::before':{transform:'translateX(20px)'},':disabled':{backgroundColor:themeConfig.colors.shade7,cursor:'not-allowed'}});export default{container:container,input:input};
|
|
@@ -1,5 +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);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import*as React from'react';import PropTypes from'prop-types';import classNames from'classnames';import{root}from"./TabIndicator.style";/**
|
|
1
|
+
var _excluded=["className"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import*as React from'react';import PropTypes from'prop-types';import classNames from'classnames';import{root}from"./TabIndicator.style";/**
|
|
2
2
|
* Tab indicator component
|
|
3
3
|
* @param {Object} props props
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/var TabIndicator=function TabIndicator(_ref){var className=_ref.className,other=_objectWithoutProperties(_ref,
|
|
5
|
+
*/var TabIndicator=function TabIndicator(_ref){var className=_ref.className,other=_objectWithoutProperties(_ref,_excluded);return React.createElement("span",_extends({className:classNames(root,className)},other));};TabIndicator.defaultProps={className:null};export default TabIndicator;
|
|
@@ -6,6 +6,6 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
|
|
|
6
6
|
* Get Tabs Meta
|
|
7
7
|
* @returns {Object}
|
|
8
8
|
*/var getTabsMeta=function getTabsMeta(){var tabsNode=tabsRef.current;var tabsMeta;if(tabsNode){var rect=tabsNode.getBoundingClientRect();// create a new object with ClientRect class props + scrollLeft
|
|
9
|
-
tabsMeta={clientWidth:tabsNode.clientWidth,top:rect.top,bottom:rect.bottom,left:rect.left,right:rect.right};}var tabMeta;if(tabsNode&&value!==false){var _children=tabListRef.current.children;if(_children.length>0){var tab=_children[valueToIndex.get(value)];tabMeta=tab?tab.getBoundingClientRect():null;}}return{tabsMeta:tabsMeta,tabMeta:tabMeta};};var updateIndicatorState=useEventCallback(function(){var
|
|
9
|
+
tabsMeta={clientWidth:tabsNode.clientWidth,top:rect.top,bottom:rect.bottom,left:rect.left,right:rect.right};}var tabMeta;if(tabsNode&&value!==false){var _children=tabListRef.current.children;if(_children.length>0){var tab=_children[valueToIndex.get(value)];tabMeta=tab?tab.getBoundingClientRect():null;}}return{tabsMeta:tabsMeta,tabMeta:tabMeta};};var updateIndicatorState=useEventCallback(function(){var _getTabsMeta=getTabsMeta(),tabsMeta=_getTabsMeta.tabsMeta,tabMeta=_getTabsMeta.tabMeta;var startValue=0;if(tabMeta&&tabsMeta){startValue=tabMeta.left-tabsMeta.left;}var newIndicatorStyle=_defineProperty(_defineProperty({},start,startValue),size,tabMeta?tabMeta[size]:0);// IE 11 support, replace with Number.isNaN
|
|
10
10
|
// eslint-disable-next-line no-restricted-globals
|
|
11
11
|
if(isNaN(indicatorStyle[start])||isNaN(indicatorStyle[size])){setIndicatorStyle(newIndicatorStyle);}else{var dStart=Math.abs(indicatorStyle[start]-newIndicatorStyle[start]);var dSize=Math.abs(indicatorStyle[size]-newIndicatorStyle[size]);if(dStart>=1||dSize>=1){setIndicatorStyle(newIndicatorStyle);}}});React.useEffect(function(){var handleResize=debounce(function(){updateIndicatorState();});var win=ownerWindow(tabsRef.current);win.addEventListener('resize',handleResize);return function(){handleResize.clear();win.removeEventListener('resize',handleResize);};},[updateIndicatorState]);React.useEffect(function(){setMounted(true);},[]);React.useEffect(function(){updateIndicatorState();});var indicator=React.createElement(TabIndicator,{style:indicatorStyle});var childIndex=0;var children=React.Children.map(childrenProp,function(child){if(!React.isValidElement(child)){return null;}var childValue=child.props.value===undefined?childIndex:child.props.value;valueToIndex.set(childValue,childIndex);var selected=childValue===value;childIndex+=1;return React.cloneElement(child,{indicator:selected&&!mounted&&indicator,selected:selected,onChange:onChange,value:childValue});});return React.createElement("div",{className:classNames(root,className)},React.createElement("div",{className:classNames(fixed),ref:tabsRef},React.createElement("div",{className:classNames(flexContainer),ref:tabListRef,role:"tablist"},children),mounted&&indicator));};Tabs.defaultProps={className:null};export default Tabs;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _isEqual from"lodash/isEqual";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
|
+
import _isEqual from"lodash/isEqual";function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component,Fragment}from'react';import PropTypes from'prop-types';import{isBefore,isAfter,isBetween}from'@shopgate/pwa-common/helpers/date';import{second$}from'@shopgate/pwa-common/streams/interval';/**
|
|
2
2
|
* The TimeBoundary component.
|
|
3
3
|
* @example
|
|
4
4
|
* <TimeBoundary
|
|
@@ -9,13 +9,15 @@ import _isEqual from"lodash/isEqual";function _typeof(obj){if(typeof Symbol==="f
|
|
|
9
9
|
{between && <div>Content is inside time boundary</div>}
|
|
10
10
|
)}
|
|
11
11
|
* </TimeBoundary>
|
|
12
|
-
*/var TimeBoundary=/*#__PURE__*/function(_Component){
|
|
13
|
-
|
|
12
|
+
*/var TimeBoundary=/*#__PURE__*/function(_Component){function TimeBoundary(props){var _this2;_classCallCheck(this,TimeBoundary);_this2=_callSuper(this,TimeBoundary,[props]);/** Clear interval if valid */_defineProperty(_this2,"clear",function(){if(_this2.intervalSubscription){_this2.intervalSubscription.unsubscribe();}});/**
|
|
13
|
+
* Check time boundary.
|
|
14
|
+
*/_defineProperty(_this2,"checkBoundary",function(){var now=new Date(Date.now());var newState={before:isBefore(now,_this2.props.start),between:isBetween(now,_this2.props.start,_this2.props.end),after:isAfter(now,_this2.props.end)};if(_isEqual(newState,_this2.state)){return;}_this2.setState(newState);if(newState.after){// already after, stop timer
|
|
15
|
+
_this2.clear();}});_this2.state={before:false,between:false,after:false};return _this2;}/**
|
|
14
16
|
* @inheritDoc
|
|
15
|
-
*/_createClass(TimeBoundary,[{key:"componentDidMount",value:function componentDidMount(){this.intervalSubscription=second$.subscribe(this.checkBoundary);this.checkBoundary();}/**
|
|
17
|
+
*/_inherits(TimeBoundary,_Component);return _createClass(TimeBoundary,[{key:"componentDidMount",value:function componentDidMount(){this.intervalSubscription=second$.subscribe(this.checkBoundary);this.checkBoundary();}/**
|
|
16
18
|
* @inheritDoc
|
|
17
|
-
*/},{key:"componentWillUnmount",value:function componentWillUnmount(){this.clear();}
|
|
19
|
+
*/},{key:"componentWillUnmount",value:function componentWillUnmount(){this.clear();}},{key:"render",value:/**
|
|
18
20
|
* @returns {JSX}
|
|
19
|
-
*/
|
|
21
|
+
*/function render(){return React.createElement(Fragment,null,this.props.children(this.state));}}]);}(Component);_defineProperty(TimeBoundary,"defaultProps",{end:null,start:null/**
|
|
20
22
|
* @inheritDoc
|
|
21
23
|
*/});export default TimeBoundary;
|
|
@@ -1,14 +1,17 @@
|
|
|
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 _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _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 _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import ReactPlayer from'react-player';import{UIEvents}from'@shopgate/pwa-core';import{UI_VISIBILITY_CHANGE}from'@shopgate/pwa-common/constants/ui';/**
|
|
2
2
|
* Video player component
|
|
3
3
|
* @param {Object} props props
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/var VideoPlayer=/*#__PURE__*/function(_PureComponent){
|
|
5
|
+
*/var VideoPlayer=/*#__PURE__*/function(_PureComponent){function VideoPlayer(){var _this2;_classCallCheck(this,VideoPlayer);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this2=_callSuper(this,VideoPlayer,[].concat(args));_defineProperty(_this2,"state",{ready:false,playing:_this2.props.playing,userPaused:false/**
|
|
6
6
|
* @inheritDoc
|
|
7
|
-
*/})
|
|
8
|
-
|
|
7
|
+
*/});/** @returns {boolean} */_defineProperty(_this2,"getPlayingState",function(){return _this2.state.ready&&!_this2.state.userPaused&&_this2.state.playing;});/** @returns {void} */_defineProperty(_this2,"handleReady",function(){_this2.setState({ready:true});});/**
|
|
8
|
+
* Not allowed autoplay error (User gesture permission)
|
|
9
|
+
* @param {Object} error error
|
|
10
|
+
*/_defineProperty(_this2,"handleError",function(error){if(error&&error.name==='NotAllowedError'){_this2.setState({playing:false});}});/** @returns {undefined} */_defineProperty(_this2,"handlePause",function(){// Check if was not paused programmatically
|
|
11
|
+
if(_this2.state.playing){_this2.setState({userPaused:true,playing:false});}});/** @returns {undefined} */_defineProperty(_this2,"handlePlay",function(){if(!_this2.state.playing){_this2.setState({userPaused:false,playing:true});}});/** @returns {undefined} */_defineProperty(_this2,"handleVisibilityChange",function(){_this2.setState({playing:false});});return _this2;}_inherits(VideoPlayer,_PureComponent);return _createClass(VideoPlayer,[{key:"componentDidMount",value:function componentDidMount(){UIEvents.addListener(UI_VISIBILITY_CHANGE,this.handleVisibilityChange);}/**
|
|
9
12
|
* @inheritDoc
|
|
10
13
|
*/},{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){var nextState={playing:nextProps.playing};if(this.props.url!==nextProps.url){nextState.ready=false;}this.setState(nextState);}/**
|
|
11
14
|
* @inheritDoc
|
|
12
|
-
*/},{key:"componentWillUnmount",value:function componentWillUnmount(){UIEvents.removeListener(UI_VISIBILITY_CHANGE,this.handleVisibilityChange);}
|
|
15
|
+
*/},{key:"componentWillUnmount",value:function componentWillUnmount(){UIEvents.removeListener(UI_VISIBILITY_CHANGE,this.handleVisibilityChange);}},{key:"render",value:/**
|
|
13
16
|
* @returns {JSX}
|
|
14
|
-
*/
|
|
17
|
+
*/function render(){return React.createElement(ReactPlayer,_extends({playsinline:true},this.props,{playing:this.getPlayingState(),onReady:this.handleReady,onPause:this.handlePause,onPlay:this.handlePlay,onError:this.handleError}));}}]);}(PureComponent);_defineProperty(VideoPlayer,"defaultProps",ReactPlayer.defaultProps);export default VideoPlayer;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from'react';import{ViewContext}from"../../context";/**
|
|
2
2
|
* @returns {JSX}
|
|
3
|
-
*/function ViewAbove(){return React.createElement(ViewContext.Consumer,null,function(_ref){var top=_ref.top;if(!top){return null;}var styles={flexShrink:0,height:"calc(".concat(top,"px + var(--safe-area-inset-top))")};return React.createElement("div",{"aria-hidden":true,style:styles});});}export default ViewAbove;
|
|
3
|
+
*/function ViewAbove(){return React.createElement(ViewContext.Consumer,null,function(_ref){var top=_ref.top;if(!top){return null;}var styles={flexShrink:0,height:"calc(".concat(top,"px + var(--safe-area-inset-top))")};return React.createElement("div",{"aria-hidden":true,style:styles,className:"engage__view__above"});});}export default ViewAbove;
|