@shipengine/js-api 1.20.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -10,17 +10,17 @@ var AccountBillingPlanChangeType = /* @__PURE__ */ ((AccountBillingPlanChangeTyp
10
10
  return AccountBillingPlanChangeType2;
11
11
  })(AccountBillingPlanChangeType || {});
12
12
 
13
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
14
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
15
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
13
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
14
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
15
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
16
16
  var __objRest$2 = (source, exclude) => {
17
17
  var target = {};
18
18
  for (var prop in source)
19
- if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
19
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
20
20
  target[prop] = source[prop];
21
- if (source != null && __getOwnPropSymbols$5)
22
- for (var prop of __getOwnPropSymbols$5(source)) {
23
- if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
21
+ if (source != null && __getOwnPropSymbols$6)
22
+ for (var prop of __getOwnPropSymbols$6(source)) {
23
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
24
24
  target[prop] = source[prop];
25
25
  }
26
26
  return target;
@@ -142,17 +142,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
142
142
  RateCardStatus
143
143
  }, Symbol.toStringTag, { value: 'Module' }));
144
144
 
145
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
146
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
147
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
145
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
146
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
147
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
148
148
  var __objRest$1 = (source, exclude) => {
149
149
  var target = {};
150
150
  for (var prop in source)
151
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
151
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
152
152
  target[prop] = source[prop];
153
- if (source != null && __getOwnPropSymbols$4)
154
- for (var prop of __getOwnPropSymbols$4(source)) {
155
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
153
+ if (source != null && __getOwnPropSymbols$5)
154
+ for (var prop of __getOwnPropSymbols$5(source)) {
155
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
156
156
  target[prop] = source[prop];
157
157
  }
158
158
  return target;
@@ -996,21 +996,21 @@ const getEndUserIpAddress = () => __async$5(void 0, null, function* () {
996
996
  }
997
997
  });
998
998
 
999
- var __defProp$3 = Object.defineProperty;
999
+ var __defProp$4 = Object.defineProperty;
1000
1000
  var __defProps$1 = Object.defineProperties;
1001
1001
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
1002
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
1003
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
1004
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
1005
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1006
- var __spreadValues$3 = (a, b) => {
1002
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
1003
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
1004
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
1005
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1006
+ var __spreadValues$4 = (a, b) => {
1007
1007
  for (var prop in b || (b = {}))
1008
- if (__hasOwnProp$3.call(b, prop))
1009
- __defNormalProp$3(a, prop, b[prop]);
1010
- if (__getOwnPropSymbols$3)
1011
- for (var prop of __getOwnPropSymbols$3(b)) {
1012
- if (__propIsEnum$3.call(b, prop))
1013
- __defNormalProp$3(a, prop, b[prop]);
1008
+ if (__hasOwnProp$4.call(b, prop))
1009
+ __defNormalProp$4(a, prop, b[prop]);
1010
+ if (__getOwnPropSymbols$4)
1011
+ for (var prop of __getOwnPropSymbols$4(b)) {
1012
+ if (__propIsEnum$4.call(b, prop))
1013
+ __defNormalProp$4(a, prop, b[prop]);
1014
1014
  }
1015
1015
  return a;
1016
1016
  };
@@ -1018,11 +1018,11 @@ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
1018
1018
  var __objRest = (source, exclude) => {
1019
1019
  var target = {};
1020
1020
  for (var prop in source)
1021
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
1021
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
1022
1022
  target[prop] = source[prop];
1023
- if (source != null && __getOwnPropSymbols$3)
1024
- for (var prop of __getOwnPropSymbols$3(source)) {
1025
- if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
1023
+ if (source != null && __getOwnPropSymbols$4)
1024
+ for (var prop of __getOwnPropSymbols$4(source)) {
1025
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
1026
1026
  target[prop] = source[prop];
1027
1027
  }
1028
1028
  return target;
@@ -1070,7 +1070,7 @@ class CarriersAPI {
1070
1070
  const endUserIpAddress = yield getEndUserIpAddress();
1071
1071
  if (!endUserIpAddress)
1072
1072
  return Promise.reject([new CodedError("Unable to get IP address")]);
1073
- return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$1(__spreadValues$3({}, connection), {
1073
+ return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$1(__spreadValues$4({}, connection), {
1074
1074
  endUserIpAddress
1075
1075
  }));
1076
1076
  });
@@ -3434,19 +3434,19 @@ class CustomPackagesAPI {
3434
3434
  }
3435
3435
  }
3436
3436
 
3437
- var __defProp$2 = Object.defineProperty;
3438
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
3439
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
3440
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
3441
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3442
- var __spreadValues$2 = (a, b) => {
3437
+ var __defProp$3 = Object.defineProperty;
3438
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
3439
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
3440
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
3441
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3442
+ var __spreadValues$3 = (a, b) => {
3443
3443
  for (var prop in b || (b = {}))
3444
- if (__hasOwnProp$2.call(b, prop))
3445
- __defNormalProp$2(a, prop, b[prop]);
3446
- if (__getOwnPropSymbols$2)
3447
- for (var prop of __getOwnPropSymbols$2(b)) {
3448
- if (__propIsEnum$2.call(b, prop))
3449
- __defNormalProp$2(a, prop, b[prop]);
3444
+ if (__hasOwnProp$3.call(b, prop))
3445
+ __defNormalProp$3(a, prop, b[prop]);
3446
+ if (__getOwnPropSymbols$3)
3447
+ for (var prop of __getOwnPropSymbols$3(b)) {
3448
+ if (__propIsEnum$3.call(b, prop))
3449
+ __defNormalProp$3(a, prop, b[prop]);
3450
3450
  }
3451
3451
  return a;
3452
3452
  };
@@ -3494,7 +3494,7 @@ class FundingSourcesAPI {
3494
3494
  if (!endUserIpAddress) {
3495
3495
  return Promise.reject([new CodedError("Unable to get IP address")]);
3496
3496
  }
3497
- return yield this.client.post("/v1/funding_sources", __spreadValues$2({
3497
+ return yield this.client.post("/v1/funding_sources", __spreadValues$3({
3498
3498
  endUserIpAddress
3499
3499
  }, createFundingSource));
3500
3500
  });
@@ -3526,7 +3526,7 @@ class FundingSourcesAPI {
3526
3526
  if (!endUserIpAddress) {
3527
3527
  return Promise.reject([new CodedError("Unable to get IP address")]);
3528
3528
  }
3529
- return yield this.client.post("/v1/registration/funding_source", __spreadValues$2({
3529
+ return yield this.client.post("/v1/registration/funding_source", __spreadValues$3({
3530
3530
  endUserIpAddress
3531
3531
  }, carrier));
3532
3532
  });
@@ -3731,6 +3731,22 @@ class RateCardsAPI {
3731
3731
  }
3732
3732
  }
3733
3733
 
3734
+ var __defProp$2 = Object.defineProperty;
3735
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
3736
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
3737
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
3738
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3739
+ var __spreadValues$2 = (a, b) => {
3740
+ for (var prop in b || (b = {}))
3741
+ if (__hasOwnProp$2.call(b, prop))
3742
+ __defNormalProp$2(a, prop, b[prop]);
3743
+ if (__getOwnPropSymbols$2)
3744
+ for (var prop of __getOwnPropSymbols$2(b)) {
3745
+ if (__propIsEnum$2.call(b, prop))
3746
+ __defNormalProp$2(a, prop, b[prop]);
3747
+ }
3748
+ return a;
3749
+ };
3734
3750
  class RatesAPI {
3735
3751
  constructor(client) {
3736
3752
  this.client = client;
@@ -3744,6 +3760,13 @@ class RatesAPI {
3744
3760
  shipmentId
3745
3761
  });
3746
3762
  };
3763
+ /**
3764
+ * The `estimate` endpoint allows us to obtain estimated rates based on the payload that is attached to the POST
3765
+ * method.
3766
+ */
3767
+ this.estimate = (params) => {
3768
+ return this.client.post("/v1/rates/estimate", __spreadValues$2({}, params));
3769
+ };
3747
3770
  this.client = client;
3748
3771
  }
3749
3772
  }
package/index.mjs CHANGED
@@ -6,17 +6,17 @@ var AccountBillingPlanChangeType = /* @__PURE__ */ ((AccountBillingPlanChangeTyp
6
6
  return AccountBillingPlanChangeType2;
7
7
  })(AccountBillingPlanChangeType || {});
8
8
 
9
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
10
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
11
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
9
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
10
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
12
12
  var __objRest$2 = (source, exclude) => {
13
13
  var target = {};
14
14
  for (var prop in source)
15
- if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
15
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
16
16
  target[prop] = source[prop];
17
- if (source != null && __getOwnPropSymbols$5)
18
- for (var prop of __getOwnPropSymbols$5(source)) {
19
- if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
17
+ if (source != null && __getOwnPropSymbols$6)
18
+ for (var prop of __getOwnPropSymbols$6(source)) {
19
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
20
20
  target[prop] = source[prop];
21
21
  }
22
22
  return target;
@@ -138,17 +138,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
138
138
  RateCardStatus
139
139
  }, Symbol.toStringTag, { value: 'Module' }));
140
140
 
141
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
142
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
143
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
141
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
142
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
143
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
144
144
  var __objRest$1 = (source, exclude) => {
145
145
  var target = {};
146
146
  for (var prop in source)
147
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
147
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
148
148
  target[prop] = source[prop];
149
- if (source != null && __getOwnPropSymbols$4)
150
- for (var prop of __getOwnPropSymbols$4(source)) {
151
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
149
+ if (source != null && __getOwnPropSymbols$5)
150
+ for (var prop of __getOwnPropSymbols$5(source)) {
151
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
152
152
  target[prop] = source[prop];
153
153
  }
154
154
  return target;
@@ -992,21 +992,21 @@ const getEndUserIpAddress = () => __async$5(void 0, null, function* () {
992
992
  }
993
993
  });
994
994
 
995
- var __defProp$3 = Object.defineProperty;
995
+ var __defProp$4 = Object.defineProperty;
996
996
  var __defProps$1 = Object.defineProperties;
997
997
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
998
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
999
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
1000
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
1001
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1002
- var __spreadValues$3 = (a, b) => {
998
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
999
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
1000
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
1001
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1002
+ var __spreadValues$4 = (a, b) => {
1003
1003
  for (var prop in b || (b = {}))
1004
- if (__hasOwnProp$3.call(b, prop))
1005
- __defNormalProp$3(a, prop, b[prop]);
1006
- if (__getOwnPropSymbols$3)
1007
- for (var prop of __getOwnPropSymbols$3(b)) {
1008
- if (__propIsEnum$3.call(b, prop))
1009
- __defNormalProp$3(a, prop, b[prop]);
1004
+ if (__hasOwnProp$4.call(b, prop))
1005
+ __defNormalProp$4(a, prop, b[prop]);
1006
+ if (__getOwnPropSymbols$4)
1007
+ for (var prop of __getOwnPropSymbols$4(b)) {
1008
+ if (__propIsEnum$4.call(b, prop))
1009
+ __defNormalProp$4(a, prop, b[prop]);
1010
1010
  }
1011
1011
  return a;
1012
1012
  };
@@ -1014,11 +1014,11 @@ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
1014
1014
  var __objRest = (source, exclude) => {
1015
1015
  var target = {};
1016
1016
  for (var prop in source)
1017
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
1017
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
1018
1018
  target[prop] = source[prop];
1019
- if (source != null && __getOwnPropSymbols$3)
1020
- for (var prop of __getOwnPropSymbols$3(source)) {
1021
- if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
1019
+ if (source != null && __getOwnPropSymbols$4)
1020
+ for (var prop of __getOwnPropSymbols$4(source)) {
1021
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
1022
1022
  target[prop] = source[prop];
1023
1023
  }
1024
1024
  return target;
@@ -1066,7 +1066,7 @@ class CarriersAPI {
1066
1066
  const endUserIpAddress = yield getEndUserIpAddress();
1067
1067
  if (!endUserIpAddress)
1068
1068
  return Promise.reject([new CodedError("Unable to get IP address")]);
1069
- return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$1(__spreadValues$3({}, connection), {
1069
+ return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$1(__spreadValues$4({}, connection), {
1070
1070
  endUserIpAddress
1071
1071
  }));
1072
1072
  });
@@ -3430,19 +3430,19 @@ class CustomPackagesAPI {
3430
3430
  }
3431
3431
  }
3432
3432
 
3433
- var __defProp$2 = Object.defineProperty;
3434
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
3435
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
3436
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
3437
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3438
- var __spreadValues$2 = (a, b) => {
3433
+ var __defProp$3 = Object.defineProperty;
3434
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
3435
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
3436
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
3437
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3438
+ var __spreadValues$3 = (a, b) => {
3439
3439
  for (var prop in b || (b = {}))
3440
- if (__hasOwnProp$2.call(b, prop))
3441
- __defNormalProp$2(a, prop, b[prop]);
3442
- if (__getOwnPropSymbols$2)
3443
- for (var prop of __getOwnPropSymbols$2(b)) {
3444
- if (__propIsEnum$2.call(b, prop))
3445
- __defNormalProp$2(a, prop, b[prop]);
3440
+ if (__hasOwnProp$3.call(b, prop))
3441
+ __defNormalProp$3(a, prop, b[prop]);
3442
+ if (__getOwnPropSymbols$3)
3443
+ for (var prop of __getOwnPropSymbols$3(b)) {
3444
+ if (__propIsEnum$3.call(b, prop))
3445
+ __defNormalProp$3(a, prop, b[prop]);
3446
3446
  }
3447
3447
  return a;
3448
3448
  };
@@ -3490,7 +3490,7 @@ class FundingSourcesAPI {
3490
3490
  if (!endUserIpAddress) {
3491
3491
  return Promise.reject([new CodedError("Unable to get IP address")]);
3492
3492
  }
3493
- return yield this.client.post("/v1/funding_sources", __spreadValues$2({
3493
+ return yield this.client.post("/v1/funding_sources", __spreadValues$3({
3494
3494
  endUserIpAddress
3495
3495
  }, createFundingSource));
3496
3496
  });
@@ -3522,7 +3522,7 @@ class FundingSourcesAPI {
3522
3522
  if (!endUserIpAddress) {
3523
3523
  return Promise.reject([new CodedError("Unable to get IP address")]);
3524
3524
  }
3525
- return yield this.client.post("/v1/registration/funding_source", __spreadValues$2({
3525
+ return yield this.client.post("/v1/registration/funding_source", __spreadValues$3({
3526
3526
  endUserIpAddress
3527
3527
  }, carrier));
3528
3528
  });
@@ -3727,6 +3727,22 @@ class RateCardsAPI {
3727
3727
  }
3728
3728
  }
3729
3729
 
3730
+ var __defProp$2 = Object.defineProperty;
3731
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
3732
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
3733
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
3734
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3735
+ var __spreadValues$2 = (a, b) => {
3736
+ for (var prop in b || (b = {}))
3737
+ if (__hasOwnProp$2.call(b, prop))
3738
+ __defNormalProp$2(a, prop, b[prop]);
3739
+ if (__getOwnPropSymbols$2)
3740
+ for (var prop of __getOwnPropSymbols$2(b)) {
3741
+ if (__propIsEnum$2.call(b, prop))
3742
+ __defNormalProp$2(a, prop, b[prop]);
3743
+ }
3744
+ return a;
3745
+ };
3730
3746
  class RatesAPI {
3731
3747
  constructor(client) {
3732
3748
  this.client = client;
@@ -3740,6 +3756,13 @@ class RatesAPI {
3740
3756
  shipmentId
3741
3757
  });
3742
3758
  };
3759
+ /**
3760
+ * The `estimate` endpoint allows us to obtain estimated rates based on the payload that is attached to the POST
3761
+ * method.
3762
+ */
3763
+ this.estimate = (params) => {
3764
+ return this.client.post("/v1/rates/estimate", __spreadValues$2({}, params));
3765
+ };
3743
3766
  this.client = client;
3744
3767
  }
3745
3768
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "1.20.0",
3
+ "version": "1.22.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
package/rates/api.d.ts CHANGED
@@ -1,32 +1,5 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { Currency } from "../payments";
3
- import { RateResponse } from "./types";
4
- /**
5
- * # Rates API - Calculate Rates Options
6
- */
7
- export interface CalculateRatesOptions {
8
- /**
9
- * `calculateTaxAmount` is an optional boolean that indicates rates returned
10
- * should include the tax amount.
11
- */
12
- calculateTaxAmount?: boolean;
13
- /**
14
- * `carrierIds` is an array of carrier IDs to filter rates by.
15
- */
16
- carrierIds: string[];
17
- /**
18
- * `packageTypes` is an optional array of package types to filter rates by.
19
- */
20
- packageTypes?: string[];
21
- /**
22
- * `preferredCurrency` is an optional indicator of the currency to return rates in.
23
- */
24
- preferredCurrency?: Currency;
25
- /**
26
- * `serviceCodes` is an optional array of specific carrier service codes to filter rates by.
27
- */
28
- serviceCodes?: string[];
29
- }
2
+ import { CalculateRatesOptions, RateResponse, RatesEstimateParams, RatesEstimateResponse } from "./types";
30
3
  /**
31
4
  * # Rates API module - /v1/rates
32
5
  */
@@ -43,4 +16,9 @@ export declare class RatesAPI {
43
16
  } & {
44
17
  rateResponse: RateResponse;
45
18
  }, any>>;
19
+ /**
20
+ * The `estimate` endpoint allows us to obtain estimated rates based on the payload that is attached to the POST
21
+ * method.
22
+ */
23
+ estimate: (params: RatesEstimateParams) => Promise<import("axios").AxiosResponse<RatesEstimateResponse, any>>;
46
24
  }
package/rates/types.d.ts CHANGED
@@ -1,30 +1,24 @@
1
+ import { DimensionsWithUnit } from "../dimensions";
1
2
  import { CodedError } from "../errors";
2
- import { Money } from "../payments";
3
- /**
4
- * @category Entities
5
- */
3
+ import { Currency, Money } from "../payments";
4
+ import { WeightWithUnit } from "../weight";
6
5
  export type RateType = "check" | "shipment";
7
- /**
8
- * @category Entities
9
- */
10
6
  export type RateDetailType = "uncategorized" | "shipping" | "insurance" | "confirmation" | "discount" | "fuel_charge" | "additional_fees" | "tariff" | "tax" | "delivery" | "handling" | "special_goods" | "pickup" | "location_fee" | "oversize" | "returns" | "notifications" | "tip" | "duties_and_taxes" | "brokerage_fee" | "admin_fee" | "adjustment";
11
- /**
12
- * @category Entities
13
- */
7
+ export type TaxType = "VAT";
8
+ export type RateDetailAttributes = {
9
+ taxCode: string;
10
+ taxPercentage: number;
11
+ taxType: TaxType;
12
+ };
14
13
  export type RateDetail = {
15
14
  amount: Money;
16
15
  carrierBillingCode: string | null;
17
16
  carrierDescription: string;
18
17
  carrierMemo: string | null;
18
+ rateDetailAttributes: RateDetailAttributes | null;
19
19
  rateDetailType: RateDetailType;
20
20
  };
21
- /**
22
- * @category Entities
23
- */
24
21
  export type RateValidationStatus = "valid" | "invalid" | "has_warnings" | "unknown";
25
- /**
26
- * @category Entities
27
- */
28
22
  export interface Rate {
29
23
  carrierCode: string;
30
24
  carrierDeliveryDays: string;
@@ -53,9 +47,6 @@ export interface Rate {
53
47
  warningMessages: string[];
54
48
  zone?: number;
55
49
  }
56
- /**
57
- * @category Entities
58
- */
59
50
  export interface RateResponse {
60
51
  createdAt: string;
61
52
  errors: CodedError[];
@@ -65,3 +56,43 @@ export interface RateResponse {
65
56
  shipmentId: string;
66
57
  status: "working" | "completed" | "partial" | "error";
67
58
  }
59
+ export type RatesEstimateResponse = Array<Omit<Rate, "rateId">>;
60
+ export interface CalculateRatesOptions {
61
+ /**
62
+ * `calculateTaxAmount` is an optional boolean that indicates rates returned
63
+ * should include the tax amount.
64
+ */
65
+ calculateTaxAmount?: boolean;
66
+ /**
67
+ * `carrierIds` is an array of carrier IDs to filter rates by.
68
+ */
69
+ carrierIds: string[];
70
+ /**
71
+ * `packageTypes` is an optional array of package types to filter rates by.
72
+ */
73
+ packageTypes?: string[];
74
+ /**
75
+ * `preferredCurrency` is an optional indicator of the currency to return rates in.
76
+ */
77
+ preferredCurrency?: Currency;
78
+ /**
79
+ * `serviceCodes` is an optional array of specific carrier service codes to filter rates by.
80
+ */
81
+ serviceCodes?: string[];
82
+ }
83
+ export interface RatesEstimateParams {
84
+ addressResidentialIndicator: string;
85
+ carrierIds: string[];
86
+ confirmation: string;
87
+ dimensions: DimensionsWithUnit;
88
+ fromCityLocality: string;
89
+ fromCountryCode: string;
90
+ fromPostalCode: string;
91
+ fromStateProvince: string;
92
+ shipDate: string;
93
+ toCityLocality: string;
94
+ toCountryCode: string;
95
+ toPostalCode: string;
96
+ toStateProvince: string;
97
+ weight: WeightWithUnit;
98
+ }