@vtex/pickup-points-modal
Advanced tools
Comparing version 0.1.14 to 0.1.15
@@ -64,7 +64,14 @@ 'use strict'; | ||
_this.createMap(mapElement); | ||
var geoCoordinates = _this.props.address.geoCoordinates.value.length > 0 ? _this.props.address.geoCoordinates.value : _this.props.activePickupPoint ? _this.props.activePickupPoint.pickupStoreInfo.address.geoCoordinates : []; | ||
_this.createMap(mapElement, geoCoordinates); | ||
if (geoCoordinates.length > 0) { | ||
_this.recenterMap(_this.getLocation(geoCoordinates)); | ||
} | ||
_this.createNewMarkers(_extends({ | ||
pickups: _this.props.pickupOptionGeolocations, | ||
pickupOptions: _this.props.pickupOptions, | ||
pickupPoint: _this.props.pickupPoint && _this.props.pickupPoint.id, | ||
pickupPoint: _this.props.pickupPoint, | ||
selectedPickupPointGeolocation: _this.props.selectedPickupPointGeolocation, | ||
@@ -75,3 +82,3 @@ recenter: true | ||
_this.createMap = function (mapElement) { | ||
_this.createMap = function (mapElement, geoCoordinates) { | ||
var _this$props = _this.props, | ||
@@ -84,9 +91,4 @@ googleMaps = _this$props.googleMaps, | ||
var geoCoordinates = _this.props.address.geoCoordinates.value; | ||
var mapOptions = _extends({ | ||
zoom: 14 | ||
}, geoCoordinates.length > 0 ? { | ||
center: _this.recenterMap(_this.getLocation(geoCoordinates)) | ||
} : {}, { | ||
zoom: 14, | ||
mapTypeControl: false, | ||
@@ -101,3 +103,5 @@ zoomControl: true, | ||
} | ||
}); | ||
}, geoCoordinates && geoCoordinates.length > 0 ? { | ||
center: _this.getLocation(geoCoordinates) | ||
} : {}); | ||
@@ -124,3 +128,4 @@ _this.map = new googleMaps.Map(_this._mapElement, mapOptions); | ||
activatePickupDetails = _this$props2.activatePickupDetails, | ||
googleMaps = _this$props2.googleMaps; | ||
googleMaps = _this$props2.googleMaps, | ||
activePickupPoint = _this$props2.activePickupPoint; | ||
@@ -143,3 +148,3 @@ | ||
map: _this.map, | ||
icon: pickupPoint === pickupOptions[index].id ? _this.state.selectedIcon : _this.state.icon | ||
icon: pickupPoint && pickupPoint.id === pickupOptions[index].id || activePickupPoint && activePickupPoint.id === pickupOptions[index].id ? _this.state.selectedIcon : _this.state.icon | ||
}; | ||
@@ -297,3 +302,3 @@ | ||
pickupOptions: nextProps.pickupOptions, | ||
pickupPoint: nextProps.pickupPoint && nextProps.pickupPoint.id, | ||
pickupPoint: nextProps.pickupPoint, | ||
selectedPickupPointGeolocation: nextProps.selectedPickupPointGeolocation, | ||
@@ -300,0 +305,0 @@ recenter: false |
@@ -6,2 +6,4 @@ 'use strict'; | ||
var _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; }; | ||
var _react = require('react'); | ||
@@ -61,2 +63,4 @@ | ||
var _validateAddress = require('@vtex/address-form/lib/validateAddress'); | ||
var _close_icon = require('./assets/icons/close_icon.svg'); | ||
@@ -115,7 +119,12 @@ | ||
_this.togglePickupDetails = function () { | ||
return _this.setState({ isPickupDetailsActive: !_this.state.isPickupDetailsActive }); | ||
return _this.setState({ | ||
isPickupDetailsActive: !_this.state.isPickupDetailsActive | ||
}); | ||
}; | ||
_this.activatePickupDetails = function () { | ||
return _this.setState({ isPickupDetailsActive: true }); | ||
return _this.setState({ | ||
isPickupDetailsActive: true, | ||
mapStatus: _constants.HIDE_MAP | ||
}); | ||
}; | ||
@@ -125,3 +134,11 @@ | ||
if (address.postalCode && !address.postalCode.value) return; | ||
_this.props.onAddressChange(address); | ||
var addressValidated = _extends({}, address, { | ||
postalCode: _extends({}, address.postalCode, (0, _validateAddress.validateField)(address.postalCode.value, 'postalCode', address, _this.props.rules)) | ||
}); | ||
_this.props.onAddressChange(_extends({}, addressValidated, { | ||
postalCode: addressValidated.postalCode.valid ? addressValidated.postalCode : { | ||
value: null | ||
} | ||
})); | ||
}; | ||
@@ -136,3 +153,3 @@ | ||
filteredPickupOptions: props.pickupOptions.filter(function (option) { | ||
return option.id !== props.activePickupPoint.id; | ||
return props.activePickupPoint && option.id !== props.activePickupPoint.id; | ||
}), | ||
@@ -148,3 +165,3 @@ showAskForGeolocation: false | ||
filteredPickupOptions: nextProps.pickupOptions.filter(function (option) { | ||
return option.id !== nextProps.activePickupPoint.id; | ||
return nextProps.activePickupPoint && option.id !== nextProps.activePickupPoint.id; | ||
}) | ||
@@ -163,2 +180,3 @@ }); | ||
isPickupDetailsActive: true, | ||
mapStatus: _constants.HIDE_MAP, | ||
isMounted: true | ||
@@ -265,3 +283,5 @@ }); | ||
'div', | ||
{ className: 'pickup-modal-info-bar-container' }, | ||
{ | ||
className: 'pickup-modal-info-bar-container ' + (mapStatus === _constants.SHOW_MAP && 'active') | ||
}, | ||
_react2.default.createElement( | ||
@@ -391,3 +411,3 @@ 'div', | ||
PickupPointsModal.propTypes = process.env.NODE_ENV !== "production" ? { | ||
activePickupPoint: _propTypes2.default.object.isRequired, | ||
activePickupPoint: _propTypes2.default.object, | ||
changeActivePickupDetails: _propTypes2.default.func.isRequired, | ||
@@ -394,0 +414,0 @@ changeActiveSLAOption: _propTypes2.default.func.isRequired, |
@@ -58,3 +58,3 @@ { | ||
"pickupPointsModal.searchLocationMap": | ||
"Buscar por Lugar, CEP, Bairro ou Cidade", | ||
"Buscar por localidade", | ||
"pickupPointsModal.productsInPoint": | ||
@@ -61,0 +61,0 @@ "Disponibilidade de produtos neste ponto", |
{ | ||
"name": "@vtex/pickup-points-modal", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"description": "Pickup Points Modal React component", | ||
@@ -20,3 +20,3 @@ "main": "lib/index.js", | ||
"prepublishOnly": "npm run build", | ||
"develop": "npm link && watch 'npm run build' src" | ||
"build:link": "npm link && watch 'npm run build' src" | ||
}, | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@vtex/address-form": "1.4.8", | ||
"@vtex/address-form": "1.4.9", | ||
"lodash": "^4.17.5", | ||
@@ -39,0 +39,0 @@ "react-tooltip": "^3.4.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170953
3913
+ Added@vtex/address-form@1.4.9(transitive)
- Removed@vtex/address-form@1.4.8(transitive)
Updated@vtex/address-form@1.4.9