@shopgate/engage 7.8.2 → 7.9.0-beta.2
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/components/QuantityInput/QuantityInput.js +2 -2
- package/components/View/style.js +1 -1
- package/components/index.js +1 -1
- package/core/constants/index.js +1 -1
- package/core/constants/shopSettings.js +1 -1
- package/core/hooks/usePrevious.js +2 -0
- package/core/index.js +2 -2
- package/core/reducers/shopSettings.js +1 -1
- package/core/selectors/index.js +1 -1
- package/core/selectors/shopSettings.js +2 -2
- package/favorites/components/CommentDialog/CommentDialog.js +10 -0
- package/favorites/components/CommentDialog/index.js +1 -0
- package/favorites/components/FavoriteButtonWide/FavoriteButtonWide.js +4 -3
- package/favorites/components/Item/Item.js +8 -4
- package/favorites/components/Item/ItemCharacteristics.js +1 -1
- package/favorites/components/Item/ItemNotes.js +7 -0
- package/favorites/components/Item/ItemQuantity.js +7 -0
- package/favorites/components/List/List.js +7 -3
- package/favorites/components/ListChooser/ListChooserItem.js +4 -5
- package/favorites/components/Lists/Lists.js +4 -4
- package/favorites/components/Lists/ListsModal.js +2 -2
- package/favorites/components/RemoveButton/RemoveButton.js +2 -2
- package/favorites/constants/Portals.js +1 -1
- package/favorites/index.js +1 -1
- package/locations/subscriptions.js +2 -2
- package/package.json +7 -7
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +5 -3
- package/styles/reset/root.js +2 -1
|
@@ -2,7 +2,7 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
2
2
|
* A Quantity Input with unit support.
|
|
3
3
|
* @returns {JSX}
|
|
4
4
|
*/var QuantityInput=forwardRef(function(_ref,outerInputRef){var className=_ref.className,onChange=_ref.onChange,customOnFocus=_ref.onFocus,customOnBlur=_ref.onBlur,value=_ref.value,maxDecimals=_ref.maxDecimals,unit=_ref.unit,minValue=_ref.minValue,maxValue=_ref.maxValue,inputProps=_objectWithoutProperties(_ref,["className","onChange","onFocus","onBlur","value","maxDecimals","unit","minValue","maxValue"]);var inputRef=outerInputRef||useRef();var _useState=useState(formatFloat(value,maxDecimals)),_useState2=_slicedToArray(_useState,2),inputValue=_useState2[0],setInputValue=_useState2[1];var _useState3=useState(false),_useState4=_slicedToArray(_useState3,2),isFocused=_useState4[0],setIsFocused=_useState4[1];var onFocus=useCallback(function(event){customOnFocus(event);setIsFocused(true);},[customOnFocus]);var onBlur=useCallback(function(event){var newValue=parseFloatString(inputValue,maxDecimals);setIsFocused(false);// If invalid switch to old value.
|
|
5
|
-
if(Number.isNaN(parseFloat(inputValue))){setInputValue(formatFloat(value,maxDecimals));return;}onChange(newValue);customOnBlur(event,newValue);},[customOnBlur,inputValue,maxDecimals,onChange,value]);var handleChange=useCallback(function(event){var newValue=event.target.value;if(newValue!==''){if(minValue&&newValue<minValue){newValue="".concat(minValue);}if(maxValue&&newValue>maxValue){newValue="".concat(maxValue);}}setInputValue(newValue);},[maxValue,minValue]);// Select the current input value after focus.
|
|
5
|
+
if(Number.isNaN(parseFloat(inputValue))){setInputValue(formatFloat(value,maxDecimals));return;}if(newValue!==value){onChange(newValue);}customOnBlur(event,newValue);},[customOnBlur,inputValue,maxDecimals,onChange,value]);var handleChange=useCallback(function(event){var newValue=event.target.value;if(newValue!==''){if(minValue&&newValue<minValue){newValue="".concat(minValue);}if(maxValue&&newValue>maxValue){newValue="".concat(maxValue);}}setInputValue(newValue);},[maxValue,minValue]);// Select the current input value after focus.
|
|
6
6
|
useLayoutEffect(function(){if(isFocused&&isIOs){inputRef.current.select();}},[inputRef,isFocused]);// Sync actual float value with displayed content.
|
|
7
7
|
useEffect(function(){setInputValue(formatFloat(value,maxDecimals));},[maxDecimals,value]);// Stop the context menu from opening.
|
|
8
|
-
useLayoutEffect(function(){inputRef.current.addEventListener('contextmenu',function(event){event.preventDefault();event.stopPropagation();return false;});},[inputRef]);var displayedValue=!isFocused&&unit?"".concat(inputValue," ").concat(unit):inputValue;return React.createElement("input",_extends({ref:inputRef},inputProps,{inputMode:"decimal"/* Pattern signals some browsers to use specialized keyboard (if inputmode not supported */,pattern:"[0-9.,]*",onFocus:onFocus,onBlur:onBlur,className:className,value:displayedValue,onChange:handleChange}));});QuantityInput.defaultProps={className:'',maxDecimals:2,unit:null,minValue:null,maxValue:null,onFocus:function onFocus(){},onChange:function onChange(){},onBlur:function onBlur(){}};export default QuantityInput;
|
|
8
|
+
useLayoutEffect(function(){inputRef.current.addEventListener('contextmenu',function(event){event.preventDefault();event.stopPropagation();return false;});},[inputRef]);var displayedValue=!isFocused&&unit?"".concat(inputValue," ").concat(unit):inputValue;return React.createElement("input",_extends({ref:inputRef},inputProps,{inputMode:"decimal"/* Pattern signals some browsers to use specialized keyboard (if inputmode not supported */,pattern:"[0-9.,]*",onFocus:onFocus,onBlur:onBlur,className:className,value:displayedValue,onChange:handleChange,onClick:function onClick(event){event.preventDefault();event.stopPropagation();if(inputRef.current){inputRef.current.focus();}}}));});QuantityInput.defaultProps={className:'',maxDecimals:2,unit:null,minValue:null,maxValue:null,onFocus:function onFocus(){},onChange:function onChange(){},onBlur:function onBlur(){}};export default QuantityInput;
|
package/components/View/style.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from'glamor';import{useScrollContainer}from'@shopgate/engage/core';export default css(useScrollContainer()?{position:'absolute',top:0,left:0,width:'100%',height:'100%',zIndex:1}:{});
|
|
1
|
+
import{css}from'glamor';import{useScrollContainer}from'@shopgate/engage/core';export default css(useScrollContainer()?{position:'absolute',top:0,left:0,width:'100%',height:'100%',zIndex:1}:{height:'100%'});
|
package/components/index.js
CHANGED
|
@@ -8,5 +8,5 @@ export{default as Accordion}from'@shopgate/pwa-ui-material/Accordion';export{def
|
|
|
8
8
|
export{default as AccordionContainer}from'@shopgate/pwa-ui-shared/AccordionContainer';export{default as ActionButton}from'@shopgate/pwa-ui-shared/ActionButton';export{default as AddToCartButton}from'@shopgate/pwa-ui-shared/AddToCartButton';export{default as Availability}from'@shopgate/pwa-ui-shared/Availability';export{default as Button}from'@shopgate/pwa-ui-shared/Button';export{default as ButtonLink}from'@shopgate/pwa-ui-shared/ButtonLink';export{default as Card}from'@shopgate/pwa-ui-shared/Card';export{default as CardList}from'@shopgate/pwa-ui-shared/CardList';export{default as CartTotalLine}from'@shopgate/pwa-ui-shared/CartTotalLine';export{default as Chip}from'@shopgate/pwa-ui-shared/Chip';export{default as ClientInformation}from'@shopgate/pwa-ui-shared/ClientInformation';export{default as ContextMenu}from'@shopgate/pwa-ui-shared/ContextMenu';export{default as Dialog}from'@shopgate/pwa-ui-shared/Dialog';export{default as DiscountBadge}from'@shopgate/pwa-ui-shared/DiscountBadge';export{default as FavoritesButton}from'@shopgate/pwa-ui-shared/FavoritesButton';export{default as Checkbox}from'@shopgate/pwa-ui-shared/Form/Checkbox';export{default as Password}from'@shopgate/pwa-ui-shared/Form/Password';export{default as RadioGroup}from'@shopgate/pwa-ui-shared/Form/RadioGroup';export{default as RadioGroupItem}from'@shopgate/pwa-ui-shared/Form/RadioGroup/components/Item';export{default as Select}from'@shopgate/pwa-ui-shared/Form/Select';export{default as TextField}from'@shopgate/pwa-ui-shared/Form/TextField';export{default as FormElement}from'@shopgate/pwa-ui-shared/FormElement';export{default as Glow}from'@shopgate/pwa-ui-shared/Glow';export{default as IndicatorCircle}from'@shopgate/pwa-ui-shared/IndicatorCircle';export{default as LoadingIndicator}from'@shopgate/pwa-ui-shared/LoadingIndicator';export{default as Manufacturer}from'@shopgate/pwa-ui-shared/Manufacturer';export{default as NoResults}from'@shopgate/pwa-ui-shared/NoResults';export{default as Placeholder}from'@shopgate/pwa-ui-shared/Placeholder';export{default as PlaceholderLabel}from'@shopgate/pwa-ui-shared/PlaceholderLabel';export{default as PlaceholderParagraph}from'@shopgate/pwa-ui-shared/PlaceholderParagraph';export{default as Price}from'@shopgate/pwa-ui-shared/Price';export{default as PriceInfo}from'@shopgate/pwa-ui-shared/PriceInfo';export{default as PriceStriked}from'@shopgate/pwa-ui-shared/PriceStriked';export{default as ProductProperties}from'@shopgate/pwa-ui-shared/ProductProperties';export{default as ProgressBar}from'@shopgate/pwa-ui-shared/ProgressBar';export{default as RadioButton}from'@shopgate/pwa-ui-shared/RadioButton';export{default as RatingNumber}from'@shopgate/pwa-ui-shared/RatingNumber';export{default as RatingStars}from'@shopgate/pwa-ui-shared/RatingStars';export{default as Ripple}from'@shopgate/pwa-ui-shared/Ripple';export{default as RippleButton}from'@shopgate/pwa-ui-shared/RippleButton';export{default as ScannerOverlay}from'@shopgate/pwa-ui-shared/ScannerOverlay';export{default as Sheet,SHEET_EVENTS}from'@shopgate/pwa-ui-shared/Sheet';export{default as TaxDisclaimer}from'@shopgate/pwa-ui-shared/TaxDisclaimer';export{default as ToggleIcon}from'@shopgate/pwa-ui-shared/ToggleIcon';// ICONS IOS
|
|
9
9
|
export{default as CartIconIOS}from'@shopgate/pwa-ui-ios/icons/CartIcon';export{default as FilterIconIOS}from'@shopgate/pwa-ui-ios/icons/FilterIcon';export{default as HomeIconIOS}from'@shopgate/pwa-ui-ios/icons/HomeIcon';export{default as ShareIconIOS}from'@shopgate/pwa-ui-ios/icons/ShareIcon';// ICONS ANDROID
|
|
10
10
|
export{default as ShareIconAndroid}from'@shopgate/pwa-ui-material/icons/ShareIcon';// ICONS SHARED
|
|
11
|
-
export{default as AccountBoxIcon}from'@shopgate/pwa-ui-shared/icons/AccountBoxIcon';export{default as AddMoreIcon}from'@shopgate/pwa-ui-shared/icons/AddMoreIcon';export{default as ArrowDropIcon}from'@shopgate/pwa-ui-shared/icons/ArrowDropIcon';export{default as ArrowIcon}from'@shopgate/pwa-ui-shared/icons/ArrowIcon';export{default as BarcodeScannerIcon}from'@shopgate/pwa-ui-shared/icons/BarcodeScannerIcon';export{default as BoxIcon}from'@shopgate/pwa-ui-shared/icons/BoxIcon';export{default as BrowseIcon}from'@shopgate/pwa-ui-shared/icons/BrowseIcon';export{default as BurgerIcon}from'@shopgate/pwa-ui-shared/icons/BurgerIcon';export{default as CartIcon}from'@shopgate/pwa-ui-shared/icons/CartIcon';export{default as CartPlusIcon}from'@shopgate/pwa-ui-shared/icons/CartPlusIcon';export{default as CheckedIcon}from'@shopgate/pwa-ui-shared/icons/CheckedIcon';export{default as CheckIcon}from'@shopgate/pwa-ui-shared/icons/CheckIcon';export{default as ChevronIcon}from'@shopgate/pwa-ui-shared/icons/ChevronIcon';export{default as CreditCardIcon}from'@shopgate/pwa-ui-shared/icons/CreditCardIcon';export{default as CrossIcon}from'@shopgate/pwa-ui-shared/icons/CrossIcon';export{default as DescriptionIcon}from'@shopgate/pwa-ui-shared/icons/DescriptionIcon';export{default as FilterIcon}from'@shopgate/pwa-ui-shared/icons/FilterIcon';export{default as FlashEnabledIcon}from'@shopgate/pwa-ui-shared/icons/FlashEnabledIcon';export{default as FlashDisabledIcon}from'@shopgate/pwa-ui-shared/icons/FlashDisabledIcon';export{default as GridIcon}from'@shopgate/pwa-ui-shared/icons/GridIcon';export{default as HeartIcon}from'@shopgate/pwa-ui-shared/icons/HeartIcon';export{default as HeartOutlineIcon}from'@shopgate/pwa-ui-shared/icons/HeartOutlineIcon';export{default as HomeIcon}from'@shopgate/pwa-ui-shared/icons/HomeIcon';export{default as InfoIcon}from'@shopgate/pwa-ui-shared/icons/InfoIcon';export{default as InfoOutlineIcon}from'@shopgate/pwa-ui-shared/icons/InfoOutlineIcon';export{default as ListIcon}from'@shopgate/pwa-ui-shared/icons/ListIcon';export{default as LocatorIcon}from'@shopgate/pwa-ui-shared/icons/LocatorIcon';export{default as LocalShippingIcon}from'@shopgate/pwa-ui-shared/icons/LocalShippingIcon';export{default as LocationIcon}from'@shopgate/pwa-ui-shared/icons/LocationIcon';export{default as LockIcon}from'@shopgate/pwa-ui-shared/icons/LockIcon';export{default as LogoutIcon}from'@shopgate/pwa-ui-shared/icons/LogoutIcon';export{default as MagnifierIcon}from'@shopgate/pwa-ui-shared/icons/MagnifierIcon';export{default as MoreIcon}from'@shopgate/pwa-ui-shared/icons/MoreIcon';export{default as MoreVertIcon}from'@shopgate/pwa-ui-shared/icons/MoreVertIcon';export{default as PhoneIcon}from'@shopgate/pwa-ui-shared/icons/PhoneIcon';export{default as PlaceholderIcon}from'@shopgate/pwa-ui-shared/icons/PlaceholderIcon';export{default as RadioCheckedIcon}from'@shopgate/pwa-ui-shared/icons/RadioCheckedIcon';export{default as RadioUncheckedIcon}from'@shopgate/pwa-ui-shared/icons/RadioUncheckedIcon';export{default as SecurityIcon}from'@shopgate/pwa-ui-shared/icons/SecurityIcon';export{default as ShoppingCartIcon}from'@shopgate/pwa-ui-shared/icons/ShoppingCartIcon';export{default as SortIcon}from'@shopgate/pwa-ui-shared/icons/SortIcon';export{default as StarHalfIcon}from'@shopgate/pwa-ui-shared/icons/StarHalfIcon';export{default as StarIcon}from'@shopgate/pwa-ui-shared/icons/StarIcon';export{default as StarOutlineIcon}from'@shopgate/pwa-ui-shared/icons/StarOutlineIcon';export{default as TickIcon}from'@shopgate/pwa-ui-shared/icons/TickIcon';export{default as TrashIcon}from'@shopgate/pwa-ui-shared/icons/TrashIcon';export{default as UncheckedIcon}from'@shopgate/pwa-ui-shared/icons/UncheckedIcon';export{default as ViewListIcon}from'@shopgate/pwa-ui-shared/icons/ViewListIcon';export{default as VisibilityIcon}from'@shopgate/pwa-ui-shared/icons/VisibilityIcon';export{default as VisibilityOffIcon}from'@shopgate/pwa-ui-shared/icons/VisibilityOffIcon';export{default as TimeIcon}from'@shopgate/pwa-ui-shared/icons/TimeIcon';// LOCAL
|
|
11
|
+
export{default as AccountBoxIcon}from'@shopgate/pwa-ui-shared/icons/AccountBoxIcon';export{default as AddMoreIcon}from'@shopgate/pwa-ui-shared/icons/AddMoreIcon';export{default as ArrowDropIcon}from'@shopgate/pwa-ui-shared/icons/ArrowDropIcon';export{default as ArrowIcon}from'@shopgate/pwa-ui-shared/icons/ArrowIcon';export{default as BarcodeScannerIcon}from'@shopgate/pwa-ui-shared/icons/BarcodeScannerIcon';export{default as BoxIcon}from'@shopgate/pwa-ui-shared/icons/BoxIcon';export{default as BrowseIcon}from'@shopgate/pwa-ui-shared/icons/BrowseIcon';export{default as BurgerIcon}from'@shopgate/pwa-ui-shared/icons/BurgerIcon';export{default as CartIcon}from'@shopgate/pwa-ui-shared/icons/CartIcon';export{default as CartPlusIcon}from'@shopgate/pwa-ui-shared/icons/CartPlusIcon';export{default as CheckedIcon}from'@shopgate/pwa-ui-shared/icons/CheckedIcon';export{default as CheckIcon}from'@shopgate/pwa-ui-shared/icons/CheckIcon';export{default as ChevronIcon}from'@shopgate/pwa-ui-shared/icons/ChevronIcon';export{default as CreditCardIcon}from'@shopgate/pwa-ui-shared/icons/CreditCardIcon';export{default as CrossIcon}from'@shopgate/pwa-ui-shared/icons/CrossIcon';export{default as DescriptionIcon}from'@shopgate/pwa-ui-shared/icons/DescriptionIcon';export{default as FilterIcon}from'@shopgate/pwa-ui-shared/icons/FilterIcon';export{default as FlashEnabledIcon}from'@shopgate/pwa-ui-shared/icons/FlashEnabledIcon';export{default as FlashDisabledIcon}from'@shopgate/pwa-ui-shared/icons/FlashDisabledIcon';export{default as GridIcon}from'@shopgate/pwa-ui-shared/icons/GridIcon';export{default as HeartIcon}from'@shopgate/pwa-ui-shared/icons/HeartIcon';export{default as HeartOutlineIcon}from'@shopgate/pwa-ui-shared/icons/HeartOutlineIcon';export{default as HeartPlusIcon}from'@shopgate/pwa-ui-shared/icons/HeartPlusIcon';export{default as HeartPlusOutlineIcon}from'@shopgate/pwa-ui-shared/icons/HeartPlusOutlineIcon';export{default as HomeIcon}from'@shopgate/pwa-ui-shared/icons/HomeIcon';export{default as InfoIcon}from'@shopgate/pwa-ui-shared/icons/InfoIcon';export{default as InfoOutlineIcon}from'@shopgate/pwa-ui-shared/icons/InfoOutlineIcon';export{default as ListIcon}from'@shopgate/pwa-ui-shared/icons/ListIcon';export{default as LocatorIcon}from'@shopgate/pwa-ui-shared/icons/LocatorIcon';export{default as LocalShippingIcon}from'@shopgate/pwa-ui-shared/icons/LocalShippingIcon';export{default as LocationIcon}from'@shopgate/pwa-ui-shared/icons/LocationIcon';export{default as LockIcon}from'@shopgate/pwa-ui-shared/icons/LockIcon';export{default as LogoutIcon}from'@shopgate/pwa-ui-shared/icons/LogoutIcon';export{default as MagnifierIcon}from'@shopgate/pwa-ui-shared/icons/MagnifierIcon';export{default as MoreIcon}from'@shopgate/pwa-ui-shared/icons/MoreIcon';export{default as MoreVertIcon}from'@shopgate/pwa-ui-shared/icons/MoreVertIcon';export{default as PhoneIcon}from'@shopgate/pwa-ui-shared/icons/PhoneIcon';export{default as PlaceholderIcon}from'@shopgate/pwa-ui-shared/icons/PlaceholderIcon';export{default as RadioCheckedIcon}from'@shopgate/pwa-ui-shared/icons/RadioCheckedIcon';export{default as RadioUncheckedIcon}from'@shopgate/pwa-ui-shared/icons/RadioUncheckedIcon';export{default as SecurityIcon}from'@shopgate/pwa-ui-shared/icons/SecurityIcon';export{default as ShoppingCartIcon}from'@shopgate/pwa-ui-shared/icons/ShoppingCartIcon';export{default as SortIcon}from'@shopgate/pwa-ui-shared/icons/SortIcon';export{default as StarHalfIcon}from'@shopgate/pwa-ui-shared/icons/StarHalfIcon';export{default as StarIcon}from'@shopgate/pwa-ui-shared/icons/StarIcon';export{default as StarOutlineIcon}from'@shopgate/pwa-ui-shared/icons/StarOutlineIcon';export{default as TickIcon}from'@shopgate/pwa-ui-shared/icons/TickIcon';export{default as TrashIcon}from'@shopgate/pwa-ui-shared/icons/TrashIcon';export{default as TrashOutlineIcon}from'@shopgate/pwa-ui-shared/icons/TrashOutlineIcon';export{default as UncheckedIcon}from'@shopgate/pwa-ui-shared/icons/UncheckedIcon';export{default as ViewListIcon}from'@shopgate/pwa-ui-shared/icons/ViewListIcon';export{default as VisibilityIcon}from'@shopgate/pwa-ui-shared/icons/VisibilityIcon';export{default as VisibilityOffIcon}from'@shopgate/pwa-ui-shared/icons/VisibilityOffIcon';export{default as TimeIcon}from'@shopgate/pwa-ui-shared/icons/TimeIcon';// LOCAL
|
|
12
12
|
export{MessageBar}from"./MessageBar";export{default as NavigationHandler}from"./NavigationHandler";export{default as TimeBoundary}from"./TimeBoundary";export{default as IntersectionVisibility}from"./IntersectionVisibility";export{default as VideoPlayer}from"./VideoPlayer";export{default as SheetDrawer}from"./SheetDrawer";export{default as SheetList}from"./SheetList";export{default as NullComponent}from"./NullComponent";export{default as View,ViewContext}from"./View";export{default as QuantityInput}from"./QuantityInput";export{default as QuantityLabel}from"./QuantityLabel";export{default as ResponsiveContainer}from"./ResponsiveContainer";export{default as BrandingColorBanner}from"./BrandingColorBanner";export{default as ScrollHeader}from"./ScrollHeader";export{default as Menu}from"./Menu";export{default as Toggle}from"./Toggle";export{Form}from"./Form";export{FormBuilder}from"./Form";export{Footer}from"./Footer";export{SideNavigation}from"./SideNavigation";export{default as TextLink}from"./TextLink/TextLink";export{ConditionalWrapper}from"./ConditionalWrapper";export{default as RadioGroupV2,useRadioGroup}from"./RadioGroup";export{default as RadioV2}from"./Radio";export{default as RadioCard}from"./RadioCard";
|
package/core/constants/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{RECEIVE_SHOP_SETTINGS,ERROR_SHOP_SETTINGS,CACHE_LEASE_SHOP_SETTINGS,SHOP_SETTING_GOOGLE_SITE_VERIFICATION_CODE,SHOP_SETTING_CART_SUPPLEMENTAL_CONTENT,SHOP_SETTING_ORDER_SUPPLEMENTAL_CONTENT,SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP,SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB,SHOP_SETTING_PRODUCTS_SORT_ORDER,SHOP_SETTING_COOKIE_CONSENT_MODE,SHOP_SETTING_DISPLAY_PRICE_PER_MEASURE_UNIT,SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_PRODUCT_PLACEHOLDER,SHOP_SETTING_IMAGES_CATEGORY_PLACEHOLDER,SHOP_SETTING_IMAGES_FAVICON,SHOP_SETTING_NUMBER_OF_ADDRESS_LINES,SHOP_SETTING_REGISTRATION_MODE_SIMPLE,SHOP_SETTING_REGISTRATION_MODE_EXTENDED}from"./shopSettings";export{RECEIVE_MERCHANT_SETTINGS,MERCHANT_SETTINGS_LOCATION_BASED_SHOPPING_ENABLED,MERCHANT_SETTINGS_SUBSTITUTION_PREFERENCES_ENABLED,MERCHANT_SETTINGS_CUSTOMER_ATTRIBUTES,MERCHANT_SETTINGS_FULFILLMENT_SCHEDULED_ENABLED,MERCHANT_SETTINGS_RESTRICT_MULTI_LOCATION_ORDERS,MERCHANT_SETTINGS_DEFAULT_CURRENCY,MERCHANT_SETTINGS_ENABLE_WEB_INDEXING,MERCHANT_SETTINGS_PRODUCT_SHOW_ALTERNATIVE_LOCATION,MERCHANT_SETTINGS_PRODUCTLIST_SHOW_INVENTORY}from"./merchantSettings";export{SHOPGATE_CORE_GET_SHOP_SETTINGS,EUNAUTHORIZED,EAUTHENTICATION}from"./pipelines";
|
|
1
|
+
export{RECEIVE_SHOP_SETTINGS,ERROR_SHOP_SETTINGS,CACHE_LEASE_SHOP_SETTINGS,SHOP_SETTING_GOOGLE_SITE_VERIFICATION_CODE,SHOP_SETTING_CART_SUPPLEMENTAL_CONTENT,SHOP_SETTING_ORDER_SUPPLEMENTAL_CONTENT,SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP,SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB,SHOP_SETTING_PRODUCTS_SORT_ORDER,SHOP_SETTING_COOKIE_CONSENT_MODE,SHOP_SETTING_DISPLAY_PRICE_PER_MEASURE_UNIT,SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_PRODUCT_PLACEHOLDER,SHOP_SETTING_IMAGES_CATEGORY_PLACEHOLDER,SHOP_SETTING_IMAGES_FAVICON,SHOP_SETTING_NUMBER_OF_ADDRESS_LINES,SHOP_SETTING_REGISTRATION_MODE_SIMPLE,SHOP_SETTING_REGISTRATION_MODE_EXTENDED,SHOP_SETTING_WISHLIST_ITEM_QUANTITY_ENABLED,SHOP_SETTING_WISHLIST_ITEM_NOTES_ENABLED,SHOP_SETTING_LOAD_WISHLIST_ON_APP_START_ENABLED,SHOP_SETTING_SHOW_WISHLIST_ITEMS_COUNT_BADGE}from"./shopSettings";export{RECEIVE_MERCHANT_SETTINGS,MERCHANT_SETTINGS_LOCATION_BASED_SHOPPING_ENABLED,MERCHANT_SETTINGS_SUBSTITUTION_PREFERENCES_ENABLED,MERCHANT_SETTINGS_CUSTOMER_ATTRIBUTES,MERCHANT_SETTINGS_FULFILLMENT_SCHEDULED_ENABLED,MERCHANT_SETTINGS_RESTRICT_MULTI_LOCATION_ORDERS,MERCHANT_SETTINGS_DEFAULT_CURRENCY,MERCHANT_SETTINGS_ENABLE_WEB_INDEXING,MERCHANT_SETTINGS_PRODUCT_SHOW_ALTERNATIVE_LOCATION,MERCHANT_SETTINGS_PRODUCTLIST_SHOW_INVENTORY}from"./merchantSettings";export{SHOPGATE_CORE_GET_SHOP_SETTINGS,EUNAUTHORIZED,EAUTHENTICATION}from"./pipelines";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var RECEIVE_SHOP_SETTINGS='RECEIVE_SHOP_SETTINGS';export var ERROR_SHOP_SETTINGS='ERROR_SHOP_SETTINGS';export var CACHE_LEASE_SHOP_SETTINGS=10*60*1000;// 10 minutes in milliseconds
|
|
2
|
-
export var SHOP_SETTING_GOOGLE_SITE_VERIFICATION_CODE='googleSiteVerificationCode';export var SHOP_SETTING_CART_SUPPLEMENTAL_CONTENT='cartSupplementalContent';export var SHOP_SETTING_ORDER_SUPPLEMENTAL_CONTENT='orderSupplementalContent';export var SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP='showShopLogoInApp';export var SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB='showShopLogoInWeb';export var SHOP_SETTING_PRODUCTS_SORT_ORDER='productsSortOrder';export var SHOP_SETTING_WISHLIST_MODE='wishlistMode';export var SHOP_SETTING_COOKIE_CONSENT_MODE='cookieConsentMode';export var SHOP_SETTING_DISPLAY_PRICE_PER_MEASURE_UNIT='displayPricePerMeasureUnit';export var SHOP_SETTING_IMAGES='images';export var SHOP_SETTING_IMAGES_PRODUCT_PLACEHOLDER='productPlaceholder';export var SHOP_SETTING_IMAGES_CATEGORY_PLACEHOLDER='categoryPlaceholder';export var SHOP_SETTING_IMAGES_FAVICON='favicon';export var SHOP_SETTING_NUMBER_OF_ADDRESS_LINES='numberOfAddressLines';export var SHOP_SETTINGS_SHOW_CATEGORY_IMAGES='showCategoryImages';export var SHOP_SETTING_REGISTRATION_MODE='registrationMode';export var SHOP_SETTING_REGISTRATION_MODE_SIMPLE='simple';export var SHOP_SETTING_REGISTRATION_MODE_EXTENDED='extended';export var WISHLIST_MODE_PERSIST_ON_ADD='persistOnAdd';
|
|
2
|
+
export var SHOP_SETTING_GOOGLE_SITE_VERIFICATION_CODE='googleSiteVerificationCode';export var SHOP_SETTING_CART_SUPPLEMENTAL_CONTENT='cartSupplementalContent';export var SHOP_SETTING_ORDER_SUPPLEMENTAL_CONTENT='orderSupplementalContent';export var SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP='showShopLogoInApp';export var SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB='showShopLogoInWeb';export var SHOP_SETTING_PRODUCTS_SORT_ORDER='productsSortOrder';export var SHOP_SETTING_WISHLIST_MODE='wishlistMode';export var SHOP_SETTING_COOKIE_CONSENT_MODE='cookieConsentMode';export var SHOP_SETTING_DISPLAY_PRICE_PER_MEASURE_UNIT='displayPricePerMeasureUnit';export var SHOP_SETTING_IMAGES='images';export var SHOP_SETTING_IMAGES_PRODUCT_PLACEHOLDER='productPlaceholder';export var SHOP_SETTING_IMAGES_CATEGORY_PLACEHOLDER='categoryPlaceholder';export var SHOP_SETTING_IMAGES_FAVICON='favicon';export var SHOP_SETTING_NUMBER_OF_ADDRESS_LINES='numberOfAddressLines';export var SHOP_SETTINGS_SHOW_CATEGORY_IMAGES='showCategoryImages';export var SHOP_SETTING_REGISTRATION_MODE='registrationMode';export var SHOP_SETTING_REGISTRATION_MODE_SIMPLE='simple';export var SHOP_SETTING_REGISTRATION_MODE_EXTENDED='extended';export var SHOP_SETTING_WISHLIST_ITEM_QUANTITY_ENABLED='wishlistItemQuantityEnabled';export var SHOP_SETTING_WISHLIST_ITEM_NOTES_ENABLED='wishlistItemNotesEnabled';export var SHOP_SETTING_LOAD_WISHLIST_ON_APP_START_ENABLED='loadWishlistOnAppStartEnabled';export var SHOP_SETTING_SHOW_WISHLIST_ITEMS_COUNT_BADGE='showWishlistItemsCountBadge';export var WISHLIST_MODE_PERSIST_ON_ADD='persistOnAdd';
|
package/core/index.js
CHANGED
|
@@ -44,9 +44,9 @@ export{default as closeModal}from'@shopgate/pwa-common/actions/modal/closeModal'
|
|
|
44
44
|
export*from'@shopgate/pwa-common/constants/ModalTypes';// HELPERS
|
|
45
45
|
export{default as withShowModal}from'@shopgate/pwa-common/helpers/modal/withShowModal';// SELECTORS
|
|
46
46
|
export*from'@shopgate/pwa-common/selectors/modal';// --------------- HOOKS --------------- //
|
|
47
|
-
export{useAsyncMemo}from"./hooks/useAsyncMemo";export{useRoute}from"./hooks/useRoute";export{useTheme}from"./hooks/useTheme";export{useApp}from"./hooks/useApp";export{useCurrentProduct}from"./hooks/useCurrentProduct";export{useNavigation}from"./hooks/useNavigation";export{usePageConfig}from"./hooks/usePageConfig";export{usePageSettings}from"./hooks/usePageSettings";export{useWidgetConfig}from"./hooks/useWidgetConfig";export{useWidgetSettings}from"./hooks/useWidgetSettings";export{useWidgetStyles}from"./hooks/useWidgetStyles";export*from"./hooks/html";export{useScroll}from"./hooks/useScroll";// --------------- HOCs --------------- //
|
|
47
|
+
export{useAsyncMemo}from"./hooks/useAsyncMemo";export{useRoute}from"./hooks/useRoute";export{useTheme}from"./hooks/useTheme";export{useApp}from"./hooks/useApp";export{useCurrentProduct}from"./hooks/useCurrentProduct";export{useNavigation}from"./hooks/useNavigation";export{usePageConfig}from"./hooks/usePageConfig";export{usePageSettings}from"./hooks/usePageSettings";export{useWidgetConfig}from"./hooks/useWidgetConfig";export{useWidgetSettings}from"./hooks/useWidgetSettings";export{useWidgetStyles}from"./hooks/useWidgetStyles";export*from"./hooks/html";export{useScroll}from"./hooks/useScroll";export{usePrevious}from"./hooks/usePrevious";// --------------- HOCs --------------- //
|
|
48
48
|
export{withTheme}from"./hocs/withTheme";export{withRoute}from"./hocs/withRoute";export{withCurrentProduct}from"./hocs/withCurrentProduct";export{withForwardedRef}from"./hocs/withForwardedRef";export{withNavigation}from"./hocs/withNavigation";export{withWidgetSettings}from"./hocs/withWidgetSettings";export{withWidgetStyles}from"./hocs/withWidgetStyles";export{withApp}from"./hocs/withApp";// --------------- CONFIG --------------- //
|
|
49
49
|
export{ThemeConfigResolver}from"./config/ThemeConfigResolver";export{isBeta}from"./config/isBeta";export{getThemeConfig}from"./config/getThemeConfig";export{getThemeSettings}from"./config/getThemeSettings";export{getThemeColors}from"./config/getThemeColors";export{getThemeAssets}from"./config/getThemeAssets";export{getPageConfig}from"./config/getPageConfig";export{getPageSettings}from"./config/getPageSettings";export{getWidgetConfig}from"./config/getWidgetConfig";export{getWidgetSettings}from"./config/getWidgetSettings";// -------------- HELPERS -------------- //
|
|
50
50
|
export{i18n,getWeekDaysOrder}from"./helpers/i18n";export{default as nl2br}from"./helpers/nl2br";export*from"./helpers/string";export{updateLegacyNavigationBar}from"./helpers/updateLegacyNavigationBar";export{getFullImageSource}from"./helpers/getFullImageSource";export{isIOSTheme}from"./helpers/isIOSTheme";export{isTouchDevice}from"./helpers/isTouchDevice";export{generateGoogleMapsDirectionsUrl}from"./helpers/googleMaps";export{hasWebBridge}from"./helpers/bridge";export{useScrollContainer}from"./helpers/scrollContainer";export{getDeviceTypeForCms}from"./helpers/deviceType";export*from"./helpers/featureFlag";// -------------- CONFIG -------------- //
|
|
51
51
|
export*from"./config/config.actions";export*from"./config/config.selectors";export*from"./config/config.streams";export*from"./initialization";// -------------- VALIDATION -------------- //
|
|
52
|
-
export*from"./validation";export{default as errorBehavior}from"./helpers/errorBehavior";export{makeGetShopSettingByKey,makeGetShopSettings,getIsLocationBasedShopping,getRestrictMultiLocationOrders,getFulfillmentSchedulingEnabled,getProductImagePlaceholder,getCategoryImagePlaceholder,getFavicon,getDefaultCurrency,getEnableWebIndexing,getNumberOfAddressLines,getGoogleSiteVerificationCode,getRegistrationMode}from"./selectors";export{SHOP_SETTING_CART_SUPPLEMENTAL_CONTENT,SHOP_SETTING_ORDER_SUPPLEMENTAL_CONTENT,SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP,SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB,SHOP_SETTING_PRODUCTS_SORT_ORDER,SHOP_SETTING_COOKIE_CONSENT_MODE,SHOP_SETTING_DISPLAY_PRICE_PER_MEASURE_UNIT,SHOP_SETTING_REGISTRATION_MODE_SIMPLE,SHOP_SETTING_REGISTRATION_MODE_EXTENDED,EUNAUTHORIZED,EAUTHENTICATION}from"./constants";
|
|
52
|
+
export*from"./validation";export{default as errorBehavior}from"./helpers/errorBehavior";export{makeGetShopSettingByKey,makeGetShopSettings,getIsLocationBasedShopping,getRestrictMultiLocationOrders,getFulfillmentSchedulingEnabled,getProductImagePlaceholder,getCategoryImagePlaceholder,getFavicon,getDefaultCurrency,getEnableWebIndexing,getNumberOfAddressLines,getGoogleSiteVerificationCode,getRegistrationMode,getWishlistItemQuantityEnabled,getWishlistItemNotesEnabled,getShowWishlistItemsCountBadge,getLoadWishlistOnAppStartEnabled}from"./selectors";export{SHOP_SETTING_CART_SUPPLEMENTAL_CONTENT,SHOP_SETTING_ORDER_SUPPLEMENTAL_CONTENT,SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP,SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB,SHOP_SETTING_PRODUCTS_SORT_ORDER,SHOP_SETTING_COOKIE_CONSENT_MODE,SHOP_SETTING_DISPLAY_PRICE_PER_MEASURE_UNIT,SHOP_SETTING_REGISTRATION_MODE_SIMPLE,SHOP_SETTING_REGISTRATION_MODE_EXTENDED,EUNAUTHORIZED,EAUTHENTICATION}from"./constants";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _SHOP_SETTING_IMAGES,_defaultState;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 _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{produce}from'immer';import{SORT_RELEVANCE}from'@shopgate/pwa-common/constants/DisplayOptions';import{RECEIVE_SHOP_SETTINGS,ERROR_SHOP_SETTINGS,SHOP_SETTING_GOOGLE_SITE_VERIFICATION_CODE,SHOP_SETTING_CART_SUPPLEMENTAL_CONTENT,SHOP_SETTING_ORDER_SUPPLEMENTAL_CONTENT,SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB,SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP,SHOP_SETTING_PRODUCTS_SORT_ORDER,SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_PRODUCT_PLACEHOLDER,SHOP_SETTING_IMAGES_CATEGORY_PLACEHOLDER,SHOP_SETTING_IMAGES_FAVICON,SHOP_SETTING_NUMBER_OF_ADDRESS_LINES}from"../constants";var defaultState=(_defaultState={},_defineProperty(_defaultState,SHOP_SETTING_GOOGLE_SITE_VERIFICATION_CODE,null),_defineProperty(_defaultState,SHOP_SETTING_CART_SUPPLEMENTAL_CONTENT,null),_defineProperty(_defaultState,SHOP_SETTING_ORDER_SUPPLEMENTAL_CONTENT,null),_defineProperty(_defaultState,SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB,true),_defineProperty(_defaultState,SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP,true),_defineProperty(_defaultState,SHOP_SETTING_PRODUCTS_SORT_ORDER,SORT_RELEVANCE),_defineProperty(_defaultState,SHOP_SETTING_NUMBER_OF_ADDRESS_LINES,2),_defineProperty(_defaultState,SHOP_SETTING_IMAGES,(_SHOP_SETTING_IMAGES={},_defineProperty(_SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_PRODUCT_PLACEHOLDER,null),_defineProperty(_SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_CATEGORY_PLACEHOLDER,null),_defineProperty(_SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_FAVICON,null),_SHOP_SETTING_IMAGES)),_defaultState);/**
|
|
1
|
+
var _SHOP_SETTING_IMAGES,_defaultState;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 _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{produce}from'immer';import{SORT_RELEVANCE}from'@shopgate/pwa-common/constants/DisplayOptions';import{RECEIVE_SHOP_SETTINGS,ERROR_SHOP_SETTINGS,SHOP_SETTING_GOOGLE_SITE_VERIFICATION_CODE,SHOP_SETTING_CART_SUPPLEMENTAL_CONTENT,SHOP_SETTING_ORDER_SUPPLEMENTAL_CONTENT,SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB,SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP,SHOP_SETTING_PRODUCTS_SORT_ORDER,SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_PRODUCT_PLACEHOLDER,SHOP_SETTING_IMAGES_CATEGORY_PLACEHOLDER,SHOP_SETTING_IMAGES_FAVICON,SHOP_SETTING_NUMBER_OF_ADDRESS_LINES,SHOP_SETTING_WISHLIST_ITEM_QUANTITY_ENABLED,SHOP_SETTING_WISHLIST_ITEM_NOTES_ENABLED,SHOP_SETTING_LOAD_WISHLIST_ON_APP_START_ENABLED,SHOP_SETTING_SHOW_WISHLIST_ITEMS_COUNT_BADGE}from"../constants";var defaultState=(_defaultState={},_defineProperty(_defaultState,SHOP_SETTING_GOOGLE_SITE_VERIFICATION_CODE,null),_defineProperty(_defaultState,SHOP_SETTING_CART_SUPPLEMENTAL_CONTENT,null),_defineProperty(_defaultState,SHOP_SETTING_ORDER_SUPPLEMENTAL_CONTENT,null),_defineProperty(_defaultState,SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB,true),_defineProperty(_defaultState,SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP,true),_defineProperty(_defaultState,SHOP_SETTING_PRODUCTS_SORT_ORDER,SORT_RELEVANCE),_defineProperty(_defaultState,SHOP_SETTING_NUMBER_OF_ADDRESS_LINES,2),_defineProperty(_defaultState,SHOP_SETTING_IMAGES,(_SHOP_SETTING_IMAGES={},_defineProperty(_SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_PRODUCT_PLACEHOLDER,null),_defineProperty(_SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_CATEGORY_PLACEHOLDER,null),_defineProperty(_SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_FAVICON,null),_SHOP_SETTING_IMAGES)),_defineProperty(_defaultState,SHOP_SETTING_WISHLIST_ITEM_QUANTITY_ENABLED,false),_defineProperty(_defaultState,SHOP_SETTING_WISHLIST_ITEM_NOTES_ENABLED,false),_defineProperty(_defaultState,SHOP_SETTING_LOAD_WISHLIST_ON_APP_START_ENABLED,true),_defineProperty(_defaultState,SHOP_SETTING_SHOW_WISHLIST_ITEMS_COUNT_BADGE,true),_defaultState);/**
|
|
2
2
|
* Stores the product locations by the location code.
|
|
3
3
|
* @param {Object} [state={}] The current state.
|
|
4
4
|
* @param {Object} action The action object.
|
package/core/selectors/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{getState as getShopSettingsState,makeGetShopSettingByKey,makeGetShopSettings,getProductImagePlaceholder,getCategoryImagePlaceholder,getFavicon,getNumberOfAddressLines,getGoogleSiteVerificationCode,getRegistrationMode}from"./shopSettings";export{getIsLocationBasedShopping,getFulfillmentSchedulingEnabled,getRestrictMultiLocationOrders,getDefaultCurrency,getEnableWebIndexing,getProductShowAlternativeLocation,getProductListShowInventory}from"./merchantSettings";
|
|
1
|
+
export{getState as getShopSettingsState,makeGetShopSettingByKey,makeGetShopSettings,getProductImagePlaceholder,getCategoryImagePlaceholder,getFavicon,getNumberOfAddressLines,getGoogleSiteVerificationCode,getRegistrationMode,getWishlistItemQuantityEnabled,getWishlistItemNotesEnabled,getShowWishlistItemsCountBadge,getLoadWishlistOnAppStartEnabled}from"./shopSettings";export{getIsLocationBasedShopping,getFulfillmentSchedulingEnabled,getRestrictMultiLocationOrders,getDefaultCurrency,getEnableWebIndexing,getProductShowAlternativeLocation,getProductListShowInventory}from"./merchantSettings";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createSelector}from'reselect';import{WISHLIST_MODE_PERSIST_ON_ADD,SHOP_SETTING_WISHLIST_MODE,SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_PRODUCT_PLACEHOLDER,SHOP_SETTING_IMAGES_CATEGORY_PLACEHOLDER,SHOP_SETTING_IMAGES_FAVICON,SHOP_SETTING_NUMBER_OF_ADDRESS_LINES,SHOP_SETTING_GOOGLE_SITE_VERIFICATION_CODE,SHOP_SETTINGS_SHOW_CATEGORY_IMAGES,SHOP_SETTING_REGISTRATION_MODE,SHOP_SETTING_REGISTRATION_MODE_EXTENDED}from"../constants/shopSettings";/**
|
|
1
|
+
import{createSelector}from'reselect';import{WISHLIST_MODE_PERSIST_ON_ADD,SHOP_SETTING_WISHLIST_MODE,SHOP_SETTING_IMAGES,SHOP_SETTING_IMAGES_PRODUCT_PLACEHOLDER,SHOP_SETTING_IMAGES_CATEGORY_PLACEHOLDER,SHOP_SETTING_IMAGES_FAVICON,SHOP_SETTING_NUMBER_OF_ADDRESS_LINES,SHOP_SETTING_GOOGLE_SITE_VERIFICATION_CODE,SHOP_SETTINGS_SHOW_CATEGORY_IMAGES,SHOP_SETTING_REGISTRATION_MODE,SHOP_SETTING_REGISTRATION_MODE_EXTENDED,SHOP_SETTING_LOAD_WISHLIST_ON_APP_START_ENABLED,SHOP_SETTING_WISHLIST_ITEM_QUANTITY_ENABLED,SHOP_SETTING_WISHLIST_ITEM_NOTES_ENABLED,SHOP_SETTING_SHOW_WISHLIST_ITEMS_COUNT_BADGE}from"../constants/shopSettings";/**
|
|
2
2
|
* Retrieves the shopSettings state from the store.
|
|
3
3
|
* @param {Object} state The current application state.
|
|
4
4
|
* @return {Object} The locations state.
|
|
@@ -22,4 +22,4 @@ import{createSelector}from'reselect';import{WISHLIST_MODE_PERSIST_ON_ADD,SHOP_SE
|
|
|
22
22
|
*/export var getNumberOfAddressLines=makeGetShopSettingByKey(SHOP_SETTING_NUMBER_OF_ADDRESS_LINES,2);export var getGoogleSiteVerificationCode=makeGetShopSettingByKey(SHOP_SETTING_GOOGLE_SITE_VERIFICATION_CODE,'');export var getShowCategoryImages=makeGetShopSettingByKey(SHOP_SETTINGS_SHOW_CATEGORY_IMAGES,true);/**
|
|
23
23
|
* Creates a selector to retrieve the current active registration mode.
|
|
24
24
|
* When the selector returns "simple" the form will not contain any address related fields.
|
|
25
|
-
*/export var getRegistrationMode=makeGetShopSettingByKey(SHOP_SETTING_REGISTRATION_MODE,SHOP_SETTING_REGISTRATION_MODE_EXTENDED);
|
|
25
|
+
*/export var getRegistrationMode=makeGetShopSettingByKey(SHOP_SETTING_REGISTRATION_MODE,SHOP_SETTING_REGISTRATION_MODE_EXTENDED);export var getWishlistItemQuantityEnabled=makeGetShopSettingByKey(SHOP_SETTING_WISHLIST_ITEM_QUANTITY_ENABLED,false);export var getWishlistItemNotesEnabled=makeGetShopSettingByKey(SHOP_SETTING_WISHLIST_ITEM_NOTES_ENABLED,false);export var getLoadWishlistOnAppStartEnabled=makeGetShopSettingByKey(SHOP_SETTING_LOAD_WISHLIST_ON_APP_START_ENABLED,true);export var getShowWishlistItemsCountBadge=createSelector(getLoadWishlistOnAppStartEnabled,makeGetShopSettingByKey(SHOP_SETTING_SHOW_WISHLIST_ITEMS_COUNT_BADGE,true),function(loadWishlistOnAppStartEnabled,showWishlistItemsCountBadge){return loadWishlistOnAppStartEnabled?showWishlistItemsCountBadge:false;});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useEffect,useState,useMemo,useCallback}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{getCommentDialogSettings}from'@shopgate/pwa-common-commerce/favorites/selectors';import{i18n,usePrevious}from'@shopgate/engage/core';import{Dialog,TextField}from'@shopgate/engage/components';import{closeFavoritesCommentDialog}from'@shopgate/pwa-common-commerce/favorites/action-creators';import{themeName}from'@shopgate/pwa-common/helpers/config';import{updateFavorite}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';import I18n from'@shopgate/pwa-common/components/I18n';var isIos=themeName.includes('ios');/**
|
|
2
|
+
* @param {Object} state State.
|
|
3
|
+
* @returns {Object}
|
|
4
|
+
*/var mapStateToProps=function mapStateToProps(state){return{settings:getCommentDialogSettings(state)};};/**
|
|
5
|
+
* @param {Object} dispatch Dispatch.
|
|
6
|
+
* @returns {Object}
|
|
7
|
+
*/var mapDispatchToProps=function mapDispatchToProps(dispatch){return{close:function close(){return dispatch(closeFavoritesCommentDialog());},updateFavoriteItem:function updateFavoriteItem(productId,listId,quantity,notes){dispatch(updateFavorite(productId,listId,quantity,notes));}};};var styles={root:css({display:'flex',flexDirection:'column'}),input:css({textAlign:'left',fontSize:'1rem'}).toString(),characterCount:css({textAlign:'right',marginTop:-16,fontSize:'0.875rem',color:'var(--color-text-medium-emphasis)'}).toString()};var MAX_CHARACTER_COUNT=250;/**
|
|
8
|
+
* @param {Object} props Props.
|
|
9
|
+
* @returns {JSX}
|
|
10
|
+
*/var CommentDialog=function CommentDialog(_ref){var settings=_ref.settings,close=_ref.close,updateFavoriteItem=_ref.updateFavoriteItem;var isVisible=!!settings;var _ref2=settings||{},productId=_ref2.productId,listId=_ref2.listId,item=_ref2.item;var prevProdId=usePrevious(productId);var _useState=useState(item===null||item===void 0?void 0:item.notes),_useState2=_slicedToArray(_useState,2),value=_useState2[0],setValue=_useState2[1];useEffect(function(){if(prevProdId!==productId){setValue(item===null||item===void 0?void 0:item.notes);}},[item,prevProdId,productId]);var handleSubmit=useCallback(function(){updateFavoriteItem(productId,listId,undefined,value);close();},[close,listId,productId,updateFavoriteItem,value]);var handleChange=useCallback(function(newValue){setValue(newValue);},[]);var attributes=useMemo(function(){return{style:{maxHeight:150,placeholder:i18n.text('favorites.comment_modal.label')},maxLength:MAX_CHARACTER_COUNT};},[]);if(!isVisible){return null;}return React.createElement(Dialog,{onConfirm:handleSubmit,onDismiss:close,modal:{title:i18n.text("favorites.comment_modal.".concat(((item===null||item===void 0?void 0:item.notes)||'').length===0?'titleAdd':'titleEdit')),dismiss:i18n.text('favorites.comment_modal.dismiss'),confirm:i18n.text('favorites.comment_modal.confirm')}},React.createElement("div",{className:styles.root},React.createElement(TextField,_extends({name:"name"},isIos?{placeholder:i18n.text('favorites.comment_modal.label')}:{label:i18n.text('favorites.comment_modal.label')},{onChange:handleChange,value:value,className:styles.input,attributes:attributes,multiLine:true})),React.createElement(I18n.Text,{className:styles.characterCount,string:"favorites.comment_modal.characterCount",params:{maxCount:MAX_CHARACTER_COUNT,count:(value===null||value===void 0?void 0:value.length)||0}})));};CommentDialog.defaultProps={settings:null};export default connect(mapStateToProps,mapDispatchToProps)(CommentDialog);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default}from"./CommentDialog";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React,{useMemo}from'react';import PropTypes from'prop-types';import{css}from'glamor';import{connect}from'react-redux';import{RippleButton}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import{toggleFavoriteWithListChooser}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';import{makeIsProductOnFavoriteList,hasMultipleFavoritesList}from'@shopgate/pwa-common-commerce/favorites/selectors';import appConfig from'@shopgate/pwa-common/helpers/config';/**
|
|
1
|
+
import React,{useMemo}from'react';import PropTypes from'prop-types';import{css}from'glamor';import{connect}from'react-redux';import{RippleButton}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import{toggleFavoriteWithListChooser}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';import{makeIsProductOnFavoriteList,hasMultipleFavoritesList}from'@shopgate/pwa-common-commerce/favorites/selectors';import{getWishlistItemQuantityEnabled}from'@shopgate/engage/core/selectors/shopSettings';import appConfig from'@shopgate/pwa-common/helpers/config';/**
|
|
2
2
|
* @param {Object} state State.
|
|
3
3
|
* @returns {Object}
|
|
4
|
-
*/var makeMapStateToProps=function makeMapStateToProps(){var getIsOnList=makeIsProductOnFavoriteList(function(_,props){return props.productId;});return function(state,props){return{isOnList:getIsOnList(state,props),hasMultipleLists:hasMultipleFavoritesList(state)};};};/**
|
|
4
|
+
*/var makeMapStateToProps=function makeMapStateToProps(){var getIsOnList=makeIsProductOnFavoriteList(function(_,props){return props.productId;});return function(state,props){return{isOnList:getIsOnList(state,props),hasMultipleLists:hasMultipleFavoritesList(state),wishlistItemQuantityEnabled:getWishlistItemQuantityEnabled(state)};};};/**
|
|
5
5
|
* @param {Function} dispatch Dispatch
|
|
6
6
|
* @returns {Object}
|
|
7
|
-
* */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{toggle:function toggle(productId){return dispatch(toggleFavoriteWithListChooser(productId));}};};var styles={root:css({'&&':{margin:'0 0px 16px 16px',backgroundColor:'#fff',border:'1px solid var(--color-primary)',color:'var(--color-high-emphasis)',borderRadius:5,fontSize:14,textTransform:'none',padding:0}}).toString(),ripple:css({padding:'8px 16px'}).toString()};/** @returns {JSX} */var FavoriteButtonWide=function FavoriteButtonWide(_ref){var productId=_ref.productId,toggle=_ref.toggle,isOnList=_ref.isOnList,hasMultipleLists=_ref.hasMultipleLists;var label=useMemo(function(){
|
|
7
|
+
* */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{toggle:function toggle(productId){return dispatch(toggleFavoriteWithListChooser(productId));}};};var styles={root:css({'&&':{margin:'0 0px 16px 16px',backgroundColor:'#fff',border:'1px solid var(--color-primary)',color:'var(--color-high-emphasis)',borderRadius:5,fontSize:14,textTransform:'none',padding:0}}).toString(),ripple:css({padding:'8px 16px'}).toString()};/** @returns {JSX} */var FavoriteButtonWide=function FavoriteButtonWide(_ref){var productId=_ref.productId,toggle=_ref.toggle,isOnList=_ref.isOnList,hasMultipleLists=_ref.hasMultipleLists,wishlistItemQuantityEnabled=_ref.wishlistItemQuantityEnabled;var label=useMemo(function(){// When wishlist item quantity is active, items cannot be removed via the button
|
|
8
|
+
if(!isOnList||wishlistItemQuantityEnabled){return'favorites.add_to_list';}if(hasMultipleLists){return'favorites.edit_lists';}return'favorites.remove_from_list';},[hasMultipleLists,isOnList,wishlistItemQuantityEnabled]);if(!appConfig.hasFavorites){return null;}return React.createElement(RippleButton,{className:styles.root,rippleClassName:styles.ripple,type:"primary",onClick:function onClick(){return toggle(productId);}},i18n.text(label));};export default connect(makeMapStateToProps,mapDispatchToProps)(FavoriteButtonWide);
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _css;function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useCallback,useMemo,useLayoutEffect,useState,useEffect}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{MODAL_VARIANT_SELECT}from'@shopgate/pwa-ui-shared/Dialog/constants';import{ProductImage,ITEM_PATH,PriceInfo,isBaseProduct as isBaseProductSelector,isProductOrderable,hasProductVariants}from'@shopgate/engage/product';import{bin2hex,showModal as showModalAction,historyPush as historyPushAction,getThemeSettings,i18n}from'@shopgate/engage/core';import{Link,SurroundPortals}from'@shopgate/engage/components';import{makeIsRopeProductOrderable,getPreferredLocation,StockInfoLists}from'@shopgate/engage/locations';import{FAVORITES_PRODUCT_NAME,FAVORITES_PRODUCT_PRICE,FAVORITES_ADD_TO_CART}from'@shopgate/engage/favorites';import{responsiveMediaQuery}from'@shopgate/engage/styles';import Price from'@shopgate/pwa-ui-shared/Price';import PriceStriked from'@shopgate/pwa-ui-shared/PriceStriked';import AddToCart from'@shopgate/pwa-ui-shared/AddToCartButton';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{updateFavorite}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';import{openFavoritesCommentDialog}from'@shopgate/pwa-common-commerce/favorites/action-creators';import classNames from'classnames';import Remove from"../RemoveButton";import ItemCharacteristics from"./ItemCharacteristics";import ItemQuantity from"./ItemQuantity";import ItemNotes from"./ItemNotes";import{FAVORITES_LIST_ITEM,FAVORITES_NOTES,FAVORITES_QUANTITY}from"../../constants/Portals";var variables=themeConfig.variables;/**
|
|
2
2
|
* @return {Function} The extended component props.
|
|
3
|
-
*/var makeMapStateToProps=function makeMapStateToProps(){var isRopeProductOrderable=makeIsRopeProductOrderable(function(state,props){var _getPreferredLocation;return(_getPreferredLocation=getPreferredLocation(state,props))===null||_getPreferredLocation===void 0?void 0:_getPreferredLocation.code;},function(state,props){return props.variantId||props.productId||null;});return function(state,props){return{isBaseProduct:isBaseProductSelector(state,props),hasVariants:hasProductVariants(state,props),isOrderable:isProductOrderable(state,props),isRopeProductOrderable:isRopeProductOrderable(state,props)};};}
|
|
3
|
+
*/var makeMapStateToProps=function makeMapStateToProps(){var isRopeProductOrderable=makeIsRopeProductOrderable(function(state,props){var _getPreferredLocation;return(_getPreferredLocation=getPreferredLocation(state,props))===null||_getPreferredLocation===void 0?void 0:_getPreferredLocation.code;},function(state,props){return props.variantId||props.productId||null;});return function(state,props){return{isBaseProduct:isBaseProductSelector(state,props),hasVariants:hasProductVariants(state,props),isOrderable:isProductOrderable(state,props),isRopeProductOrderable:isRopeProductOrderable(state,props)};};};/**
|
|
4
|
+
* @param {Function} dispatch Dispatch.
|
|
5
|
+
* @returns {Object}
|
|
6
|
+
*/var mapDispatchToProps=function mapDispatchToProps(dispatch){return{showModal:showModalAction,historyPush:historyPushAction,updateFavoriteItem:function updateFavoriteItem(productId,listId,quantity,notes){dispatch(updateFavorite(productId,listId,quantity,notes));},openCommentDialog:function openCommentDialog(productId,listId){return dispatch(openFavoritesCommentDialog(productId,listId));}};};var styles={root:css({display:'flex',position:'relative','&:not(:last-child)':{marginBottom:16}}).toString(),imageContainer:css((_css={flex:0.4,marginRight:18},_defineProperty(_css,responsiveMediaQuery('>=xs',{appAlways:true}),{maxWidth:120,minWidth:80}),_defineProperty(_css,responsiveMediaQuery('>=md',{webOnly:true}),{maxWidth:120,minWidth:80}),_defineProperty(_css,responsiveMediaQuery('>=md',{webOnly:true}),{width:120,flex:'none'}),_css)).toString(),infoContainer:css({flex:1,display:'flex',flexDirection:'column',flexWrap:'wrap',gap:8}).toString(),infoContainerRow:css({flexDirection:'row',display:'flex',justifyContent:'space-between'}).toString(),quantityContainer:css({flexDirection:'row',display:'flex',alignItems:'center',flexWrap:'wrap',gap:16}).toString(),priceContainer:css({minWidth:100}).toString(),priceInfo:css({wordBreak:'break-word',fontSize:'0.875rem',lineHeight:'0.875rem',color:'var(--color-text-low-emphasis)',padding:"".concat(variables.gap.xsmall,"px 0")}).toString(),titleWrapper:css({display:'flex',flexDirection:'column',gap:8}).toString(),titleContainer:css({marginRight:10,flex:1}).toString(),title:css({fontSize:17,color:'var(--color-secondary)',fontWeight:600}).toString(),removeContainer:css({display:'flex',flexShrink:0,alignItems:'flex-start'})};/**
|
|
4
7
|
* Favorite Item component
|
|
5
8
|
* @return {JSX}
|
|
6
|
-
*/var FavoriteItem=function FavoriteItem(_ref){var _product$price,_product$price2,_product$price3;var listId=_ref.listId,product=_ref.product,remove=_ref.remove,addToCart=_ref.addToCart,isBaseProduct=_ref.isBaseProduct,isOrderable=_ref.isOrderable,isRopeProductOrderable=_ref.isRopeProductOrderable,hasVariants=_ref.hasVariants,showModal=_ref.showModal,historyPush=_ref.historyPush;var _ref2=getThemeSettings('AppImages')||{},gridResolutions=_ref2.ListImage;var _useState=useState(!isOrderable&&!hasVariants),_useState2=_slicedToArray(_useState,2),isDisabled=_useState2[0],setIsDisabled=_useState2[1];var currency=((_product$price=product.price)===null||_product$price===void 0?void 0:_product$price.currency)||'EUR';var defaultPrice=((_product$price2=product.price)===null||_product$price2===void 0?void 0:_product$price2.unitPrice)||0;var specialPrice=(_product$price3=product.price)===null||_product$price3===void 0?void 0:_product$price3.unitPriceStriked;var hasStrikePrice=typeof specialPrice==='number'&&specialPrice!==defaultPrice;var price=hasStrikePrice?specialPrice:defaultPrice;var characteristics=(product===null||product===void 0?void 0:product.characteristics)||[];var productLink="".concat(ITEM_PATH,"/").concat(bin2hex(product.id));useLayoutEffect(function(){setIsDisabled(!isOrderable&&!hasVariants);},[hasVariants,isOrderable]);var handleAddToCart=useCallback(function(e){e.preventDefault();e.stopPropagation();if(isBaseProduct&&hasVariants){// Called for a parent product.
|
|
9
|
+
*/var FavoriteItem=function FavoriteItem(_ref){var _product$price,_product$price2,_product$price3;var listId=_ref.listId,product=_ref.product,notes=_ref.notes,quantity=_ref.quantity,remove=_ref.remove,addToCart=_ref.addToCart,isBaseProduct=_ref.isBaseProduct,isOrderable=_ref.isOrderable,isRopeProductOrderable=_ref.isRopeProductOrderable,hasVariants=_ref.hasVariants,showModal=_ref.showModal,historyPush=_ref.historyPush,updateFavoriteItem=_ref.updateFavoriteItem,openCommentDialog=_ref.openCommentDialog;var _ref2=getThemeSettings('AppImages')||{},gridResolutions=_ref2.ListImage;var _useState=useState(!isOrderable&&!hasVariants),_useState2=_slicedToArray(_useState,2),isDisabled=_useState2[0],setIsDisabled=_useState2[1];var currency=((_product$price=product.price)===null||_product$price===void 0?void 0:_product$price.currency)||'EUR';var defaultPrice=((_product$price2=product.price)===null||_product$price2===void 0?void 0:_product$price2.unitPrice)||0;var specialPrice=(_product$price3=product.price)===null||_product$price3===void 0?void 0:_product$price3.unitPriceStriked;var hasStrikePrice=typeof specialPrice==='number'&&specialPrice!==defaultPrice;var price=hasStrikePrice?specialPrice:defaultPrice;var characteristics=(product===null||product===void 0?void 0:product.characteristics)||[];var productLink="".concat(ITEM_PATH,"/").concat(bin2hex(product.id));var _useState3=useState(quantity),_useState4=_slicedToArray(_useState3,2),internalQuantity=_useState4[0],setInternalQuantity=_useState4[1];useEffect(function(){setInternalQuantity(quantity);},[quantity]);useLayoutEffect(function(){setIsDisabled(!isOrderable&&!hasVariants);},[hasVariants,isOrderable]);var handleOpenComment=useCallback(function(e){e.preventDefault();e.stopPropagation();openCommentDialog(product.id,listId);},[listId,openCommentDialog,product.id]);var handleAddToCart=useCallback(function(e){e.preventDefault();e.stopPropagation();if(isBaseProduct&&hasVariants){// Called for a parent product. User needs to confirm the navigation to the PDP
|
|
7
10
|
showModal({title:null,type:MODAL_VARIANT_SELECT,message:'favorites.modal.message',confirm:'favorites.modal.confirm',dismiss:'common.cancel',params:{productId:product.id}});return false;}if(!isRopeProductOrderable){// Product is not orderable for ROPE. So users need to do some corrections. Just redirect.
|
|
8
|
-
historyPush({pathname:productLink});return false;}return addToCart(e);},[addToCart,hasVariants,historyPush,isBaseProduct,isRopeProductOrderable,product.id,productLink,showModal]);var commonPortalProps=useMemo(function(){var availability=product.availability,id=product.id,name=product.name;return{availability:availability,characteristics:characteristics,id:id,name:name,price:price,listId:listId};},[characteristics,listId,price,product]);var ctaPortalProps=useMemo(function(){return{isLoading:false,noShadow:false,listId:listId,isBaseProduct:isBaseProduct,isDisabled:isDisabled,productId:product.id,handleRemoveFromCart:remove,handleAddToCart:handleAddToCart};},[handleAddToCart,isBaseProduct,isDisabled,listId,product.id,remove]);return React.createElement(SurroundPortals,{portalName:FAVORITES_LIST_ITEM,portalProps:product},React.createElement("div",{className:styles.root},React.createElement(Link,{className:styles.imageContainer,component:"div",href:productLink},React.createElement(ProductImage,{src:product.featuredImageBaseUrl,resolutions:gridResolutions})),React.createElement(
|
|
11
|
+
historyPush({pathname:productLink});return false;}return addToCart(e);},[addToCart,hasVariants,historyPush,isBaseProduct,isRopeProductOrderable,product.id,productLink,showModal]);var commonPortalProps=useMemo(function(){var availability=product.availability,id=product.id,name=product.name;return{availability:availability,characteristics:characteristics,id:id,name:name,price:price,listId:listId};},[characteristics,listId,price,product]);var ctaPortalProps=useMemo(function(){return{isLoading:false,noShadow:false,listId:listId,isBaseProduct:isBaseProduct,isDisabled:isDisabled,productId:product.id,handleRemoveFromCart:remove,handleAddToCart:handleAddToCart};},[handleAddToCart,isBaseProduct,isDisabled,listId,product.id,remove]);var handleChangeQuantity=useCallback(function(newQuantity){updateFavoriteItem(product.id,listId,newQuantity,notes);},[listId,notes,product.id,updateFavoriteItem]);var handleDeleteComment=useCallback(function(event){event.preventDefault();event.stopPropagation();updateFavoriteItem(product.id,listId,quantity,'');},[listId,product.id,quantity,updateFavoriteItem]);return React.createElement(SurroundPortals,{portalName:FAVORITES_LIST_ITEM,portalProps:product},React.createElement("div",{className:styles.root},React.createElement(Link,{className:styles.imageContainer,component:"div",href:productLink},React.createElement(ProductImage,{src:product.featuredImageBaseUrl,resolutions:gridResolutions})),React.createElement("div",{className:styles.infoContainer},React.createElement("div",{className:classNames(styles.infoContainerRow)},React.createElement("div",{className:styles.titleWrapper},React.createElement(SurroundPortals,{portalName:FAVORITES_PRODUCT_NAME,portalProps:commonPortalProps},React.createElement(Link,{href:productLink,tag:"span",className:styles.titleContainer},React.createElement("span",{className:styles.title// eslint-disable-next-line react/no-danger
|
|
12
|
+
,dangerouslySetInnerHTML:{__html:"".concat(product.name)}})))),React.createElement("div",{className:styles.removeContainer},React.createElement(Remove,{onClick:remove}))),React.createElement(ItemCharacteristics,{characteristics:characteristics}),React.createElement(StockInfoLists,{product:product}),React.createElement("div",{className:styles.infoContainerRow},React.createElement("div",{className:styles.quantityContainer},React.createElement(SurroundPortals,{portalName:FAVORITES_QUANTITY,portalProps:commonPortalProps},React.createElement(ItemQuantity,{quantity:internalQuantity,onChange:handleChangeQuantity})),React.createElement(SurroundPortals,{portalName:FAVORITES_PRODUCT_PRICE,portalProps:commonPortalProps},React.createElement("div",{className:styles.priceContainer},hasStrikePrice?React.createElement(PriceStriked,{value:defaultPrice,currency:currency}):null,React.createElement(Price,{currency:currency,discounted:hasStrikePrice,taxDisclaimer:true,unitPrice:price}),React.createElement(PriceInfo,{product:product,currency:currency,className:styles.priceInfo})))),React.createElement(SurroundPortals,{portalName:FAVORITES_ADD_TO_CART,portalProps:ctaPortalProps},React.createElement(AddToCart,{onClick:handleAddToCart,isLoading:false,isDisabled:isDisabled,"aria-label":i18n.text('product.add_to_cart')}))),React.createElement(SurroundPortals,{portalName:FAVORITES_NOTES,portalProps:commonPortalProps},React.createElement(ItemNotes,{notes:notes,onClickDeleteComment:handleDeleteComment,onClickOpenComment:handleOpenComment})))));};FavoriteItem.defaultProps={isBaseProduct:true,isOrderable:true,isRopeProductOrderable:true,hasVariants:false,notes:undefined,quantity:1};export default connect(makeMapStateToProps,mapDispatchToProps)(FavoriteItem);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from'react';import PropTypes from'prop-types';import{css}from'glamor';var styles={property:css({fontSize:14,color:'var(--color-text-
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{css}from'glamor';var styles={property:css({fontSize:14,color:'var(--color-text-medium-emphasis)',fontWeight:400,whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis'})};/**
|
|
2
2
|
* @param {Object} props The component props
|
|
3
3
|
* @returns {JSX}
|
|
4
4
|
*/var ItemCharacteristics=function ItemCharacteristics(_ref){var characteristics=_ref.characteristics;if(!characteristics||characteristics.length===0){return null;}return React.createElement("ul",null,characteristics.map(function(_ref2){var label=_ref2.label,value=_ref2.value;return React.createElement("li",{key:"".concat(label,"-").concat(value),className:styles.property},label,': ',value);}));};ItemCharacteristics.defaultProps={characteristics:null};export default ItemCharacteristics;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{css}from'glamor';import{connect}from'react-redux';import{i18n}from'@shopgate/engage/core';import{getWishlistItemNotesEnabled}from"../../../core/selectors/shopSettings";var styles={root:css({display:'flex',flexWrap:'wrap',alignItems:'center'}),addCommentButton:css({fontSize:17,color:'var(--color-secondary)',fontWeight:500,whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis',paddingLeft:0,paddingRight:0,textAlign:'left'}),comment:css({fontSize:17,color:'var(--color-text-high-emphasis)',fontWeight:500,whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis'}),notes:css({paddingRight:4,fontStyle:'italic'}),buttons:css({whiteSpace:'nowrap'})};/**
|
|
2
|
+
* @return {Function} The extended component props.
|
|
3
|
+
*/var makeMapStateToProps=function makeMapStateToProps(){return function(state){return{wishlistItemNotesEnabled:getWishlistItemNotesEnabled(state)};};};/**
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} props The component props
|
|
6
|
+
* @returns {JSX}
|
|
7
|
+
*/var ItemNotes=function ItemNotes(_ref){var wishlistItemNotesEnabled=_ref.wishlistItemNotesEnabled,notes=_ref.notes,onClickOpenComment=_ref.onClickOpenComment,onClickDeleteComment=_ref.onClickDeleteComment;if(!wishlistItemNotesEnabled){return null;}return React.createElement(React.Fragment,null,notes?React.createElement("div",{className:styles.root},React.createElement("span",{className:styles.comment},"".concat(i18n.text('favorites.comments.notes'),": ")),React.createElement("span",{className:styles.notes},"\"".concat(notes,"\"")),React.createElement("span",{className:styles.buttons},React.createElement("button",{type:"button",onClick:onClickOpenComment,className:styles.addCommentButton},i18n.text('favorites.comments.edit')),' | ',React.createElement("button",{type:"button",onClick:onClickDeleteComment,className:styles.addCommentButton},i18n.text('favorites.comments.delete')))):React.createElement("button",{type:"button",onClick:onClickOpenComment,className:styles.addCommentButton},i18n.text('favorites.comments.add')));};ItemNotes.defaultProps={notes:null};export default connect(makeMapStateToProps)(ItemNotes);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useState,useCallback}from'react';import PropTypes from'prop-types';import{css}from'glamor';import{connect}from'react-redux';import{getWishlistItemQuantityEnabled}from"../../../core/selectors/shopSettings";import UnitQuantityPicker from"../../../product/components/UnitQuantityPicker/UnitQuantityPicker";var styles={root:css({width:120})};/**
|
|
2
|
+
* @return {Function} The extended component props.
|
|
3
|
+
*/var makeMapStateToProps=function makeMapStateToProps(){return function(state){return{wishlistItemQuantityEnabled:getWishlistItemQuantityEnabled(state)};};};/**
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} props The component props
|
|
6
|
+
* @returns {JSX}
|
|
7
|
+
*/var ItemQuantity=function ItemQuantity(_ref){var wishlistItemQuantityEnabled=_ref.wishlistItemQuantityEnabled,quantity=_ref.quantity,onChange=_ref.onChange;var _useState=useState(quantity),_useState2=_slicedToArray(_useState,2),internalQuantity=_useState2[0],setInternalQuantity=_useState2[1];var handleChange=useCallback(function(newQuantity){setInternalQuantity(newQuantity);onChange(newQuantity);},[onChange]);if(!wishlistItemQuantityEnabled){return null;}return React.createElement("div",{className:styles.root},React.createElement(UnitQuantityPicker,{maxValue:99,maxDecimals:0,incrementStep:1,decrementStep:1,onChange:handleChange,value:internalQuantity}));};export default connect(makeMapStateToProps)(ItemQuantity);
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import React,{Fragment}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{i18n}from'@shopgate/engage/core';import{Accordion,Card,ContextMenu,SurroundPortals}from'@shopgate/engage/components';import{makeGetFavorites}from'@shopgate/pwa-common-commerce/favorites/selectors';import{FAVORITES_LIST_CONTEXT_MENU}from"../../constants/Portals";import Item from"../Item";var styles={root:css({margin:'8px 8px 10px'}).toString(),title:css({flex:1}).toString(),divider:css({height:1,width:'calc(100% + 32px)',backgroundColor:'rgb(234, 234, 234)',marginLeft:-16,marginRight:-16,marginBottom:16}).toString()};/**
|
|
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 React,{Fragment}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{i18n,showModal}from'@shopgate/engage/core';import{Accordion,Card,ContextMenu,SurroundPortals}from'@shopgate/engage/components';import{makeGetFavorites}from'@shopgate/pwa-common-commerce/favorites/selectors';import{FAVORITES_LIST_CONTEXT_MENU}from"../../constants/Portals";import Item from"../Item";var styles={root:css({margin:'8px 8px 10px'}).toString(),title:css({flex:1}).toString(),divider:css({height:1,width:'calc(100% + 32px)',backgroundColor:'rgb(234, 234, 234)',marginLeft:-16,marginRight:-16,marginBottom:16}).toString()};/**
|
|
2
2
|
* Favorite List Label component
|
|
3
3
|
* @return {JSX}
|
|
4
4
|
*/var FavoriteListLabel=function FavoriteListLabel(_ref){var id=_ref.id,title=_ref.title,rename=_ref.rename,remove=_ref.remove;return React.createElement(Fragment,null,React.createElement("span",{className:styles.title},title),React.createElement(SurroundPortals,{portalName:FAVORITES_LIST_CONTEXT_MENU,portalProps:{id:id}},React.createElement(ContextMenu,null,React.createElement(ContextMenu.Item,{onClick:rename},i18n.text('favorites.rename_list')),React.createElement(ContextMenu.Item,{onClick:remove,disabled:id==='DEFAULT'},i18n.text('favorites.remove_list')))));};/**
|
|
5
5
|
* @param {Object} _ State
|
|
6
6
|
* @param {Object} props Props
|
|
7
7
|
* @returns {Object}
|
|
8
|
-
*/var makeMapStateToProps=function makeMapStateToProps(_,_ref2){var id=_ref2.id;var getFavorites=makeGetFavorites(function(){return id;});return function(state){return{
|
|
8
|
+
*/var makeMapStateToProps=function makeMapStateToProps(_,_ref2){var id=_ref2.id;var getFavorites=makeGetFavorites(function(){return id;});return function(state){return{items:getFavorites(state)};};};/**
|
|
9
|
+
* @param {Object} dispatch Dispatch
|
|
10
|
+
* @param {Object} props The component props
|
|
11
|
+
* @returns {Object}
|
|
12
|
+
*/var mapDispatchToProps=function mapDispatchToProps(dispatch,props){return{remove:function(){var _remove=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(id){var confirmed;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return dispatch(showModal({message:'favorites.delete_list_modal.message',title:'favorites.delete_list_modal.title',params:{name:props.name}}));case 2:confirmed=_context.sent;if(confirmed){props.remove(id);}case 4:case"end":return _context.stop();}}},_callee);}));function remove(_x){return _remove.apply(this,arguments);}return remove;}()};};/**
|
|
9
13
|
* Favorite List component
|
|
10
14
|
* @return {JSX}
|
|
11
|
-
*/var FavoriteList=function FavoriteList(_ref3){var id=_ref3.id,name=_ref3.name,
|
|
15
|
+
*/var FavoriteList=function FavoriteList(_ref3){var id=_ref3.id,name=_ref3.name,items=_ref3.items,_rename=_ref3.rename,remove=_ref3.remove,removeItem=_ref3.removeItem,_addToCart=_ref3.addToCart;return React.createElement(Card,{className:styles.root},React.createElement(Accordion,{className:"",openWithChevron:true,renderLabel:function renderLabel(){return React.createElement(FavoriteListLabel,{id:id,title:name,rename:function rename(newName){return _rename(id,newName);},remove:remove});},chevronPosition:"left",startOpened:true},React.createElement("div",{className:styles.divider}),items.length===0?React.createElement("span",null,i18n.text('favorites.empty')):null,items.filter(function(_ref4){var product=_ref4.product;return product;}).map(function(_ref5,index){var product=_ref5.product,notes=_ref5.notes,quantity=_ref5.quantity;return React.createElement("div",{key:product.id},React.createElement(Item,{product:product,notes:notes,quantity:quantity,listId:id,productId:product.id,addToCart:function addToCart(e){e.preventDefault();e.stopPropagation();return _addToCart(product,quantity);},remove:function remove(e){e.preventDefault();e.stopPropagation();removeItem(product.id);}}),index===items.length-1?null:React.createElement("div",{className:styles.divider}));})));};export default connect(makeMapStateToProps,mapDispatchToProps)(FavoriteList);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{makeIsProductOnSpecificFavoriteList}from'@shopgate/pwa-common-commerce/favorites/selectors';import{i18n}from'@shopgate/engage/core';/**
|
|
2
|
-
* @param {Object} state State.
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{makeIsProductOnSpecificFavoriteList}from'@shopgate/pwa-common-commerce/favorites/selectors';import{i18n}from'@shopgate/engage/core';import{getWishlistItemQuantityEnabled}from"../../../core/selectors/shopSettings";/**
|
|
3
2
|
* @returns {Object}
|
|
4
|
-
*/var makeMapStateToProps=function makeMapStateToProps(){var getIsOnList=makeIsProductOnSpecificFavoriteList(function(_,props){return props.productId;},function(_,props){return props.listId;});return function(state,props){return{isOnList:getIsOnList(state,props)};};};var styles={remove:css({color:'var(--color-state-alert)'}).toString(),add:css({color:'var(--color-state-ok)'}).toString()};/**
|
|
3
|
+
*/var makeMapStateToProps=function makeMapStateToProps(){var getIsOnList=makeIsProductOnSpecificFavoriteList(function(_,props){return props.productId;},function(_,props){return props.listId;});return function(state,props){return{isOnList:getIsOnList(state,props),wishlistItemQuantityEnabled:getWishlistItemQuantityEnabled(state)};};};var styles={remove:css({color:'var(--color-state-alert)'}).toString(),add:css({color:'var(--color-state-ok)',whiteSpace:'noWrap'}).toString()};/**
|
|
5
4
|
* @param {Object} props Props.
|
|
6
|
-
* @returns {JSX}
|
|
7
|
-
*/var ListChooserItem=function ListChooserItem(_ref){var isOnList=_ref.isOnList;return isOnList
|
|
5
|
+
* @returns {JSX.Element}
|
|
6
|
+
*/var ListChooserItem=function ListChooserItem(_ref){var isOnList=_ref.isOnList,wishlistItemQuantityEnabled=_ref.wishlistItemQuantityEnabled;if(wishlistItemQuantityEnabled&&isOnList){return React.createElement("span",{className:styles.add},i18n.text('favorites.list_chooser.add_more'));}if(isOnList){return React.createElement("span",{className:styles.remove},i18n.text('favorites.list_chooser.remove'));}return React.createElement("span",{className:styles.add},i18n.text('favorites.list_chooser.add'));};export default connect(makeMapStateToProps)(ListChooserItem);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useState,useCallback,useRef}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{RippleButton,SurroundPortals}from'@shopgate/engage/components';import{i18n,configuration,IS_CONNECT_EXTENSION_ATTACHED}from'@shopgate/engage/core';import{getFavoritesLists,isInitialLoading}from'@shopgate/pwa-common-commerce/favorites/selectors';import addFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/addFavoritesList';import updateFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/updateFavoritesList';import removeFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/removeFavoritesList';import{removeFavorites}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';import addProductsToCart from'@shopgate/pwa-common-commerce/cart/actions/addProductsToCart';import{FulfillmentSheet,MULTI_LINE_RESERVE,STAGE_SELECT_STORE}from'@shopgate/engage/locations';import{openSheet}from'@shopgate/engage/locations/providers/FulfillmentProvider';import{getWishlistMode}from'@shopgate/engage/core/selectors/shopSettings';import{WISHLIST_MODE_PERSIST_ON_ADD}from'@shopgate/engage/core/constants/shopSettings';import{getPreferredLocation,getPreferredFulfillmentMethod,getUserSearch}from'@shopgate/engage/locations/selectors';import{responsiveMediaQuery}from'@shopgate/engage/styles';import{makeGetEnabledFulfillmentMethods}from'@shopgate/engage/core/config';import{fetchProductLocations}from'@shopgate/engage/locations/actions';import List from"../List";import ListsModal from"./ListsModal";import ItemFulfillmentMethod from"../ItemFulfillmentMethod";import{FAVORITES_LIST_ADD_BUTTON,FAVORITES_LIST}from"../../constants/Portals";/**
|
|
1
|
+
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useState,useCallback,useRef}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{RippleButton,SurroundPortals}from'@shopgate/engage/components';import{i18n,configuration,IS_CONNECT_EXTENSION_ATTACHED}from'@shopgate/engage/core';import{getFavoritesLists,isInitialLoading}from'@shopgate/pwa-common-commerce/favorites/selectors';import addFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/addFavoritesList';import updateFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/updateFavoritesList';import removeFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/removeFavoritesList';import{removeFavorites}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';import addProductsToCart from'@shopgate/pwa-common-commerce/cart/actions/addProductsToCart';import{FulfillmentSheet,MULTI_LINE_RESERVE,STAGE_SELECT_STORE}from'@shopgate/engage/locations';import{openSheet}from'@shopgate/engage/locations/providers/FulfillmentProvider';import{getWishlistMode}from'@shopgate/engage/core/selectors/shopSettings';import{WISHLIST_MODE_PERSIST_ON_ADD}from'@shopgate/engage/core/constants/shopSettings';import{getPreferredLocation,getPreferredFulfillmentMethod,getUserSearch}from'@shopgate/engage/locations/selectors';import{responsiveMediaQuery}from'@shopgate/engage/styles';import{makeGetEnabledFulfillmentMethods}from'@shopgate/engage/core/config';import{fetchProductLocations}from'@shopgate/engage/locations/actions';import List from"../List";import ListsModal from"./ListsModal";import CommentDialog from"../CommentDialog";import ItemFulfillmentMethod from"../ItemFulfillmentMethod";import{FAVORITES_LIST_ADD_BUTTON,FAVORITES_LIST}from"../../constants/Portals";/**
|
|
2
2
|
* @param {Object} state State
|
|
3
3
|
* @param {Object} props Props
|
|
4
4
|
* @returns {Object}
|
|
@@ -13,13 +13,13 @@ var promiseRef=useRef(null);var _useState=useState(null),_useState2=_slicedToArr
|
|
|
13
13
|
setFOMethodChooser(false);// Handle cancellation.
|
|
14
14
|
if(!method){return;}setFulfillmentMethod(method);// Direct ship.
|
|
15
15
|
if(method==='directShip'){addToCart([{productId:activeProductId,quantity:1}]);promiseRef.current.resolve();return;}// Open the sheet
|
|
16
|
-
fetchLocations(activeProductId,userSearch);setTimeout(function(){openSheet({callback:function callback(state){var _promiseRef$current2;if(state){var _promiseRef$current;return(_promiseRef$current=promiseRef.current)===null||_promiseRef$current===void 0?void 0:_promiseRef$current.resolve();}return(_promiseRef$current2=promiseRef.current)===null||_promiseRef$current2===void 0?void 0:_promiseRef$current2.reject();},fulfillmentPath:MULTI_LINE_RESERVE,stage:STAGE_SELECT_STORE});},10);},[activeProductId,addToCart,fetchLocations,userSearch]);var handleAddToCart=useCallback(function(listId,product){
|
|
16
|
+
fetchLocations(activeProductId,userSearch);setTimeout(function(){openSheet({callback:function callback(state){var _promiseRef$current2;if(state){var _promiseRef$current;return(_promiseRef$current=promiseRef.current)===null||_promiseRef$current===void 0?void 0:_promiseRef$current.resolve();}return(_promiseRef$current2=promiseRef.current)===null||_promiseRef$current2===void 0?void 0:_promiseRef$current2.reject();},fulfillmentPath:MULTI_LINE_RESERVE,stage:STAGE_SELECT_STORE});},10);},[activeProductId,addToCart,fetchLocations,userSearch]);var handleAddToCart=useCallback(function(listId,product){var quantity=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;// Create promise to inform add to cart button when ready.
|
|
17
17
|
var promise=new Promise(function(_resolve,reject){promiseRef.current={resolve:function resolve(){// Remove item from wishlist after adding to cart.
|
|
18
18
|
if(wishlistMode!==WISHLIST_MODE_PERSIST_ON_ADD){_removeItem(listId,product.id);}_resolve();},reject:reject};});// Get location.
|
|
19
19
|
var activeLocation=null;if(preferredLocation){activeLocation=preferredLocation;}// Get fulfillment method that is both active for location and product.
|
|
20
20
|
var activeFulfillmentMethod=preferredFulfillmentMethod||fulfillmentMethod;var availableFulfillmentMethods=(shopFulfillmentMethods===null||shopFulfillmentMethods===void 0?void 0:shopFulfillmentMethods.filter(function(s){return product.fulfillmentMethods.indexOf(s)!==-1;}))||[];if(activeLocation&&!activeFulfillmentMethod&&availableFulfillmentMethods.length===1){var _availableFulfillment=_slicedToArray(availableFulfillmentMethods,1);activeFulfillmentMethod=_availableFulfillment[0];}// If all options are already configured immediately add it to the cart.
|
|
21
|
-
if(activeFulfillmentMethod&&activeLocation){addToCart([{productId:product.id,quantity:
|
|
21
|
+
if(activeFulfillmentMethod&&activeLocation){addToCart([{productId:product.id,quantity:quantity,fulfillment:{method:activeFulfillmentMethod,location:{code:activeLocation.code,name:activeLocation.name||''}}}]);promiseRef.current.resolve();return promise;}// Location not set but FO method is set.
|
|
22
22
|
setActiveProductId(product.id);if(activeFulfillmentMethod&&!activeLocation){handleAddToCartWithMethod(activeFulfillmentMethod);return promise;}if(!activeFulfillmentMethod&&!activeFulfillmentMethod){// Long path is required <- fo method and location unset.
|
|
23
23
|
setFulfillmentMethods(shopFulfillmentMethods);setFOMethodChooser(true);return promise;}// Short path is required <- fo method is unset.
|
|
24
24
|
setFulfillmentMethods(availableFulfillmentMethods);setFOMethodChooser(true);return promise;},[addToCart,fulfillmentMethod,handleAddToCartWithMethod,preferredFulfillmentMethod,preferredLocation,_removeItem,shopFulfillmentMethods,wishlistMode]);var handleMethodClose=useCallback(function(){setFOMethodChooser(false);promiseRef.current.reject();},[]);// Modal for renaming and adding.
|
|
25
|
-
var _useState9=useState(false),_useState10=_slicedToArray(_useState9,2),modalOpen=_useState10[0],setModalOpen=_useState10[1];var _useState11=useState(null),_useState12=_slicedToArray(_useState11,2),modalType=_useState12[0],setModalType=_useState12[1];var _useState13=useState(null),_useState14=_slicedToArray(_useState13,2),modalTarget=_useState14[0],setModalTarget=_useState14[1];var openAddModal=useCallback(function(){setModalOpen(true);setModalType('add_list');setModalTarget(null);},[]);var openRenameModal=useCallback(function(code){setModalOpen(true);setModalType('rename_list');setModalTarget(code);},[]);var closeModal=useCallback(function(){setModalOpen(false);setModalType(null);setModalTarget(null);},[]);var confirmModal=useCallback(function(name){if(modalType==='add_list'){addList(name);}else if(modalType==='rename_list'){updateList(modalTarget,name);}closeModal();},[addList,closeModal,modalTarget,modalType,updateList]);if(isInitializing){return null;}return React.createElement("div",{className:styles.root},lists.map(function(list){return React.createElement(SurroundPortals,{key:list.id,portalName:FAVORITES_LIST,portalProps:list},React.createElement(List,{id:list.id,name:list.name,rename:openRenameModal,remove:function remove(){return removeList(list.id);},removeItem:function removeItem(productId){return _removeItem(list.id,productId);},addToCart:function addToCart(product){return handleAddToCart(list.id,product);}}));}),modalOpen?React.createElement(ListsModal,{type:modalType,onDismiss:closeModal,onConfirm:confirmModal}):null,activeProductId?React.createElement(FulfillmentSheet,{productId:activeProductId,fulfillmentMethod:fulfillmentMethod}):null,React.createElement(ItemFulfillmentMethod,{isOpen:foMethodChooser,methods:fulfillmentMethods,onSelect:handleAddToCartWithMethod,onClose:handleMethodClose}),React.createElement(SurroundPortals,{portalName:FAVORITES_LIST_ADD_BUTTON},hasConnectExtension?React.createElement(RippleButton,{type:"primary",className:styles.addButton,onClick:openAddModal,disabled:false},i18n.text('favorites.add_list')):null));};FavoriteLists.defaultProps={lists:[],userSearch:{},preferredFulfillmentMethod:null,preferredLocation:null,isInitializing:true};export default connect(makeMapStateToProps,mapDispatchToProps)(FavoriteLists);
|
|
25
|
+
var _useState9=useState(false),_useState10=_slicedToArray(_useState9,2),modalOpen=_useState10[0],setModalOpen=_useState10[1];var _useState11=useState(null),_useState12=_slicedToArray(_useState11,2),modalType=_useState12[0],setModalType=_useState12[1];var _useState13=useState(null),_useState14=_slicedToArray(_useState13,2),modalTarget=_useState14[0],setModalTarget=_useState14[1];var openAddModal=useCallback(function(){setModalOpen(true);setModalType('add_list');setModalTarget(null);},[]);var openRenameModal=useCallback(function(code){setModalOpen(true);setModalType('rename_list');setModalTarget(code);},[]);var closeModal=useCallback(function(){setModalOpen(false);setModalType(null);setModalTarget(null);},[]);var confirmModal=useCallback(function(name){if(modalType==='add_list'){addList(name);}else if(modalType==='rename_list'){updateList(modalTarget,name);}closeModal();},[addList,closeModal,modalTarget,modalType,updateList]);if(isInitializing){return null;}return React.createElement("div",{className:styles.root},lists.map(function(list){return React.createElement(SurroundPortals,{key:list.id,portalName:FAVORITES_LIST,portalProps:list},React.createElement(List,{id:list.id,name:list.name,rename:openRenameModal,remove:function remove(){return removeList(list.id);},removeItem:function removeItem(productId){return _removeItem(list.id,productId);},addToCart:function addToCart(product,quantity){return handleAddToCart(list.id,product,quantity);}}));}),modalOpen?React.createElement(ListsModal,{type:modalType,onDismiss:closeModal,onConfirm:confirmModal}):null,activeProductId?React.createElement(FulfillmentSheet,{productId:activeProductId,fulfillmentMethod:fulfillmentMethod}):null,React.createElement(CommentDialog,null),React.createElement(ItemFulfillmentMethod,{isOpen:foMethodChooser,methods:fulfillmentMethods,onSelect:handleAddToCartWithMethod,onClose:handleMethodClose}),React.createElement(SurroundPortals,{portalName:FAVORITES_LIST_ADD_BUTTON},hasConnectExtension?React.createElement(RippleButton,{type:"primary",className:styles.addButton,onClick:openAddModal,disabled:false},i18n.text('favorites.add_list')):null));};FavoriteLists.defaultProps={lists:[],userSearch:{},preferredFulfillmentMethod:null,preferredLocation:null,isInitializing:true};export default connect(makeMapStateToProps,mapDispatchToProps)(FavoriteLists);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useState,useCallback}from'react';import PropTypes from'prop-types';import{Dialog,TextField}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import{css}from'glamor';var styles={root:css({display:'flex',flexDirection:'column'})};/**
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useState,useCallback}from'react';import PropTypes from'prop-types';import{Dialog,TextField}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import{themeName}from'@shopgate/pwa-common/helpers/config';import{css}from'glamor';var isIos=themeName.includes('ios');var styles={root:css({display:'flex',flexDirection:'column'}),input:css({textAlign:'left',fontSize:'1rem'}).toString()};/**
|
|
2
2
|
* @param {Object} props Props
|
|
3
3
|
* @returns {Object}
|
|
4
|
-
*/var ListsModal=function ListsModal(_ref){var type=_ref.type,onConfirm=_ref.onConfirm,onDismiss=_ref.onDismiss;var _useState=useState(''),_useState2=_slicedToArray(_useState,2),input=_useState2[0],setInput=_useState2[1];var _useState3=useState(null),_useState4=_slicedToArray(_useState3,2),error=_useState4[0],setError=_useState4[1];var onConfirmWrapped=useCallback(function(){if(input.length===0){setError(i18n.text('favorites.errors.invalid_name'));return;}onConfirm(input);},[input,onConfirm]);var onChange=useCallback(function(value){setInput(value);},[]);return React.createElement(Dialog,{onConfirm:onConfirmWrapped,onDismiss:onDismiss,modal:{title:i18n.text("favorites.".concat(type,"_modal.title")),dismiss:i18n.text("favorites.".concat(type,"_modal.dismiss")),confirm:i18n.text("favorites.".concat(type,"_modal.confirm"))}},React.createElement("div",{className:styles.root},React.createElement("span",null,i18n.text("favorites.".concat(type,"_modal.message"))),React.createElement(TextField,{name:"name",label:i18n.text("favorites.".concat(type,"_modal.label")),onChange:onChange,value:input,errorText:error||undefined})));};export default ListsModal;
|
|
4
|
+
*/var ListsModal=function ListsModal(_ref){var type=_ref.type,onConfirm=_ref.onConfirm,onDismiss=_ref.onDismiss;var _useState=useState(''),_useState2=_slicedToArray(_useState,2),input=_useState2[0],setInput=_useState2[1];var _useState3=useState(null),_useState4=_slicedToArray(_useState3,2),error=_useState4[0],setError=_useState4[1];var onConfirmWrapped=useCallback(function(){if(input.length===0){setError(i18n.text('favorites.errors.invalid_name'));return;}onConfirm(input);},[input,onConfirm]);var onChange=useCallback(function(value){setInput(value);},[]);return React.createElement(Dialog,{onConfirm:onConfirmWrapped,onDismiss:onDismiss,modal:{title:i18n.text("favorites.".concat(type,"_modal.title")),dismiss:i18n.text("favorites.".concat(type,"_modal.dismiss")),confirm:i18n.text("favorites.".concat(type,"_modal.confirm"))}},React.createElement("div",{className:styles.root},React.createElement("span",null,i18n.text("favorites.".concat(type,"_modal.message"))),React.createElement(TextField,_extends({name:"name"},isIos?{placeholder:i18n.text("favorites.".concat(type,"_modal.label"))}:{label:i18n.text("favorites.".concat(type,"_modal.label"))},{onChange:onChange,value:input,errorText:error||undefined,className:styles.input}))));};export default ListsModal;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from'react';import PropTypes from'prop-types';import{css}from'glamor';import{i18n}from'@shopgate/engage/core';import{Ripple}from'@shopgate/engage/components';import
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{css}from'glamor';import{i18n}from'@shopgate/engage/core';import{Ripple}from'@shopgate/engage/components';import TrashOutlineIcon from'@shopgate/pwa-ui-shared/icons/TrashOutlineIcon';var styles={root:css({display:'flex',borderRadius:'50%',color:'var(--color-text-high-emphasis)',fontSize:'1.5rem',padding:'0 8px 8px 8px',lineHeight:1,outline:0,justifyContent:'center',alignItems:'center',marginRight:-1}).toString(),ripple:css({flexShrink:0}).toString()};/**
|
|
2
2
|
* The remove favorites button component.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/var RemoveButton=function RemoveButton(_ref){var onClick=_ref.onClick;return React.createElement("button",{className:styles.root,onClick:onClick,type:"button","aria-label":i18n.text('favorites.remove')},React.createElement(Ripple,
|
|
4
|
+
*/var RemoveButton=function RemoveButton(_ref){var onClick=_ref.onClick;return React.createElement("button",{className:styles.root,onClick:onClick,type:"button","aria-label":i18n.text('favorites.remove')},React.createElement(Ripple,{className:styles.ripple},React.createElement(TrashOutlineIcon,null)));};export default RemoveButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FAVORITES}from'@shopgate/pwa-common-commerce/favorites/constants/Portals';export var FAVORITES_LIST="".concat(FAVORITES,".list");export var FAVORITES_LIST_ADD_BUTTON="".concat(FAVORITES,".list-add-button");export var FAVORITES_LIST_CONTEXT_MENU="".concat(FAVORITES,".list-context-menu");export var
|
|
1
|
+
import{FAVORITES}from'@shopgate/pwa-common-commerce/favorites/constants/Portals';export var FAVORITES_LIST="".concat(FAVORITES,".list");export var FAVORITES_LIST_ADD_BUTTON="".concat(FAVORITES,".list-add-button");export var FAVORITES_LIST_CONTEXT_MENU="".concat(FAVORITES,".list-context-menu");export var FAVORITES_LIST_ITEM="".concat(FAVORITES,".list-item");export var FAVORITES_NOTES="".concat(FAVORITES,".notes");export var FAVORITES_QUANTITY="".concat(FAVORITES,".quantity");
|
package/favorites/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @module favorites */ // ACTIONS
|
|
2
|
-
export{default as fetchFavorites}from'@shopgate/pwa-common-commerce/favorites/actions/fetchFavorites';export{default as fetchFavoritesLists}from'@shopgate/pwa-common-commerce/favorites/actions/fetchFavoritesList';export{default as addFavoritesList}from'@shopgate/pwa-common-commerce/favorites/actions/addFavoritesList';export{addFavorite,removeFavorites,requestSync as toggleFavorites,toggleFavoriteWithListChooser,toggleFavorite}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';// CONSTANTS
|
|
2
|
+
export{default as fetchFavorites}from'@shopgate/pwa-common-commerce/favorites/actions/fetchFavorites';export{default as fetchFavoritesLists}from'@shopgate/pwa-common-commerce/favorites/actions/fetchFavoritesList';export{default as addFavoritesList}from'@shopgate/pwa-common-commerce/favorites/actions/addFavoritesList';export{addFavorite,removeFavorites,requestSync as toggleFavorites,toggleFavoriteWithListChooser,toggleFavorite}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';export{default as fetchFavoritesListsWithItems}from'@shopgate/pwa-common-commerce/favorites/actions/fetchFavoritesListsWithItems';// CONSTANTS
|
|
3
3
|
export*from'@shopgate/pwa-common-commerce/favorites/constants/index';export*from'@shopgate/pwa-common-commerce/favorites/constants/Pipelines';export*from'@shopgate/pwa-common-commerce/favorites/constants/Portals';export*from"./constants/Portals";// SELECTORS
|
|
4
4
|
export*from'@shopgate/pwa-common-commerce/favorites/selectors';// STREAMS
|
|
5
5
|
export*from'@shopgate/pwa-common-commerce/favorites/streams';
|
|
@@ -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 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{getProductsResult,productIsReady$,productsReceived$,productsReceivedCached$,RECEIVE_PRODUCTS_CACHED,variantDidChange$}from'@shopgate/engage/product';import{cartReceived$,fetchCart,cartDidEnter$,getCartItems}from'@shopgate/engage/cart';import{userDidLogin$}from'@shopgate/engage/user';import{appDidStart$,routeWillEnter$,UIEvents,getCurrentRoute,hex2bin,getThemeSettings,getCurrentSearchQuery}from'@shopgate/engage/core';import{receiveFavoritesWhileVisible$}from'@shopgate/pwa-common-commerce/favorites/streams';import{getFavoritesProductsIds}from'@shopgate/pwa-common-commerce/favorites/selectors';import{categoryDidBackEnter$}from'@shopgate/pwa-common-commerce/category/streams';import{searchDidBackEntered$}from'@shopgate/pwa-common-commerce/search/streams';import{getUserSearch,getStoreFinderSearch,getPreferredLocation,getIsPending,getProductAlternativeLocationParams,getProductAlternativeLocations}from"./selectors";import{fetchLocations,fetchProductLocations,setPending,setUserGeolocation}from"./actions";import{setShowInventoryInLists,showInventoryInLists}from"./helpers/showInventoryInLists";import fetchInventories from"./actions/fetchInventories";import{EVENT_SET_OPEN}from"./providers/FulfillmentProvider";import fetchProductInventories from"./actions/fetchProductInventories";import{submitReservationSuccess$,userSearchChanged$,storeFinderWillEnter$,preferredLocationDidUpdateOnPDP$,provideAlternativeLocation$,preferredLocationDidUpdateGlobalOnWishlist$}from"./locations.streams";import selectLocation from"./action-creators/selectLocation";import{SET_STORE_FINDER_SEARCH_RADIUS}from"./constants";import selectGlobalLocation from"./action-creators/selectGlobalLocation";var initialLocationsResolve;var initialLocationsReject;var initialLocationsPromise=new Promise(function(resolve,reject){initialLocationsResolve=resolve;initialLocationsReject=reject;});/**
|
|
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 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{getProductsResult,productIsReady$,productsReceived$,productsReceivedCached$,RECEIVE_PRODUCTS_CACHED,variantDidChange$}from'@shopgate/engage/product';import{cartReceived$,fetchCart,cartDidEnter$,getCartItems}from'@shopgate/engage/cart';import{userDidLogin$}from'@shopgate/engage/user';import{appDidStart$,routeWillEnter$,UIEvents,getCurrentRoute,hex2bin,getThemeSettings,getCurrentSearchQuery}from'@shopgate/engage/core';import{receiveFavoritesWhileVisible$}from'@shopgate/pwa-common-commerce/favorites/streams';import{getFavoritesProductsIds,isFetching}from'@shopgate/pwa-common-commerce/favorites/selectors';import{categoryDidBackEnter$}from'@shopgate/pwa-common-commerce/category/streams';import{searchDidBackEntered$}from'@shopgate/pwa-common-commerce/search/streams';import{getUserSearch,getStoreFinderSearch,getPreferredLocation,getIsPending,getProductAlternativeLocationParams,getProductAlternativeLocations}from"./selectors";import{fetchLocations,fetchProductLocations,setPending,setUserGeolocation}from"./actions";import{setShowInventoryInLists,showInventoryInLists}from"./helpers/showInventoryInLists";import fetchInventories from"./actions/fetchInventories";import{EVENT_SET_OPEN}from"./providers/FulfillmentProvider";import fetchProductInventories from"./actions/fetchProductInventories";import{submitReservationSuccess$,userSearchChanged$,storeFinderWillEnter$,preferredLocationDidUpdateOnPDP$,provideAlternativeLocation$,preferredLocationDidUpdateGlobalOnWishlist$}from"./locations.streams";import selectLocation from"./action-creators/selectLocation";import{SET_STORE_FINDER_SEARCH_RADIUS}from"./constants";import selectGlobalLocation from"./action-creators/selectGlobalLocation";var initialLocationsResolve;var initialLocationsReject;var initialLocationsPromise=new Promise(function(resolve,reject){initialLocationsResolve=resolve;initialLocationsReject=reject;});/**
|
|
2
2
|
* Sets a location once the location has been validated.
|
|
3
3
|
* @param {string} locationCode Location code
|
|
4
4
|
* @param {Function} dispatch Redux dispatch function
|
|
@@ -23,5 +23,5 @@ userSearch=getUserSearch(state);storeFinderSearch=getStoreFinderSearch(state);_c
|
|
|
23
23
|
*/subscribe(routeWillEnter$,function(_ref15){var action=_ref15.action,dispatch=_ref15.dispatch,getState=_ref15.getState;var locationCode=action.route.query.store;if(!locationCode){if(!getIsPending(getState())){dispatch(setPending(false));}return;}setLocationOnceAvailable(locationCode,dispatch);});var alternative$=productInventoryNeedsUpdate$.switchMap(function(){return provideAlternativeLocation$.first();});/**
|
|
24
24
|
* Provide alternative location on PDP when preferred location is out of stock
|
|
25
25
|
*/subscribe(alternative$,/*#__PURE__*/function(){var _ref17=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref16){var action,dispatch,getState,state,alternativeLocations,productId,params,alternativeParams,fetchParams;return _regeneratorRuntime.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:action=_ref16.action,dispatch=_ref16.dispatch,getState=_ref16.getState;_context6.next=3;return dispatch(setUserGeolocation({silent:true}));case 3:// Get new state with geolocation
|
|
26
|
-
state=getState();alternativeLocations=getProductAlternativeLocations(state,action);if(!alternativeLocations){_context6.next=7;break;}return _context6.abrupt("return");case 7:productId=action.productId,params=action.params;alternativeParams=getProductAlternativeLocationParams(state);fetchParams=_extends({},alternativeParams,{},params);if(fetchParams.geolocation||fetchParams.postalCode){dispatch(fetchProductLocations(productId,fetchParams));}case 11:case"end":return _context6.stop();}}},_callee6);}));return function(_x7){return _ref17.apply(this,arguments);};}());subscribe(categoryDidBackEnter$.merge(searchDidBackEntered$),function(_ref18){var _getProductsResult;var action=_ref18.action,dispatch=_ref18.dispatch,getState=_ref18.getState;var state=getState();if(!showInventoryInLists(state)){return;}var categoryId=action.route.params.categoryId;var query=getCurrentSearchQuery(state);var products=(_getProductsResult=getProductsResult(state,{categoryId:hex2bin(categoryId),searchPhrase:query}))===null||_getProductsResult===void 0?void 0:_getProductsResult.products;if(!products||!products.length){return;}var productCodes=products.map(function(_ref19){var id=_ref19.id;return id;});dispatch(fetchInventories(productCodes));});subscribe(productsReceived$.merge(productsReceivedCached$),function(_ref20){var action=_ref20.action,dispatch=_ref20.dispatch,getState=_ref20.getState;if(!showInventoryInLists(getState())){return;}if(!action.products||!action.products.length){return;}var productCodes=action.type!==RECEIVE_PRODUCTS_CACHED?action.products.map(function(_ref21){var id=_ref21.id;return id;}):action.products;dispatch(fetchInventories(productCodes));});subscribe(receiveFavoritesWhileVisible$.merge(preferredLocationDidUpdateGlobalOnWishlist$),function(_ref22){var dispatch=_ref22.dispatch,getState=_ref22.getState;var state=getState();if(!showInventoryInLists(state)){return;}var productIds=getFavoritesProductsIds(state);if(!productIds||!productIds.length){return;}dispatch(fetchInventories(productIds));});subscribe(appDidStart$,function(_ref23){var getState=_ref23.getState;// enable inventory in product lists for some users
|
|
26
|
+
state=getState();alternativeLocations=getProductAlternativeLocations(state,action);if(!alternativeLocations){_context6.next=7;break;}return _context6.abrupt("return");case 7:productId=action.productId,params=action.params;alternativeParams=getProductAlternativeLocationParams(state);fetchParams=_extends({},alternativeParams,{},params);if(fetchParams.geolocation||fetchParams.postalCode){dispatch(fetchProductLocations(productId,fetchParams));}case 11:case"end":return _context6.stop();}}},_callee6);}));return function(_x7){return _ref17.apply(this,arguments);};}());subscribe(categoryDidBackEnter$.merge(searchDidBackEntered$),function(_ref18){var _getProductsResult;var action=_ref18.action,dispatch=_ref18.dispatch,getState=_ref18.getState;var state=getState();if(!showInventoryInLists(state)){return;}var categoryId=action.route.params.categoryId;var query=getCurrentSearchQuery(state);var products=(_getProductsResult=getProductsResult(state,{categoryId:hex2bin(categoryId),searchPhrase:query}))===null||_getProductsResult===void 0?void 0:_getProductsResult.products;if(!products||!products.length){return;}var productCodes=products.map(function(_ref19){var id=_ref19.id;return id;});dispatch(fetchInventories(productCodes));});subscribe(productsReceived$.merge(productsReceivedCached$),function(_ref20){var action=_ref20.action,dispatch=_ref20.dispatch,getState=_ref20.getState;if(!showInventoryInLists(getState())){return;}if(!action.products||!action.products.length||(action===null||action===void 0?void 0:action.fetchInventory)===false){return;}var productCodes=action.type!==RECEIVE_PRODUCTS_CACHED?action.products.map(function(_ref21){var id=_ref21.id;return id;}):action.products;dispatch(fetchInventories(productCodes));});subscribe(receiveFavoritesWhileVisible$.merge(preferredLocationDidUpdateGlobalOnWishlist$),function(_ref22){var dispatch=_ref22.dispatch,getState=_ref22.getState;var state=getState();if(!showInventoryInLists(state)||isFetching(getState())){return;}var productIds=getFavoritesProductsIds(state);if(!productIds||!productIds.length){return;}dispatch(fetchInventories(productIds));});subscribe(appDidStart$,function(_ref23){var getState=_ref23.getState;// enable inventory in product lists for some users
|
|
27
27
|
setShowInventoryInLists(getState());});}export default locationsSubscriber;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/engage",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.9.0-beta.2",
|
|
4
4
|
"description": "Shopgate's ENGAGE library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@shopgate/native-modules": "1.0.0-beta.18",
|
|
19
|
-
"@shopgate/pwa-common": "7.
|
|
20
|
-
"@shopgate/pwa-common-commerce": "7.
|
|
21
|
-
"@shopgate/pwa-core": "7.
|
|
22
|
-
"@shopgate/pwa-ui-ios": "7.
|
|
23
|
-
"@shopgate/pwa-ui-material": "7.
|
|
24
|
-
"@shopgate/pwa-ui-shared": "7.
|
|
19
|
+
"@shopgate/pwa-common": "7.9.0-beta.2",
|
|
20
|
+
"@shopgate/pwa-common-commerce": "7.9.0-beta.2",
|
|
21
|
+
"@shopgate/pwa-core": "7.9.0-beta.2",
|
|
22
|
+
"@shopgate/pwa-ui-ios": "7.9.0-beta.2",
|
|
23
|
+
"@shopgate/pwa-ui-material": "7.9.0-beta.2",
|
|
24
|
+
"@shopgate/pwa-ui-shared": "7.9.0-beta.2",
|
|
25
25
|
"@stripe/react-stripe-js": "^1.1.2",
|
|
26
26
|
"@stripe/stripe-js": "^1.3.1",
|
|
27
27
|
"@virtuous/conductor": "~2.5.0",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useCallback,useEffect}from'react';import PropTypes from'prop-types';import{i18n}from'@shopgate/engage/core';import{css}from'glamor';import classNames from'classnames';import{themeConfig}from'@shopgate/engage';import{RippleButton,QuantityInput}from'@shopgate/engage/components';var variables=themeConfig.variables,colors=themeConfig.colors;var styles={root:css({display:'flex',flexDirection:'row'}).toString(),input:css({padding:"0 ".concat(variables.gap.small,"px"),textAlign:'center',flex:1,fontSize:15,height:28,width:'100%',backgroundColor:"var(--color-background-accent, ".concat(colors.shade8,")")}).toString(),inputWrapper:css({width:'100%'}),button:css({width:28,' &&':{minWidth:28,padding:0},height:28}).toString(),buttonRipple:css({padding:0}).toString(),buttonNoRadiusLeft:css({' &&':{borderTopLeftRadius:0,borderBottomLeftRadius:0}}).toString(),buttonNoRadiusRight:css({' &&':{borderTopRightRadius:0,borderBottomRightRadius:0}}).toString(),disabled:css({' > div':{padding:0}}).toString()};/**
|
|
1
|
+
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useCallback,useEffect,useState}from'react';import PropTypes from'prop-types';import{i18n}from'@shopgate/engage/core';import{css}from'glamor';import classNames from'classnames';import{themeConfig}from'@shopgate/engage';import{RippleButton,QuantityInput}from'@shopgate/engage/components';var variables=themeConfig.variables,colors=themeConfig.colors;var styles={root:css({display:'flex',flexDirection:'row',position:'relative',zIndex:1000}).toString(),backdrop:css({zIndex:999,top:0,left:0,height:'100%',width:'100%',position:'fixed'}),input:css({padding:"0 ".concat(variables.gap.small,"px"),textAlign:'center',flex:1,fontSize:15,height:28,width:'100%',backgroundColor:"var(--color-background-accent, ".concat(colors.shade8,")")}).toString(),inputWrapper:css({width:'100%'}),button:css({width:28,' &&':{minWidth:28,padding:0},height:28}).toString(),buttonRipple:css({padding:0}).toString(),buttonNoRadiusLeft:css({' &&':{borderTopLeftRadius:0,borderBottomLeftRadius:0}}).toString(),buttonNoRadiusRight:css({' &&':{borderTopRightRadius:0,borderBottomRightRadius:0}}).toString(),disabled:css({' > div':{padding:0}}).toString()};/**
|
|
2
2
|
* A Quantity Picker with unit support.
|
|
3
|
-
* @returns {JSX}
|
|
4
|
-
*/var UnitQuantityPicker=function UnitQuantityPicker(_ref){var className=_ref.className,onChange=_ref.onChange,value=_ref.value,allowDecrement=_ref.allowDecrement,allowIncrement=_ref.allowIncrement,allowZero=_ref.allowZero,decrementStep=_ref.decrementStep,incrementStep=_ref.incrementStep,maxDecimals=_ref.maxDecimals,unit=_ref.unit,disabled=_ref.disabled,minValue=_ref.minValue,maxValue=_ref.maxValue;var handleDecrement=useCallback(function(){var newValue=value-decrementStep;if(newValue<=0&&!allowZero||minValue&&newValue<minValue){newValue=value;}onChange(newValue);},[allowZero,decrementStep,minValue,onChange,value]);var handleIncrement=useCallback(function(){var newValue=value+incrementStep;if(maxValue&&newValue>maxValue){newValue=value;}onChange(newValue);},[incrementStep,maxValue,onChange,value]);useEffect(function(){if(minValue&&value<minValue){onChange(minValue);}if(maxValue&&value>maxValue){onChange(maxValue);}/* eslint-disable react-hooks/exhaustive-deps */},[]);/* eslint-enable react-hooks/exhaustive-deps */return React.createElement(
|
|
3
|
+
* @returns {JSX.Element}
|
|
4
|
+
*/var UnitQuantityPicker=function UnitQuantityPicker(_ref){var className=_ref.className,onChange=_ref.onChange,value=_ref.value,allowDecrement=_ref.allowDecrement,allowIncrement=_ref.allowIncrement,allowZero=_ref.allowZero,decrementStep=_ref.decrementStep,incrementStep=_ref.incrementStep,maxDecimals=_ref.maxDecimals,unit=_ref.unit,disabled=_ref.disabled,minValue=_ref.minValue,maxValue=_ref.maxValue;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isFocused=_useState2[0],setIsFocused=_useState2[1];var handleOnFocus=useCallback(function(){setIsFocused(true);},[]);var handleOnBlur=useCallback(function(){setIsFocused(false);},[]);var handleDecrement=useCallback(function(event){var newValue=value-decrementStep;if(newValue<=0&&!allowZero||minValue&&newValue<minValue){newValue=value;}onChange(newValue);event.preventDefault();event.stopPropagation();},[allowZero,decrementStep,minValue,onChange,value]);var handleIncrement=useCallback(function(event){var newValue=value+incrementStep;if(maxValue&&newValue>maxValue){newValue=value;}onChange(newValue);event.preventDefault();event.stopPropagation();},[incrementStep,maxValue,onChange,value]);useEffect(function(){if(minValue&&value<minValue){onChange(minValue);}if(maxValue&&value>maxValue){onChange(maxValue);}/* eslint-disable react-hooks/exhaustive-deps */},[]);/* eslint-enable react-hooks/exhaustive-deps */return React.createElement(React.Fragment,null,isFocused&&// Show hidden backdrop when focused to avoid side effects when user blurs the input
|
|
5
|
+
// e.g. opening links unintended
|
|
6
|
+
React.createElement("div",{className:styles.backdrop}),React.createElement("div",{className:"".concat(styles.root," ").concat(className)},React.createElement(RippleButton,{rippleClassName:styles.buttonRipple,className:classNames(styles.button,styles.buttonNoRadiusRight,_defineProperty({},styles.disabled,disabled)),type:"secondary",disabled:!allowDecrement||disabled,onClick:handleDecrement,"aria-label":i18n.text('product.decrease_quantity')},"-"),React.createElement("span",null,React.createElement(QuantityInput,{className:styles.input,value:value,onChange:onChange,maxDecimals:maxDecimals,unit:unit,disabled:disabled,minValue:minValue,maxValue:maxValue,"aria-label":i18n.text('product.quantity'),onFocus:handleOnFocus,onBlur:handleOnBlur})),React.createElement(RippleButton,{type:"secondary",disabled:!allowIncrement||disabled,rippleClassName:styles.buttonRipple,className:classNames(styles.button,styles.buttonNoRadiusLeft,_defineProperty({},styles.disabled,disabled)),onClick:handleIncrement,"aria-label":i18n.text('product.increase_quantity')},"+")));};UnitQuantityPicker.defaultProps={className:'',allowZero:false,allowIncrement:true,allowDecrement:true,incrementStep:0.25,decrementStep:0.25,maxDecimals:2,unit:null,disabled:false,minValue:null,maxValue:null};export default UnitQuantityPicker;
|
package/styles/reset/root.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{css}from'glamor';import{useScrollContainer,hasWebBridge,isIOSTheme}from'@shopgate/engage/core';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var typography=themeConfig.typography;var iosThemeActive=isIOSTheme();css.global('*, *:before, *:after',{boxSizing:'border-box'});css.global('*',{touchAction:'manipulation'});css.global('::-moz-focus-inner',{border:0});css.global('html, body',{WebkitTapHighlightColor:'transparent',width:'100%',height:'100%'});css.global('html',{overflow:useScrollContainer()?'hidden':'inherit',MozOsxFontSmoothing:'grayscale',WebkitFontSmoothing:'antialiased',MsTextSizeAdjust:'100%',WebkitTextSizeAdjust:'100%',minHeight:'100%'});css.global('body',{font:"".concat(typography.rootSize,"px/").concat(typography.lineHeight," ").concat(typography.family),overflow:'auto',margin:0,WebkitOverflowScrolling:'touch',WebkitUserSelect:hasWebBridge()?'inherit':'none',userSelect:hasWebBridge()?'inherit':'none',color:'var(--color-text-high-emphasis)'});css.global('[data-pattern]',{height:'100% !important'});css.global('html, body',{backgroundColor:'var(--page-background-color)'});if(hasWebBridge()&&!iosThemeActive){css.insert("@media(min-width: 600px) {\n html, body {\n background-color: var(--color-background-gutter-body, var(--page-background-color))\n }\n }");}
|
|
1
|
+
import{css}from'glamor';import{useScrollContainer,hasWebBridge,isIOSTheme}from'@shopgate/engage/core';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var typography=themeConfig.typography;var iosThemeActive=isIOSTheme();css.global('*, *:before, *:after',{boxSizing:'border-box'});css.global('*',{touchAction:'manipulation'});css.global('::-moz-focus-inner',{border:0});css.global('html, body',{WebkitTapHighlightColor:'transparent',width:'100%',height:'100%'});css.global('html',{overflow:useScrollContainer()?'hidden':'inherit',MozOsxFontSmoothing:'grayscale',WebkitFontSmoothing:'antialiased',MsTextSizeAdjust:'100%',WebkitTextSizeAdjust:'100%',minHeight:'100%'});css.global('body',{font:"".concat(typography.rootSize,"px/").concat(typography.lineHeight," ").concat(typography.family),overflow:'auto',margin:0,WebkitOverflowScrolling:'touch',WebkitUserSelect:hasWebBridge()?'inherit':'none',userSelect:hasWebBridge()?'inherit':'none',color:'var(--color-text-high-emphasis)'});css.global('[data-pattern]',{height:'100% !important'});css.global('html, body',{backgroundColor:'var(--page-background-color)'});if(hasWebBridge()&&!iosThemeActive){css.insert("@media(min-width: 600px) {\n html, body {\n background-color: var(--color-background-gutter-body, var(--page-background-color))\n }\n }");}// since iOS 15 button has a default color of blue rgb(0, 122, 255);
|
|
2
|
+
css.global('button',{color:'inherit'});
|