@vtex/delivery-packages
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -10,2 +10,3 @@ const { | ||
shippingEstimate: true, | ||
deliveryChannel: true, | ||
}; | ||
@@ -95,3 +96,4 @@ | ||
if ( | ||
criteria.selectedSla && pack.deliveryChannel !== item.deliveryChannel | ||
criteria.deliveryChannel && | ||
pack.deliveryChannel !== item.deliveryChannel | ||
) { | ||
@@ -135,6 +137,9 @@ return false | ||
slas: item.slas, | ||
pickupFriendlyName: criteria.selectedSla | ||
? item.pickupFriendlyName | ||
: undefined, | ||
seller: criteria.seller ? item.item.seller : undefined, | ||
address: criteria.selectedSla ? item.address : undefined, | ||
selectedSla: criteria.selectedSla ? item.selectedSla : undefined, | ||
deliveryChannel: criteria.selectedSla | ||
deliveryChannel: criteria.deliveryChannel | ||
? item.deliveryChannel | ||
@@ -211,3 +216,10 @@ : undefined, | ||
function getAddress({ itemIndex, logisticsInfo, selectedAddresses }) { | ||
if (logisticsInfo[itemIndex].deliveryChannel === 'pickup-in-point') { | ||
const selectedSla = getSelectedSla({ | ||
itemIndex, | ||
logisticsInfo, | ||
}); | ||
if (!selectedSla) return null | ||
if (selectedSla.deliveryChannel === 'pickup-in-point') { | ||
return getPickupAddress({ itemIndex, logisticsInfo }) | ||
@@ -221,7 +233,14 @@ } | ||
function getLogisticsInfoData({ itemIndex, logisticsInfo }) { | ||
const selectedSla = getSelectedSla({ | ||
itemIndex, | ||
logisticsInfo, | ||
}); | ||
return { | ||
selectedSla: logisticsInfo[itemIndex].selectedSla, | ||
shippingEstimate: logisticsInfo[itemIndex].shippingEstimate, | ||
shippingEstimateDate: logisticsInfo[itemIndex].shippingEstimateDate, | ||
deliveryChannel: logisticsInfo[itemIndex].deliveryChannel, | ||
shippingEstimate: selectedSla ? selectedSla.shippingEstimate : undefined, | ||
shippingEstimateDate: selectedSla | ||
? selectedSla.shippingEstimateDate | ||
: undefined, | ||
deliveryChannel: logisticsInfo[itemIndex].selectedDeliveryChannel, | ||
deliveryWindow: logisticsInfo[itemIndex].deliveryWindow, | ||
@@ -228,0 +247,0 @@ slas: logisticsInfo[itemIndex].slas, |
@@ -12,2 +12,3 @@ 'use strict'; | ||
shippingEstimate: true, | ||
deliveryChannel: true, | ||
}; | ||
@@ -97,3 +98,4 @@ | ||
if ( | ||
criteria.selectedSla && pack.deliveryChannel !== item.deliveryChannel | ||
criteria.deliveryChannel && | ||
pack.deliveryChannel !== item.deliveryChannel | ||
) { | ||
@@ -137,6 +139,9 @@ return false | ||
slas: item.slas, | ||
pickupFriendlyName: criteria.selectedSla | ||
? item.pickupFriendlyName | ||
: undefined, | ||
seller: criteria.seller ? item.item.seller : undefined, | ||
address: criteria.selectedSla ? item.address : undefined, | ||
selectedSla: criteria.selectedSla ? item.selectedSla : undefined, | ||
deliveryChannel: criteria.selectedSla | ||
deliveryChannel: criteria.deliveryChannel | ||
? item.deliveryChannel | ||
@@ -213,3 +218,10 @@ : undefined, | ||
function getAddress({ itemIndex, logisticsInfo, selectedAddresses }) { | ||
if (logisticsInfo[itemIndex].deliveryChannel === 'pickup-in-point') { | ||
const selectedSla = getSelectedSla({ | ||
itemIndex, | ||
logisticsInfo, | ||
}); | ||
if (!selectedSla) return null | ||
if (selectedSla.deliveryChannel === 'pickup-in-point') { | ||
return getPickupAddress({ itemIndex, logisticsInfo }) | ||
@@ -223,7 +235,14 @@ } | ||
function getLogisticsInfoData({ itemIndex, logisticsInfo }) { | ||
const selectedSla = getSelectedSla({ | ||
itemIndex, | ||
logisticsInfo, | ||
}); | ||
return { | ||
selectedSla: logisticsInfo[itemIndex].selectedSla, | ||
shippingEstimate: logisticsInfo[itemIndex].shippingEstimate, | ||
shippingEstimateDate: logisticsInfo[itemIndex].shippingEstimateDate, | ||
deliveryChannel: logisticsInfo[itemIndex].deliveryChannel, | ||
shippingEstimate: selectedSla ? selectedSla.shippingEstimate : undefined, | ||
shippingEstimateDate: selectedSla | ||
? selectedSla.shippingEstimateDate | ||
: undefined, | ||
deliveryChannel: logisticsInfo[itemIndex].selectedDeliveryChannel, | ||
deliveryWindow: logisticsInfo[itemIndex].deliveryWindow, | ||
@@ -230,0 +249,0 @@ slas: logisticsInfo[itemIndex].slas, |
{ | ||
"name": "@vtex/delivery-packages", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "", | ||
@@ -15,5 +15,15 @@ "main": "dist/index.js", | ||
}, | ||
"keywords": [], | ||
"author": "Breno Calazans (@klzns)", | ||
"keywords": [ | ||
"vtex", | ||
"delivery" | ||
], | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/vtex/delivery-packages.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/vtex/delivery-packages/issues" | ||
}, | ||
"homepage": "https://github.com/vtex/delivery-packages#readme", | ||
"devDependencies": { | ||
@@ -20,0 +30,0 @@ "babel-core": "6", |
@@ -114,3 +114,4 @@ # delivery-packages | ||
seller: true, | ||
shippingEstimate: true | ||
shippingEstimate: true, | ||
deliveryChannel: true | ||
} | ||
@@ -130,2 +131,3 @@ ``` | ||
seller: String, | ||
items: [Object], | ||
package: Object, | ||
@@ -148,2 +150,6 @@ selectedSla: String, | ||
#### items | ||
The items of the package. | ||
#### seller | ||
@@ -150,0 +156,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 too big to display
Sorry, the diff of this file is not supported yet
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
330087
3727
0
264
0