{"id":21835734,"url":"https://github.com/vtex/delivery-packages","last_synced_at":"2025-07-28T00:08:33.574Z","repository":{"id":46947017,"uuid":"122251399","full_name":"vtex/delivery-packages","owner":"vtex","description":"Small library to separate items in packages","archived":false,"fork":false,"pushed_at":"2025-03-13T13:04:01.000Z","size":1704,"stargazers_count":5,"open_issues_count":18,"forks_count":2,"subscribers_count":140,"default_branch":"master","last_synced_at":"2025-07-04T20:05:13.722Z","etag":null,"topics":["srv-checkout-ui","xp-shopping"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vtex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-02-20T20:21:48.000Z","updated_at":"2025-03-13T13:04:04.000Z","dependencies_parsed_at":"2025-04-15T23:15:11.132Z","dependency_job_id":null,"html_url":"https://github.com/vtex/delivery-packages","commit_stats":null,"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"purl":"pkg:github/vtex/delivery-packages","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fdelivery-packages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fdelivery-packages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fdelivery-packages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fdelivery-packages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vtex","download_url":"https://codeload.github.com/vtex/delivery-packages/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex%2Fdelivery-packages/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267442458,"owners_count":24087803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["srv-checkout-ui","xp-shopping"],"created_at":"2024-11-27T20:24:03.774Z","updated_at":"2025-07-28T00:08:33.547Z","avatar_url":"https://github.com/vtex.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# delivery-packages\n\n\u003e Library of functions that help to separate items in parcels and select delivery items on UIs\n\n## Motivation\n\nThe UX of displaying to the user how their items are going to be delivered can be tricky to be expressed and developed.\n\nThere are many criteria to split items in different parcels. They are:\n\n1. Seller\n2. SLAs options\n3. Selected SLA ID\n4. Selected SLA Shipping Estimate\n5. Selected SLA Delivery Channel\n6. Packages already delivered (post purchase scenario)\n7. Group SLAs based on having a valid availableDeliveryWindows\n8. Selected SLA Type, distinguishing pickup from pickup checked in (take away)\n\nThis module provides a consistent way to handle all those criteria.\n\nAnd provide also helper functions for other use cases.\n\n## Install\n\n```sh\n$ npm install @vtex/delivery-packages\n```\n\n## API\n\n- [parcelify](#parcelifyorder-options)\n\n#### Address\n\n- [addAddressId](#addaddressid-address)\n- [addPickupPointAddresses](#addpickuppointaddresses-addresses-pickupslas)\n- [findAddressIndex](#findaddressindex-addresses-searchaddress)\n- [findAddress](#findaddress-addresses-searchaddress)\n- [findAddressByPostalCode](#findaddressbypostalcode-addresses-searchaddress)\n- [isAddressComplete](#isaddresscomplete-address)\n- [isPickupAddress](#ispickupaddress-address)\n- [isDeliveryAddress](#isdeliveryaddress-address)\n- [getDeliveryAvailableAddresses](#getdeliveryavailableaddresses-addresses)\n- [groupByAddressType](#groupbyaddresstype-addresses)\n- [addOrReplaceAddressTypeOnList](#addorreplaceaddresstypeonlist-addresses-newaddress)\n- [addOrReplaceAddressOnList](#addorreplaceaddressonlist-addresses-newaddress)\n- [setDeliveryAddressOnList](#setdeliveryaddressonlist-addresses-newaddress)\n\n#### Delivery Channel\n\n- [getDeliveryChannel](#getdeliverychannel-deliverychannelsource)\n- [isPickup](#ispickup-deliverychannelsource)\n- [isDelivery](#isdelivery-deliverychannelsource)\n- [findChannelById](#findchannelbyid-logisticsinfoitem-deliverychannelsource)\n\n#### Items\n\n- [getNewItems](#getnewitems-items-changes)\n- [getDeliveredItems](#getdelivereditems--items-packages-)\n- [getItemsIndexes](#getitemsindexes-items)\n\n#### Scheduled Delivery\n\n- [areAvailableDeliveryWindowsEquals](#areavailabledeliverywindowsequals-availabledeliverywindows1-availabledeliverywindows2)\n- [selectDeliveryWindow](#selectdeliverywindow-logisticsinfo--selectedsla-deliverywindow-)\n- [getFirstScheduledDelivery](#getfirstscheduleddelivery-logisticsinfo-availabledeliverywindows--null)\n\n#### Shipping\n\n- [getNewLogisticsInfo](#getnewlogisticsinfo-logisticsinfo-selectedsla-availabledeliverywindows--null)\n- [getNewLogisticsInfoWithSelectedScheduled](#getnewlogisticsinfowithselectedscheduled-logisticsinfo)\n- [getNewLogisticsInfoWithScheduledDeliveryChoice](#getnewlogisticsinfowithscheduleddeliverychoice-logisticsinfo-scheduleddeliverychoice-scheduleddeliveryitems--null)\n- [filterLogisticsInfo](#filterlogisticsinfo-logisticsinfo-filters-keepsize--false)\n- [getNewLogisticsMatchingSelectedAddresses](#getnewlogisticsmatchingselectedaddresses-logisticsinfo-selectedaddresses)\n- [mergeLogisticsInfos](#mergelogisticsinfos-logisticsinfo1-logisticsinfo2)\n\n#### SLA\n\n- [hasSLAs](#hasslas-slassource)\n- [hasDeliveryWindows](#hasdeliverywindows-slas)\n- [excludePickupTypeFromSlas](#excludepickuptypefromslas-slas)\n- [getSlaObj](#getslaobj-slas-slaid)\n- [getSlaType](#getslatype)\n- [changeSelectedSla](#changeselectedsla-logisticsinfoitem-sla)\n- [getSelectedSla](#getselectedsla-logisticsinfo-itemindex-selectedsla)\n- [getSelectedSlas](#getselectedslas-logisticsinfo)\n- [getPickupSelectedSlas](#getpickupselectedslas-logisticsinfo)\n\n### parcelify(order, options)\n\nReturns an array of [Parcel](#Parcel)s.\n\n#### order\n\nAn order shaped like an [orderForm](https://github.com/vtex/vtex.js/blob/master/docs/checkout/order-form.md).\n\n#### options.criteria\n\nType: `Object`\u003cbr/\u003e\nDefault:\u003cbr/\u003e\n\n```js\n{\n  groupBySelectedSlaType: false,\n  groupByAvailableDeliveryWindows: false,\n  slaOptions: false,\n  selectedSla: true,\n  seller: true,\n  shippingEstimate: true,\n  deliveryChannel: true,\n  useMarketplaceItems: true\n}\n```\n\nThis param will be merged with the default options.\n\n## Parcel\n\n\u003e @vtex/delivery-packages/\n\nA Parcel object shape\n\n```js\n{\n  address: Object,\n  listPrice: Number,\n  price: Number,\n  sellingPrice: Number,\n  pickupFriendlyName: String,\n  seller: String,\n  items: [Object],\n  package: Object,\n  selectedSla: String,\n  selectedSlaObj: Object,\n  slas: [Object],\n  shippingEstimate: String,\n  shippingEstimateDate: String,\n  deliveryChannel: String,\n  selectedSlaType: String,\n  deliveryIds: [Object]\n}\n```\n\n#### address\n\nThe `address` used for that parcel. If it is a pickup point, the address of the pickup point is returned.\n\n#### pickupFriendlyName\n\nIf the parcel is delivered to a pickup point, this field has its friendly name.\n\n#### items\n\nThe items of the parcel.\n\n#### seller\n\nThe seller of the parcel.\n\n#### package\n\nThe `package` object from `packageAttachment`, if it is one.\n\n#### slas, selectedSla, shippingEstimate, shippingEstimateDate, deliveryChannel, deliveryIds\n\nThese properties are taken from the `logisticsInfo` of the parcel.\n\n## Example\n\n```js\nconst parcelify = require('@vtex/delivery-packages')\n\nconst order = {\n  items: [\n    // You can pass all the properties of the item. That's simplified.\n    { id: 0, quantity: 1, seller: '1' },\n    { id: 1, quantity: 1, seller: '1' },\n  ],\n  shippingData: {\n    selectedAddresses: [{ addressId: '-4556418741084', street: 'Rua Barão' }],\n    logisticsInfo: [\n      {\n        // You can pass all the properties of the logisticsInfo\n        addressId: '-4556418741084',\n        selectedSla: 'Expressa',\n        shippingEstimate: '5bd',\n        shippingEstimateDate: '2018-02-23T19:01:07.0336412+00:00',\n        deliveryChannel: 'delivery',\n        itemIndex: 0,\n        slas: [\n          // You can pass all the properties of the sla\n          { id: 'Expressa', deliveryChannel: 'delivery', price: 20000 },\n        ],\n      },\n      {\n        addressId: '-4556418741084',\n        selectedSla: 'Normal',\n        shippingEstimate: '6bd',\n        shippingEstimateDate: '2018-02-24T19:01:07.0336412+00:00',\n        deliveryChannel: 'delivery',\n        itemIndex: 1,\n        slas: [{ id: 'Normal', deliveryChannel: 'delivery', price: 20000 }],\n      },\n    ],\n  },\n  packageAttachment: {\n    packages: [\n      {\n        // You can pass all the properties of tha package.\n        courierStatus: { finished: false },\n        trackingNumber: '123',\n        trackingUrl: '',\n        invoiceNumber: '456',\n        items: [{ itemIndex: 0, quantity: 1 }],\n      },\n    ],\n  },\n}\n\nparcelify(order, { criteria: { seller: false } })\n// [\n//   {\n//     \"package\": {\n//       \"courierStatus\": { \"finished\": false },\n//       \"trackingNumber\": \"123\",\n//       \"trackingUrl\": \"\",\n//       \"invoiceNumber\": \"456\",\n//       \"items\": [\n//         { \"itemIndex\": 0, \"quantity\": 1 }\n//       ],\n//       \"index\": 0\n//     },\n//     \"address\": { \"addressId\": \"-4556418741084\", \"street\": \"Rua Barão\" },\n//     \"price\": 20000,\n//     \"pickupFriendlyName\": null,\n//     \"selectedSla\": \"Expressa\",\n//     \"selectedSlaObj\": { \"id\": \"Expressa\", \"deliveryChannel\": \"delivery\" },\n//     \"slas\": [{ \"id\": \"Expressa\", \"deliveryChannel\": \"delivery\" }],\n//     \"shippingEstimate\": \"5bd\",\n//     \"shippingEstimateDate\": \"2018-02-23T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"selectedSlaType\": \"delivery\",\n//     \"items\": [\n//       { \"id\": 0, \"quantity\": 1, \"seller\": \"1\", \"index\": 0 }\n//     ],\n//     \"seller\": \"1\"\n//   },\n//   {\n//     \"address\": { \"addressId\": \"-4556418741084\", \"street\": \"Rua Barão\" },\n//     \"price\": 10000,\n//     \"pickupFriendlyName\": null,\n//     \"selectedSla\": \"Normal\",\n//     \"selectedSlaObj\": { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" },\n//     \"slas\": [{ \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }],\n//     \"shippingEstimate\": \"6bd\",\n//     \"shippingEstimateDate\": \"2018-02-24T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"selectedSlaType\": \"delivery\",\n//     \"items\": [\n//       { \"id\": 1, \"quantity\": 1, \"seller\": \"1\", \"index\": 1 }\n//     ],\n//     \"seller\": \"1\"\n//   }\n// ]\n```\n\n## Address\n\u003e @vtex/delivery-packages/dist/address\n\n### addAddressId (address)\n\nAdd property addressId with random hash string (uuid) if not present on address object passed\n\n#### Usage\n```js\nconst { addAddressId } = require('@vtex/delivery-packages/dist/address')\n\naddAddressId({\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n})\n// -\u003e {\n//   addressId: '935befd9-dcc3-45f3-e327-9d8611e43630',\n//   addressType: 'residential',\n//   receiverName: 'John Doe',\n//   street: 'Rua Barão',\n//   number: '2',\n//   complement: null,\n//   neighborhood: 'Botafogo',\n//   postalCode: '22231-100',\n//   city: 'Rio de Janeiro',\n//   state: 'RJ',\n//   country: 'BRA',\n//   reference: null,\n//   geoCoordinates: [],\n// }\n\naddAddressId({\n  addressId: '1234',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n})\n// -\u003e {\n//   addressId: '1234',\n//   addressType: 'residential',\n//   receiverName: 'John Doe',\n//   street: 'Rua Barão',\n//   number: '2',\n//   complement: null,\n//   neighborhood: 'Botafogo',\n//   postalCode: '22231-100',\n//   city: 'Rio de Janeiro',\n//   state: 'RJ',\n//   country: 'BRA',\n//   reference: null,\n//   geoCoordinates: [],\n// }\n```\n\n**params:**\n- **address**\nType: `object`\nAn object containing all address fields like on availableAddresses of orderForm\n\n**returns:**\n- **newAddress**\nType: `object`\nAn object containing all address fields like on availableAddresses of orderForm with an addressId included\n\n### addPickupPointAddresses (addresses, pickupSlas)\n\nAdd all addresses present on pickupSlas that are not already on addresses list\n\n#### Usage\n```js\nconst { addPickupPointAddresses } = require('@vtex/delivery-packages/dist/address')\n\naddPickupPointAddresses([{\n  addressId: '1234',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}], [{\n  id: 'Retirada normal',\n  deliveryChannel: 'pickup-in-point',\n  pickupStoreInfo: {\n    isPickupStore: true,\n    friendlyName: 'Shopping da Gávea',\n    address: {\n      addressId: '141125e',\n      addressType: 'pickup',\n      city: 'Rio de Janeiro',\n      complement: '',\n      country: 'BRA',\n      geoCoordinates: [-43.18080139160156, -22.96540069580078],\n      neighborhood: 'Copacabana',\n      number: '5',\n      postalCode: '22011050',\n      receiverName: null,\n      reference: null,\n      state: 'RJ',\n      street: 'Rua General Azevedo Pimentel',\n    },\n  },\n}])\n// -\u003e [{\n//   addressId: '1234',\n//   addressType: 'residential',\n//   receiverName: 'John Doe',\n//   street: 'Rua Barão',\n//   number: '2',\n//   complement: null,\n//   neighborhood: 'Botafogo',\n//   postalCode: '22231-100',\n//   city: 'Rio de Janeiro',\n//   state: 'RJ',\n//   country: 'BRA',\n//   reference: null,\n//   geoCoordinates: [],\n// }, {\n//   addressId: '141125e',\n//   addressType: 'pickup',\n//   city: 'Rio de Janeiro',\n//   complement: '',\n//   country: 'BRA',\n//   geoCoordinates: [-43.18080139160156, -22.96540069580078],\n//   neighborhood: 'Copacabana',\n//   number: '5',\n//   postalCode: '22011050',\n//   receiverName: null,\n//   reference: null,\n//   state: 'RJ',\n//   street: 'Rua General Azevedo Pimentel',\n// }]\n```\n**params:**\n- **addresses**\nType: `Array\u003cobject\u003e`\nAn array which each item is an object containing all address fields like on availableAddresses of orderForm\n- **pickupSlas**\nType: `Array\u003cobject\u003e`\nAn array which each item is an object containing a list of slas of the pickup-in-point deliveryChannel\n\n**returns:**\n- **newAddresses**\nType: `Array\u003cobject\u003e`\nNew list of addresses containing the pickup addresses\n\n### findAddressIndex (addresses, searchAddress)\n\nFind a reference address index on addresses list according to the reference addressId or -1 if it doesn't find it\n\n#### Usage\n```js\nconst { findAddressIndex } = require('@vtex/delivery-packages/dist/address')\n\nfindAddressIndex([{\n  addressId: '935befd9-dcc3-45f3-e327-9d8611e43630',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}, {\n  addressId: '783978bd-e71c-4602-4bc6-387cc68f226d',\n  addressType: 'commercial',\n  receiverName: 'John Doe',\n  street: 'Rua dos bobos',\n  number: '0',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22250-040',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}], { addressId: '935befd9-dcc3-45f3-e327-9d8611e43630' })\n// -\u003e 0\n\nfindAddressIndex([{\n  addressId: '935befd9-dcc3-45f3-e327-9d8611e43630',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}, {\n  addressId: '783978bd-e71c-4602-4bc6-387cc68f226d',\n  addressType: 'commercial',\n  receiverName: 'John Doe',\n  street: 'Rua dos bobos',\n  number: '0',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22250-040',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}], { addressId: 'not-found' })\n// -\u003e -1\n```\n\n**params:**\n- **addresses**\nType: `Array\u003cobject\u003e`\nAn array which each item is an object containing all address fields like on availableAddresses of orderForm\n- **searchAddress**\nType: `object`\nAn object with addressId reference to be used to search\n\n**returns:**\n- **index**\nType: `number`\nPosition on addresses of the searchAddress reference according to its addressId\n\n### findAddress (addresses, searchAddress)\n\nFind a reference address on addresses list according to the reference addressId or null if it doesn't find it\n\n#### Usage\n```js\nconst { findAddress } = require('@vtex/delivery-packages/dist/address')\n\nfindAddress([{\n  addressId: '935befd9-dcc3-45f3-e327-9d8611e43630',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}, {\n  addressId: '783978bd-e71c-4602-4bc6-387cc68f226d',\n  addressType: 'commercial',\n  receiverName: 'John Doe',\n  street: 'Rua dos bobos',\n  number: '0',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22250-040',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}], { addressId: '935befd9-dcc3-45f3-e327-9d8611e43630' })\n// -\u003e {\n//   addressId: '935befd9-dcc3-45f3-e327-9d8611e43630',\n//   addressType: 'residential',\n//   receiverName: 'John Doe',\n//   street: 'Rua Barão',\n//   number: '2',\n//   complement: null,\n//   neighborhood: 'Botafogo',\n//   postalCode: '22231-100',\n//   city: 'Rio de Janeiro',\n//   state: 'RJ',\n//   country: 'BRA',\n//   reference: null,\n//   geoCoordinates: []\n// }\n\nfindAddress([{\n  addressId: '935befd9-dcc3-45f3-e327-9d8611e43630',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}, {\n  addressId: '783978bd-e71c-4602-4bc6-387cc68f226d',\n  addressType: 'commercial',\n  receiverName: 'John Doe',\n  street: 'Rua dos bobos',\n  number: '0',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22250-040',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}], { addressId: 'not-found' })\n// -\u003e null\n```\n\n**params:**\n- **addresses**\nType: `Array\u003cobject\u003e`\nAn array which each item is an object containing all address fields like on availableAddresses of orderForm\n- **searchAddress**\nType: `object`\nAn object with addressId reference to be used to search\n\n**returns:**\n- **addressFound**\nType: `object`\nThe address found\n\n### findAddressByPostalCode (addresses, searchAddress)\n\nWorks like findAddress above but the searchAddress postalCode property is used instead\n\n#### Usage\n```js\nconst { findAddress } = require('@vtex/delivery-packages/dist/address')\n\nfindAddress([{\n  addressId: '935befd9-dcc3-45f3-e327-9d8611e43630',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}, {\n  addressId: '783978bd-e71c-4602-4bc6-387cc68f226d',\n  addressType: 'commercial',\n  receiverName: 'John Doe',\n  street: 'Rua dos bobos',\n  number: '0',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22250-040',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}], { postalCode: '22250-040' })\n// -\u003e {\n//   addressId: '783978bd-e71c-4602-4bc6-387cc68f226d',\n//   addressType: 'commercial',\n//   receiverName: 'John Doe',\n//   street: 'Rua dos bobos',\n//   number: '0',\n//   complement: null,\n//   neighborhood: 'Botafogo',\n//   postalCode: '22250-040',\n//   city: 'Rio de Janeiro',\n//   state: 'RJ',\n//   country: 'BRA',\n//   reference: null,\n//   geoCoordinates: [],\n// }\n```\n\n### isAddressComplete (address)\n\nVerify address has all required basic fields\n\n##### Usage\n```js\nconst { isAddressComplete } = require('@vtex/delivery-packages/dist/address')\n\nisAddressComplete({\n  addressId: '-4556418741084',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n})\n// -\u003e true\n\nisAddressComplete({\n  addressId: '-4556418741084',\n  addressType: 'residential',\n  receiverName: null,\n  reference: null,\n  geoCoordinates: [],\n})\n// -\u003e false\n\nisAddressComplete({\n  addressId: '-4556418741084',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: null,\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n}, [\n  'state',\n  'city',\n  'neighborhood',\n  'street',\n])\n// -\u003e true\n```\n\n**params:**\n- **address**\nType: `object`\nAn object containing all address fields like on availableAddresses of orderForm\n\n- **requiredFields**\nType: `array`\nAn array containing all required fields. The default required address fields are `state`, `city`, `neighborhood`, `street` and `number`.\n\n**returns:**\n- **isAddressComplete**\nType: `boolean`\nIf the address has all required fields\n\n## isPickupAddress (address)\n\nVerify address refers to a pickup point\n\n##### Usage\n```js\nconst { isPickupAddress } = require('@vtex/delivery-packages/dist/address')\n\nisPickupAddress({\n  addressId: '-4556418741084',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n})\n// -\u003e false\n\nisPickupAddress({\n  addressId: '141125d',\n  addressType: 'pickup',\n  city: 'Rio de Janeiro',\n  complement: '',\n  country: 'BRA',\n  geoCoordinates: [-43.18080139160156, -22.96540069580078],\n  neighborhood: 'Copacabana',\n  number: '5',\n  postalCode: '22011050',\n  receiverName: 'auto auto',\n  reference: null,\n  state: 'RJ',\n  street: 'Rua General Azevedo Pimentel',\n})\n// -\u003e true\n```\n\n**params:**\n- **address**\nType: `object`\nAn object containing all address fields like on availableAddresses of orderForm\n\n**returns:**\n- **isPickupAddress**\nType: `boolean`\nIf the address refers to a pickup point\n\n## isDeliveryAddress (address)\n\nVerify address refers to a residential address (to deliver items)\n\n##### Usage\n```js\nconst { isDeliveryAddress } = require('@vtex/delivery-packages/dist/address')\n\nisDeliveryAddress({\n  addressId: '-4556418741084',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n})\n// -\u003e true\n\nisDeliveryAddress({\n  addressId: '141125d',\n  addressType: 'pickup',\n  city: 'Rio de Janeiro',\n  complement: '',\n  country: 'BRA',\n  geoCoordinates: [-43.18080139160156, -22.96540069580078],\n  neighborhood: 'Copacabana',\n  number: '5',\n  postalCode: '22011050',\n  receiverName: 'auto auto',\n  reference: null,\n  state: 'RJ',\n  street: 'Rua General Azevedo Pimentel',\n})\n// -\u003e false\n```\n\n**params:**\n- **address**\nType: `object`\nAn object containing all address fields like on availableAddresses of orderForm\n\n**returns:**\n- **isDeliveryAddress**\nType: `boolean`\nIf the address refers to a residential address (to deliver items)\n\n## isGiftRegistry (address)\n\nVerify address refers to a gift list address\n\n##### Usage\n```js\nconst { isGiftRegistry } = require('@vtex/delivery-packages/dist/address')\n\nisGiftRegistry({\n  addressId: '-4556418741084',\n  addressType: 'residential',\n  receiverName: 'John Doe',\n  street: 'Rua Barão',\n  number: '2',\n  complement: null,\n  neighborhood: 'Botafogo',\n  postalCode: '22231-100',\n  city: 'Rio de Janeiro',\n  state: 'RJ',\n  country: 'BRA',\n  reference: null,\n  geoCoordinates: [],\n})\n// -\u003e false\n\nisGiftRegistry({\n  addressId: '141125d',\n  addressType: 'giftRegistry',\n  city: 'Rio de Janeiro',\n  complement: '',\n  country: 'BRA',\n  geoCoordinates: [-43.18080139160156, -22.96540069580078],\n  neighborhood: 'Copacabana',\n  number: '5',\n  postalCode: '22011050',\n  receiverName: 'auto auto',\n  reference: null,\n  state: 'RJ',\n  street: 'Rua General Azevedo Pimentel',\n})\n// -\u003e true\n```\n\n**params:**\n- **address**\nType: `object`\nAn object containing all address fields like on availableAddresses of orderForm\n\n**returns:**\n- **isGiftRegistry**\nType: `boolean`\nIf the address refers to a gift list address\n\n\n## getDeliveryAvailableAddresses (addresses)\n\nFilter only residential and complete address\n\n##### Usage\n```js\nconst { getDeliveryAvailableAddresses } = require('@vtex/delivery-packages/dist/address')\n\ngetDeliveryAvailableAddresses([\n  {\n    addressId: '-4556418741084',\n    addressType: 'residential',\n    receiverName: 'John Doe',\n    street: 'Rua Barão',\n    number: '2',\n    complement: null,\n    neighborhood: 'Botafogo',\n    postalCode: '22231-100',\n    city: 'Rio de Janeiro',\n    state: 'RJ',\n    country: 'BRA',\n    reference: null,\n    geoCoordinates: [],\n  },\n  {\n    addressId: '141125d',\n    addressType: 'pickup',\n    city: 'Rio de Janeiro',\n    complement: '',\n    country: 'BRA',\n    geoCoordinates: [-43.18080139160156, -22.96540069580078],\n    neighborhood: 'Copacabana',\n    number: '5',\n    postalCode: '22011050',\n    receiverName: 'auto auto',\n    reference: null,\n    state: 'RJ',\n    street: 'Rua General Azevedo Pimentel',\n  }\n])\n// -\u003e [\n//   {\n//     addressId: '-4556418741084',\n//     addressType: 'residential',\n//     receiverName: 'John Doe',\n//     street: 'Rua Barão',\n//     number: '2',\n//     complement: null,\n//     neighborhood: 'Botafogo',\n//     postalCode: '22231-100',\n//     city: 'Rio de Janeiro',\n//     state: 'RJ',\n//     country: 'BRA',\n//     reference: null,\n//     geoCoordinates: [],\n//   }\n// ]\n```\n\n**params:**\n- **addresses**\nType: `Array\u003cobject\u003e`\nAn array which each item is an object containing all address fields like on availableAddresses of orderForm\n\n**returns:**\n- **filteredAddresses**\nType: `Array\u003cobject\u003e`\nFiltered addresses that contain only residential and complete address\n\n## groupByAddressType (addresses)\n\nCreate an object where each key is an address type and each value is an array of addresses grouped by each address type\n\n##### Usage\n```js\nconst { groupByAddressType } = require('@vtex/delivery-packages/dist/address')\n\ngroupByAddressType([\n  {\n    addressId: '-4556418741084',\n    addressType: 'residential',\n    receiverName: 'John Doe',\n    street: 'Rua Barão',\n    number: '2',\n    complement: null,\n    neighborhood: 'Botafogo',\n    postalCode: '22231-100',\n    city: 'Rio de Janeiro',\n    state: 'RJ',\n    country: 'BRA',\n    reference: null,\n    geoCoordinates: [],\n  },\n  {\n    addressId: '141125d',\n    addressType: 'pickup',\n    city: 'Rio de Janeiro',\n    complement: '',\n    country: 'BRA',\n    geoCoordinates: [-43.18080139160156, -22.96540069580078],\n    neighborhood: 'Copacabana',\n    number: '5',\n    postalCode: '22011050',\n    receiverName: 'auto auto',\n    reference: null,\n    state: 'RJ',\n    street: 'Rua General Azevedo Pimentel',\n  }\n])\n// -\u003e {\n//   residential: [{\n//     addressId: '-4556418741084',\n//     addressType: 'residential',\n//     receiverName: 'John Doe',\n//     street: 'Rua Barão',\n//     number: '2',\n//     complement: null,\n//     neighborhood: 'Botafogo',\n//     postalCode: '22231-100',\n//     city: 'Rio de Janeiro',\n//     state: 'RJ',\n//     country: 'BRA',\n//     reference: null,\n//     geoCoordinates: [],\n//   }],\n//   pickup: [{\n//     addressId: '141125d',\n//     addressType: 'pickup',\n//     city: 'Rio de Janeiro',\n//     complement: '',\n//     country: 'BRA',\n//     geoCoordinates: [-43.18080139160156, -22.96540069580078],\n//     neighborhood: 'Copacabana',\n//     number: '5',\n//     postalCode: '22011050',\n//     receiverName: 'auto auto',\n//     reference: null,\n//     state: 'RJ',\n//     street: 'Rua General Azevedo Pimentel',\n//   }]\n// }\n```\n\n**params:**\n- **addresses**\nType: `Array\u003cobject\u003e`\nAn array which each item is an object containing all address fields like on selectedAddresses of orderForm\n\n**returns:**\n- **group of addresses**\nType: `object`\nAn object where each key is an address type and each value is an array of addresses grouped by each address type\n\n## addOrReplaceAddressTypeOnList (addresses, newAddress)\n\nAdds new address if the addressType of newAddress is not found or replace an existing address of that type\n\n##### Usage\n```js\nconst { addOrReplaceAddressTypeOnList } = require('@vtex/delivery-packages/dist/address')\n\naddOrReplaceAddressTypeOnList([\n  {\n    addressId: '-4556418741084',\n    addressType: 'residential',\n    receiverName: 'John Doe',\n    street: 'Rua Barão',\n    number: '2',\n    complement: null,\n    neighborhood: 'Botafogo',\n    postalCode: '22231-100',\n    city: 'Rio de Janeiro',\n    state: 'RJ',\n    country: 'BRA',\n    reference: null,\n    geoCoordinates: [],\n  }\n],\n{\n  addressId: '141125d',\n  addressType: 'pickup',\n  city: 'Rio de Janeiro',\n  complement: '',\n  country: 'BRA',\n  geoCoordinates: [-43.18080139160156, -22.96540069580078],\n  neighborhood: 'Copacabana',\n  number: '5',\n  postalCode: '22011050',\n  receiverName: 'auto auto',\n  reference: null,\n  state: 'RJ',\n  street: 'Rua General Azevedo Pimentel',\n})\n// -\u003e [\n//   {\n//     addressId: '-4556418741084',\n//     addressType: 'residential',\n//     receiverName: 'John Doe',\n//     street: 'Rua Barão',\n//     number: '2',\n//     complement: null,\n//     neighborhood: 'Botafogo',\n//     postalCode: '22231-100',\n//     city: 'Rio de Janeiro',\n//     state: 'RJ',\n//     country: 'BRA',\n//     reference: null,\n//     geoCoordinates: [],\n//   },\n//   {\n//     addressId: '141125d',\n//     addressType: 'pickup',\n//     city: 'Rio de Janeiro',\n//     complement: '',\n//     country: 'BRA',\n//     geoCoordinates: [-43.18080139160156, -22.96540069580078],\n//     neighborhood: 'Copacabana',\n//     number: '5',\n//     postalCode: '22011050',\n//     receiverName: 'auto auto',\n//     reference: null,\n//     state: 'RJ',\n//     street: 'Rua General Azevedo Pimentel',\n//   }\n// ]\n\naddOrReplaceAddressTypeOnList([\n  {\n    addressId: '-4556418741084',\n    addressType: 'residential',\n    receiverName: 'John Doe',\n    street: 'Rua Barão',\n    number: '2',\n    complement: null,\n    neighborhood: 'Botafogo',\n    postalCode: '22231-100',\n    city: 'Rio de Janeiro',\n    state: 'RJ',\n    country: 'BRA',\n    reference: null,\n    geoCoordinates: [],\n  },\n  {\n    addressId: '141125d',\n    addressType: 'pickup',\n    city: 'Rio de Janeiro',\n    complement: '',\n    country: 'BRA',\n    geoCoordinates: [-43.18080139160156, -22.96540069580078],\n    neighborhood: 'Copacabana',\n    number: '5',\n    postalCode: '22011050',\n    receiverName: 'auto auto',\n    reference: null,\n    state: 'RJ',\n    street: 'Rua General Azevedo Pimentel',\n  }\n], {\n  addressId: '1234',\n  addressType: 'pickup',\n  city: 'Rio de Janeiro',\n  complement: '',\n  country: 'BRA',\n  geoCoordinates: [],\n  neighborhood: 'Botafogo',\n  number: '300',\n  postalCode: '22250040',\n  receiverName: 'auto auto',\n  reference: null,\n  state: 'RJ',\n  street: 'Praia de botafogo',\n})\n// -\u003e [\n//   {\n//     addressId: '-4556418741084',\n//     addressType: 'residential',\n//     receiverName: 'John Doe',\n//     street: 'Rua Barão',\n//     number: '2',\n//     complement: null,\n//     neighborhood: 'Botafogo',\n//     postalCode: '22231-100',\n//     city: 'Rio de Janeiro',\n//     state: 'RJ',\n//     country: 'BRA',\n//     reference: null,\n//     geoCoordinates: [],\n//   },\n//   {\n//     addressId: '1234',\n//     addressType: 'pickup',\n//     city: 'Rio de Janeiro',\n//     complement: '',\n//     country: 'BRA',\n//     geoCoordinates: [],\n//     neighborhood: 'Botafogo',\n//     number: '300',\n//     postalCode: '22250040',\n//     receiverName: 'auto auto',\n//     reference: null,\n//     state: 'RJ',\n//     street: 'Praia de botafogo',\n//   }\n// ]\n```\n\n**params:**\n- **addresses**\nType: `Array\u003cobject\u003e`\nAn array which each item is an object containing all address fields like on selectedAddresses of orderForm\n- **newAddress**\nType: `string`\nNew address to be included on the list of addresses\n\n**returns:**\n- **new addresses**\nType: `object`\nNew list of addresses with the newAddress included\n\n## addOrReplaceAddressOnList (addresses, newAddress)\n\nAdds new address if the newAddress is not found or replace an existing address with the same addressId\n\n##### Usage\n```js\nconst { addOrReplaceAddressOnList } = require('@vtex/delivery-packages/dist/address')\n\naddOrReplaceAddressOnList([\n  {\n    addressId: '-4556418741084',\n    addressType: 'residential',\n    receiverName: 'John Doe',\n    street: 'Rua Barão',\n    number: '2',\n    complement: null,\n    neighborhood: 'Botafogo',\n    postalCode: '22231-100',\n    city: 'Rio de Janeiro',\n    state: 'RJ',\n    country: 'BRA',\n    reference: null,\n    geoCoordinates: [],\n  }\n],\n{\n  addressId: '141125d',\n  addressType: 'pickup',\n  city: 'Rio de Janeiro',\n  complement: '',\n  country: 'BRA',\n  geoCoordinates: [-43.18080139160156, -22.96540069580078],\n  neighborhood: 'Copacabana',\n  number: '5',\n  postalCode: '22011050',\n  receiverName: 'auto auto',\n  reference: null,\n  state: 'RJ',\n  street: 'Rua General Azevedo Pimentel',\n})\n// -\u003e [\n//   {\n//     addressId: '-4556418741084',\n//     addressType: 'residential',\n//     receiverName: 'John Doe',\n//     street: 'Rua Barão',\n//     number: '2',\n//     complement: null,\n//     neighborhood: 'Botafogo',\n//     postalCode: '22231-100',\n//     city: 'Rio de Janeiro',\n//     state: 'RJ',\n//     country: 'BRA',\n//     reference: null,\n//     geoCoordinates: [],\n//   },\n//   {\n//     addressId: '141125d',\n//     addressType: 'pickup',\n//     city: 'Rio de Janeiro',\n//     complement: '',\n//     country: 'BRA',\n//     geoCoordinates: [-43.18080139160156, -22.96540069580078],\n//     neighborhood: 'Copacabana',\n//     number: '5',\n//     postalCode: '22011050',\n//     receiverName: 'auto auto',\n//     reference: null,\n//     state: 'RJ',\n//     street: 'Rua General Azevedo Pimentel',\n//   }\n// ]\n\naddOrReplaceAddressTypeOnList([\n  {\n    addressId: '-4556418741084',\n    addressType: 'residential',\n    receiverName: 'John Doe',\n    street: 'Rua Barão',\n    number: '2',\n    complement: null,\n    neighborhood: 'Botafogo',\n    postalCode: '22231-100',\n    city: 'Rio de Janeiro',\n    state: 'RJ',\n    country: 'BRA',\n    reference: null,\n    geoCoordinates: [],\n  },\n  {\n    addressId: '1234',\n    addressType: 'pickup',\n    city: 'Rio de Janeiro',\n    complement: '',\n    country: 'BRA',\n    geoCoordinates: [-43.18080139160156, -22.96540069580078],\n    neighborhood: 'Copacabana',\n    number: '5',\n    postalCode: '22011050',\n    receiverName: 'auto auto',\n    reference: null,\n    state: 'RJ',\n    street: 'Rua General Azevedo Pimentel',\n  }\n], {\n  addressId: '1234',\n  addressType: 'pickup',\n  city: 'Rio de Janeiro',\n  complement: '',\n  country: 'BRA',\n  geoCoordinates: [],\n  neighborhood: 'Botafogo',\n  number: '300',\n  postalCode: '22250040',\n  receiverName: 'auto auto',\n  reference: null,\n  state: 'RJ',\n  street: 'Praia de botafogo',\n})\n// -\u003e [\n//   {\n//     addressId: '-4556418741084',\n//     addressType: 'residential',\n//     receiverName: 'John Doe',\n//     street: 'Rua Barão',\n//     number: '2',\n//     complement: null,\n//     neighborhood: 'Botafogo',\n//     postalCode: '22231-100',\n//     city: 'Rio de Janeiro',\n//     state: 'RJ',\n//     country: 'BRA',\n//     reference: null,\n//     geoCoordinates: [],\n//   },\n//   {\n//     addressId: '1234',\n//     addressType: 'pickup',\n//     city: 'Rio de Janeiro',\n//     complement: '',\n//     country: 'BRA',\n//     geoCoordinates: [],\n//     neighborhood: 'Botafogo',\n//     number: '300',\n//     postalCode: '22250040',\n//     receiverName: 'auto auto',\n//     reference: null,\n//     state: 'RJ',\n//     street: 'Praia de botafogo',\n//   }\n// ]\n```\n\n**params:**\n- **addresses**\nType: `Array\u003cobject\u003e`\nAn array which each item is an object containing all address fields like on selectedAddresses of orderForm\n- **newAddress**\nType: `string`\nNew address to be included on the list of addresses\n\n**returns:**\n- **new addresses**\nType: `object`\nNew list of addresses with the newAddress included\n\n## setDeliveryAddressOnList (addresses, newAddress)\n\nAdds a new address if no delivery address exists on addresses and the `addressType` of `newAddress` is delivery **or** replace an existing delivery address with the current delivery address merged with the `newAddress` data.\n\n##### Usage\n```js\nconst { setDeliveryAddressOnList } = require('@vtex/delivery-packages/dist/address')\n\nsetDeliveryAddressOnList([\n  {\n    addressId: '141125d',\n    addressType: 'pickup',\n    city: 'Rio de Janeiro',\n    complement: '',\n    country: 'BRA',\n    geoCoordinates: [-43.18080139160156, -22.96540069580078],\n    neighborhood: 'Copacabana',\n    number: '5',\n    postalCode: '22011050',\n    receiverName: 'auto auto',\n    reference: null,\n    state: 'RJ',\n    street: 'Rua General Azevedo Pimentel',\n  }\n],\n\n{\n    addressId: '-4556418741084',\n    addressType: 'residential',\n    receiverName: 'John Doe',\n    street: 'Rua Barão',\n    number: '2',\n    complement: null,\n    neighborhood: 'Botafogo',\n    postalCode: '22231-100',\n    city: 'Rio de Janeiro',\n    state: 'RJ',\n    country: 'BRA',\n    reference: null,\n    geoCoordinates: [],\n  })\n// -\u003e [\n//   {\n//     addressId: '141125d',\n//     addressType: 'pickup',\n//     city: 'Rio de Janeiro',\n//     complement: '',\n//     country: 'BRA',\n//     geoCoordinates: [-43.18080139160156, -22.96540069580078],\n//     neighborhood: 'Copacabana',\n//     number: '5',\n//     postalCode: '22011050',\n//     receiverName: 'auto auto',\n//     reference: null,\n//     state: 'RJ',\n//     street: 'Rua General Azevedo Pimentel',\n//   },\n//   {\n//     addressId: '-4556418741084',\n//     addressType: 'residential',\n//     receiverName: 'John Doe',\n//     street: 'Rua Barão',\n//     number: '2',\n//     complement: null,\n//     neighborhood: 'Botafogo',\n//     postalCode: '22231-100',\n//     city: 'Rio de Janeiro',\n//     state: 'RJ',\n//     country: 'BRA',\n//     reference: null,\n//     geoCoordinates: [],\n//   },\n// ]\n\nsetDeliveryAddressOnList([\n  {\n    addressId: '-4556418741084',\n    addressType: 'residential',\n    receiverName: 'John Doe',\n    street: 'Rua Barão',\n    number: '2',\n    complement: null,\n    neighborhood: 'Botafogo',\n    postalCode: '22231-100',\n    city: 'Rio de Janeiro',\n    state: 'RJ',\n    country: 'BRA',\n    reference: null,\n    geoCoordinates: [],\n  },\n  {\n    addressId: '141125d',\n    addressType: 'pickup',\n    city: 'Rio de Janeiro',\n    complement: '',\n    country: 'BRA',\n    geoCoordinates: [-43.18080139160156, -22.96540069580078],\n    neighborhood: 'Copacabana',\n    number: '5',\n    postalCode: '22011050',\n    receiverName: 'auto auto',\n    reference: null,\n    state: 'RJ',\n    street: 'Rua General Azevedo Pimentel',\n  }\n], {\n  addressId: '1234',\n  addressType: 'commercial',\n  city: 'Rio de Janeiro',\n  complement: '',\n  country: 'BRA',\n  geoCoordinates: [],\n  neighborhood: 'Botafogo',\n  number: '300',\n  postalCode: '22250040',\n  receiverName: 'auto auto',\n  reference: null,\n  state: 'RJ',\n  street: 'Praia de botafogo',\n})\n// -\u003e [\n//   {\n//     addressId: '1234',\n//     addressType: 'commercial',\n//     city: 'Rio de Janeiro',\n//     complement: '',\n//     country: 'BRA',\n//     geoCoordinates: [],\n//     neighborhood: 'Botafogo',\n//     number: '300',\n//     postalCode: '22250040',\n//     receiverName: 'auto auto',\n//     reference: null,\n//     state: 'RJ',\n//     street: 'Praia de botafogo',\n//   },\n//   {\n//     addressId: '1234',\n//     addressType: 'pickup',\n//     city: 'Rio de Janeiro',\n//     complement: '',\n//     country: 'BRA',\n//     geoCoordinates: [],\n//     neighborhood: 'Botafogo',\n//     number: '300',\n//     postalCode: '22250040',\n//     receiverName: 'auto auto',\n//     reference: null,\n//     state: 'RJ',\n//     street: 'Praia de botafogo',\n//   }\n// ]\n```\n\n**params:**\n- **addresses**\nType: `Array\u003cobject\u003e`\nAn array which each item is an object containing all address fields like on selectedAddresses of orderForm\n- **newAddress**\nType: `object`\nNew address to be included on the list of addresses\n\n**returns:**\n- **new addresses**\nType: `Array\u003cobject\u003e`\nNew list of addresses with the newAddress included\n\n## Delivery Channel\n\n\u003e @vtex/delivery-packages/dist/delivery-channel\n\n### getDeliveryChannel (deliveryChannelSource)\n\nGet the delivery channel string of a delivery channel source.\n\n##### Usage\n\n```js\nconst {\n  getDeliveryChannel,\n} = require('@vtex/delivery-packages/dist/delivery-channel')\n\ngetDeliveryChannel({ id: 'pickup-in-point' })\n// -\u003e 'pickup-in-point'\n```\n\n**params:**\n\n- **deliveryChannelSource**\n  Type: `object` or `string`\n  An object containing a deliveryChannel string or the string itself\n\n**returns:**\n\n- **deliveryChannel**\n  Type: `string`\n  The deliveryChannel string (generally 'pickup-in-point' or 'delivery')\n\n### isPickup (deliveryChannelSource)\n\nCheck if the delivery channel source is a pickup point.\n\n##### Usage\n\n```js\nconst { isPickup } = require('@vtex/delivery-packages/dist/delivery-channel')\n\nisPickup({ id: 'pickup-in-point' })\n// -\u003e true\n\nisPickup({ selectedDeliveryChannel: 'pickup-in-point' })\n// true\n\nisPickup({ deliveryChannel: 'pickup-in-point' })\n// true\n\nisPickup({ id: 'delivery' })\n// -\u003e false\n```\n\n**params:**\n\n- **deliveryChannelSource**\n  Type: `object` or `string`\n  An object containing a deliveryChannel string or the string itself\n\n**returns:**\n\n- **isPickup**\n  Type: `boolean`\n  true or false\n\n### isDelivery (deliveryChannelSource)\n\nCheck if the delivery channel source is a delivery.\n\n##### Usage\n\n```js\nconst { isDelivery } = require('@vtex/delivery-packages/dist/delivery-channel')\n\nisDelivery({ id: 'pickup-in-point' })\n// -\u003e false\n\nisDelivery({ selectedDeliveryChannel: 'delivery' })\n// true\n\nisDelivery({ deliveryChannel: 'delivery' })\n// true\n\nisDelivery({ id: 'delivery' })\n// -\u003e true\n```\n\n**params:**\n\n- **deliveryChannelSource**\n  Type: `object` or `string`\n  An object containing a deliveryChannel string or the string itself\n\n**returns:**\n\n- **isDelivery**\n  Type: `boolean`\n  true or false\n\n### findChannelById (logisticsInfoItem, deliveryChannelSource)\n\nSearch for a delivery channel object from an object container a list of delivery channel objects (usually it will be a logisticsInfo item).\n\n##### Usage\n\n```js\nconst {\n  findChannelById,\n} = require('@vtex/delivery-packages/dist/delivery-channel')\n\nfindChannelById({ deliveryChannels: [{ id: 'delivery' }] }, 'pickup-in-point')\n// -\u003e null\n\nfindChannelById(\n  { deliveryChannels: [{ id: 'delivery' }, { id: 'pickup-in-point' }] },\n  'delivery'\n)\n// -\u003e { id: 'delivery' }\n```\n\n**params:**\n\n- **logisticsInfoItem**\n  Type: `object`\n  An object containing a deliveryChannels array\n- **deliveryChannelSource**\n  Type: `object` or `string`\n  An object containing a deliveryChannel string or the string itself\n\n**returns:**\n\n- **deliveryChannel**\n  Type: `object`\n  Object like `{ id: 'delivery' }` or `{ id: 'pickup-in-point' }`\n\n## Items\n\n\u003e @vtex/delivery-packages/dist/items\n\n### getNewItems (items, changes)\n\nGet new items based on the ones passed and an array of changes.\n\n##### Usage\n\n```js\nconst { getNewItems } = require('@vtex/delivery-packages/dist/items')\n\nconst items = [\n  { id: 10, quantity: 1, seller: '1' },\n  { id: 11, quantity: 1, seller: '1' },\n]\nconst changes = [\n  { itemsAdded: [{ id: 12, quantity: 1, seller: '1' }] },\n  { itemsRemoved: [{ id: 11, quantity: 1, seller: '1' }] },\n]\n\ngetNewItems(items, changes)\n// -\u003e [{ id: 10, quantity: 1, seller: '1' }, { id: 12, quantity: 1, seller: '1'}]\n```\n\n**params:**\n\n- **items**\n  Type: `Array\u003cobject\u003e`\n  Array of items (like the ones in an orderForm)\n\n- **changes**\n  Type: `Array\u003cobject\u003e`\n  Array of changes, each change on the format `{ itemsAdded: Array\u003citem\u003e, itemsRemoved: Array\u003citem\u003e }`\n\n**returns:**\n\n- **new items**\n  Type: `Array\u003cobject\u003e`\n  New array of items with the changes applied\n\n### getDeliveredItems ({ items, packages })\n\nMerge items with packages and organize them based if they were already delivered or will be delivered.\n\n##### Usage\n\n```js\nconst { getDeliveredItems } = require('@vtex/delivery-packages/dist/items')\n\nconst items = [\n  { id: 10, quantity: 1, seller: '1', index: 0 },\n  { id: 11, quantity: 1, seller: '1', index: 1 },\n]\nconst packages = [\n  {\n    courierStatus: { finished: false },\n    index: 0,\n    invoiceNumber: '456',\n    items: [{ itemIndex: 0, quantity: 1 }, { itemIndex: 1, quantity: 1 }],\n    trackingNumber: '123',\n    trackingUrl: '',\n  },\n]\n\ngetDeliveredItems({ items, packages })\n// -\u003e {\n//   delivered: [\n//     {\n//       item: { id: '10', index: 0, quantity: 1, seller: '1' },\n//       package: {\n//         courierStatus: { finished: false },\n//         index: 0,\n//         invoiceNumber: '456',\n//         items: [{ itemIndex: 0, quantity: 1 }, { itemIndex: 1, quantity: 1 }],\n//         trackingNumber: '123',\n//         trackingUrl: '',\n//       },\n//     },\n//   ],\n//   toBeDelivered: [{ item: { id: '1', index: 1, quantity: 1, seller: '1' } }],\n// }\n```\n\n**params:**\n\n- **deliveryContext**\n  Type: `object`\n  Object on the format `{ items, packages }` containing the items and packages of an order, with the index of each item and package\n\n**returns:**\n\n- **items with packages**\n  Type: `object`\n  Object contained the keys delivered and toBeDelivered containing the right items and packages\n\n### getItemsIndexes (items)\n\nReturn multiple values with information about the items indexes\n\n##### Usage\n```js\nconst { getItemsIndexes } = require('@vtex/delivery-packages/dist/items')\n\nconst items = [\n  { itemIndex: 0, sla: 'sla1' },\n  { itemIndex: 2, sla: 'sla2' },\n]\n\ngetItemsIndexes(items)\n// -\u003e {\n//   indexes: [0, 2],\n//   otherIndexes: [1],\n//   indexesMap: { 0: items[0], 2: items[1] },\n//   maxIndex: 2,\n// }\n```\n\n**params:**\n- **items**\nType: `Array\u003cobject\u003e`\nArray of items with itemIndex keys like the logisticsInfo of the orderForm\n\n**returns:**\n- **indexes context**\nType: { indexes: `Array\u003cnumber\u003e`, otherIndexes: `Array\u003cnumber\u003e`, indexesMap: `object`, maxIndex: `number`}\n\nindexes: an array with all the numbers matching the items passed\n\notherIndexes: an array with all the numbers not matching the items passed until maxIndex\n\nindexesMap: an object where the keys are the indexes and the values are the original items\n\nmaxIndex: the maximum index found in the list of items\n\n## Scheduled Delivery\n\n\u003e @vtex/delivery-packages/dist/scheduled-delivery\n\n### areAvailableDeliveryWindowsEquals (availableDeliveryWindows1, availableDeliveryWindows2)\n\nCheck if two available delivery windows are equal.\n\n##### Usage\n\n```js\nconst {\n  areAvailableDeliveryWindowsEquals,\n} = require('@vtex/delivery-packages/dist/scheduled-delivery')\n\nconst availableDeliveryWindows1 = [\n  {\n    startDateUtc: '2018-05-26T09:00:00+00:00',\n    endDateUtc: '2018-05-26T21:00:00+00:00',\n    price: 500,\n    lisPrice: 500,\n    tax: 0,\n  },\n]\n\nconst availableDeliveryWindows2 = [\n  {\n    startDateUtc: '2018-05-26T09:00:00+00:00',\n    endDateUtc: '2018-05-26T21:00:00+00:00',\n    price: 500,\n    lisPrice: 500,\n    tax: 0,\n  },\n]\n\nconst availableDeliveryWindows3 = [\n  {\n    startDateUtc: '2018-06-20T09:00:00+00:00',\n    endDateUtc: '2018-06-20T21:00:00+00:00',\n    price: 500,\n    lisPrice: 500,\n    tax: 0,\n  },\n]\n\nareAvailableDeliveryWindowsEquals(\n  availableDeliveryWindows1,\n  availableDeliveryWindows2\n)\n// -\u003e true\n\nareAvailableDeliveryWindowsEquals(\n  availableDeliveryWindows1,\n  availableDeliveryWindows3\n)\n// -\u003e false\n```\n\n**params:**\n\n- **availableDeliveryWindows1**\n  Type: `Array\u003cobject\u003e`\n  Array of objects, each object with `startDateUtc`, `endDateUtc`, `price`, `lisPrice` and `tax` properties (like inside logisticsInfo[i].slas that have scheduled deliveries)\n\n- **availableDeliveryWindows2**\n  Type: `Array\u003cobject\u003e`\n  Array of objects, each object with `startDateUtc`, `endDateUtc`, `price`, `lisPrice` and `tax` properties (like inside logisticsInfo[i].slas that have scheduled deliveries)\n\n**returns:**\n\n- **are equal**\n  Type: `boolean`\n  true or false\n\n### selectDeliveryWindow (logisticsInfo, { selectedSla, deliveryWindow })\n\nGet new logisticsInfo with the deliveryWindow of the selectedSla inserted.\n\n##### Usage\n\n```js\nconst {\n  selectDeliveryWindow,\n} = require('@vtex/delivery-packages/dist/scheduled-delivery')\n\nconst logisticsInfo = [\n  {\n    // You can pass all the properties of the logisticsInfo\n    addressId: '-4556418741084',\n    selectedSla: 'Agendada',\n    shippingEstimate: '5bd',\n    shippingEstimateDate: '2018-02-23T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 0,\n    slas: [\n      // You can pass all the properties of the sla\n      {\n        id: 'Agendada',\n        deliveryChannel: 'delivery',\n        availableDeliveryWindows: [\n          {\n            startDateUtc: '2018-05-26T09:00:00+00:00',\n            endDateUtc: '2018-05-26T21:00:00+00:00',\n            price: 500,\n            lisPrice: 500,\n            tax: 0,\n          },\n          {\n            startDateUtc: '2018-05-26T12:00:00+00:00',\n            endDateUtc: '2018-05-26T13:00:00+00:00',\n            price: 500,\n            lisPrice: 500,\n            tax: 0,\n          },\n        ],\n      },\n    ],\n  },\n  {\n    addressId: '-4556418741084',\n    selectedSla: 'Normal',\n    shippingEstimate: '6bd',\n    shippingEstimateDate: '2018-02-24T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 1,\n    slas: [{ id: 'Normal', deliveryChannel: 'delivery' }],\n  },\n]\n\nselectDeliveryWindow(logisticsInfo, {\n  selectedSla: 'Agendada',\n  deliveryWindow: {\n    startDateUtc: '2018-05-26T09:00:00+00:00',\n    endDateUtc: '2018-05-26T21:00:00+00:00',\n    price: 500,\n    lisPrice: 500,\n    tax: 0,\n  },\n})\n// -\u003e [\n//   {\n//     // You can pass all the properties of the logisticsInfo\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": \"Agendada\",\n//     \"shippingEstimate\": \"5bd\",\n//     \"shippingEstimateDate\": \"2018-02-23T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 0,\n//     \"deliveryWindow\": {\n//       startDateUtc: '2018-05-26T09:00:00+00:00',\n//       endDateUtc: '2018-05-26T21:00:00+00:00',\n//       price: 500,\n//       lisPrice: 500,\n//       tax: 0,\n//     },\n//     \"slas\": [\n//       // You can pass all the properties of the sla\n//       {\n//         \"id\": \"Agendada\",\n//         \"deliveryChannel\": \"delivery\",\n//         \"deliveryWindow\": {\n//           startDateUtc: '2018-05-26T09:00:00+00:00',\n//           endDateUtc: '2018-05-26T21:00:00+00:00',\n//           price: 500,\n//           lisPrice: 500,\n//           tax: 0,\n//         },\n//         \"availableDeliveryWindows\": [\n//           {\n//             startDateUtc: '2018-05-26T09:00:00+00:00',\n//             endDateUtc: '2018-05-26T21:00:00+00:00',\n//             price: 500,\n//             lisPrice: 500,\n//             tax: 0,\n//           },\n//           {\n//             startDateUtc: '2018-05-26T12:00:00+00:00',\n//             endDateUtc: '2018-05-26T13:00:00+00:00',\n//             price: 500,\n//             lisPrice: 500,\n//             tax: 0,\n//           }\n//         ]\n//       }\n//     ]\n//   },\n//   {\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": \"Normal\",\n//     \"shippingEstimate\": \"6bd\",\n//     \"shippingEstimateDate\": \"2018-02-24T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 1,\n//     \"slas\": [\n//       { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }\n//     ]\n//   }\n// ]\n```\n\n**params:**\n\n- **logisticsInfo**\n  Type: `Array\u003cobject\u003e`\n  The logisticsInfo like the one inside `orderForm.shippingData` with `selectedSla` and `slas`\n\n- **action**\n  Type: `object`\n  Object on the format `{ selectedSla, deliveryWindow }`, selectedSla being a string with the id of the selectedSla of each logisticsInfo item and deliveryWindow being an object of the availableDeliveryWindows on these items\n\n**returns:**\n\n- **new logisticsInfo**\n  Type: `Array\u003cobject\u003e`\n  The new logisticsInfo with the deliveryWindow selected on the matching items that have the selectedSla passed\n\n### getFirstScheduledDelivery (logisticsInfo, availableDeliveryWindows = null)\n\nGet the first sla with scheduled delivery matching the availableDeliveryWindows passed.\n\n##### Usage\n\n```js\nconst {\n  getFirstScheduledDelivery,\n} = require('@vtex/delivery-packages/dist/scheduled-delivery')\n\nconst logisticsInfo = [\n  {\n    // You can pass all the properties of the logisticsInfo\n    addressId: '-4556418741084',\n    selectedSla: 'Agendada',\n    shippingEstimate: '5bd',\n    shippingEstimateDate: '2018-02-23T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 0,\n    slas: [\n      // You can pass all the properties of the sla\n      {\n        id: 'Agendada',\n        deliveryChannel: 'delivery',\n        availableDeliveryWindows: [\n          {\n            startDateUtc: '2018-05-26T09:00:00+00:00',\n            endDateUtc: '2018-05-26T21:00:00+00:00',\n            price: 500,\n            lisPrice: 500,\n            tax: 0,\n          },\n          {\n            startDateUtc: '2018-05-26T12:00:00+00:00',\n            endDateUtc: '2018-05-26T13:00:00+00:00',\n            price: 500,\n            lisPrice: 500,\n            tax: 0,\n          },\n        ],\n      },\n    ],\n  },\n  {\n    addressId: '-4556418741084',\n    selectedSla: 'Normal',\n    shippingEstimate: '6bd',\n    shippingEstimateDate: '2018-02-24T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 1,\n    slas: [{ id: 'Normal', deliveryChannel: 'delivery' }],\n  },\n]\n\ngetFirstScheduledDelivery(logisticsInfo, [\n  {\n    startDateUtc: '2018-05-26T09:00:00+00:00',\n    endDateUtc: '2018-05-26T21:00:00+00:00',\n    price: 500,\n    lisPrice: 500,\n    tax: 0,\n  },\n  {\n    startDateUtc: '2018-05-26T12:00:00+00:00',\n    endDateUtc: '2018-05-26T13:00:00+00:00',\n    price: 500,\n    lisPrice: 500,\n    tax: 0,\n  },\n])\n// -\u003e\n// {\n//   \"id\": \"Agendada\",\n//   \"deliveryChannel\": \"delivery\",\n//   \"availableDeliveryWindows\": [\n//     {\n//       startDateUtc: '2018-05-26T09:00:00+00:00',\n//       endDateUtc: '2018-05-26T21:00:00+00:00',\n//       price: 500,\n//       lisPrice: 500,\n//       tax: 0,\n//     },\n//     {\n//       startDateUtc: '2018-05-26T12:00:00+00:00',\n//       endDateUtc: '2018-05-26T13:00:00+00:00',\n//       price: 500,\n//       lisPrice: 500,\n//       tax: 0,\n//     }\n//   ]\n// }\n```\n\n**params:**\n\n- **logisticsInfo**\n  Type: `Array\u003cobject\u003e`\n  The logisticsInfo like the one inside `orderForm.shippingData` with `selectedSla` and `slas`\n\n- **availableDeliveryWindows1**\n  Type: `Array\u003cobject\u003e`\n  Array of objects, each object with `startDateUtc`, `endDateUtc`, `price`, `lisPrice` and `tax` properties (like inside logisticsInfo[i].slas that have scheduled deliveries). The default value for this parameter is null\n\n**returns:**\n\n- **sla**\n  Type: `object`\n  If availableDeliveryWindows is passed, return the first sla with scheduled delivery matching the availableDeliveryWindows. If availableDeliveryWindows is not passed, return the first scheduled delivery sla that exists\n\n## Shipping\n\n\u003e @vtex/delivery-packages/dist/shipping\n\n### getNewLogisticsInfo (logisticsInfo, selectedSla, availableDeliveryWindows = null)\n\nGet new logisticsInfo with the selectedSla on all items that can receive it as selected.\n\n##### Usage\n\n```js\nconst { getNewLogisticsInfo } = require('@vtex/delivery-packages/dist/shipping')\n\nconst logisticsInfo = [\n  {\n    // You can pass all the properties of the logisticsInfo\n    addressId: '-4556418741084',\n    selectedSla: null,\n    selectedDeliveryChannel: null,\n    shippingEstimate: '5bd',\n    shippingEstimateDate: '2018-02-23T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 0,\n    slas: [\n      // You can pass all the properties of the sla\n      {\n        id: 'Agendada',\n        deliveryChannel: 'delivery',\n        availableDeliveryWindows: [\n          {\n            startDateUtc: '2018-05-26T09:00:00+00:00',\n            endDateUtc: '2018-05-26T21:00:00+00:00',\n            price: 500,\n            lisPrice: 500,\n            tax: 0,\n          },\n          {\n            startDateUtc: '2018-05-26T12:00:00+00:00',\n            endDateUtc: '2018-05-26T13:00:00+00:00',\n            price: 500,\n            lisPrice: 500,\n            tax: 0,\n          },\n        ],\n      },\n    ],\n  },\n  {\n    addressId: '-4556418741084',\n    selectedSla: null,\n    selectedDeliveryChannel: null,\n    shippingEstimate: '6bd',\n    shippingEstimateDate: '2018-02-24T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 1,\n    slas: [{ id: 'Normal', deliveryChannel: 'delivery' }],\n  },\n]\n\ngetNewLogisticsInfo(logisticsInfo, 'Normal')\n// -\u003e [\n//   {\n//     // You can pass all the properties of the logisticsInfo\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": null,\n//     \"selectedDeliveryChannel\": null,\n//     \"shippingEstimate\": \"5bd\",\n//     \"shippingEstimateDate\": \"2018-02-23T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 0,\n//     \"slas\": [\n//       // You can pass all the properties of the sla\n//       {\n//         \"id\": \"Agendada\",\n//         \"deliveryChannel\": \"delivery\",\n//         \"availableDeliveryWindows\": [\n//           {\n//             startDateUtc: '2018-05-26T09:00:00+00:00',\n//             endDateUtc: '2018-05-26T21:00:00+00:00',\n//             price: 500,\n//             lisPrice: 500,\n//             tax: 0,\n//           },\n//           {\n//             startDateUtc: '2018-05-26T12:00:00+00:00',\n//             endDateUtc: '2018-05-26T13:00:00+00:00',\n//             price: 500,\n//             lisPrice: 500,\n//             tax: 0,\n//           }\n//         ]\n//       }\n//     ]\n//   },\n//   {\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": \"Normal\",\n//     \"selectedDeliveryChannel\": \"delivery\",\n//     \"shippingEstimate\": \"6bd\",\n//     \"shippingEstimateDate\": \"2018-02-24T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 1,\n//     \"slas\": [\n//       { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }\n//     ]\n//   }\n// ]\n\ngetNewLogisticsInfo(logisticsInfo, 'Agendada', [\n  {\n    startDateUtc: '2018-05-26T09:00:00+00:00',\n    endDateUtc: '2018-05-26T21:00:00+00:00',\n    price: 500,\n    lisPrice: 500,\n    tax: 0,\n  },\n  {\n    startDateUtc: '2018-05-26T12:00:00+00:00',\n    endDateUtc: '2018-05-26T13:00:00+00:00',\n    price: 500,\n    lisPrice: 500,\n    tax: 0,\n  },\n])\n// -\u003e [\n//   {\n//     // You can pass all the properties of the logisticsInfo\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": \"Agendada\",\n//     \"selectedDeliveryChannel\": \"delivery\",\n//     \"shippingEstimate\": \"5bd\",\n//     \"shippingEstimateDate\": \"2018-02-23T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 0,\n//     \"slas\": [\n//       // You can pass all the properties of the sla\n//       {\n//         \"id\": \"Agendada\",\n//         \"deliveryChannel\": \"delivery\",\n//         \"availableDeliveryWindows\": [\n//           {\n//             startDateUtc: '2018-05-26T09:00:00+00:00',\n//             endDateUtc: '2018-05-26T21:00:00+00:00',\n//             price: 500,\n//             lisPrice: 500,\n//             tax: 0,\n//           },\n//           {\n//             startDateUtc: '2018-05-26T12:00:00+00:00',\n//             endDateUtc: '2018-05-26T13:00:00+00:00',\n//             price: 500,\n//             lisPrice: 500,\n//             tax: 0,\n//           }\n//         ]\n//       }\n//     ]\n//   },\n//   {\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": null,\n//     \"selectedDeliveryChannel\": null,\n//     \"shippingEstimate\": \"6bd\",\n//     \"shippingEstimateDate\": \"2018-02-24T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 1,\n//     \"slas\": [\n//       { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }\n//     ]\n//   }\n// ]\n```\n\n**params:**\n\n- **logisticsInfo**\n  Type: `Array\u003cobject\u003e`\n  The logisticsInfo like the one inside `orderForm.shippingData` with `selectedSla` and `slas`\n\n- **selectedSla**\n  Type: `string`\n  The id of the selected sla on logisticsInfo items\n\n- **availableDeliveryWindows**\n  Type: `Array\u003cobject\u003e`\n  Array of objects, each object with `startDateUtc`, `endDateUtc`, `price`, `lisPrice` and `tax` properties (like inside logisticsInfo[i].slas that have scheduled deliveries). The default value for this parameter is null\n\n**returns:**\n\n- **new logisticsInfo**\n  Type: `Array\u003cobject\u003e`\n  New logisticsInfo with selectedSla and selectedDeliveryChannel filled correctly on each item with slas that can be selected. Optionally the availableDeliveryWindows can be passed to filter the scheduled delivery slas\n\n### getNewLogisticsInfoWithSelectedScheduled (logisticsInfo)\n\nGet new logisticsInfo selecting first sla that has availableDeliveryWindows on each item that can be scheduled delivered.\n\n##### Usage\n\n```js\nconst {\n  getNewLogisticsInfoWithSelectedScheduled,\n} = require('@vtex/delivery-packages/dist/shipping')\n\nconst logisticsInfo = [\n  {\n    // You can pass all the properties of the logisticsInfo\n    addressId: '-4556418741084',\n    selectedSla: null,\n    selectedDeliveryChannel: null,\n    shippingEstimate: '5bd',\n    shippingEstimateDate: '2018-02-23T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 0,\n    slas: [\n      // You can pass all the properties of the sla\n      {\n        id: 'Agendada',\n        deliveryChannel: 'delivery',\n        availableDeliveryWindows: [\n          {\n            startDateUtc: '2018-05-26T09:00:00+00:00',\n            endDateUtc: '2018-05-26T21:00:00+00:00',\n            price: 500,\n            lisPrice: 500,\n            tax: 0,\n          },\n          {\n            startDateUtc: '2018-05-26T12:00:00+00:00',\n            endDateUtc: '2018-05-26T13:00:00+00:00',\n            price: 500,\n            lisPrice: 500,\n            tax: 0,\n          },\n        ],\n      },\n    ],\n  },\n  {\n    addressId: '-4556418741084',\n    selectedSla: null,\n    selectedDeliveryChannel: null,\n    shippingEstimate: '6bd',\n    shippingEstimateDate: '2018-02-24T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 1,\n    slas: [{ id: 'Normal', deliveryChannel: 'delivery' }],\n  },\n]\n\ngetNewLogisticsInfoWithSelectedScheduled(logisticsInfo)\n// -\u003e [\n//   {\n//     // You can pass all the properties of the logisticsInfo\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": 'Agendada',\n//     \"selectedDeliveryChannel\": 'delivery',\n//     \"shippingEstimate\": \"5bd\",\n//     \"shippingEstimateDate\": \"2018-02-23T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 0,\n//     \"slas\": [\n//       // You can pass all the properties of the sla\n//       {\n//         \"id\": \"Agendada\",\n//         \"deliveryChannel\": \"delivery\",\n//         \"availableDeliveryWindows\": [\n//           {\n//             startDateUtc: '2018-05-26T09:00:00+00:00',\n//             endDateUtc: '2018-05-26T21:00:00+00:00',\n//             price: 500,\n//             lisPrice: 500,\n//             tax: 0,\n//           },\n//           {\n//             startDateUtc: '2018-05-26T12:00:00+00:00',\n//             endDateUtc: '2018-05-26T13:00:00+00:00',\n//             price: 500,\n//             lisPrice: 500,\n//             tax: 0,\n//           }\n//         ]\n//       }\n//     ]\n//   },\n//   {\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": null,\n//     \"selectedDeliveryChannel\": null,\n//     \"shippingEstimate\": \"6bd\",\n//     \"shippingEstimateDate\": \"2018-02-24T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 1,\n//     \"slas\": [\n//       { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }\n//     ]\n//   }\n// ]\n```\n\n**params:**\n\n- **logisticsInfo**\n  Type: `Array\u003cobject\u003e`\n  The logisticsInfo like the one inside `orderForm.shippingData` with `selectedSla` and `slas`\n\n**returns:**\n\n- **new logisticsInfo**\n  Type: `Array\u003cobject\u003e`\n  New logisticsInfo with selectedSla and selectedDeliveryChannel filled correctly on each item with slas that has availableDeliveryWindows\n\n### getNewLogisticsInfoWithScheduledDeliveryChoice (logisticsInfo, scheduledDeliveryChoice, scheduledDeliveryItems = null)\n\nGet new logisticsInfo selecting the sla and delivery window passed and optionally filtering by a logistics items array.\n\n##### Usage\n\n```js\nconst {\n  getNewLogisticsInfoWithScheduledDeliveryChoice,\n} = require('@vtex/delivery-packages/dist/shipping')\n\nconst logisticsInfo = [\n  {\n    // You can pass all the properties of the logisticsInfo\n    addressId: '-4556418741084',\n    selectedSla: null,\n    selectedDeliveryChannel: null,\n    shippingEstimate: '5bd',\n    shippingEstimateDate: '2018-02-23T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 0,\n    slas: [\n      // You can pass all the properties of the sla\n      {\n        id: 'Agendada',\n        deliveryChannel: 'delivery',\n        availableDeliveryWindows: [\n          {\n            startDateUtc: '2018-05-26T09:00:00+00:00',\n            endDateUtc: '2018-05-26T21:00:00+00:00',\n            price: 500,\n            lisPrice: 500,\n            tax: 0,\n          },\n          {\n            startDateUtc: '2018-05-26T12:00:00+00:00',\n            endDateUtc: '2018-05-26T13:00:00+00:00',\n            price: 500,\n            lisPrice: 500,\n            tax: 0,\n          },\n        ],\n      },\n    ],\n  },\n  {\n    addressId: '-4556418741084',\n    selectedSla: null,\n    selectedDeliveryChannel: null,\n    shippingEstimate: '6bd',\n    shippingEstimateDate: '2018-02-24T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 1,\n    slas: [{ id: 'Normal', deliveryChannel: 'delivery' }],\n  },\n]\n\nconst deliveryWindow = {\n  startDateUtc: '2018-05-26T12:00:00+00:00',\n  endDateUtc: '2018-05-26T13:00:00+00:00',\n  price: 500,\n  lisPrice: 500,\n  tax: 0,\n}\n\ngetNewLogisticsInfoWithScheduledDeliveryChoice(\n  logisticsInfo,\n  { selectedSla: 'Agendada', deliveryWindow },\n  [{ itemIndex: 0 }]\n)\n// -\u003e [\n//   {\n//     // You can pass all the properties of the logisticsInfo\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": 'Agendada',\n//     \"selectedDeliveryChannel\": 'delivery',\n//     \"shippingEstimate\": \"5bd\",\n//     \"shippingEstimateDate\": \"2018-02-23T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 0,\n//     \"deliveryWindow\": {\n//       startDateUtc: '2018-05-26T12:00:00+00:00',\n//       endDateUtc: '2018-05-26T13:00:00+00:00',\n//       price: 500,\n//       lisPrice: 500,\n//       tax: 0,\n//     },\n//     \"slas\": [\n//       // You can pass all the properties of the sla\n//       {\n//         \"id\": \"Agendada\",\n//         \"deliveryChannel\": \"delivery\",\n//         \"deliveryWindow\": {\n//           startDateUtc: '2018-05-26T12:00:00+00:00',\n//           endDateUtc: '2018-05-26T13:00:00+00:00',\n//           price: 500,\n//           lisPrice: 500,\n//           tax: 0,\n//         },\n//         \"availableDeliveryWindows\": [\n//           {\n//             startDateUtc: '2018-05-26T09:00:00+00:00',\n//             endDateUtc: '2018-05-26T21:00:00+00:00',\n//             price: 500,\n//             lisPrice: 500,\n//             tax: 0,\n//           },\n//           {\n//             startDateUtc: '2018-05-26T12:00:00+00:00',\n//             endDateUtc: '2018-05-26T13:00:00+00:00',\n//             price: 500,\n//             lisPrice: 500,\n//             tax: 0,\n//           }\n//         ]\n//       }\n//     ]\n//   },\n//   {\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": null,\n//     \"selectedDeliveryChannel\": null,\n//     \"shippingEstimate\": \"6bd\",\n//     \"shippingEstimateDate\": \"2018-02-24T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 1,\n//     \"slas\": [\n//       { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }\n//     ]\n//   }\n// ]\n```\n\n**params:**\n\n- **logisticsInfo**\n  Type: `Array\u003cobject\u003e`\n  The logisticsInfo like the one inside `orderForm.shippingData` with `selectedSla` and `slas`\n- **scheduledDeliveryChoice**\n  Type: `object`\n  An object like `{ selectedSla, deliveryWindow }` saying what sla and deliveryWindow to choose the delivery\n- **scheduledDeliveryItems**\n  Type: `Array\u003cobject\u003e`\n  An array of objects, each like `{ itemIndex: number }` or `{ index: number }` so that you can filter what items should change their selected sla and delivery window\n\n**returns:**\n\n- **new logisticsInfo**\n  Type: `Array\u003cobject\u003e`\n  New logisticsInfo with selectedSla, selectedDeliveryChannel and deliveryWindow filled correctly according to the params\n\n### filterLogisticsInfo (logisticsInfo, filters, keepSize = false)\n\nGet new logisticsInfo filtered by filters object and optionally choosing if the missing items are maintained on the new array as `null` values, to keep the original size.\n\nOn each criteria, like in the `items` filter, the algorithm is to include everything that match any `item` filter (using an `||` logic).\n\n##### Usage\n\n```js\nconst { filterLogisticsInfo } = require('@vtex/delivery-packages/dist/shipping')\n\nconst logisticsInfo = [\n  {\n    // You can pass all the properties of the logisticsInfo\n    addressId: '-4556418741084',\n    selectedSla: null,\n    selectedDeliveryChannel: null,\n    shippingEstimate: '1bd',\n    shippingEstimateDate: '2018-02-23T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 0,\n    slas: [\n      // You can pass all the properties of the sla\n      { id: 'Expressa', deliveryChannel: 'delivery' },\n    ],\n  },\n  {\n    addressId: '-4556418741084',\n    selectedSla: null,\n    selectedDeliveryChannel: null,\n    shippingEstimate: '6bd',\n    shippingEstimateDate: '2018-02-24T19:01:07.0336412+00:00',\n    deliveryChannel: 'delivery',\n    itemIndex: 1,\n    slas: [{ id: 'Normal', deliveryChannel: 'delivery' }],\n  },\n]\n\nconst items = [{ index: 0 }] // or const items = [{ itemIndex: 0 }, { itemIndex: 2 }]\n\nfilterLogisticsInfo(logisticsInfo, { items })\n// -\u003e [\n//   {\n//     // You can pass all the properties of the logisticsInfo\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": null,\n//     \"selectedDeliveryChannel\": null,\n//     \"shippingEstimate\": \"1bd\",\n//     \"shippingEstimateDate\": \"2018-02-23T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 0,\n//     \"slas\": [\n//       // You can pass all the properties of the sla\n//       {\"id\": \"Expressa\", \"deliveryChannel\": \"delivery\"}\n//     ]\n//   }\n// ]\n\nconst keepSize = true\nfilterLogisticsInfo(logisticsInfo, { items }, keepSize)\n// -\u003e [\n//   {\n//     // You can pass all the properties of the logisticsInfo\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": null,\n//     \"selectedDeliveryChannel\": null,\n//     \"shippingEstimate\": \"1bd\",\n//     \"shippingEstimateDate\": \"2018-02-23T19:01:07.0336412+00:00\",\n//     \"deliveryChannel\": \"delivery\",\n//     \"itemIndex\": 0,\n//     \"slas\": [\n//       // You can pass all the properties of the sla\n//       {\"id\": \"Expressa\", \"deliveryChannel\": \"delivery\"}\n//     ]\n//   },\n//   null\n// ]\n```\n\n**params:**\n\n- **logisticsInfo**\n  Type: `Array\u003cobject\u003e`\n  The logisticsInfo like the one inside `orderForm.shippingData` with `selectedSla` and `slas`\n- **filters**\n  Type: `object`\n  An object like `{ items: [{ index or itemIndex: number }, ...], }` saying what items to filter on logisticsInfo\n- **keepSize**\n  Type: `boolean`\n  Flag to inform if the missing items are maintained on the new array as `null` values, to keep the original size, or they are just removed (default)\n\n**returns:**\n\n- **new logisticsInfo**\n  Type: `Array\u003cobject\u003e`\n  New logisticsInfo filtered by the `filters` param and with the size according to `keepSize` param\n\n### getNewLogisticsMatchingSelectedAddresses (logisticsInfo, selectedAddresses)\n\nGet new logisticsInfo and selectedAddresses making sure all pickup addresses that are on a selectedSla are included on selectedAddresses list and then making sure all logisticsInfo items have addressIds matching the ones on selectedAddresses.\n\n##### Usage\n```js\nconst { getNewLogisticsMatchingSelectedAddresses } = require('@vtex/delivery-packages/dist/shipping')\n\nconst logisticsInfo = [\n  {\n    // You can pass all the properties of the logisticsInfo\n    \"addressId\": \"-4556418741084\",\n    \"selectedSla\": \"MeuPickupPoint\",\n    \"selectedDeliveryChannel\": \"pickup-in-point\",\n    \"itemIndex\": 0,\n    \"slas\": [\n      {\n      \t\"id\": \"MeuPickupPoint\",\n      \t\"deliveryChannel\": \"pickup-in-point\",\n      \t\"name\": \"VTEX RJ (1b4e9b2)\",\n      \t\"shippingEstimate\": \"0bd\",\n      \t\"price\": 0,\n      \t\"pickupPointId\": \"1_1b4e9b2\",\n      \t\"pickupStoreInfo\": {\n      \t\t\"isPickupStore\": true,\n      \t\t\"friendlyName\": \"VTEX RJ\",\n      \t\t\"address\": {\n      \t\t\t\"addressType\": \"pickup\",\n      \t\t\t\"receiverName\": null,\n      \t\t\t\"addressId\": \"1b4e9b2\",\n      \t\t\t\"postalCode\": \"22250040\",\n      \t\t\t\"city\": \"Rio de Janeiro\",\n      \t\t\t\"state\": \"RJ\",\n      \t\t\t\"country\": \"BRA\",\n      \t\t\t\"street\": \"Praia de Botafogo\",\n      \t\t\t\"number\": \"300\",\n      \t\t\t\"neighborhood\": \"Botafogo\",\n      \t\t\t\"complement\": \"\",\n      \t\t\t\"reference\": null,\n      \t\t\t\"geoCoordinates\": [-43.1822662, -22.9459858]\n      \t\t}\n      \t}\n      }\n    ]\n  },\n  {\n    \"addressId\": null,\n    \"selectedSla\": \"Normal\",\n    \"selectedDeliveryChannel\": \"delivery\",\n    \"itemIndex\": 1,\n    \"slas\": [\n      // You can pass all the properties of the sla\n      { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }\n    ]\n  }\n]\n\nconst selectedAddresses = [{\n  \"addressId\": \"-4556418741084\",\n  \"addressType\": \"residential\",\n  \"receiverName\": \"John Doe\",\n  \"street\": \"Rua Barão\",\n  \"number\": \"2\",\n  \"complement\": null,\n  \"neighborhood\": \"Botafogo\",\n  \"postalCode\": \"22231-100\",\n  \"city\": \"Rio de Janeiro\",\n  \"state\": \"RJ\",\n  \"country\": \"BRA\",\n  \"reference\": null,\n  \"geoCoordinates\": [],\n}]\n\ngetNewLogisticsMatchingSelectedAddresses(logisticsInfo, selectedAddresses)\n// -\u003e {\n//   logisticsInfo: [{\n//     \"addressId\": \"1b4e9b2\",\n//     \"selectedSla\": \"MeuPickupPoint\",\n//     \"selectedDeliveryChannel\": \"pickup-in-point\",\n//     \"itemIndex\": 0,\n//     \"slas\": [\n//       {\n//       \t\"id\": \"MeuPickupPoint\",\n//       \t\"deliveryChannel\": \"pickup-in-point\",\n//       \t\"name\": \"VTEX RJ (1b4e9b2)\",\n//       \t\"shippingEstimate\": \"0bd\",\n//       \t\"price\": 0,\n//       \t\"pickupPointId\": \"1_1b4e9b2\",\n//       \t\"pickupStoreInfo\": {\n//       \t\t\"isPickupStore\": true,\n//       \t\t\"friendlyName\": \"VTEX RJ\",\n//       \t\t\"address\": {\n//       \t\t\t\"addressType\": \"pickup\",\n//       \t\t\t\"receiverName\": null,\n//       \t\t\t\"addressId\": \"1b4e9b2\",\n//       \t\t\t\"postalCode\": \"22250040\",\n//       \t\t\t\"city\": \"Rio de Janeiro\",\n//       \t\t\t\"state\": \"RJ\",\n//       \t\t\t\"country\": \"BRA\",\n//       \t\t\t\"street\": \"Praia de Botafogo\",\n//       \t\t\t\"number\": \"300\",\n//       \t\t\t\"neighborhood\": \"Botafogo\",\n//       \t\t\t\"complement\": \"\",\n//       \t\t\t\"reference\": null,\n//       \t\t\t\"geoCoordinates\": [-43.1822662, -22.9459858]\n//       \t\t}\n//       \t}\n//       }\n//     ]\n//   },\n//   {\n//     \"addressId\": \"-4556418741084\",\n//     \"selectedSla\": \"Normal\",\n//     \"selectedDeliveryChannel\": \"delivery\",\n//     \"itemIndex\": 1,\n//     \"slas\": [\n//       { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }\n//     ]\n//   }],\n//   selectedAddresses: [{\n//     \"addressId\": \"-4556418741084\",\n//     \"addressType\": \"residential\",\n//     \"receiverName\": \"John Doe\",\n//     \"street\": \"Rua Barão\",\n//     \"number\": \"2\",\n//     \"complement\": null,\n//     \"neighborhood\": \"Botafogo\",\n//     \"postalCode\": \"22231-100\",\n//     \"city\": \"Rio de Janeiro\",\n//     \"state\": \"RJ\",\n//     \"country\": \"BRA\",\n//     \"reference\": null,\n//     \"geoCoordinates\": [],\n//   }, {\n//     \"addressType\": \"pickup\",\n//     \"receiverName\": null,\n//     \"addressId\": \"1b4e9b2\",\n//     \"postalCode\": \"22250040\",\n//     \"city\": \"Rio de Janeiro\",\n//     \"state\": \"RJ\",\n//     \"country\": \"BRA\",\n//     \"street\": \"Praia de Botafogo\",\n//     \"number\": \"300\",\n//     \"neighborhood\": \"Botafogo\",\n//     \"complement\": \"\",\n//     \"reference\": null,\n//     \"geoCoordinates\": [-43.1822662, -22.9459858]\n//   }]\n// }\n```\n\n**params:**\n- **logisticsInfo**\nType: `Array\u003cobject\u003e`\nThe logisticsInfo like the one inside `orderForm.shippingData` with `selectedSla` and `slas`\n- **selectedAddresses**\nType: `Array\u003cobject\u003e`\nThe selectedAddresses like the one inside `orderForm.shippingData` with address objects that are related to the order\n**returns:**\n- **new object with new logisticsInfo and new selectedAddresses**\nType: `{ logisticsInfo: Array\u003cobject\u003e, selectedAddresses: Array\u003cobject\u003e }`\nNew logisticsInfo and selectedAddresses with matching addressIds and with all pickup addresses included\n\n### mergeLogisticsInfos (logisticsInfo1, logisticsInfo2)\n\nGet new logisticsInfo with the merged items from logisticsInfo1 and logisticsInfo2\n\n##### Usage\n```js\nconst { mergeLogisticsInfos } = require('@vtex/delivery-packages/dist/shipping')\n\nconst logisticsInfo1 = [\n  {\n    // You can pass all the properties of the logisticsInfo\n    \"itemIndex\": 0,\n    \"selectedSla\": \"sla1\",\n  },\n  {\n    // You can pass all the properties of the logisticsInfo\n    \"itemIndex\": 2,\n    \"selectedSla\": \"sla3\",\n  }\n]\nconst logisticsInfo2 = [\n  {\n    // You can pass all the properties of the logisticsInfo\n    \"itemIndex\": 1,\n    \"selectedSla\": \"sla2\",\n  }\n]\nmergeLogisticsInfos(logisticsInfo1, logisticsInfo2)\n// -\u003e [\n//   {\n//     \"itemIndex\": 0,\n//     \"selectedSla\": \"sla1\",\n//   },\n//   {\n//     \"itemIndex\": 1,\n//     \"selectedSla\": \"sla2\",\n//   },\n//   {\n//     \"itemIndex\": 2,\n//     \"selectedSla\": \"sla3\",\n//   },\n// ]\n```\n\n**params:**\n- **logisticsInfo1**\nType: `Array\u003cobject\u003e`\nThe logisticsInfo like the one inside `orderForm.shippingData` with `itemIndex`\n- **logisticsInfo2**\nType: `Array\u003cobject\u003e`\nThe logisticsInfo like the one inside `orderForm.shippingData` with `itemIndex`\n**returns:**\n- **new logisticsInfo**\nType: `Array\u003cobject\u003e`\nReturn all items of logisticsInfo2 completing its missing items from the logisticsInfo1 (merge operation)\n\n## SLA\n\n\u003e @vtex/delivery-packages/dist/sla\n\n### hasSLAs (slasSource)\n\nCheck if the object or array passed have one or more slas\n\n##### Usage\n\n```js\nconst { hasSLAs } = require('@vtex/delivery-packages/dist/sla')\n\nhasSLAs({\n  slas: [\n    { id: 'Normal', deliveryChannel: 'delivery' },\n    { id: 'Expressa', deliveryChannel: 'delivery' },\n  ],\n})\n// -\u003e true\n\nhasSLAs([\n  { id: 'Normal', deliveryChannel: 'delivery' },\n  { id: 'Expressa', deliveryChannel: 'delivery' },\n])\n// -\u003e true\n\nhasSLAs({ slas: [] })\n// -\u003e false\n```\n\n**params:**\n\n- **slasSource**\n  Type: `object` or `Array\u003cobject\u003e`\n  Object with slas key or array of objects\n\n**returns:**\n\n- **hasSLAs**\n  Type: `boolean`\n  true or false\n\n### hasDeliveryWindows (slas)\n\nCheck if the object or array passed have at least of sla that can be scheduled delivered.\n\n##### Usage\n\n```js\nconst { hasDeliveryWindows } = require('@vtex/delivery-packages/dist/sla')\n\nhasDeliveryWindows([\n  { id: 'Normal', deliveryChannel: 'delivery' },\n  { id: 'Expressa', deliveryChannel: 'delivery' },\n])\n// -\u003e false\n\nhasDeliveryWindows([\n  {\n    id: 'Agendada',\n    deliveryChannel: 'delivery',\n    availableDeliveryWindows: [\n      {\n        startDateUtc: '2018-05-26T09:00:00+00:00',\n        endDateUtc: '2018-05-26T21:00:00+00:00',\n        price: 500,\n        lisPrice: 500,\n        tax: 0,\n      },\n    ],\n  },\n  { id: 'Expressa', deliveryChannel: 'delivery' },\n])\n// -\u003e true\n\nhasDeliveryWindows({\n  id: 'Agendada',\n  deliveryChannel: 'delivery',\n  availableDeliveryWindows: [\n    {\n      startDateUtc: '2018-05-26T09:00:00+00:00',\n      endDateUtc: '2018-05-26T21:00:00+00:00',\n      price: 500,\n      lisPrice: 500,\n      tax: 0,\n    },\n  ],\n})\n// -\u003e true\n```\n\n**params:**\n\n- **slas**\n  Type: `object` or `Array\u003cobject\u003e`\n  Object with a single sla or an array of slas\n\n**returns:**\n\n- **hasDeliveryWindows**\n  Type: `boolean`\n  true or false\n\n### excludePickupTypeFromSlas (slas)\n\nReturn only delivery slas from a list of slas passed.\n\n##### Usage\n\n```js\nconst {\n  excludePickupTypeFromSlas,\n} = require('@vtex/delivery-packages/dist/sla')\n\nexcludePickupTypeFromSlas([\n  { id: 'Normal', deliveryChannel: 'delivery' },\n  {\n    id: 'Pickup',\n    deliveryChannel: 'delivery',\n    pickupStoreInfo: { isPickupStore: true, friendlyName: 'Shopping da Gávea' },\n  },\n])\n// -\u003e [ { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" } ]\n```\n\n**params:**\n\n- **slas**\n  Type: `Array\u003cobject\u003e`\n  An array of slas\n\n**returns:**\n\n- **delivery slas**\n  Type: `Array\u003cobject\u003e`\n  An array with only the delivery slas (no pickup point sla)\n\n### getSlaObj (slas, slaId)\n\nGet the sla object on slas that match the slaId passed.\n\n##### Usage\n\n```js\nconst { getSlaObj } = require('@vtex/delivery-packages/dist/sla')\n\ngetSlaObj(\n  [\n    { id: 'Normal', deliveryChannel: 'delivery' },\n    { id: 'Expressa', deliveryChannel: 'delivery' },\n  ],\n  'Normal'\n)\n// -\u003e { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }\n\ngetSlaObj(\n  [\n    { id: 'Normal', deliveryChannel: 'delivery' },\n    { id: 'Expressa', deliveryChannel: 'delivery' },\n  ],\n  'Agendada'\n)\n// -\u003e null\n```\n\n**params:**\n\n- **slas**\n  Type: `Array\u003cobject\u003e`\n  An array of slas\n\n- **slaId**\n  Type: `string`\n  The id of a sla of the list passed\n\n**returns:**\n\n- **sla**\n  Type: `object`\n  the sla object on the array that match the slaId passed or null if it doesn't find it\n\n### getSlaType (slaObj, order)\n\nGet the sla type (`delivery`, `pickup-in-point` or `take-away`) based on the sla deliveryChannel and if order is checkedIn\n\n##### Usage\n\n```js\nconst { getSlaType } = require('@vtex/delivery-packages/dist/sla')\n\ngetSlaType(\n  { id: 'Normal', deliveryChannel: 'delivery' }\n)\n// -\u003e \"delivery\"\n\ngetSlaType(\n  { id: 'Pickup', deliveryChannel: 'pickup-in-point' }\n)\n// -\u003e \"pickup-in-point\"\n\ngetSlaType(\n  { id: 'Pickup checked In', deliveryChannel: 'pickup-in-point', pickupPointId: '1_2' },\n  { orderId: '123', checkedInPickupPointId: '1_2' }\n)\n// -\u003e \"take-away\"\n```\n\n**params:**\n\n- **sla**\n  Type: `object`\n  An sla object\n\n- **order**\n  Type: `object`\n  An optional order object with the `checkedInPickupPointId` information\n\n**returns:**\n\n- **sla type**\n  Type: `string`\n  the sla type (`delivery`, `pickup-in-point` or `take-away`)\n\n### changeSelectedSla (logisticsInfoItem, sla)\n\nChange logisticsInfoItem info to match the sla passed\n\n##### Usage\n```js\nconst { changeSelectedSla } = require('@vtex/delivery-packages/dist/sla')\n\nchangeSelectedSla(\n  // Pode passar qualquer outra propriedade de um logisticsInfo item\n  { \"itemIndex\": 0, \"selectedSla\": \"Pickup\", \"selectedDeliveryChannel\": \"pickup-in-point\" },\n  { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }\n)\n// -\u003e { \"itemIndex\": 0, \"selectedSla\": \"Normal\", \"selectedDeliveryChannel\": \"delivery\" }\n```\n\n**params:**\n- **logisticsInfoItem**\nType: `object`\nAn object like the ones on logisticsInfo of the orderForm\n- **sla**\nType: `object`\nAn object like the ones on logisticsInfoItem.slas\n\n**returns:**\n- **newLogisticsInfoItem**\nType: `object`\nThe new logisticsInfoItem with the selectedSla infos changed to match the sla param\n\n### getSelectedSla ({logisticsInfo, itemIndex, selectedSla})\n\nGet the select sla object on logisticsInfo at the itemIndex position and optionally passing another selectedSla as reference.\n\n##### Usage\n\n```js\nconst { getSelectedSla } = require('@vtex/delivery-packages/dist/sla')\n\ngetSelectedSla({\n  logisticsInfo: [\n    {\n      // other logisticsInfo properties can be passed also\n      selectedSla: 'Normal',\n      slas: [\n        { id: 'Normal', deliveryChannel: 'delivery' },\n        { id: 'Expressa', deliveryChannel: 'delivery' },\n      ],\n    },\n    {\n      // other logisticsInfo properties can be passed also\n      selectedSla: 'Expressa',\n      slas: [\n        { id: 'Normal', deliveryChannel: 'delivery' },\n        { id: 'Expressa', deliveryChannel: 'delivery' },\n      ],\n    },\n  ],\n  itemIndex: 0,\n})\n// -\u003e { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }\n\ngetSelectedSla({\n  logisticsInfo: [\n    {\n      // other logisticsInfo properties can be passed also\n      selectedSla: 'Normal',\n      slas: [\n        { id: 'Normal', deliveryChannel: 'delivery' },\n        { id: 'Expressa', deliveryChannel: 'delivery' },\n      ],\n    },\n    {\n      // other logisticsInfo properties can be passed also\n      selectedSla: 'Expressa',\n      slas: [\n        { id: 'Normal', deliveryChannel: 'delivery' },\n        { id: 'Expressa', deliveryChannel: 'delivery' },\n      ],\n    },\n  ],\n  itemIndex: 1,\n  selectedSla: 'Normal',\n})\n// -\u003e { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }\n```\n\n**params:**\n\n- **selectedSlaContext**\n  Type: `object`\n  Object on the format `{logisticsInfo, itemIndex, selectedSla}` with logisticsInfo being an object like the one inside an orderForm, itemIndex a number referring the position of a logisticsInfo item and selectedSla an optional string with the id of the wanted sla\n\n**returns:**\n\n- **selectedSla**\nType: `object`\nthe selectedSla object on the logisticsInfo item that itemIndex refers and optionally using another selectedSla then the one on logisticsInfo item\n\n### getSelectedSlas (logisticsInfo)\n\nGet all selected slas objects on logisticsInfo.\n\n##### Usage\n```js\nconst { getSelectedSlas } = require('@vtex/delivery-packages/dist/sla')\n\nlet logisticsInfo = [\n  {\n    // other logisticsInfo properties can be passed also\n    selectedSla: 'Normal',\n    itemIndex: 0,\n    slas: [\n      { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }, { \"id\": \"Expressa\", \"deliveryChannel\": \"delivery\" }\n    ]\n  },\n  {\n    // other logisticsInfo properties can be passed also\n    selectedSla: 'Expressa',\n    itemIndex: 1,\n    slas: [\n      { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }, { \"id\": \"Expressa\", \"deliveryChannel\": \"delivery\" }\n    ]\n  }\n]\n\ngetSelectedSlas(logisticsInfo)\n// -\u003e [{ itemIndex: 0, \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }, { itemIndex: 1, \"id\": \"Expressa\", \"deliveryChannel\": \"delivery\" }]\n\nlogisticsInfo = [\n  {\n    // other logisticsInfo properties can be passed also\n    selectedSla: 'Normal',\n    itemIndex: 0,\n    slas: [\n      { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }, { \"id\": \"Expressa\", \"deliveryChannel\": \"delivery\" }\n    ]\n  },\n  {\n    // other logisticsInfo properties can be passed also\n    selectedSla: null,\n    itemIndex: 1,\n    slas: [\n      { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }, { \"id\": \"Expressa\", \"deliveryChannel\": \"delivery\" }\n    ]\n  }\n]\n\ngetSelectedSlas(logisticsInfo)\n// -\u003e [{ itemIndex: 0, \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }, null]\n```\n\n**params:**\n- **logisticsInfo**\nType: `Array\u003cobject\u003e`\nThe logisticsInfo like the one inside `orderForm.shippingData` with `selectedSla` and `slas`\n\n**returns:**\n- **selectedSlas**\nType: `Array\u003cobject\u003e`\nthe selected slas objects on the logisticsInfo items hydrated with itemIndex reference or empty array in case of wrong or empty params passed\n\n## getPickupSelectedSlas (logisticsInfo)\n\nGet the selected slas objects on logisticsInfo filtered by pickup points type.\n\n##### Usage\n```js\nconst { getPickupSelectedSlas } = require('@vtex/delivery-packages/dist/sla')\n\nlet logisticsInfo = [\n  {\n    // other logisticsInfo properties can be passed also\n    selectedSla: 'Normal',\n    itemIndex: 0,\n    slas: [\n      { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }, { \"id\": \"Expressa\", \"deliveryChannel\": \"delivery\" }\n    ]\n  },\n  {\n    // other logisticsInfo properties can be passed also\n    selectedSla: 'Pickup',\n    itemIndex: 1,\n    slas: [\n      { \"id\": \"Normal\", \"deliveryChannel\": \"delivery\" }, { \"id\": \"Pickup\", \"deliveryChannel\": \"pickup-in-point\" }\n    ]\n  }\n]\n\ngetPickupSelectedSlas(logisticsInfo)\n// -\u003e [{ \"itemIndex\": 1,  \"id\": \"Pickup\", \"deliveryChannel\": \"pickup-in-point\" }]\n```\n\n**params:**\n- **logisticsInfo**\nType: `Array\u003cobject\u003e`\nThe logisticsInfo like the one inside `orderForm.shippingData` with `selectedSla` and `slas`\n\n**returns:**\n- **selectedPickupSlas**\nType: `Array\u003cobject\u003e`\nthe selected slas objects on the logisticsInfo items hydrated with itemIndex reference and filtered by pickup type or empty array in case of wrong or empty params passed\n\n## License\n\nMIT © [VTEX](https://www.vtex.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtex%2Fdelivery-packages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvtex%2Fdelivery-packages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtex%2Fdelivery-packages/lists"}