@shopgate/engage 7.12.3-beta.1 → 7.20.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/components/Section/index.js +2 -2
- package/a11y/components/VisuallyHidden/index.js +8 -0
- package/a11y/components/index.js +1 -0
- package/a11y/constants/index.js +1 -0
- package/a11y/helpers/index.js +1 -0
- package/a11y/index.js +1 -4
- package/account/actions/addContacts.js +1 -1
- package/account/actions/deleteContact.js +1 -1
- package/account/actions/deleteCustomer.js +1 -1
- package/account/actions/fetchContacts.js +1 -1
- package/account/actions/fetchCustomer.js +1 -1
- package/account/actions/updateContact.js +1 -1
- package/account/actions/updateCustomer.js +1 -1
- package/account/components/Account/Account.style.js +1 -1
- package/account/components/Profile/Profile.provider.js +3 -3
- package/account/components/ProfileContact/ProfileContact.js +1 -1
- package/app-rating/action-creators/appStart.js +3 -3
- package/app-rating/action-creators/ordersPlaced.js +3 -3
- package/app-rating/action-creators/popup.js +4 -4
- package/app-rating/action-creators/timer.js +3 -3
- package/app-rating/actions/showModal.js +6 -6
- package/app-rating/constants/index.js +2 -2
- package/app-rating/reducers/index.js +2 -2
- package/app-rating/subscriptions/index.js +4 -4
- package/back-in-stock/actions/index.js +14 -0
- package/back-in-stock/components/BackInStockButton/connector.js +1 -0
- package/back-in-stock/components/BackInStockButton/index.js +14 -0
- package/back-in-stock/components/BackInStockButton/style.js +1 -0
- package/back-in-stock/components/CharacteristicsButton/connector.js +3 -0
- package/back-in-stock/components/CharacteristicsButton/index.js +8 -0
- package/back-in-stock/components/ProductInfoBackInStockButton/connector.js +3 -0
- package/back-in-stock/components/ProductInfoBackInStockButton/index.js +10 -0
- package/back-in-stock/components/Subscriptions/components/List/index.js +4 -0
- package/back-in-stock/components/Subscriptions/components/Subscription/index.js +7 -0
- package/back-in-stock/components/Subscriptions/index.js +4 -0
- package/back-in-stock/components/index.js +1 -0
- package/back-in-stock/constants/Actions.js +1 -0
- package/back-in-stock/constants/Common.js +1 -0
- package/back-in-stock/constants/Pipelines.js +1 -0
- package/back-in-stock/constants/Portals.js +9 -0
- package/back-in-stock/constants/index.js +1 -0
- package/back-in-stock/hooks/index.js +4 -0
- package/back-in-stock/providers/BackInStockSubscriptionsProvider.connector.js +7 -0
- package/back-in-stock/providers/BackInStockSubscriptionsProvider.context.js +1 -0
- package/back-in-stock/providers/BackInStockSubscriptionsProvider.js +5 -0
- package/back-in-stock/providers/index.js +1 -0
- package/back-in-stock/reducers/index.js +5 -0
- package/back-in-stock/selectors/index.js +43 -0
- package/back-in-stock/streams/index.js +1 -0
- package/back-in-stock/subscriptions/index.js +11 -0
- package/cart/cart.helpers.js +2 -2
- package/cart/components/CartItem/CartItemCoupon.js +10 -6
- package/cart/components/CartItem/CartItemCouponCode.js +2 -2
- package/cart/components/CartItem/CartItemCouponDelete.js +1 -1
- package/cart/components/CartItem/CartItemCouponFreeShipping.js +1 -1
- package/cart/components/CartItem/CartItemCouponIcon.js +2 -2
- package/cart/components/CartItem/CartItemCouponLayout.style.js +5 -1
- package/cart/components/CartItem/CartItemCouponTitle.js +2 -2
- package/cart/components/CartItem/CartItemProductLayout.js +3 -2
- package/cart/components/CartItem/CartItemProductLayoutWide.style.js +1 -1
- package/cart/components/CartItem/CartItemProductTitle.js +2 -2
- package/cart/components/CartItem/CartItemQuantityPicker.js +26 -14
- package/cart/components/CartItem/CartItemSubstitution.js +1 -1
- package/cart/components/CartItems/CartItemCardReservation.js +1 -1
- package/cart/components/CartItems/CartItemGroupReservation.js +1 -1
- package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.style.js +1 -1
- package/cart/components/PaymentBar/PaymentBar.js +1 -1
- package/cart/components/PaymentBar/PaymentBarCheckoutButton.style.js +1 -1
- package/cart/components/PaymentBar/PaymentBarPromotionCouponMessages.js +1 -1
- package/cart/index.js +1 -1
- package/category/actions/index.js +1 -0
- package/category/components/CategoryList/index.js +7 -0
- package/category/components/CategoryList/style.js +1 -0
- package/category/components/index.js +1 -1
- package/category/constants/index.js +1 -0
- package/category/helpers/index.js +1 -0
- package/category/index.js +1 -6
- package/category/selectors/index.js +2 -0
- package/category/streams/index.js +1 -1
- package/checkout/actions/errorCheckout.js +1 -1
- package/checkout/actions/fetchCheckoutOrder.js +1 -1
- package/checkout/actions/fetchPaymentMethods.js +1 -1
- package/checkout/actions/initializeCheckout.js +1 -1
- package/checkout/actions/prepareCheckout.js +2 -2
- package/checkout/actions/submitCheckoutOrder.js +1 -1
- package/checkout/actions/updateCheckoutOrder.js +1 -1
- package/checkout/components/Checkout/CheckoutSectionMessages.js +1 -1
- package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +1 -1
- package/checkout/components/CheckoutConfirmation/CheckoutConfirmationBilledTo.js +1 -1
- package/checkout/components/PaymentMethodButton/PaymentMethodButton.js +1 -1
- package/checkout/components/ShippingMethods/ShippingMethods.js +4 -4
- package/checkout/paymentMethods/index.js +2 -2
- package/checkout/paymentMethods/paypal/PaypalButtonApp.js +1 -1
- package/checkout/paymentMethods/paypal/PaypalButtonWeb.js +1 -1
- package/checkout/paymentMethods/paypal/PaypalPayButton.js +1 -1
- package/checkout/paymentMethods/paypal/PaypalProvider.js +1 -1
- package/checkout/paymentMethods/stripe/StripeButton.js +2 -2
- package/checkout/paymentMethods/stripe/StripeCreditCard.js +3 -3
- package/checkout/paymentMethods/stripe/StripeProvider.js +8 -8
- package/checkout/paymentMethods/stripe/sdk.js +1 -1
- package/checkout/providers/AddressBookProvider.js +1 -1
- package/checkout/providers/CheckoutProvider.js +8 -8
- package/components/ChipLayout/index.js +38 -0
- package/components/ChipLayout/spec.js +5 -0
- package/components/ChipLayout/style.js +5 -0
- package/components/Footer/Footer.js +7 -7
- package/components/Form/Builder/Builder.js +50 -29
- package/components/Form/Builder/ElementCheckbox.js +1 -1
- package/components/Form/Builder/ElementMultiSelect.js +1 -1
- package/components/Form/Builder/ElementPhoneNumber.js +3 -3
- package/components/Form/Builder/ElementRadio.js +1 -1
- package/components/Form/Builder/ElementSelect.js +1 -1
- package/components/Form/Builder/ElementText.js +3 -3
- package/components/Form/Builder/classes/ActionListener.constants.js +2 -2
- package/components/Form/Builder/classes/ActionListener.js +73 -16
- package/components/Form/Builder/helpers/buildFormElements.js +2 -2
- package/components/Form/Form.js +8 -5
- package/components/IntersectionVisibility/index.js +14 -7
- package/components/Logo/connector.js +4 -0
- package/components/Logo/index.js +4 -0
- package/components/Logo/spec.js +1 -0
- package/components/Logo/style.js +1 -0
- package/components/Menu/components/Position/index.js +5 -5
- package/components/Menu/index.js +9 -9
- package/components/MessageBar/MessageBar.js +1 -1
- package/components/MessageBar/index.js +1 -1
- package/components/NavigationHandler/index.js +4 -4
- package/components/NavigationHandler/spec.js +1 -1
- package/components/Picker/components/Button/index.js +1 -1
- package/components/Picker/components/List/index.js +2 -2
- package/components/Picker/components/Modal/index.js +7 -7
- package/components/Picker/index.js +18 -9
- package/components/PickerUtilize/components/Button/index.js +5 -0
- package/components/PickerUtilize/components/Button/style.js +1 -0
- package/components/PickerUtilize/index.js +17 -0
- package/components/PickerUtilize/spec.js +1 -0
- package/components/PickerUtilize/style.js +1 -0
- package/components/QuantityInput/QuantityInput.js +2 -2
- package/components/Radio/Radio.js +1 -1
- package/components/RadioCard/RadioCard.js +1 -1
- package/components/RangeSlider/components/Handle/index.js +1 -1
- package/components/RangeSlider/index.js +36 -24
- package/components/SheetList/components/Item/index.js +5 -5
- package/components/SheetList/index.js +4 -4
- package/components/SideNavigation/SideNavigationCategories.connector.js +2 -2
- package/components/SnackBarContainer/index.js +5 -0
- package/components/Switch/index.js +12 -0
- package/components/Switch/style.js +1 -0
- package/components/Tabs/components/TabIndicator.js +2 -2
- package/components/Tabs/components/Tabs.js +1 -1
- package/components/TimeBoundary/index.js +8 -6
- package/components/VideoPlayer/index.js +9 -6
- package/components/View/components/Above/index.js +1 -1
- package/components/View/components/Below/index.js +1 -1
- package/components/View/components/Content/index.js +18 -11
- package/components/View/index.js +1 -1
- package/components/View/provider.js +22 -5
- package/components/index.js +2 -2
- package/core/action-creators/app.js +5 -0
- package/core/action-creators/appPermissions.js +9 -0
- package/core/action-creators/index.js +1 -1
- package/core/actions/getGeolocation.js +2 -2
- package/core/actions/grantAppTrackingTransparencyPermission.js +6 -0
- package/core/actions/grantCameraPermissions.js +1 -1
- package/core/actions/grantGeolocationPermissions.js +1 -1
- package/core/actions/grantPermissions.js +13 -6
- package/core/actions/grantPushPermissions.js +22 -0
- package/core/actions/index.js +7 -0
- package/core/actions/requestAppPermission.js +12 -0
- package/core/actions/requestAppPermissionStatus.js +12 -0
- package/core/classes/GeolocationRequest.js +2 -3
- package/core/classes/GeolocationRequestApp.js +6 -6
- package/core/classes/GeolocationRequestBrowser.js +2 -2
- package/core/classes/index.js +1 -0
- package/core/collections/AppInitialization.js +49 -0
- package/core/collections/index.js +1 -0
- package/core/commands/analyticsSetConsent.js +11 -0
- package/core/commands/index.js +1 -0
- package/core/config/ThemeConfigResolver.js +2 -2
- package/core/config/config.action-creators.js +1 -1
- package/core/config/config.actions.js +1 -1
- package/core/config/config.reducers.js +1 -1
- package/core/config/config.subscriptions.js +2 -2
- package/core/config/index.js +1 -1
- package/core/constants/actionTypes.js +1 -0
- package/core/constants/appFeatures.js +1 -0
- package/core/constants/index.js +6 -1
- package/core/contexts/index.js +1 -0
- package/core/helpers/appFeatures.js +14 -0
- package/core/helpers/appPermissions.js +43 -6
- package/core/helpers/baseUrl.js +14 -0
- package/core/helpers/environment.js +4 -0
- package/core/helpers/getFullImageSource.js +1 -1
- package/core/helpers/i18n.js +5 -3
- package/core/helpers/index.js +7 -0
- package/core/hocs/index.js +1 -0
- package/core/hocs/withCurrentProduct.js +6 -6
- package/core/hocs/withTheme.js +2 -2
- package/core/hooks/index.js +1 -0
- package/core/hooks/useAsyncMemo.js +1 -1
- package/core/hooks/useFormState.js +1 -1
- package/core/hooks/useScrollTo.js +1 -1
- package/core/hooks/useTheme.js +2 -2
- package/core/index.js +5 -52
- package/core/initialization/index.js +4 -2
- package/core/providers/AppProvider.js +10 -8
- package/core/providers/index.js +1 -0
- package/core/reducers/app.js +6 -0
- package/core/reducers/index.js +1 -1
- package/core/reducers/merchantSettings.js +1 -1
- package/core/reducers/shopSettings.js +1 -1
- package/core/selectors/app.js +9 -0
- package/core/selectors/index.js +6 -1
- package/core/streams/app.js +8 -0
- package/core/streams/appPermissions.js +19 -0
- package/core/streams/index.js +4 -0
- package/core/subscriptions/app.js +7 -0
- package/favorites/components/Item/Item.js +5 -5
- package/favorites/components/List/List.js +1 -1
- package/favorites/components/Lists/Lists.js +4 -4
- package/filter/components/PriceSlider/index.js +9 -9
- package/filter/helpers/buildFilterParamsForFetchFiltersRequest.js +9 -0
- package/filter/helpers/buildUpdatedFilters.js +1 -1
- package/filter/helpers/index.js +1 -0
- package/filter/helpers/translateFilterLabel.js +6 -0
- package/filter/index.js +1 -1
- package/filter/providers/SortProvider.helpers.js +1 -1
- package/locations/actions/fetchFulfillmentSlots.js +5 -3
- package/locations/actions/fetchInventories.js +5 -4
- package/locations/actions/fetchLocations.js +18 -3
- package/locations/actions/fetchProductInventories.js +4 -2
- package/locations/actions/fetchProductLocations.js +9 -2
- package/locations/actions/index.js +1 -1
- package/locations/actions/setUserGeolocation.js +1 -1
- package/locations/actions/setUserSearchGeolocation.js +1 -1
- package/locations/actions/submitReservation.js +2 -2
- package/locations/components/Cart/CartContextMenuChangeFulfillmentContent.js +1 -1
- package/locations/components/FulfillmentPath/FulfillmentPath.js +1 -1
- package/locations/components/FulfillmentPath/FulfillmentPathItem.js +2 -2
- package/locations/components/FulfillmentSelector/FulfillmentSelectorAddToCart.js +2 -2
- package/locations/components/FulfillmentSelector/FulfillmentSelectorAlternativeLocation.js +1 -1
- package/locations/components/FulfillmentSheet/FulfillmentSheet.js +2 -2
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +1 -1
- package/locations/components/ReserveForm/ReserveForm.js +1 -1
- package/locations/components/ReserveForm/ReserveFormPhone.js +1 -1
- package/locations/components/StockInfo/StockInfo.defaultSettings.js +1 -1
- package/locations/components/StoreFinder/StoreFinderMap.style.js +2 -2
- package/locations/components/StoreList/StoreListSearch.js +2 -2
- package/locations/locations.streams.js +1 -1
- package/locations/providers/FulfillmentProvider.js +4 -4
- package/locations/providers/StoreFinderProvider.js +1 -1
- package/locations/reducers/storage.js +3 -3
- package/locations/selectors/index.js +2 -2
- package/locations/subscriptions.js +13 -13
- package/login/components/ForgotPassword/ForgotPassword.js +1 -1
- package/orders/actions/cancelOrder.js +1 -1
- package/orders/actions/fetchOrderDetails.js +1 -1
- package/orders/constants/status.js +2 -2
- package/orders/providers/OrderDetailsPrivateProvider.js +1 -1
- package/orders/providers/OrderDetailsProvider.js +3 -3
- package/package.json +8 -8
- package/page/actions/index.js +1 -0
- package/page/components/index.js +1 -0
- package/page/constants/index.js +1 -0
- package/page/index.js +2 -4
- package/page/selectors/index.js +1 -0
- package/product/collections/index.js +1 -0
- package/product/components/Availability/Availability.connector.js +4 -5
- package/product/components/Availability/Availability.js +3 -3
- package/product/components/Characteristics/Characteristic/components/Sheet/index.js +20 -0
- package/product/components/Characteristics/Characteristic/components/SheetItem/index.js +10 -0
- package/product/components/Characteristics/Characteristic/components/SheetItem/style.js +1 -0
- package/product/components/Characteristics/Characteristic/index.js +18 -0
- package/product/components/Characteristics/Characteristic/style.js +1 -0
- package/product/components/Characteristics/Swatch/index.js +12 -0
- package/product/components/Characteristics/Swatch/style.js +1 -0
- package/product/components/Characteristics/index.js +12 -0
- package/product/components/Characteristics/transition.js +1 -0
- package/product/components/Description/index.js +2 -2
- package/product/components/EffectivityDates/helpers.js +3 -3
- package/product/components/EffectivityDates/index.js +1 -1
- package/product/components/Header/PriceStriked/connector.js +9 -0
- package/product/components/Header/PriceStriked/index.js +5 -0
- package/product/components/Header/PriceStriked/style.js +1 -0
- package/product/components/Header/Shipping/components/Label/index.js +6 -0
- package/product/components/Header/Shipping/components/Label/style.js +1 -0
- package/product/components/Header/Shipping/connector.js +9 -0
- package/product/components/Header/Shipping/index.js +5 -0
- package/product/components/Header/Shipping/mock.js +1 -0
- package/product/components/Header/Shipping/spec.js +5 -0
- package/product/components/Header/Shipping/style.js +1 -0
- package/product/components/Header/Tiers/components/Tier/index.js +6 -0
- package/product/components/Header/Tiers/components/Tier/spec.js +1 -0
- package/product/components/Header/Tiers/connector.js +10 -0
- package/product/components/Header/Tiers/index.js +5 -0
- package/product/components/Header/Tiers/spec.js +1 -0
- package/product/components/Header/Tiers/style.js +1 -0
- package/product/components/Header/index.js +1 -0
- package/product/components/MapPriceHint/index.js +1 -1
- package/product/components/Media/FeaturedMedia.js +1 -1
- package/product/components/MediaSlider/index.js +1 -1
- package/product/components/Options/components/Content/connector.js +10 -0
- package/product/components/Options/components/Content/index.js +16 -0
- package/product/components/Options/components/Content/spec.js +2 -0
- package/product/components/Options/components/Option/index.js +4 -0
- package/product/components/Options/components/TextOption/components/OptionInfo/index.js +9 -0
- package/product/components/Options/components/TextOption/components/OptionInfo/spec.js +1 -0
- package/product/components/Options/components/TextOption/components/OptionInfo/style.js +1 -0
- package/product/components/Options/components/TextOption/index.js +22 -0
- package/product/components/Options/components/TextOption/style.js +1 -0
- package/product/components/Options/index.js +5 -0
- package/product/components/OrderQuantityHint/index.js +3 -2
- package/product/components/OrderQuantityHint/style.js +1 -1
- package/product/components/PriceDifference/index.js +1 -1
- package/product/components/ProductCard/index.js +2 -2
- package/product/components/ProductCharacteristics/helpers/index.js +1 -1
- package/product/components/ProductCharacteristics/index.js +28 -12
- package/product/components/ProductDiscountBadge/spec.js +1 -1
- package/product/components/ProductGridPrice/index.js +2 -2
- package/product/components/ProductImage/index.js +15 -12
- package/product/components/ProductList/components/Item/index.js +5 -0
- package/product/components/ProductList/components/Item/style.js +2 -0
- package/product/components/ProductList/components/Iterator/index.js +5 -0
- package/product/components/ProductList/components/Iterator/style.js +1 -0
- package/product/components/ProductList/components/Layout/index.js +5 -0
- package/product/components/ProductList/components/Layout/style.js +1 -0
- package/product/components/ProductList/index.js +5 -0
- package/product/components/ProductProperties/Content.js +1 -1
- package/product/components/ProductProperties/GroupedProperties.js +1 -1
- package/product/components/ProductProperties/ListsHTML.js +1 -1
- package/product/components/ProductProperties/ProductProperties.js +1 -1
- package/product/components/ProductProperties/RowHTML.js +1 -1
- package/product/components/ProductProperties/Wrapper.js +1 -1
- package/product/components/ProductProperties/style.js +1 -1
- package/product/components/ProductProvider/connector.js +5 -0
- package/product/components/ProductProvider/index.js +4 -0
- package/product/components/ProductSlider/index.js +4 -0
- package/product/components/ProductSlider/spec.js +1 -0
- package/product/components/ProductSlider/style.js +1 -0
- package/product/components/Rating/connector.js +9 -0
- package/product/components/Rating/index.js +7 -0
- package/product/components/Rating/mock.js +5 -0
- package/product/components/Rating/spec.js +5 -0
- package/product/components/Rating/style.js +1 -0
- package/product/components/Swatch/SwatchContent.js +1 -1
- package/product/components/index.js +1 -0
- package/product/constants/index.js +1 -1
- package/product/contexts/index.js +1 -0
- package/product/helpers/index.js +2 -2
- package/product/helpers/redirects.js +1 -1
- package/product/hocs/index.js +1 -0
- package/product/hocs/withProductListEntryProduct.js +12 -0
- package/product/hooks/index.js +1 -0
- package/product/index.js +4 -11
- package/product/providers/index.js +1 -0
- package/product/selectors/product.js +13 -2
- package/product/selectors/variants.js +2 -2
- package/product/streams/index.js +1 -0
- package/push-opt-in/action-creators/index.js +1 -0
- package/push-opt-in/action-creators/optInTrigger.js +23 -0
- package/push-opt-in/action-creators/pushOptIn.js +7 -0
- package/push-opt-in/actions/index.js +1 -0
- package/push-opt-in/actions/pushOptInModal.js +8 -0
- package/push-opt-in/components/PushOptInModal/connector.js +9 -0
- package/push-opt-in/components/PushOptInModal/index.js +10 -0
- package/push-opt-in/components/PushOptInModal/push-opt-in.svg +62 -0
- package/push-opt-in/components/PushOptInModal/style.js +1 -0
- package/push-opt-in/components/index.js +1 -0
- package/push-opt-in/constants/index.js +1 -0
- package/push-opt-in/constants/optInModal.js +1 -0
- package/push-opt-in/constants/optInTrigger.js +1 -0
- package/push-opt-in/reducers/index.js +1 -0
- package/push-opt-in/reducers/optInModal.js +6 -0
- package/push-opt-in/reducers/optInTrigger.js +6 -0
- package/push-opt-in/selectors/index.js +1 -0
- package/push-opt-in/selectors/optInModal.js +8 -0
- package/push-opt-in/selectors/optInTrigger.js +5 -0
- package/push-opt-in/subscriptions/index.js +1 -0
- package/push-opt-in/subscriptions/optInTrigger.js +14 -0
- package/registration/providers/GuestRegistrationProvider.actions.js +2 -2
- package/registration/providers/GuestRegistrationProvider.js +3 -3
- package/registration/providers/RegistrationProvider.actions.js +3 -3
- package/registration/providers/RegistrationProvider.js +2 -2
- package/registration/subscriptions/index.js +1 -1
- package/reviews/actions/index.js +1 -0
- package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/index.js +1 -1
- package/reviews/components/Reviews/components/List/index.js +3 -3
- package/reviews/components/Reviews/components/List/spec.js +1 -1
- package/reviews/components/Reviews/components/RatingCount/index.js +1 -1
- package/reviews/components/Reviews/components/ReviewsInfo/index.js +1 -2
- package/reviews/components/Reviews/spec.js +1 -1
- package/reviews/components/index.js +1 -0
- package/reviews/constants/index.js +1 -0
- package/reviews/index.js +1 -7
- package/reviews/selectors/index.js +1 -0
- package/reviews/streams/index.js +1 -0
- package/scanner/action-creators/index.js +1 -0
- package/scanner/actions/index.js +1 -0
- package/scanner/classes/index.js +1 -0
- package/scanner/constants/index.js +1 -0
- package/scanner/helpers/index.js +1 -0
- package/scanner/index.js +1 -6
- package/scanner/streams/index.js +1 -0
- package/search/actions/index.js +1 -0
- package/search/constants/index.js +1 -0
- package/search/helpers/index.js +1 -0
- package/search/index.js +1 -6
- package/search/selectors/index.js +1 -0
- package/search/streams/index.js +1 -0
- package/styles/helpers/index.js +1 -0
- package/styles/helpers/initCSSCustomProperties.js +3 -3
- package/styles/helpers/setPageContentWidth.js +2 -1
- package/styles/index.js +1 -1
- package/tracking/components/CookieConsent/CookieConsentContent.js +1 -1
- package/tracking/constants/index.js +2 -1
- package/components/MessageBar/MessageBar.types.js +0 -0
- package/components/MessageBar/style.js +0 -1
- package/product/components/Availability/Availability.types.js +0 -1
- /package/page/{NotFound.js → components/NotFound.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./optInTrigger";export*from"./pushOptIn";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{PUSH_OPT_IN_INCREASE_APP_START_COUNT,PUSH_OPT_IN_RESET_APP_START_COUNT,PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT,PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT,PUSH_OPT_IN_INCREASE_REJECTION_COUNT,PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP,PUSH_OPT_IN_OPT_IN_POSTPONED}from"../constants";/**
|
|
2
|
+
* Increment the app start count
|
|
3
|
+
* @return {Object} The dispatched action object.
|
|
4
|
+
*/export var increaseAppStartCount=function increaseAppStartCount(){return{type:PUSH_OPT_IN_INCREASE_APP_START_COUNT};};/**
|
|
5
|
+
* Reset the app start count, and increment reset counts
|
|
6
|
+
* @return {Object} The dispatched action object.
|
|
7
|
+
*/export var resetAppStartCount=function resetAppStartCount(){return{type:PUSH_OPT_IN_RESET_APP_START_COUNT};};/**
|
|
8
|
+
* Increment the orders placed count
|
|
9
|
+
* @return {Object} The dispatched action object.
|
|
10
|
+
*/export var increaseOrdersPlacedCount=function increaseOrdersPlacedCount(){return{type:PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT};};/**
|
|
11
|
+
* Reset the orders placed count, and increment reset counts
|
|
12
|
+
* @return {Object} The dispatched action object.
|
|
13
|
+
*/export var resetOrdersPlacedCount=function resetOrdersPlacedCount(){return{type:PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT};};/**
|
|
14
|
+
* Sets the last opt-in timestamp
|
|
15
|
+
* @return {Object} The dispatched action object.
|
|
16
|
+
*/export var setLastPopupTimestamp=function setLastPopupTimestamp(){return{type:PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP};};/**
|
|
17
|
+
* Increased the opt-in rejection / postponement count
|
|
18
|
+
* @return {Object} The dispatched action object.
|
|
19
|
+
*/export var increaseRejectionCount=function increaseRejectionCount(){return{type:PUSH_OPT_IN_INCREASE_REJECTION_COUNT};};/**
|
|
20
|
+
* Action to be dispatched when push opt in was postponed e.g. Opt In Modal was closed without
|
|
21
|
+
* taking a decision about permissions.
|
|
22
|
+
* @return {Object} The dispatched action object.
|
|
23
|
+
*/export var optInPostponed=function optInPostponed(){return{type:PUSH_OPT_IN_OPT_IN_POSTPONED};};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{HIDE_PUSH_OPT_IN_MODAL,SHOW_PUSH_OPT_IN_MODAL}from"../constants";/**
|
|
2
|
+
* action to be dispatched when the push opt-in should be shown
|
|
3
|
+
* @returns {Function}
|
|
4
|
+
*/export var showPushOptInModal=function showPushOptInModal(){return{type:SHOW_PUSH_OPT_IN_MODAL};};/**
|
|
5
|
+
* action to be dispatched when the push opt-in should be hidden
|
|
6
|
+
* @returns {Function}
|
|
7
|
+
*/export var hidePushOptInModal=function hidePushOptInModal(){return{type:HIDE_PUSH_OPT_IN_MODAL};};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./pushOptInModal";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{grantPushPermissions}from"../../core";import{hidePushOptInModal,optInPostponed}from"../action-creators";/**
|
|
2
|
+
* action to be dispatched when the user allowed the push opt-in in the modal
|
|
3
|
+
* and native modal should be triggered for setting the permission
|
|
4
|
+
* @returns {Function}
|
|
5
|
+
*/export var allowPushOptIn=function allowPushOptIn(){return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return dispatch(grantPushPermissions({useSettingsModal:true}));case 2:dispatch(hidePushOptInModal());case 3:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());};/**
|
|
6
|
+
* action to be dispatched when the user denied the push opt-in in the modal
|
|
7
|
+
* @returns {Function}
|
|
8
|
+
*/export var denyPushOptIn=function denyPushOptIn(){return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(dispatch){return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return dispatch(optInPostponed());case 2:dispatch(hidePushOptInModal());case 3:case"end":return _context2.stop();}},_callee2);}));return function(_x2){return _ref2.apply(this,arguments);};}());};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{connect}from'react-redux';import{getIsPushOptInModalVisible}from"../../selectors";import{allowPushOptIn,denyPushOptIn}from"../../actions";/**
|
|
2
|
+
* Maps the contents of the state to the component props.
|
|
3
|
+
* @param {Object} state The current application state.
|
|
4
|
+
* @return {Object} The extended component props.
|
|
5
|
+
*/var mapStateToProps=function mapStateToProps(state){return{isPushOptInModalVisible:getIsPushOptInModalVisible(state)};};/**
|
|
6
|
+
* Connects the dispatch function to a callable function in the props.
|
|
7
|
+
* @param {Function} dispatch The redux dispatch function.
|
|
8
|
+
* @return {Object} The extended component props.
|
|
9
|
+
*/var mapDispatchToProps={allowPushOptIn:allowPushOptIn,denyPushOptIn:denyPushOptIn};export default connect(mapStateToProps,mapDispatchToProps);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React,{useMemo}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{Grid,I18n,Button,Modal}from'@shopgate/engage/components';import{appConfig}from'@shopgate/engage';import pushImage from"./push-opt-in.svg";import styles from"./style";import connect from"./connector";/**
|
|
2
|
+
* The Push opt-in modal component.
|
|
3
|
+
* @param {Object} props The component props.
|
|
4
|
+
* @returns {JSX.Element}
|
|
5
|
+
*/var PushOptInModal=function PushOptInModal(_ref){var isPushOptInModalVisible=_ref.isPushOptInModalVisible,allowPushOptIn=_ref.allowPushOptIn,denyPushOptIn=_ref.denyPushOptIn;var _appConfig$pushOptIn=appConfig.pushOptIn,_appConfig$pushOptIn2=_appConfig$pushOptIn===void 0?{}:_appConfig$pushOptIn,modalMessage=_appConfig$pushOptIn2.modalMessage,modalTitle=_appConfig$pushOptIn2.modalTitle,modalButtonDeny=_appConfig$pushOptIn2.modalButtonDeny,modalButtonAllow=_appConfig$pushOptIn2.modalButtonAllow,modalImageURL=_appConfig$pushOptIn2.modalImageURL,modalImageSVG=_appConfig$pushOptIn2.modalImageSVG;var imageSRC=useMemo(function(){// No overwrite configured -> use default image
|
|
6
|
+
if(!modalImageURL&&!modalImageSVG){return pushImage;}// URL overwrite configured -> use it
|
|
7
|
+
if(modalImageURL){return modalImageURL;}// SVG overwrite configured -> create data url
|
|
8
|
+
try{// Remove any characters outside the Latin1 range
|
|
9
|
+
var decoded=decodeURIComponent(encodeURIComponent(modalImageSVG));// Now we can use btoa to convert the svg to base64
|
|
10
|
+
var base64=btoa(decoded);return"data:image/svg+xml;base64,".concat(base64);}catch(e){return pushImage;}},[modalImageSVG,modalImageURL]);if(!isPushOptInModalVisible){return null;}return React.createElement(Modal,{isOpened:isPushOptInModalVisible,classes:{content:styles.modalContent,layout:styles.modalLayout}},React.createElement(Grid,{className:classNames(styles.container,'push-opt-in-modal__container'),role:"alertdialog","aria-modal":true,"aria-labelledby":"pushOptInDialogTitle","aria-describedby":"pushOptInDialogMessage"},React.createElement(Grid.Item,{className:styles.item},React.createElement("img",{src:imageSRC,className:classNames(styles.image,'push-opt-in-modal__image'),alt:"","aria-hidden":"true"}),React.createElement(I18n.Text,{className:classNames(styles.title,'push-opt-in-modal__title'),string:modalTitle||'pushOptInModal.title',id:"pushOptInDialogTitle"}),React.createElement(I18n.Text,{className:classNames('push-opt-in-modal__message'),string:modalMessage||'pushOptInModal.message',id:"pushOptInDialogMessage"}),React.createElement(Button,{onClick:allowPushOptIn,type:"primary",className:classNames(styles.button,'push-opt-in-modal__button-allow')},React.createElement(I18n.Text,{string:modalButtonAllow||'pushOptInModal.buttonAllow'})),React.createElement(Button,{onClick:denyPushOptIn,type:"plain",className:classNames(styles.button,'push-opt-in-modal__button-deny')},React.createElement(I18n.Text,{string:modalButtonDeny||'pushOptInModal.buttonDeny',className:styles.buttonText})))));};export default connect(PushOptInModal);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 1107 791" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
4
|
+
<g transform="matrix(1,0,0,1,-88.9596,-502.577)">
|
|
5
|
+
<g transform="matrix(1.28381,0,0,1.28381,-145.009,-328.293)">
|
|
6
|
+
<g>
|
|
7
|
+
<g transform="matrix(0.738616,0,0,0.7166,142.625,351.19)">
|
|
8
|
+
<path d="M1052.9,1091.68C1052.9,1062.46 1029.88,1038.73 1001.53,1038.73L244.024,1038.73C215.667,1038.73 192.646,1062.46 192.646,1091.68L192.646,1219.08C192.646,1248.3 215.667,1272.03 244.024,1272.03L1001.53,1272.03C1029.88,1272.03 1052.9,1248.3 1052.9,1219.08L1052.9,1091.68Z" style="fill:rgb(193,193,193);"/>
|
|
9
|
+
</g>
|
|
10
|
+
<g transform="matrix(0.859568,0,0,0.833947,80.1965,145.713)">
|
|
11
|
+
<path d="M1052.9,1091.68C1052.9,1062.46 1029.88,1038.73 1001.53,1038.73L244.024,1038.73C215.667,1038.73 192.646,1062.46 192.646,1091.68L192.646,1219.08C192.646,1248.3 215.667,1272.03 244.024,1272.03L1001.53,1272.03C1029.88,1272.03 1052.9,1248.3 1052.9,1219.08L1052.9,1091.68Z" style="fill:rgb(216,216,216);"/>
|
|
12
|
+
</g>
|
|
13
|
+
<g transform="matrix(1.00203,0,0,0.972164,-10.791,-90.8989)">
|
|
14
|
+
<path d="M1052.9,1091.68C1052.9,1062.46 1029.88,1038.73 1001.53,1038.73L244.024,1038.73C215.667,1038.73 192.646,1062.46 192.646,1091.68L192.646,1219.08C192.646,1248.3 215.667,1272.03 244.024,1272.03L1001.53,1272.03C1029.88,1272.03 1052.9,1248.3 1052.9,1219.08L1052.9,1091.68Z" style="fill:rgb(235,235,235);"/>
|
|
15
|
+
</g>
|
|
16
|
+
<g transform="matrix(1.00203,0,0,0.972164,-10.791,-362.62)">
|
|
17
|
+
<path d="M1052.9,1091.68C1052.9,1062.46 1029.88,1038.73 1001.53,1038.73L244.024,1038.73C215.667,1038.73 192.646,1062.46 192.646,1091.68L192.646,1219.08C192.646,1248.3 215.667,1272.03 244.024,1272.03L1001.53,1272.03C1029.88,1272.03 1052.9,1248.3 1052.9,1219.08L1052.9,1091.68Z" style="fill:rgb(235,235,235);"/>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
<g transform="matrix(1.00052,0,0,1,-19.3912,30.3377)">
|
|
21
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.762,1033.42 949.281,1033.42L424.519,1033.42C422.039,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.039,1065.77 424.519,1065.77L949.281,1065.77C951.762,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
22
|
+
</g>
|
|
23
|
+
<g transform="matrix(0.823791,0,0,1,54.8392,-16.3916)">
|
|
24
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.33,1033.42 948.317,1033.42L425.484,1033.42C422.471,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.471,1065.77 425.484,1065.77L948.317,1065.77C951.33,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
25
|
+
</g>
|
|
26
|
+
<g transform="matrix(0.904048,0,0,1,21.129,-67.1309)">
|
|
27
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.547,1033.42 948.801,1033.42L424.999,1033.42C422.254,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.254,1065.77 424.999,1065.77L948.801,1065.77C951.547,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
28
|
+
</g>
|
|
29
|
+
<g transform="matrix(1.02071,0,0,1.04641,-38.8586,-763.331)">
|
|
30
|
+
<path d="M393.702,1679.71C393.702,1660.56 377.767,1645.02 358.141,1645.02L287.019,1645.02C267.393,1645.02 251.458,1660.56 251.458,1679.71L251.458,1749.29C251.458,1768.44 267.393,1783.98 287.019,1783.98L358.141,1783.98C377.767,1783.98 393.702,1768.44 393.702,1749.29L393.702,1679.71Z" style="fill:rgb(255,115,115);"/>
|
|
31
|
+
<clipPath id="_clip1">
|
|
32
|
+
<path d="M393.702,1679.71C393.702,1660.56 377.767,1645.02 358.141,1645.02L287.019,1645.02C267.393,1645.02 251.458,1660.56 251.458,1679.71L251.458,1749.29C251.458,1768.44 267.393,1783.98 287.019,1783.98L358.141,1783.98C377.767,1783.98 393.702,1768.44 393.702,1749.29L393.702,1679.71Z"/>
|
|
33
|
+
</clipPath>
|
|
34
|
+
<g clip-path="url(#_clip1)">
|
|
35
|
+
<g transform="matrix(0.76313,0,0,0.744387,148.731,1102.32)">
|
|
36
|
+
<path d="M226.411,745.537L243.421,797.888L298.467,797.888L253.934,830.243L270.944,882.594L226.411,850.239L181.879,882.594L198.889,830.243L154.356,797.888L209.402,797.888L226.411,745.537Z" style="fill:white;"/>
|
|
37
|
+
</g>
|
|
38
|
+
</g>
|
|
39
|
+
</g>
|
|
40
|
+
<g transform="matrix(0.933678,0,0,1,8.6838,-241.981)">
|
|
41
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.617,1033.42 948.959,1033.42L424.841,1033.42C422.183,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.183,1065.77 424.841,1065.77L948.959,1065.77C951.617,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
42
|
+
</g>
|
|
43
|
+
<g transform="matrix(1,0,0,1,-19.173,-288.71)">
|
|
44
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.761,1033.42 949.279,1033.42L424.522,1033.42C422.04,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.04,1065.77 424.522,1065.77L949.279,1065.77C951.761,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
45
|
+
</g>
|
|
46
|
+
<g transform="matrix(0.844941,0,0,1,45.9556,-337.889)">
|
|
47
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.391,1033.42 948.453,1033.42L425.347,1033.42C422.409,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.409,1065.77 425.347,1065.77L948.453,1065.77C951.391,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
48
|
+
</g>
|
|
49
|
+
<g transform="matrix(1.02071,0,0,1.04641,-38.8586,-1035.65)">
|
|
50
|
+
<path d="M393.702,1679.71C393.702,1660.56 377.767,1645.02 358.141,1645.02L287.019,1645.02C267.393,1645.02 251.458,1660.56 251.458,1679.71L251.458,1749.29C251.458,1768.44 267.393,1783.98 287.019,1783.98L358.141,1783.98C377.767,1783.98 393.702,1768.44 393.702,1749.29L393.702,1679.71Z" style="fill:rgb(255,115,115);"/>
|
|
51
|
+
<clipPath id="_clip2">
|
|
52
|
+
<path d="M393.702,1679.71C393.702,1660.56 377.767,1645.02 358.141,1645.02L287.019,1645.02C267.393,1645.02 251.458,1660.56 251.458,1679.71L251.458,1749.29C251.458,1768.44 267.393,1783.98 287.019,1783.98L358.141,1783.98C377.767,1783.98 393.702,1768.44 393.702,1749.29L393.702,1679.71Z"/>
|
|
53
|
+
</clipPath>
|
|
54
|
+
<g clip-path="url(#_clip2)">
|
|
55
|
+
<g transform="matrix(0.979712,0,0,0.955649,69.3286,762.785)">
|
|
56
|
+
<text x="193.673px" y="1041.62px" style="font-family:'HelveticaNeue-Bold', 'Helvetica Neue';font-weight:700;font-size:128px;fill:white;">%</text>
|
|
57
|
+
</g>
|
|
58
|
+
</g>
|
|
59
|
+
</g>
|
|
60
|
+
</g>
|
|
61
|
+
</g>
|
|
62
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{css}from'glamor';import{themeColors}from'@shopgate/pwa-common/helpers/config';var modalContent=css({width:'100%'}).toString();var modalLayout=css({backgroundColor:themeColors.lightOverlay}).toString();var container=css({backgroundColor:themeColors.lightOverlay,textAlign:'center',padding:'30px',justifyContent:'center',display:'flex',flexDirection:'column'}).toString();var title=css({fontWeight:'bold',fontSize:'1.35rem',paddingTop:'30px',paddingBottom:'30px'}).toString();var item=css({display:'flex',flexDirection:'column',alignItems:'center'}).toString();var link=css({paddingTop:'30px',textAlign:'center',color:themeColors.gray}).toString();var image=css({width:'80%',maxWidth:400}).toString();var button=css({marginTop:'30px'}).toString();var buttonText=css({color:themeColors.gray}).toString();export default{modalContent:modalContent,modalLayout:modalLayout,container:container,item:item,title:title,link:link,image:image,button:button,buttonText:buttonText};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as PushOptInModal}from"./PushOptInModal";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./optInTrigger";export*from"./optInModal";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var SHOW_PUSH_OPT_IN_MODAL='SHOW_PUSH_OPT_IN_MODAL';export var HIDE_PUSH_OPT_IN_MODAL='HIDE_PUSH_OPT_IN_MODAL';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var PUSH_OPT_IN_INCREASE_APP_START_COUNT='PUSH_OPT_IN_INCREASE_APP_START_COUNT';export var PUSH_OPT_IN_RESET_APP_START_COUNT='PUSH_OPT_IN_RESET_APP_START_COUNT';export var PUSH_OPT_IN_RESET_APP_START_STATE='PUSH_OPT_IN_RESET_APP_START_STATE';export var PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT='PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT';export var PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT='PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT';export var PUSH_OPT_IN_RESET_ORDERS_PLACED_STATE='PUSH_OPT_IN_RESET_ORDERS_PLACED_STATE';export var PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP='PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP';export var PUSH_OPT_IN_INCREASE_REJECTION_COUNT='PUSH_OPT_IN_INCREASE_REJECTION_COUNT';export var PUSH_OPT_IN_OPT_IN_POSTPONED='PUSH_OPT_IN_OPT_IN_POSTPONED';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{combineReducers}from'redux';import optInTrigger from"./optInTrigger";import optInModal from"./optInModal";export default combineReducers({optInTrigger:optInTrigger,optInModal:optInModal});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{HIDE_PUSH_OPT_IN_MODAL,SHOW_PUSH_OPT_IN_MODAL}from"../constants";var defaultState={isPushOptInModalVisible:false};/**
|
|
2
|
+
* Stores all the states related to the push Opt-In Modal functionality.
|
|
3
|
+
* @param {Object} [state] The current state.
|
|
4
|
+
* @param {Object} action The action object.
|
|
5
|
+
* @return {Object} The new state.
|
|
6
|
+
*/var pushOptInModalReducer=function pushOptInModalReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case SHOW_PUSH_OPT_IN_MODAL:{return _extends({},state,{isPushOptInModalVisible:true});}case HIDE_PUSH_OPT_IN_MODAL:{return _extends({},state,{isPushOptInModalVisible:false});}default:return state;}};export default pushOptInModalReducer;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{PUSH_OPT_IN_INCREASE_APP_START_COUNT,PUSH_OPT_IN_RESET_APP_START_STATE,PUSH_OPT_IN_RESET_APP_START_COUNT,PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT,PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT,PUSH_OPT_IN_RESET_ORDERS_PLACED_STATE,PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP,PUSH_OPT_IN_INCREASE_REJECTION_COUNT}from"../constants";var defaultState={appStartCount:0,appStartResetCount:0,ordersPlacedCount:0,ordersPlacedResetCount:0,lastPopupAt:null,rejectionCount:0};/**
|
|
2
|
+
* Stores all the states related to the pushOptInTrigger functionality.
|
|
3
|
+
* @param {Object} [state] The current state.
|
|
4
|
+
* @param {Object} action The action object.
|
|
5
|
+
* @return {Object} The new state.
|
|
6
|
+
*/var pushOptInReducer=function pushOptInReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case PUSH_OPT_IN_INCREASE_APP_START_COUNT:{return _extends({},state,{appStartCount:state.appStartCount+1});}case PUSH_OPT_IN_RESET_APP_START_COUNT:{return _extends({},state,{appStartCount:0,appStartResetCount:state.appStartResetCount+1});}case PUSH_OPT_IN_RESET_APP_START_STATE:{return _extends({},state,{appStartCount:0,appStartResetCount:0});}case PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT:{return _extends({},state,{ordersPlacedCount:state.ordersPlacedCount+1});}case PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT:{return _extends({},state,{ordersPlacedCount:0,ordersPlacedResetCount:state.ordersPlacedResetCount+1});}case PUSH_OPT_IN_RESET_ORDERS_PLACED_STATE:{return _extends({},state,{ordersPlacedCount:0,ordersPlacedResetCount:0});}case PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP:{return _extends({},state,{lastPopupAt:Date.now()});}case PUSH_OPT_IN_INCREASE_REJECTION_COUNT:{return _extends({},state,{rejectionCount:state.rejectionCount+1});}default:return state;}};export default pushOptInReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./optInTrigger";export*from"./optInModal";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{createSelector}from'reselect';/**
|
|
2
|
+
* Selects the push opt-in modal state.
|
|
3
|
+
* @param {Object} state The current state of the push opt-in modal.
|
|
4
|
+
* @returns {Object} whether push opt-in modal is shown.
|
|
5
|
+
*/export var getPushOptInModalState=function getPushOptInModalState(state){var _state$pushOptIn;return(state===null||state===void 0?void 0:(_state$pushOptIn=state.pushOptIn)===null||_state$pushOptIn===void 0?void 0:_state$pushOptIn.optInModal)||{};};/**
|
|
6
|
+
* Selects the property of the push opt-in modal.
|
|
7
|
+
* @returns {boolean} whether push opt-in modal is shown.
|
|
8
|
+
*/export var getIsPushOptInModalVisible=createSelector(getPushOptInModalState,function(modalState){return modalState.isPushOptInModalVisible||false;});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selects the push opt in information.
|
|
3
|
+
* @param {Object} state The current state.
|
|
4
|
+
* @returns {Object} The push opt in information.
|
|
5
|
+
*/export var getPushOptInTriggerState=function getPushOptInTriggerState(state){var _state$pushOptIn;return(state===null||state===void 0?void 0:(_state$pushOptIn=state.pushOptIn)===null||_state$pushOptIn===void 0?void 0:_state$pushOptIn.optInTrigger)||{};};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import optInTrigger from"./optInTrigger";export default(function(subscribe){optInTrigger(subscribe);});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";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 asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{appConfig}from'@shopgate/engage';import{main$,appDidStart$}from'@shopgate/engage/core/streams';import{event}from'@shopgate/engage/core/classes';import{appSupportsPushOptIn,logger}from'@shopgate/engage/core/helpers';import{PERMISSION_ID_PUSH,PERMISSION_STATUS_NOT_DETERMINED}from'@shopgate/engage/core/constants';import{requestAppPermissionStatus}from'@shopgate/engage/core/actions';// TODO replace appDidStart$ with cookieConsentInitialized$ after cookie consent feature is merged
|
|
2
|
+
// import { cookieConsentInitialized$ } from '@shopgate/engage/tracking/streams';
|
|
3
|
+
import{increaseAppStartCount,resetAppStartCount,increaseOrdersPlacedCount,resetOrdersPlacedCount,setLastPopupTimestamp,increaseRejectionCount,showPushOptInModal}from"../action-creators";import{PUSH_OPT_IN_OPT_IN_POSTPONED}from"../constants";import{getPushOptInTriggerState}from"../selectors";var DAY_IN_MS=1000*60*60*24;var increaseRejectionCount$=main$.filter(function(_ref){var action=_ref.action;return action.type===PUSH_OPT_IN_OPT_IN_POSTPONED;});/**
|
|
4
|
+
* Push opt in subscriptions
|
|
5
|
+
* @param {Function} subscribe The subscribe function
|
|
6
|
+
*/export default function pushOptIn(subscribe){/**
|
|
7
|
+
* @param {Object} subscriptionParams Params from the subscription callback
|
|
8
|
+
* @param {string} configKey The "pushOptIn" key to be used
|
|
9
|
+
* @param {Function} increaseCountAction Action to increase the count in Redux for the configKey
|
|
10
|
+
* @returns {void}
|
|
11
|
+
*/var showOptInAfterChecks=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2,configKey,increaseCountAction){var dispatch,getState,_appConfig$pushOptIn,_appConfig$pushOptIn2,appStarts,ordersPlaced,rejectionMaxCount,minDaysBetweenOptIns,_ref4,pushStatus,state,configValue,resetAction,resetCountState,configCountState,mustShowModal,hasRepeats,minDaysElapsed;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:dispatch=_ref2.dispatch,getState=_ref2.getState;if(appSupportsPushOptIn()){_context.next=3;break;}return _context.abrupt("return");case 3:_appConfig$pushOptIn=appConfig.pushOptIn,_appConfig$pushOptIn2=_appConfig$pushOptIn===void 0?{}:_appConfig$pushOptIn,appStarts=_appConfig$pushOptIn2.appStarts,ordersPlaced=_appConfig$pushOptIn2.ordersPlaced,rejectionMaxCount=_appConfig$pushOptIn2.rejectionMaxCount,minDaysBetweenOptIns=_appConfig$pushOptIn2.minDaysBetweenOptIns;// Deactivate feature when config is invalid
|
|
12
|
+
if(!(typeof minDaysBetweenOptIns!=='number'||typeof rejectionMaxCount!=='number'||_typeof(ordersPlaced)!=='object'||_typeof(appStarts)!=='object')){_context.next=7;break;}logger.error('PushOptInTrigger - Config invalid',appConfig===null||appConfig===void 0?void 0:appConfig.pushOptIn);return _context.abrupt("return");case 7:_context.next=9;return dispatch(requestAppPermissionStatus({permissionId:PERMISSION_ID_PUSH}));case 9:_ref4=_context.sent;pushStatus=_ref4.status;if(!(pushStatus!==PERMISSION_STATUS_NOT_DETERMINED)){_context.next=13;break;}return _context.abrupt("return");case 13:dispatch(increaseCountAction());state=getPushOptInTriggerState(getState());configValue=appStarts;resetAction=resetAppStartCount;resetCountState=state.appStartResetCount;configCountState=state.appStartCount;if(configKey==='ordersPlaced'){configValue=ordersPlaced;resetAction=resetOrdersPlacedCount;resetCountState=state.ordersPlacedResetCount;configCountState=state.ordersPlacedCount;}if(!(state.rejectionCount>=rejectionMaxCount)){_context.next=22;break;}return _context.abrupt("return");case 22:mustShowModal=Number(configValue.value)>0&&configCountState>=configValue.value;hasRepeats=configValue.repeats===null||resetCountState<=configValue.repeats;minDaysElapsed=Date.now()-state.lastPopupAt>=minDaysBetweenOptIns*DAY_IN_MS;if(mustShowModal&&hasRepeats&&minDaysElapsed){dispatch(setLastPopupTimestamp());dispatch(resetAction());dispatch(showPushOptInModal());}case 26:case"end":return _context.stop();}},_callee);}));return function showOptInAfterChecks(_x,_x2,_x3){return _ref3.apply(this,arguments);};}();// event subscriber to handle app start based push opt in
|
|
13
|
+
subscribe(appDidStart$,/*#__PURE__*/function(){var _ref6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref5){var dispatch,getState;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:dispatch=_ref5.dispatch,getState=_ref5.getState;_context2.next=3;return showOptInAfterChecks({dispatch:dispatch,getState:getState},'appStarts',increaseAppStartCount);case 3:case"end":return _context2.stop();}},_callee2);}));return function(_x4){return _ref6.apply(this,arguments);};}());// event subscriber to handle order based push opt in
|
|
14
|
+
subscribe(appDidStart$,function(_ref7){var dispatch=_ref7.dispatch,getState=_ref7.getState;event.addCallback('checkoutSuccess',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(){return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return showOptInAfterChecks({dispatch:dispatch,getState:getState},'ordersPlaced',increaseOrdersPlacedCount);case 2:case"end":return _context3.stop();}},_callee3);})));});subscribe(increaseRejectionCount$,function(_ref9){var dispatch=_ref9.dispatch;dispatch(increaseRejectionCount());});}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";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;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{EVALIDATION}from'@shopgate/engage/core';import{updateCheckoutOrder}from'@shopgate/engage/checkout/actions';import{extractAttributes,convertPipelineValidationErrors}from'@shopgate/engage/account/helper/form';import{getMerchantCustomerAttributes}from'@shopgate/engage/core/selectors/merchantSettings';/**
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";var _excluded=["marketingOptIn"];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;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{EVALIDATION}from'@shopgate/engage/core';import{updateCheckoutOrder}from'@shopgate/engage/checkout/actions';import{extractAttributes,convertPipelineValidationErrors}from'@shopgate/engage/account/helper/form';import{getMerchantCustomerAttributes}from'@shopgate/engage/core/selectors/merchantSettings';/**
|
|
2
2
|
* Submits guest registration form data.
|
|
3
3
|
* @returns {Function}
|
|
4
|
-
*/export var submitGuestRegistration=function submitGuestRegistration(_ref){var billingFormData=_ref.billingFormData,shippingFormData=_ref.shippingFormData,pickupFormData=_ref.pickupFormData,extraFormData=_ref.extraFormData,processShipping=_ref.processShipping;return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch,getState){var customerAttributes,marketingOptIn,attributeData,attributes,pickupPerson,restPickupFormData,_pickupFormData,shippingFormVisible,pickupFormVisible,addressSequences,order,errors,response,code,validationErrors,converted,_converted$validation,_converted$validation2,sequenceErrors,shippingIndex,pickupIndex,billing,shipping,pickup,extra;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)
|
|
4
|
+
*/export var submitGuestRegistration=function submitGuestRegistration(_ref){var billingFormData=_ref.billingFormData,shippingFormData=_ref.shippingFormData,pickupFormData=_ref.pickupFormData,extraFormData=_ref.extraFormData,processShipping=_ref.processShipping;return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch,getState){var customerAttributes,marketingOptIn,attributeData,attributes,pickupPerson,restPickupFormData,_pickupFormData,shippingFormVisible,pickupFormVisible,addressSequences,order,errors,response,code,validationErrors,converted,_converted$validation,_converted$validation2,sequenceErrors,shippingIndex,pickupIndex,billing,shipping,pickup,extra;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:customerAttributes=getMerchantCustomerAttributes(getState());marketingOptIn=extraFormData.marketingOptIn,attributeData=_objectWithoutProperties(extraFormData,_excluded);attributes=extractAttributes(customerAttributes,attributeData);restPickupFormData={};if(pickupFormData){_pickupFormData=pickupFormData;pickupPerson=_pickupFormData.pickupPerson;restPickupFormData=_objectWithoutPropertiesLoose(_pickupFormData,["pickupPerson"]);_pickupFormData;}shippingFormVisible=processShipping&&!!shippingFormData;pickupFormVisible=pickupFormData&&pickupPerson!=='me';addressSequences=[_extends({type:'billing'},billingFormData)].concat(processShipping?_extends({type:'shipping'},shippingFormData||billingFormData):[],pickupFormData?_extends({},pickupPerson==='me'?_extends({type:'pickup'},billingFormData):_extends({type:'pickup'},restPickupFormData)):[]);order=_extends({addressSequences:addressSequences,primaryBillToAddressSequenceIndex:0,primaryShipToAddressSequenceIndex:1},(attributes===null||attributes===void 0?void 0:attributes.length)?{customer:{attributes:attributes}}:{});_context.prev=9;_context.next=12;return dispatch(updateCheckoutOrder(order));case 12:response=_context.sent;_context.next=23;break;case 15:_context.prev=15;_context.t0=_context["catch"](9);code=_context.t0.code,validationErrors=_context.t0.errors;if(!(code===EVALIDATION)){_context.next=22;break;}errors=validationErrors;_context.next=23;break;case 22:throw _context.t0;case 23:converted=convertPipelineValidationErrors(errors,attributes);if(!((converted===null||converted===void 0?void 0:converted.validation)&&Object.keys(converted.validation).length>0)){_context.next=33;break;}sequenceErrors=converted===null||converted===void 0?void 0:(_converted$validation=converted.validation)===null||_converted$validation===void 0?void 0:_converted$validation.addressSequences;shippingIndex=addressSequences.findIndex(function(item){return item.type==='shipping';});pickupIndex=addressSequences.findIndex(function(item){return item.type==='pickup';});billing=(sequenceErrors===null||sequenceErrors===void 0?void 0:sequenceErrors['0'])||{};shipping=shippingFormVisible?(sequenceErrors===null||sequenceErrors===void 0?void 0:sequenceErrors[shippingIndex])||{}:{};pickup=pickupFormVisible?(sequenceErrors===null||sequenceErrors===void 0?void 0:sequenceErrors[pickupIndex])||{}:{};extra=(converted===null||converted===void 0?void 0:(_converted$validation2=converted.validation)===null||_converted$validation2===void 0?void 0:_converted$validation2.attributes)||{};return _context.abrupt("return",{response:response,errors:{billingFormData:_extends({},billing),shippingFormData:_extends({},shipping),pickupFormData:_extends({},pickup),extraFormData:_extends({},extra)}});case 33:return _context.abrupt("return",{response:response});case 34:case"end":return _context.stop();}},_callee,null,[[9,15]]);}));return function(_x,_x2){return _ref2.apply(this,arguments);};}());};
|
|
@@ -6,15 +6,15 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGenera
|
|
|
6
6
|
* @param {Object} props The provider props
|
|
7
7
|
* @returns {JSX}
|
|
8
8
|
*/var GuestRegistrationProvider=function GuestRegistrationProvider(_ref){var children=_ref.children,formContainerRef=_ref.formContainerRef,isDataReady=_ref.isDataReady,userLocation=_ref.userLocation,customerAttributes=_ref.customerAttributes,billingAddress=_ref.billingAddress,shippingAddress=_ref.shippingAddress,pickupAddress=_ref.pickupAddress,customer=_ref.customer,billingPickupEquals=_ref.billingPickupEquals,billingShippingEquals=_ref.billingShippingEquals,numberOfAddressLines=_ref.numberOfAddressLines,cartHasDirectShipItems=_ref.cartHasDirectShipItems,orderReserveOnly=_ref.orderReserveOnly,orderNeedsPayment=_ref.orderNeedsPayment,isShippingAddressSelectionEnabled=_ref.isShippingAddressSelectionEnabled,isPickupContactSelectionEnabled=_ref.isPickupContactSelectionEnabled,shopSettings=_ref.shopSettings,submitGuestRegistration=_ref.submitGuestRegistration,prepareCheckout=_ref.prepareCheckout,isLastStackEntry=_ref.isLastStackEntry,historyPop=_ref.historyPop,historyPush=_ref.historyPush;var _useScrollTo=useScrollTo(formContainerRef),scrollTo=_useScrollTo.scrollTo;var isShippingFormEnabled=useMemo(function(){return cartHasDirectShipItems;},[cartHasDirectShipItems]);var getIsShippingFormVisible=useCallback(function(){return isShippingFormEnabled&&!!shippingAddress&&!billingShippingEquals;},[billingShippingEquals,isShippingFormEnabled,shippingAddress]);var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isLocked=_useState2[0],setIsLocked=_useState2[1];var _useState3=useState(false),_useState4=_slicedToArray(_useState3,2),isBillingFormSubmitted=_useState4[0],setIsBillingFormSubmitted=_useState4[1];var _useState5=useState(false),_useState6=_slicedToArray(_useState5,2),isShippingFormSubmitted=_useState6[0],setIsShippingFormSubmitted=_useState6[1];var _useState7=useState(false),_useState8=_slicedToArray(_useState7,2),isExtraFormSubmitted=_useState8[0],setIsExtraFormSubmitted=_useState8[1];var _useState9=useState(false),_useState10=_slicedToArray(_useState9,2),isPickupFormSubmitted=_useState10[0],setIsPickupFormSubmitted=_useState10[1];var _useState11=useState(null),_useState12=_slicedToArray(_useState11,2),billingFormRequestErrors=_useState12[0],setBillingFormRequestErrors=_useState12[1];var _useState13=useState(null),_useState14=_slicedToArray(_useState13,2),shippingFormRequestErrors=_useState14[0],setShippingFormRequestErrors=_useState14[1];var _useState15=useState(null),_useState16=_slicedToArray(_useState15,2),pickupFormRequestErrors=_useState16[0],setPickupFormRequestErrors=_useState16[1];var _useState17=useState(null),_useState18=_slicedToArray(_useState17,2),extraFormRequestErrors=_useState18[0],setExtraFormRequestErrors=_useState18[1];var _useState19=useState(getIsShippingFormVisible()),_useState20=_slicedToArray(_useState19,2),isShippingFormVisible=_useState20[0],setIsShippingFormVisible=_useState20[1];var _useState21=useState(generateSelfPickupConstraints()),_useState22=_slicedToArray(_useState21,2),pickupConstraints=_useState22[0],setPickupConstraints=_useState22[1];var _useRoute=useRoute(),_useRoute$query$edit=_useRoute.query.edit,guestRegistrationEditMode=_useRoute$query$edit===void 0?null:_useRoute$query$edit;// Initialize checkout process.
|
|
9
|
-
var _useAsyncMemo=useAsyncMemo(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)
|
|
9
|
+
var _useAsyncMemo=useAsyncMemo(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!guestRegistrationEditMode){_context.next=2;break;}return _context.abrupt("return",true);case 2:_context.prev=2;setIsLocked(true);_context.next=6;return prepareCheckout({initializePayment:false,initializeOrder:!!isLastStackEntry});case 6:setIsLocked(false);return _context.abrupt("return",true);case 10:_context.prev=10;_context.t0=_context["catch"](2);setIsLocked(false);return _context.abrupt("return",false);case 14:case"end":return _context.stop();}},_callee,null,[[2,10]]);})),[],false),_useAsyncMemo2=_slicedToArray(_useAsyncMemo,1),isInitialized=_useAsyncMemo2[0];useEffect(function(){setIsShippingFormVisible(getIsShippingFormVisible());},[getIsShippingFormVisible,setIsShippingFormVisible]);// Determine values to prefill some form fields
|
|
10
10
|
var userCountry=useMemo(function(){return(userLocation===null||userLocation===void 0?void 0:userLocation.country)||(appConfig===null||appConfig===void 0?void 0:appConfig.marketId)||null;},[userLocation]);var userRegion=useMemo(function(){return(userLocation===null||userLocation===void 0?void 0:userLocation.region)||null;},[userLocation]);// ===== billing form =====
|
|
11
11
|
var defaultBillingFormState=useMemo(function(){return _extends({},initialBillingFormState,{country:userCountry,region:userRegion},pickBy(billingAddress||{},identity));},[billingAddress,userCountry,userRegion]);var billingConstraints=useMemo(function(){return generateBillingConstraints(orderReserveOnly);},[orderReserveOnly]);var handleBillingFormSubmit=useCallback(function(){setIsBillingFormSubmitted(true);},[setIsBillingFormSubmitted]);var billingFormState=useFormState(defaultBillingFormState,handleBillingFormSubmit,billingConstraints,formContainerRef);// ===== shipping form =====
|
|
12
12
|
var defaultShippingFormState=useMemo(function(){return _extends({},initialShippingFormState,{country:userCountry,region:userRegion},!billingShippingEquals?pickBy(shippingAddress||{},identity):{});},[billingShippingEquals,shippingAddress,userCountry,userRegion]);var shippingConstraints=useMemo(function(){return isShippingFormVisible?generateShippingConstraints():{};},[isShippingFormVisible]);var handleShippingFormSubmit=useCallback(function(){setIsShippingFormSubmitted(true);},[setIsShippingFormSubmitted]);var shippingFormState=useFormState(defaultShippingFormState,handleShippingFormSubmit,shippingConstraints,formContainerRef);// ===== pickup contact form =====
|
|
13
13
|
var defaultPickupFormState=useMemo(function(){return _extends({},initialPickupFormState,{},!billingPickupEquals?pickBy(pickupAddress||{},identity):{},{pickupPerson:billingPickupEquals?'me':'someoneElse'});},[billingPickupEquals,pickupAddress]);var handlePickupFormSubmit=useCallback(function(){setIsPickupFormSubmitted(true);},[]);var pickupFormState=useFormState(defaultPickupFormState,handlePickupFormSubmit,pickupConstraints,formContainerRef);useEffect(function(){setPickupConstraints(pickupFormState.values.pickupPerson==='me'?generateSelfPickupConstraints():generatePickupConstraints());},[pickupFormState.values.pickupPerson]);// ===== extra form =====
|
|
14
14
|
var defaultExtraFormState=useMemo(function(){return _extends({},initialOptInFormState,{},extractDefaultValues((customer===null||customer===void 0?void 0:customer.attributes)||[]));},[customer]);var extraConstraints=useMemo(function(){return generateExtraConstraints(customerAttributes);},[customerAttributes]);var handleExtraFormSubmit=useCallback(function(){setIsExtraFormSubmitted(true);},[]);var extraFormState=useFormState(defaultExtraFormState,handleExtraFormSubmit,extraConstraints,formContainerRef);var handleSubmit=useCallback(function(){billingFormState.handleSubmit();shippingFormState.handleSubmit();pickupFormState.handleSubmit();extraFormState.handleSubmit();},[billingFormState,extraFormState,pickupFormState,shippingFormState]);useEffect(function(){if(!isBillingFormSubmitted||!isShippingFormSubmitted||!isPickupFormSubmitted||!isExtraFormSubmitted){return;}// Break the process when one of the forms has validation errors from the constraints
|
|
15
|
-
if(!billingFormState.valid||!shippingFormState.valid||!pickupFormState.valid||!extraFormState.valid){setIsBillingFormSubmitted(false);setIsShippingFormSubmitted(false);setIsPickupFormSubmitted(false);setIsExtraFormSubmitted(false);}/** Async wrapper for submit registration */var fn=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(){var response,_ref4,errors;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)
|
|
15
|
+
if(!billingFormState.valid||!shippingFormState.valid||!pickupFormState.valid||!extraFormState.valid){setIsBillingFormSubmitted(false);setIsShippingFormSubmitted(false);setIsPickupFormSubmitted(false);setIsExtraFormSubmitted(false);}/** Async wrapper for submit registration */var fn=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(){var response,_ref4,errors;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:setIsLocked(true);_context2.prev=1;_context2.next=4;return submitGuestRegistration(_extends({billingFormData:billingFormState.values},isShippingFormVisible?{shippingFormData:shippingFormState.values}:{},{},isPickupContactSelectionEnabled?{pickupFormData:pickupFormState.values}:{},{extraFormData:extraFormState.values,processShipping:isShippingAddressSelectionEnabled}));case 4:response=_context2.sent;_context2.next=11;break;case 7:_context2.prev=7;_context2.t0=_context2["catch"](1);setIsLocked(false);return _context2.abrupt("return");case 11:_ref4=response||{},errors=_ref4.errors;if(errors){_context2.next=17;break;}setIsLocked(false);LoadingProvider.setLoading(GUEST_CHECKOUT_PAYMENT_PATTERN);if(guestRegistrationEditMode){historyPop();}else{historyPush({pathname:GUEST_CHECKOUT_PAYMENT_PATTERN});}return _context2.abrupt("return");case 17:// Updated the request validation errors
|
|
16
16
|
setBillingFormRequestErrors((errors===null||errors===void 0?void 0:errors.billingFormData)||null);setShippingFormRequestErrors((errors===null||errors===void 0?void 0:errors.shippingFormData)||null);setPickupFormRequestErrors((errors===null||errors===void 0?void 0:errors.pickupFormData)||null);setExtraFormRequestErrors((errors===null||errors===void 0?void 0:errors.extraFormData)||null);// Release forms for additional submits
|
|
17
|
-
setIsBillingFormSubmitted(false);setIsShippingFormSubmitted(false);setIsPickupFormSubmitted(false);setIsExtraFormSubmitted(false);setIsLocked(false);case 26:case"end":return _context2.stop();}}
|
|
17
|
+
setIsBillingFormSubmitted(false);setIsShippingFormSubmitted(false);setIsPickupFormSubmitted(false);setIsExtraFormSubmitted(false);setIsLocked(false);case 26:case"end":return _context2.stop();}},_callee2,null,[[1,7]]);}));return function fn(){return _ref3.apply(this,arguments);};}();fn();/* eslint-disable react-hooks/exhaustive-deps */},[isBillingFormSubmitted,isShippingFormSubmitted,isPickupFormSubmitted,isExtraFormSubmitted]);/* eslint-enable react-hooks/exhaustive-deps */ /* eslint-disable react-hooks/exhaustive-deps */useEffect(function(){billingFormState.scrollToError();},[billingFormRequestErrors,shippingFormRequestErrors,pickupFormRequestErrors,billingFormState.scrollToError]);/* eslint-enable react-hooks/exhaustive-deps */useEffect(function(){if(isLocked){LoadingProvider.setLoading(GUEST_CHECKOUT_PATTERN);return;}LoadingProvider.unsetLoading(GUEST_CHECKOUT_PATTERN);},[isLocked]);useEffect(function(){var timer=setTimeout(function(){if(!guestRegistrationEditMode){return;}var scrollToElement;if(guestRegistrationEditMode===ADDRESS_TYPE_SHIPPING){if(isShippingFormVisible){scrollToElement=ELEMENT_ID_SHIPPING_CONTACT;}else{scrollToElement=ELEMENT_ID_SHIPPING_CONTACT_TOGGLE;}}else if(guestRegistrationEditMode===ADDRESS_TYPE_PICKUP){scrollToElement=ELEMENT_ID_PICKUP_CONTACT;}if(scrollToElement){scrollTo("#".concat(scrollToElement));}},500);return function(){return clearTimeout(timer);};/* eslint-disable react-hooks/exhaustive-deps */},[]);/* eslint-enable react-hooks/exhaustive-deps */var value=useMemo(function(){return{isShippingFormEnabled:isShippingFormEnabled,isShippingFormVisible:isShippingFormVisible,setIsShippingFormVisible:setIsShippingFormVisible,orderReserveOnly:orderReserveOnly,orderNeedsPayment:orderNeedsPayment,guestRegistrationEditMode:guestRegistrationEditMode,defaultBillingFormState:defaultBillingFormState,updateBillingForm:billingFormState.setValues,defaultShippingFormState:defaultShippingFormState,updateShippingForm:shippingFormState.setValues,defaultPickupFormState:defaultPickupFormState,updatePickupForm:pickupFormState.setValues,defaultExtraFormState:defaultExtraFormState,updateExtraForm:extraFormState.setValues,billingFormValidationErrors:convertValidationErrors(billingFormState.validationErrors||billingFormRequestErrors||{}),shippingFormValidationErrors:convertValidationErrors(shippingFormState.validationErrors||shippingFormRequestErrors||{}),pickupFormValidationErrors:convertValidationErrors(pickupFormState.validationErrors||pickupFormRequestErrors||{}),extraFormValidationErrors:convertValidationErrors(extraFormState.validationErrors||extraFormRequestErrors||{}),isShippingAddressSelectionEnabled:isShippingAddressSelectionEnabled,isPickupContactSelectionEnabled:isPickupContactSelectionEnabled,customerAttributes:customerAttributes,numberOfAddressLines:numberOfAddressLines,userLocation:userLocation,supportedCountries:shopSettings.supportedCountries,countrySortOrder:shopSettings.countrySortOrder,isLocked:isLocked,handleSubmit:handleSubmit,/**
|
|
18
18
|
* Handling of registrationMode "simple" is not implemented for checkout. But since
|
|
19
19
|
* the guest registration is actually an order update and not a real registration, we
|
|
20
20
|
* hardcode the registration mode here, since the provider value will be used inside
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";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;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{EVALIDATION,getRegistrationMode,SHOP_SETTING_REGISTRATION_MODE_SIMPLE}from'@shopgate/engage/core';import{extractAttributes,convertPipelineValidationErrors}from'@shopgate/engage/account/helper/form';import{getMerchantCustomerAttributes}from'@shopgate/engage/core/selectors/merchantSettings';import{submitRegistration as submit}from"../actions";/**
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";var _excluded=["marketingOptIn"];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;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{EVALIDATION,getRegistrationMode,SHOP_SETTING_REGISTRATION_MODE_SIMPLE}from'@shopgate/engage/core';import{extractAttributes,convertPipelineValidationErrors}from'@shopgate/engage/account/helper/form';import{getMerchantCustomerAttributes}from'@shopgate/engage/core/selectors/merchantSettings';import{submitRegistration as submit}from"../actions";/**
|
|
2
2
|
* Submits registration form data.
|
|
3
3
|
* @param {Object} baseFormData Data from the base form
|
|
4
4
|
* @param {Object} shippingFormData Data from the shipping form
|
|
5
5
|
* @param {Object} additionalData Additional data for the request.
|
|
6
6
|
* @returns {Function}
|
|
7
|
-
*/export var submitRegistration=function submitRegistration(_ref){var baseFormData=_ref.baseFormData,billingFormData=_ref.billingFormData,shippingFormData=_ref.shippingFormData,additionalFormData=_ref.additionalFormData;return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch,getState){var customerAttributes,registrationMode,marketingOptIn,attributeData,attributes,emailAddress,password,firstName,lastName,customer,errors,code,validationErrors,converted,_converted$
|
|
8
|
-
customer.contacts=[_extends({},billingFormData,{emailAddress:emailAddress,isDefaultBilling:true,isDefaultShipping:!shippingFormData})].concat(shippingFormData?[_extends({},shippingFormData,{emailAddress:emailAddress,isDefaultBilling:false,isDefaultShipping:true})]:[]);}_context.prev=8;_context.next=11;return dispatch(submit(customer));case 11:_context.next=18;break;case 13:_context.prev=13;_context.t0=_context["catch"](8);code=_context.t0.code;validationErrors=_context.t0.errors;if(code===EVALIDATION){errors=validationErrors;}case 18:converted=convertPipelineValidationErrors(errors,attributes);if(!((converted===null||converted===void 0?void 0:converted.validation)&&Object.keys(converted.validation).length>0)){_context.next=25;break;}_converted$
|
|
7
|
+
*/export var submitRegistration=function submitRegistration(_ref){var baseFormData=_ref.baseFormData,billingFormData=_ref.billingFormData,shippingFormData=_ref.shippingFormData,additionalFormData=_ref.additionalFormData;return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch,getState){var customerAttributes,registrationMode,marketingOptIn,attributeData,attributes,emailAddress,password,firstName,lastName,customer,errors,code,validationErrors,converted,_converted$validation3,_converted$validation4,_converted$validation5,_converted$validation6,_converted$validation7,_converted$validation2,errEmailAddress,errPassword,billing,shipping,extra;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:customerAttributes=getMerchantCustomerAttributes(getState());registrationMode=getRegistrationMode(getState());marketingOptIn=additionalFormData.marketingOptIn,attributeData=_objectWithoutProperties(additionalFormData,_excluded);attributes=extractAttributes(customerAttributes,attributeData);emailAddress=baseFormData.emailAddress,password=baseFormData.password;if(registrationMode===SHOP_SETTING_REGISTRATION_MODE_SIMPLE){firstName=baseFormData.firstName;lastName=baseFormData.lastName;}else{firstName=billingFormData.firstName;lastName=billingFormData.lastName;}customer={firstName:firstName,lastName:lastName,emailAddress:emailAddress,password:password,attributes:attributes,settings:{marketingOptIn:marketingOptIn}};if(registrationMode!==SHOP_SETTING_REGISTRATION_MODE_SIMPLE){// No contacts creation at "simple" registration mode
|
|
8
|
+
customer.contacts=[_extends({},billingFormData,{emailAddress:emailAddress,isDefaultBilling:true,isDefaultShipping:!shippingFormData})].concat(shippingFormData?[_extends({},shippingFormData,{emailAddress:emailAddress,isDefaultBilling:false,isDefaultShipping:true})]:[]);}_context.prev=8;_context.next=11;return dispatch(submit(customer));case 11:_context.next=18;break;case 13:_context.prev=13;_context.t0=_context["catch"](8);code=_context.t0.code;validationErrors=_context.t0.errors;if(code===EVALIDATION){errors=validationErrors;}case 18:converted=convertPipelineValidationErrors(errors,attributes);if(!((converted===null||converted===void 0?void 0:converted.validation)&&Object.keys(converted.validation).length>0)){_context.next=25;break;}_converted$validation2=converted.validation,errEmailAddress=_converted$validation2.emailAddress,errPassword=_converted$validation2.password;billing=(converted===null||converted===void 0?void 0:(_converted$validation3=converted.validation)===null||_converted$validation3===void 0?void 0:(_converted$validation4=_converted$validation3.contacts)===null||_converted$validation4===void 0?void 0:_converted$validation4['0'])||{};shipping=(converted===null||converted===void 0?void 0:(_converted$validation5=converted.validation)===null||_converted$validation5===void 0?void 0:(_converted$validation6=_converted$validation5.contacts)===null||_converted$validation6===void 0?void 0:_converted$validation6['1'])||{};extra=(converted===null||converted===void 0?void 0:(_converted$validation7=converted.validation)===null||_converted$validation7===void 0?void 0:_converted$validation7.attributes)||{};return _context.abrupt("return",{errors:{baseFormData:_extends({},errEmailAddress?{emailAddress:errEmailAddress}:{},{},errPassword?{password:errPassword}:{}),billingFormData:_extends({},billing),shippingFormData:_extends({},shipping),extraFormData:_extends({},extra)}});case 25:return _context.abrupt("return",null);case 26:case"end":return _context.stop();}},_callee,null,[[8,13]]);}));return function(_x,_x2){return _ref2.apply(this,arguments);};}());};
|
|
@@ -12,6 +12,6 @@ var handleBaseFormSubmit=useCallback(function(){setIsBaseFormSubmitted(true);},[
|
|
|
12
12
|
var baseFormState=useFormState(defaultBaseFormState,handleBaseFormSubmit,baseConstraints,formContainerRef);var billingFormState=useFormState(defaultBillingFormState,handleBillingFormSubmit,billingConstraints,formContainerRef);var shippingFormState=useFormState(defaultShippingFormState,handleShippingFormSubmit,shippingConstraints,formContainerRef);var extraFormState=useFormState(defaultExtraFormState,handleExtraFormSubmit,extraConstraints,formContainerRef);// Central submit handler
|
|
13
13
|
var handleSubmit=useCallback(function(){baseFormState.handleSubmit(new Event('submit'));billingFormState.handleSubmit(new Event('submit'));shippingFormState.handleSubmit(new Event('submit'));extraFormState.handleSubmit(new Event('submit'));},[baseFormState,billingFormState,extraFormState,shippingFormState]);useEffect(function(){// Break the process when the forms are not submitted yet
|
|
14
14
|
if(!isBaseFormSubmitted||!isBillingFormSubmitted||!isShippingFormSubmitted||!isExtraFormSubmitted){return;}// Break the process when one of the forms has validation errors from the constraints
|
|
15
|
-
if(!baseFormState.valid||!billingFormState.valid||isShippingFormVisible&&!shippingFormState.valid||!extraFormState.valid){setIsBaseFormSubmitted(false);setIsBillingFormSubmitted(false);setIsShippingFormSubmitted(false);setIsExtraFormSubmitted(false);return;}/** Async wrapper for submit registration */var fn=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var response,_ref3,errors;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)
|
|
15
|
+
if(!baseFormState.valid||!billingFormState.valid||isShippingFormVisible&&!shippingFormState.valid||!extraFormState.valid){setIsBaseFormSubmitted(false);setIsBillingFormSubmitted(false);setIsShippingFormSubmitted(false);setIsExtraFormSubmitted(false);return;}/** Async wrapper for submit registration */var fn=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var response,_ref3,errors;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:setLocked(true);_context.next=3;return submitRegistration(_extends({baseFormData:baseFormState.values,billingFormData:billingFormState.values,additionalFormData:extraFormState.values},isShippingFormVisible?{shippingFormData:shippingFormState.values}:{}));case 3:response=_context.sent;_ref3=response||{},errors=_ref3.errors;// Updated the request validation errors
|
|
16
16
|
setBaseFormRequestErrors((errors===null||errors===void 0?void 0:errors.baseFormData)||null);setBillingFormRequestErrors((errors===null||errors===void 0?void 0:errors.billingFormData)||null);setShippingFormRequestErrors((errors===null||errors===void 0?void 0:errors.shippingFormData)||null);setExtraFormRequestErrors((errors===null||errors===void 0?void 0:errors.extraFormData)||null);// Release forms for additional submits
|
|
17
|
-
setIsBaseFormSubmitted(false);setIsBillingFormSubmitted(false);setIsShippingFormSubmitted(false);setIsExtraFormSubmitted(false);setLocked(false);case 14:case"end":return _context.stop();}}
|
|
17
|
+
setIsBaseFormSubmitted(false);setIsBillingFormSubmitted(false);setIsShippingFormSubmitted(false);setIsExtraFormSubmitted(false);setLocked(false);case 14:case"end":return _context.stop();}},_callee);}));return function fn(){return _ref2.apply(this,arguments);};}();fn();/* eslint-disable react-hooks/exhaustive-deps */},[isBaseFormSubmitted,isBillingFormSubmitted,isShippingFormSubmitted,isExtraFormSubmitted,baseFormState.valid,billingFormState.valid,shippingFormState.valid,extraFormState.valid,isShippingFormVisible,submitRegistration]);/* eslint-enable react-hooks/exhaustive-deps */ /* eslint-disable react-hooks/exhaustive-deps */useEffect(function(){baseFormState.scrollToError();},[baseFormRequestErrors,billingFormRequestErrors,shippingFormRequestErrors,baseFormState.scrollToError]);/* eslint-enable react-hooks/exhaustive-deps */ /* eslint-disable react-hooks/exhaustive-deps */useEffect(function(){shippingFormState.setIgnoreErrors(!isShippingFormVisible);},[isShippingFormVisible]);/* eslint-enable react-hooks/exhaustive-deps */useEffect(function(){if(isLocked){LoadingProvider.setLoading(REGISTER_PATH);return;}LoadingProvider.unsetLoading(REGISTER_PATH);},[isLocked]);var value=useMemo(function(){return{supportedCountries:shopSettings.supportedCountries||[],countrySortOrder:shopSettings.countrySortOrder||[],customerAttributes:customerAttributes,userLocation:userLocation,defaultBaseFormState:defaultBaseFormState,defaultBillingFormState:defaultBillingFormState,defaultShippingFormState:defaultShippingFormState,defaultExtraFormState:defaultExtraFormState,baseFormValidationErrors:convertValidationErrors(baseFormState.validationErrors||baseFormRequestErrors||{}),billingFormValidationErrors:convertValidationErrors(billingFormState.validationErrors||billingFormRequestErrors||{}),shippingFormValidationErrors:convertValidationErrors(shippingFormState.validationErrors||shippingFormRequestErrors||{}),extraFormValidationErrors:convertValidationErrors(extraFormState.validationErrors||extraFormRequestErrors||{}),handleSubmit:handleSubmit,updateBaseForm:baseFormState.setValues,updateBillingForm:billingFormState.setValues,updateShippingForm:shippingFormState.setValues,updateExtraForm:extraFormState.setValues,isShippingAddressSelectionEnabled:isShippingAddressSelectionEnabled,isBillingAddressSelectionEnabled:isBillingAddressSelectionEnabled,isShippingFormVisible:isShippingFormVisible,setIsShippingFormVisible:setIsShippingFormVisible,numberOfAddressLines:numberOfAddressLines,registrationMode:registrationMode};},[shopSettings.supportedCountries,shopSettings.countrySortOrder,customerAttributes,userLocation,defaultBaseFormState,defaultBillingFormState,defaultShippingFormState,baseFormState.validationErrors,baseFormState.setValues,baseFormRequestErrors,billingFormState.validationErrors,billingFormState.setValues,billingFormRequestErrors,shippingFormState.validationErrors,shippingFormState.setValues,shippingFormRequestErrors,handleSubmit,defaultExtraFormState,extraFormState.setValues,extraFormState.validationErrors,extraFormRequestErrors,isShippingAddressSelectionEnabled,isBillingAddressSelectionEnabled,isShippingFormVisible,setIsShippingFormVisible,numberOfAddressLines,registrationMode]);if(!isDataReady){return null;}return React.createElement(Context.Provider,{value:value},children);};RegistrationProvider.defaultProps={formContainerRef:null,cartHasDirectShipItems:false,numberOfAddressLines:null};export default connect(RegistrationProvider);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{main$,makeGetPrevRoute,getCurrentRoute,historyPop}from'@shopgate/engage/core';import{LOGIN_PATH}from'@shopgate/pwa-common/constants/RoutePaths';import{successLogin}from'@shopgate/pwa-common/action-creators';import{SUCCESS_REGISTRATION}from"../constants";/**
|
|
2
2
|
* @param {Function} subscribe Subscribes to an observable.
|
|
3
3
|
*/export default function registration(subscribe){var registrationSuccess$=main$.filter(function(_ref){var action=_ref.action;return action.type===SUCCESS_REGISTRATION;});subscribe(registrationSuccess$,function(_ref2){var dispatch=_ref2.dispatch,getState=_ref2.getState;var currentRoute=getCurrentRoute(getState());var redirect;if(currentRoute){// Try to get the login page from the router stack to extract the original redirect target
|
|
4
|
-
var getPrevRoute=makeGetPrevRoute();var routeId=currentRoute.id;var
|
|
4
|
+
var getPrevRoute=makeGetPrevRoute();var routeId=currentRoute.id;var _ref4=getPrevRoute(getState(),{routeId:routeId})||{},pattern=_ref4.pattern,state=_ref4.state;if(pattern===LOGIN_PATH&&(state===null||state===void 0?void 0:state.redirect)){redirect=state.redirect;}}// TODO improve navigation since the login page will be briefly visible
|
|
5
5
|
dispatch(historyPop());dispatch(successLogin(redirect));});}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as fetchProductReviews}from'@shopgate/pwa-common-commerce/reviews/actions/fetchProductReviews';export{default as fetchReviews}from'@shopgate/pwa-common-commerce/reviews/actions/fetchReviews';export{default as fetchUserReview}from'@shopgate/pwa-common-commerce/reviews/actions/fetchUserReview';export{default as flushUserReview}from'@shopgate/pwa-common-commerce/reviews/actions/flushUserReview';export{default as submitReview}from'@shopgate/pwa-common-commerce/reviews/actions/submitReview';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import appConfig from'@shopgate/pwa-common/helpers/config';import I18n from'@shopgate/pwa-common/components/I18n';import RatingNumber from'@shopgate/pwa-ui-shared/RatingNumber';import AverageRating from"../AverageRating";import WriteReviewLink from"../WriteReviewLink";import*as styles from"./style";/* eslint-disable jsx-a11y/aria-role */ /**
|
|
2
2
|
* @param {Object} props The component props.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/var ReviewsExcerpt=function ReviewsExcerpt(_ref){var
|
|
4
|
+
*/var ReviewsExcerpt=function ReviewsExcerpt(_ref){var productId=_ref.productId,average=_ref.average,count=_ref.count,withTopGap=_ref.withTopGap;return React.createElement("div",{className:classNames('engage__reviews__reviews-excerpt',_defineProperty(_defineProperty({},styles.withTopGapContainer,withTopGap),styles.container,!withTopGap)),id:"reviewsExcerpt"},React.createElement(AverageRating,{productId:productId,average:average,count:count}),React.createElement("div",{className:styles.reviewsLine,role:"text"},React.createElement(I18n.Text,{string:"reviews.rating",className:styles.averageRatingText},React.createElement(RatingNumber,{rating:average,className:styles.averageRatingNumber})),appConfig.showWriteReview&&React.createElement(WriteReviewLink,{productId:productId})));};/* eslint-enable jsx-a11y/aria-role */ReviewsExcerpt.defaultProps={average:0,count:0,productId:null,withTopGap:false};export default ReviewsExcerpt;
|
|
@@ -1,5 +1,5 @@
|
|
|
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,{PureComponent}from'react';import PropTypes from'prop-types';import{SurroundPortals}from'@shopgate/engage/components';import{PRODUCT_REVIEWS_ENTRY}from'@shopgate/engage/product';import Title from"./components/Title";import Rating from"./components/Rating";import Text from"./components/Text";import Info from"./components/Info";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,{PureComponent}from'react';import PropTypes from'prop-types';import{SurroundPortals}from'@shopgate/engage/components';import{PRODUCT_REVIEWS_ENTRY}from'@shopgate/engage/product';import Title from"./components/Title";import Rating from"./components/Rating";import Text from"./components/Text";import Info from"./components/Info";import styles from"./style";/**
|
|
2
2
|
* Review List Component.
|
|
3
|
-
*/var List=/*#__PURE__*/function(_PureComponent){
|
|
3
|
+
*/var List=/*#__PURE__*/function(_PureComponent){function List(){_classCallCheck(this,List);return _callSuper(this,List,arguments);}_inherits(List,_PureComponent);return _createClass(List,[{key:"render",value:/**
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/
|
|
5
|
+
*/function render(){var reviews=this.props.reviews;if(!reviews||reviews.length===0){return null;}return React.createElement("ul",{className:"engage__reviews__list"},reviews.map(function(review){return React.createElement("li",{key:review.id,className:styles,"data-test-id":"reviewTitle: ".concat(review.title)},React.createElement(SurroundPortals,{portalName:PRODUCT_REVIEWS_ENTRY,portalProps:{review:review}},React.createElement(Title,{title:review.title}),React.createElement(Rating,{rate:review.rate}),React.createElement(Text,{review:review.review}),React.createElement(Info,{review:review})));}));}}]);}(PureComponent);_defineProperty(List,"defaultProps",{reviews:null});export default List;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from'react';import{mount}from'enzyme';import mockRenderOptions from'@shopgate/pwa-common/helpers/mocks/mockRenderOptions';import List from"./index";describe('<List />',function(){var list=null;var reviews=[{id:'a',author:'',date:'2017-09-06T12:38:51.000Z',rate:100,title:'',review:'No Name and Title Lorem ipsum dolor sit amet, con… takimata sanctus est Lorem ipsum dolor sit amet.'},{id:'b',author:'username123',date:'2017-09-06T12:37:40.000Z',rate:40,title:'Test review 2 ',review:'Lorem ipsum dolor sit amet, consetetur sadipscing … takimata sanctus est Lorem ipsum dolor sit amet.'},{id:'c',author:'Carina Hoffmann',date:'2017-09-06T12:30:23.000Z',rate:60,title:'',review:'Test review'},{id:'d',author:'',date:'2017-09-06T12:30:23.000Z',rate:20,title:'',review:''}];beforeEach(function(){list=mount(React.createElement(List,{reviews:[]}),mockRenderOptions);});it('should not render when no reviews given',function(){expect(list).toMatchSnapshot();expect(list.find('Review').exists()).toBe(false);});it('should render list with reviews',function(){list.setProps({reviews:reviews});expect(list).toMatchSnapshot();expect(list.find('List > ul').exists()).toBe(true);list.find('Review').forEach(function(node,i){var ratingNode=node.find('Rating');expect(ratingNode.prop('rate')).toEqual(reviews[i].rate);expect(ratingNode.find('RatingStars').prop('value')).toEqual(reviews[i].rate);expect(node.find('Info').prop('review').date).toEqual(reviews[i].date);if(reviews[i].author){expect(node.find('Info').prop('review').author).toEqual(reviews[i].author);}if(reviews[i].title){expect(node.find('Title').prop('title')).toEqual(reviews[i].title);}if(reviews[i].review){expect(node.find('Text').prop('review')).toEqual(reviews[i].review);}});});});
|
|
1
|
+
import React from'react';import{mount}from'enzyme';import mockRenderOptions from'@shopgate/pwa-common/helpers/mocks/mockRenderOptions';import List from"./index";jest.mock('@shopgate/engage/components');describe('<List />',function(){var list=null;var reviews=[{id:'a',author:'',date:'2017-09-06T12:38:51.000Z',rate:100,title:'',review:'No Name and Title Lorem ipsum dolor sit amet, con… takimata sanctus est Lorem ipsum dolor sit amet.'},{id:'b',author:'username123',date:'2017-09-06T12:37:40.000Z',rate:40,title:'Test review 2 ',review:'Lorem ipsum dolor sit amet, consetetur sadipscing … takimata sanctus est Lorem ipsum dolor sit amet.'},{id:'c',author:'Carina Hoffmann',date:'2017-09-06T12:30:23.000Z',rate:60,title:'',review:'Test review'},{id:'d',author:'',date:'2017-09-06T12:30:23.000Z',rate:20,title:'',review:''}];beforeEach(function(){list=mount(React.createElement(List,{reviews:[]}),mockRenderOptions);});it('should not render when no reviews given',function(){expect(list).toMatchSnapshot();expect(list.find('Review').exists()).toBe(false);});it('should render list with reviews',function(){list.setProps({reviews:reviews});expect(list).toMatchSnapshot();expect(list.find('List > ul').exists()).toBe(true);list.find('Review').forEach(function(node,i){var ratingNode=node.find('Rating');expect(ratingNode.prop('rate')).toEqual(reviews[i].rate);expect(ratingNode.find('RatingStars').prop('value')).toEqual(reviews[i].rate);expect(node.find('Info').prop('review').date).toEqual(reviews[i].date);if(reviews[i].author){expect(node.find('Info').prop('review').author).toEqual(reviews[i].author);}if(reviews[i].title){expect(node.find('Title').prop('title')).toEqual(reviews[i].title);}if(reviews[i].review){expect(node.find('Text').prop('review')).toEqual(reviews[i].review);}});});});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import I18n from'@shopgate/pwa-common/components/I18n';import{greyStyle,prominentStyle}from"./style";/**
|
|
2
2
|
* @param {Object} props The component props.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/var RatingCount=function RatingCount(props){
|
|
4
|
+
*/var RatingCount=function RatingCount(props){if(!props.count){return null;}return React.createElement(I18n.Text,{string:"reviews.review_count",params:props,className:classNames(_defineProperty(_defineProperty({},greyStyle,true),prominentStyle,props.prominent),'engage__reviews__rating-count')});};RatingCount.defaultProps={count:null,prominent:false};export default RatingCount;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from'react';import{css}from'glamor';import classNames from'classnames';import appConfig from'@shopgate/pwa-common/helpers/config';import{Link}from'@shopgate/engage/components';var styles={root:css({textAlign:'center',marginTop:8,fontSize:'.875rem',fontWeight:300,lineHeight:1.5,padding:'0 1rem 1rem'}).toString(),link:css({textAlign:'center',fontWeight:600,marginTop:8}).toString()};var _appConfig$reviewsInf=appConfig.reviewsInfo
|
|
1
|
+
import React from'react';import{css}from'glamor';import classNames from'classnames';import appConfig from'@shopgate/pwa-common/helpers/config';import{Link}from'@shopgate/engage/components';var styles={root:css({textAlign:'center',marginTop:8,fontSize:'.875rem',fontWeight:300,lineHeight:1.5,padding:'0 1rem 1rem'}).toString(),link:css({textAlign:'center',fontWeight:600,marginTop:8}).toString()};var _appConfig$reviewsInf=appConfig.reviewsInfo,_appConfig$reviewsInf2=_appConfig$reviewsInf===void 0?{}:_appConfig$reviewsInf,text=_appConfig$reviewsInf2.text,linkText=_appConfig$reviewsInf2.linkText,linkUrl=_appConfig$reviewsInf2.linkUrl;/**
|
|
2
2
|
* The ReviewsInfo component
|
|
3
3
|
* @param {Object} props The component props
|
|
4
|
-
* @param {Array} [props.reviews] The reviews shown inside the Reviews component
|
|
5
4
|
* @returns {JSX}
|
|
6
5
|
*/var ReviewsInfo=function ReviewsInfo(){if(!text){return null;}return React.createElement("div",{className:classNames(styles.root,'engage__reviews__review_info_text')},React.createElement("div",null,text,linkText&&linkUrl&&React.createElement(Link,{href:linkUrl,className:styles.link},linkText)));};export default ReviewsInfo;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from'react';import{Provider}from'react-redux';import configureStore from'redux-mock-store';import{mount}from'enzyme';import mockRenderOptions from'@shopgate/pwa-common/helpers/mocks/mockRenderOptions';import{mockedStateWithAll,mockedStateWithoutReview,mockedStateWithTwoReviews,setMocks}from'@shopgate/pwa-common-commerce/reviews/mock';var mockedStore=configureStore();/**
|
|
2
2
|
* @returns {JSX}
|
|
3
|
-
*/var Header=function Header(){return React.createElement("div",null);};var mock=Header;jest.mock("./components/Header",function(){return mock;});jest.mock('@shopgate/engage/product',function(){return{PRODUCT_REVIEWS:'product.reviews',makeIsBaseProductActive:jest.fn(function(){return function(){return true;};})};});jest.mock('@shopgate/engage/components');beforeEach(function(){jest.resetModules();});/**
|
|
3
|
+
*/var Header=function Header(){return React.createElement("div",null);};var mock=Header;jest.mock("./components/Header",function(){return mock;});jest.mock('@shopgate/engage/product',function(){return{PRODUCT_REVIEWS:'product.reviews',makeIsBaseProductActive:jest.fn(function(){return function(){return true;};})};});jest.mock('@shopgate/engage/components');jest.mock('@shopgate/pwa-ui-shared/Sheet',function(){return function Sheet(){return null;};});beforeEach(function(){jest.resetModules();});/**
|
|
4
4
|
* Creates component with provided store state.
|
|
5
5
|
* @param {Object} mockedState Mocked stage.
|
|
6
6
|
* @return {ReactWrapper}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as Reviews}from"./Reviews";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from'@shopgate/pwa-common-commerce/reviews/constants/index';export*from'@shopgate/pwa-common-commerce/reviews/constants/Pipelines';export*from'@shopgate/pwa-common-commerce/reviews/constants/Portals';
|
package/reviews/index.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
/** @module reviews */
|
|
2
|
-
export{default as fetchProductReviews}from'@shopgate/pwa-common-commerce/reviews/actions/fetchProductReviews';export{default as fetchReviews}from'@shopgate/pwa-common-commerce/reviews/actions/fetchReviews';export{default as fetchUserReview}from'@shopgate/pwa-common-commerce/reviews/actions/fetchUserReview';export{default as flushUserReview}from'@shopgate/pwa-common-commerce/reviews/actions/flushUserReview';export{default as submitReview}from'@shopgate/pwa-common-commerce/reviews/actions/submitReview';// CONSTANTS
|
|
3
|
-
export*from'@shopgate/pwa-common-commerce/reviews/constants/index';export*from'@shopgate/pwa-common-commerce/reviews/constants/Pipelines';export*from'@shopgate/pwa-common-commerce/reviews/constants/Portals';// SELECTORS
|
|
4
|
-
export*from'@shopgate/pwa-common-commerce/reviews/selectors';// STREAMS
|
|
5
|
-
export*from'@shopgate/pwa-common-commerce/reviews/streams';// MOCKS
|
|
6
|
-
export*from'@shopgate/pwa-common-commerce/reviews/mock';// COMPONENTS
|
|
7
|
-
export{default as Reviews}from"./components/Reviews";
|
|
1
|
+
/** @module reviews */ /* eslint-disable import/export */export*from"./actions";export*from"./components";export*from"./constants";export*from"./mocks";export*from"./selectors";export*from"./streams";/* eslint-enable import/export */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from'@shopgate/pwa-common-commerce/reviews/selectors';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from'@shopgate/pwa-common-commerce/reviews/streams';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as startScanner}from'@shopgate/pwa-common-commerce/scanner/action-creators/startScanner';export{default as successHandleScanner}from'@shopgate/pwa-common-commerce/scanner/action-creators/successHandleScanner';export{default as errorHandleScanner}from'@shopgate/pwa-common-commerce/scanner/action-creators/errorHandleScanner';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as handleBarCode}from'@shopgate/pwa-common-commerce/scanner/actions/handleBarCode';export{default as handleQrCode}from'@shopgate/pwa-common-commerce/scanner/actions/handleQrCode';export{default as handleSearch}from'@shopgate/pwa-common-commerce/scanner/actions/handleSearch';export{default as handleNoResults}from'@shopgate/pwa-common-commerce/scanner/actions/handleNoResults';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as scanner}from'@shopgate/pwa-core/classes/Scanner';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from'@shopgate/pwa-common-commerce/scanner/constants';export*from'@shopgate/pwa-common-commerce/scanner/constants/Portals';export*from'@shopgate/pwa-core/constants/Scanner';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from'@shopgate/pwa-common-commerce/scanner/helpers';
|
package/scanner/index.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
/** @module scanner */
|
|
2
|
-
export{default as startScanner}from'@shopgate/pwa-common-commerce/scanner/action-creators/startScanner';export{default as successHandleScanner}from'@shopgate/pwa-common-commerce/scanner/action-creators/successHandleScanner';export{default as errorHandleScanner}from'@shopgate/pwa-common-commerce/scanner/action-creators/errorHandleScanner';// ACTIONS
|
|
3
|
-
export{default as handleBarCode}from'@shopgate/pwa-common-commerce/scanner/actions/handleBarCode';export{default as handleQrCode}from'@shopgate/pwa-common-commerce/scanner/actions/handleQrCode';export{default as handleSearch}from'@shopgate/pwa-common-commerce/scanner/actions/handleSearch';export{default as handleNoResults}from'@shopgate/pwa-common-commerce/scanner/actions/handleNoResults';export{default as scanner}from'@shopgate/pwa-core/classes/Scanner';// CONSTANTS
|
|
4
|
-
export*from'@shopgate/pwa-common-commerce/scanner/constants';export*from'@shopgate/pwa-common-commerce/scanner/constants/Portals';export*from'@shopgate/pwa-core/constants/Scanner';// HELPERS
|
|
5
|
-
export*from'@shopgate/pwa-common-commerce/scanner/helpers';// STREAMS
|
|
6
|
-
export*from'@shopgate/pwa-common-commerce/scanner/streams';
|
|
1
|
+
/** @module scanner */ /* eslint-disable import/export */export*from"./actions";export*from"./action-creators";export*from"./classes";export*from"./constants";export*from"./helpers";export*from"./streams";/* eslint-enable import/export */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from'@shopgate/pwa-common-commerce/scanner/streams';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as fetchSearchResults}from'@shopgate/pwa-common-commerce/search/actions/fetchSearchResults';export{default as fetchSearchSuggestions}from'@shopgate/pwa-common-commerce/search/actions/fetchSearchSuggestions';
|