![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@vtex/delivery-packages
Advanced tools
Small library to separate items in packages
The UX of displaying to the user how their items are going to be delivered can be tricky to be expressed and developed.
There are many criteria to split items in different packages. They are:
This module provides a consistent way to handle all those criteria.
$ npm install @vtex/delivery-packages
const packagify = require('@vtex/delivery-packages')
packagify(order)
// [
// {
// "seller": "1",
// "pickupFriendlyName": null,
// "selectedSla": "Normal",
// "slas": [
// {
// "id": "Normal",
// "deliveryChannel": "delivery",
// ...
// }
// ],
// "shippingEstimate": "6bd",
// "shippingEstimateDate": "2018-02-24T19:01:07.0336412+00:00",
// "deliveryChannel": "delivery",
// "items": [
// {
// "index": 0,
// "id": 0,
// "quantity": 1,
// "seller": "1",
// ...
// }
// ],
// "address": {
// "addressId": "-4556418741084",
// "addressType": "residential",
// "receiverName": "John Doe",
// ...
// }
// },
// {
// "seller": "2",
// "pickupFriendlyName": "Shopping da Gávea",
// "selectedSla": "Retirada na loja (17c6a89)",
// "slas": [
// {
// "id": "Retirada na loja (17c6a89)",
// "deliveryChannel": "pickup-in-point",
// ...
// }
// ],
// "shippingEstimate": "5h",
// "shippingEstimateDate": "2018-02-23T19:01:07.0336412+00:00",
// "deliveryChannel": "pickup-in-point",
// "items": [
// {
// "id": 1,
// "quantity": 1,
// "seller": "2",
// "index": 1
// }
// ],
// "address": {
// "addressId": "141125d",
// "addressType": "pickup",
// "geoCoordinates": [-43.18080139160156, -22.96540069580078],
// ...
// }
// }
// ]
Returns an array of Packages.
An order shaped like an orderForm.
Type: Object
Default:
{
slaOptions: false,
selectedSla: true,
seller: true,
shippingEstimate: true,
deliveryChannel: true
}
This param will be merged with the default options.
A Package object shape
{
address: Object,
pickupFriendlyName: String,
seller: String,
items: [Object],
package: Object,
selectedSla: String,
slas: [Object],
shippingEstimate: String,
shippingEstimateDate: String,
deliveryChannel: String,
}
The address
used for that package. If it is a pickup point, the address of the pickup point is returned.
If the package is delivered to a pickup point, this field has its friendly name.
The items of the package.
The seller of the package.
The package
object from packageAttachment
, if it is one.
These properties are taken from the logisticsInfo
of the package.
const order = {
items: [
// You can pass all the properties of the item. That's simplified.
{ "id": 0, "quantity": 1, "seller": "1" },
{ "id": 1, "quantity": 1, "seller": "1" }
],
shippingData: {
selectedAddresses: [
{ "addressId": "-4556418741084", "street": "Rua Barão" }
],
logisticsInfo: [
{
// You can pass all the properties of the logisticInfo
"addressId": "-4556418741084",
"selectedSla": "Expressa",
"shippingEstimate": "5bd",
"shippingEstimateDate": "2018-02-23T19:01:07.0336412+00:00",
"deliveryChannel": "delivery",
"itemIndex": 0,
"slas": [
// You can pass all the properties of the sla
{ "id": "Expressa", "deliveryChannel": "delivery" }
]
},
{
"addressId": "-4556418741084",
"selectedSla": "Normal",
"shippingEstimate": "6bd",
"shippingEstimateDate": "2018-02-24T19:01:07.0336412+00:00",
"deliveryChannel": "delivery",
"itemIndex": 1,
"slas": [
{ "id": "Normal", "deliveryChannel": "delivery" }
]
}
]
},
packageAttachment: {
packages: [
{
// You can pass all the properties of tha package.
"courierStatus": { "finished": false },
"trackingNumber": "123",
"trackingUrl": "",
"invoiceNumber": "456",
"items": [
{ "itemIndex": 0, "quantity": 1 }
]
}
]
}
}
packagify(order, { criteria: { seller: false } })
// [
// {
// "package": {
// "courierStatus": { "finished": false },
// "trackingNumber": "123",
// "trackingUrl": "",
// "invoiceNumber": "456",
// "items": [
// { "itemIndex": 0, "quantity": 1 }
// ],
// "index": 0
// },
// "address": { "addressId": "-4556418741084", "street": "Rua Barão" },
// "pickupFriendlyName": null,
// "selectedSla": "Expressa",
// "slas": [{ "id": "Expressa", "deliveryChannel": "delivery" }],
// "shippingEstimate": "5bd",
// "shippingEstimateDate": "2018-02-23T19:01:07.0336412+00:00",
// "deliveryChannel": "delivery",
// "items": [
// { "id": 0, "quantity": 1, "seller": "1", "index": 0 }
// ],
// "seller": "1"
// },
// {
// "address": { "addressId": "-4556418741084", "street": "Rua Barão" },
// "pickupFriendlyName": null,
// "selectedSla": "Normal",
// "slas": [{ "id": "Normal", "deliveryChannel": "delivery" }],
// "shippingEstimate": "6bd",
// "shippingEstimateDate": "2018-02-24T19:01:07.0336412+00:00",
// "deliveryChannel": "delivery",
// "items": [
// { "id": 1, "quantity": 1, "seller": "1", "index": 1 }
// ],
// "seller": "1"
// }
// ]
MIT © VTEX
FAQs
> Library of functions that help to separate items in parcels and select delivery items on UIs
The npm package @vtex/delivery-packages receives a total of 418 weekly downloads. As such, @vtex/delivery-packages popularity was classified as not popular.
We found that @vtex/delivery-packages demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 81 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.