@shipengine/alchemy 5.1.8 → 5.1.10

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.
Files changed (3) hide show
  1. package/index.js +217 -77
  2. package/index.mjs +214 -78
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -10786,17 +10786,17 @@ var AccountBillingPlanChangeType = /* @__PURE__ */ ((AccountBillingPlanChangeTyp
10786
10786
  return AccountBillingPlanChangeType2;
10787
10787
  })(AccountBillingPlanChangeType || {});
10788
10788
 
10789
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
10790
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
10791
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
10789
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
10790
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
10791
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
10792
10792
  var __objRest$e = (source, exclude) => {
10793
10793
  var target = {};
10794
10794
  for (var prop in source)
10795
- if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
10795
+ if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
10796
10796
  target[prop] = source[prop];
10797
- if (source != null && __getOwnPropSymbols$j)
10798
- for (var prop of __getOwnPropSymbols$j(source)) {
10799
- if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
10797
+ if (source != null && __getOwnPropSymbols$k)
10798
+ for (var prop of __getOwnPropSymbols$k(source)) {
10799
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
10800
10800
  target[prop] = source[prop];
10801
10801
  }
10802
10802
  return target;
@@ -10918,17 +10918,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
10918
10918
  RateCardStatus
10919
10919
  }, Symbol.toStringTag, { value: 'Module' }));
10920
10920
 
10921
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
10922
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
10923
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
10921
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
10922
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
10923
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
10924
10924
  var __objRest$d = (source, exclude) => {
10925
10925
  var target = {};
10926
10926
  for (var prop in source)
10927
- if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
10927
+ if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
10928
10928
  target[prop] = source[prop];
10929
- if (source != null && __getOwnPropSymbols$i)
10930
- for (var prop of __getOwnPropSymbols$i(source)) {
10931
- if (exclude.indexOf(prop) < 0 && __propIsEnum$i.call(source, prop))
10929
+ if (source != null && __getOwnPropSymbols$j)
10930
+ for (var prop of __getOwnPropSymbols$j(source)) {
10931
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
10932
10932
  target[prop] = source[prop];
10933
10933
  }
10934
10934
  return target;
@@ -13670,7 +13670,7 @@ var ipaddr = {
13670
13670
  }).call(commonjsGlobal);
13671
13671
  } (ipaddr));
13672
13672
 
13673
- var __async$E = (__this, __arguments, generator) => {
13673
+ var __async$G = (__this, __arguments, generator) => {
13674
13674
  return new Promise((resolve, reject) => {
13675
13675
  var fulfilled = (value) => {
13676
13676
  try {
@@ -13690,7 +13690,7 @@ var __async$E = (__this, __arguments, generator) => {
13690
13690
  step((generator = generator.apply(__this, __arguments)).next());
13691
13691
  });
13692
13692
  };
13693
- const getEndUserIpAddress = () => __async$E(void 0, null, function* () {
13693
+ const getEndUserIpAddress = () => __async$G(void 0, null, function* () {
13694
13694
  try {
13695
13695
  const response = yield axios.get("https://api.ipify.org/?format=json");
13696
13696
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -13702,21 +13702,21 @@ const getEndUserIpAddress = () => __async$E(void 0, null, function* () {
13702
13702
  }
13703
13703
  });
13704
13704
 
13705
- var __defProp$6 = Object.defineProperty;
13705
+ var __defProp$7 = Object.defineProperty;
13706
13706
  var __defProps$3 = Object.defineProperties;
13707
13707
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
13708
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
13709
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
13710
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
13711
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13712
- var __spreadValues$6 = (a, b) => {
13708
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
13709
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
13710
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
13711
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13712
+ var __spreadValues$7 = (a, b) => {
13713
13713
  for (var prop in b || (b = {}))
13714
- if (__hasOwnProp$h.call(b, prop))
13715
- __defNormalProp$6(a, prop, b[prop]);
13716
- if (__getOwnPropSymbols$h)
13717
- for (var prop of __getOwnPropSymbols$h(b)) {
13718
- if (__propIsEnum$h.call(b, prop))
13719
- __defNormalProp$6(a, prop, b[prop]);
13714
+ if (__hasOwnProp$i.call(b, prop))
13715
+ __defNormalProp$7(a, prop, b[prop]);
13716
+ if (__getOwnPropSymbols$i)
13717
+ for (var prop of __getOwnPropSymbols$i(b)) {
13718
+ if (__propIsEnum$i.call(b, prop))
13719
+ __defNormalProp$7(a, prop, b[prop]);
13720
13720
  }
13721
13721
  return a;
13722
13722
  };
@@ -13724,16 +13724,16 @@ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
13724
13724
  var __objRest$c = (source, exclude) => {
13725
13725
  var target = {};
13726
13726
  for (var prop in source)
13727
- if (__hasOwnProp$h.call(source, prop) && exclude.indexOf(prop) < 0)
13727
+ if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
13728
13728
  target[prop] = source[prop];
13729
- if (source != null && __getOwnPropSymbols$h)
13730
- for (var prop of __getOwnPropSymbols$h(source)) {
13731
- if (exclude.indexOf(prop) < 0 && __propIsEnum$h.call(source, prop))
13729
+ if (source != null && __getOwnPropSymbols$i)
13730
+ for (var prop of __getOwnPropSymbols$i(source)) {
13731
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$i.call(source, prop))
13732
13732
  target[prop] = source[prop];
13733
13733
  }
13734
13734
  return target;
13735
13735
  };
13736
- var __async$D = (__this, __arguments, generator) => {
13736
+ var __async$F = (__this, __arguments, generator) => {
13737
13737
  return new Promise((resolve, reject) => {
13738
13738
  var fulfilled = (value) => {
13739
13739
  try {
@@ -13771,12 +13771,12 @@ class CarriersAPI {
13771
13771
  /**
13772
13772
  * The `connect` method connects a carrier account to a user's ShipEngine account.
13773
13773
  */
13774
- this.connect = (_a) => __async$D(this, null, function* () {
13774
+ this.connect = (_a) => __async$F(this, null, function* () {
13775
13775
  var _b = _a, { carrierCode } = _b, connection = __objRest$c(_b, ["carrierCode"]);
13776
13776
  const endUserIpAddress = yield getEndUserIpAddress();
13777
13777
  if (!endUserIpAddress)
13778
13778
  return Promise.reject([new CodedError("Unable to get IP address")]);
13779
- return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$3(__spreadValues$6({}, connection), {
13779
+ return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$3(__spreadValues$7({}, connection), {
13780
13780
  endUserIpAddress
13781
13781
  }));
13782
13782
  });
@@ -13855,6 +13855,26 @@ class CarriersAPI {
13855
13855
  }
13856
13856
  }
13857
13857
 
13858
+ var __async$E = (__this, __arguments, generator) => {
13859
+ return new Promise((resolve, reject) => {
13860
+ var fulfilled = (value) => {
13861
+ try {
13862
+ step(generator.next(value));
13863
+ } catch (e) {
13864
+ reject(e);
13865
+ }
13866
+ };
13867
+ var rejected = (value) => {
13868
+ try {
13869
+ step(generator.throw(value));
13870
+ } catch (e) {
13871
+ reject(e);
13872
+ }
13873
+ };
13874
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
13875
+ step((generator = generator.apply(__this, __arguments)).next());
13876
+ });
13877
+ };
13858
13878
  class ConnectionsAPI {
13859
13879
  constructor(client) {
13860
13880
  this.client = client;
@@ -13874,6 +13894,15 @@ class ConnectionsAPI {
13874
13894
  { params }
13875
13895
  );
13876
13896
  };
13897
+ /**
13898
+ * The `connectCarrier` method connects a carrier to account.
13899
+ */
13900
+ this.connectCarrier = (carrierName, formData) => __async$E(this, null, function* () {
13901
+ return yield this.client.post(
13902
+ `/v1/connections/carriers/${carrierName}`,
13903
+ formData
13904
+ );
13905
+ });
13877
13906
  this.client = client;
13878
13907
  }
13879
13908
  }
@@ -16087,23 +16116,23 @@ class CustomPackagesAPI {
16087
16116
  }
16088
16117
  }
16089
16118
 
16090
- var __defProp$5 = Object.defineProperty;
16091
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
16092
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
16093
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
16094
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16095
- var __spreadValues$5 = (a, b) => {
16119
+ var __defProp$6 = Object.defineProperty;
16120
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
16121
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
16122
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
16123
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16124
+ var __spreadValues$6 = (a, b) => {
16096
16125
  for (var prop in b || (b = {}))
16097
- if (__hasOwnProp$g.call(b, prop))
16098
- __defNormalProp$5(a, prop, b[prop]);
16099
- if (__getOwnPropSymbols$g)
16100
- for (var prop of __getOwnPropSymbols$g(b)) {
16101
- if (__propIsEnum$g.call(b, prop))
16102
- __defNormalProp$5(a, prop, b[prop]);
16126
+ if (__hasOwnProp$h.call(b, prop))
16127
+ __defNormalProp$6(a, prop, b[prop]);
16128
+ if (__getOwnPropSymbols$h)
16129
+ for (var prop of __getOwnPropSymbols$h(b)) {
16130
+ if (__propIsEnum$h.call(b, prop))
16131
+ __defNormalProp$6(a, prop, b[prop]);
16103
16132
  }
16104
16133
  return a;
16105
16134
  };
16106
- var __async$C = (__this, __arguments, generator) => {
16135
+ var __async$D = (__this, __arguments, generator) => {
16107
16136
  return new Promise((resolve, reject) => {
16108
16137
  var fulfilled = (value) => {
16109
16138
  try {
@@ -16142,11 +16171,11 @@ class FundingSourcesAPI {
16142
16171
  * The `create` method creates a new funding source for a given user. This requires
16143
16172
  * payment information to be collected from the user.
16144
16173
  */
16145
- this.create = (createFundingSource) => __async$C(this, null, function* () {
16174
+ this.create = (createFundingSource) => __async$D(this, null, function* () {
16146
16175
  const endUserIpAddress = yield getEndUserIpAddress();
16147
16176
  if (!endUserIpAddress)
16148
16177
  return Promise.reject([new CodedError("Unable to get IP address")]);
16149
- return yield this.client.post("/v1/funding_sources", __spreadValues$5({
16178
+ return yield this.client.post("/v1/funding_sources", __spreadValues$6({
16150
16179
  endUserIpAddress
16151
16180
  }, createFundingSource));
16152
16181
  });
@@ -16155,7 +16184,7 @@ class FundingSourcesAPI {
16155
16184
  * user to update the billing address or payment information associated with the
16156
16185
  * funding source.
16157
16186
  */
16158
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$C(this, null, function* () {
16187
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$D(this, null, function* () {
16159
16188
  const endUserIpAddress = yield getEndUserIpAddress();
16160
16189
  if (!endUserIpAddress)
16161
16190
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16172,18 +16201,18 @@ class FundingSourcesAPI {
16172
16201
  * The `registerCarrier` method registers a carrier account and associates
16173
16202
  * it with a given funding source.
16174
16203
  */
16175
- this.registerCarrier = (carrier) => __async$C(this, null, function* () {
16204
+ this.registerCarrier = (carrier) => __async$D(this, null, function* () {
16176
16205
  const endUserIpAddress = yield getEndUserIpAddress();
16177
16206
  if (!endUserIpAddress)
16178
16207
  return Promise.reject([new CodedError("Unable to get IP address")]);
16179
- return yield this.client.post("/v1/registration/funding_source", __spreadValues$5({
16208
+ return yield this.client.post("/v1/registration/funding_source", __spreadValues$6({
16180
16209
  endUserIpAddress
16181
16210
  }, carrier));
16182
16211
  });
16183
16212
  /**
16184
16213
  * The `addFunds` method allows you to add funds to a funding source.
16185
16214
  */
16186
- this.addFunds = (amount, fundingSourceId) => __async$C(this, null, function* () {
16215
+ this.addFunds = (amount, fundingSourceId) => __async$D(this, null, function* () {
16187
16216
  return yield this.client.put(
16188
16217
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
16189
16218
  amount
@@ -16193,7 +16222,7 @@ class FundingSourcesAPI {
16193
16222
  * The `metadata` method returns seller-specific requirements for creating funding sources
16194
16223
  * and attaching carriers
16195
16224
  */
16196
- this.metadata = () => __async$C(this, null, function* () {
16225
+ this.metadata = () => __async$D(this, null, function* () {
16197
16226
  return yield this.client.get("/v1/funding_sources/metadata");
16198
16227
  });
16199
16228
  /**
@@ -16451,7 +16480,43 @@ class SalesOrdersAPI {
16451
16480
  }
16452
16481
  }
16453
16482
 
16454
- var __async$B = (__this, __arguments, generator) => {
16483
+ var __defProp$5 = Object.defineProperty;
16484
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
16485
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
16486
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
16487
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16488
+ var __spreadValues$5 = (a, b) => {
16489
+ for (var prop in b || (b = {}))
16490
+ if (__hasOwnProp$g.call(b, prop))
16491
+ __defNormalProp$5(a, prop, b[prop]);
16492
+ if (__getOwnPropSymbols$g)
16493
+ for (var prop of __getOwnPropSymbols$g(b)) {
16494
+ if (__propIsEnum$g.call(b, prop))
16495
+ __defNormalProp$5(a, prop, b[prop]);
16496
+ }
16497
+ return a;
16498
+ };
16499
+ class ServicePointsAPI {
16500
+ constructor(client) {
16501
+ /**
16502
+ * The `list` method returns a list of service points based on several factors
16503
+ * A providers list that must contain at least one provider but no more than five
16504
+ * Either an address, coordinates, or an address query
16505
+ */
16506
+ this.list = (options) => {
16507
+ return this.client.post("/v1/service_points/list", __spreadValues$5({}, options));
16508
+ };
16509
+ /**
16510
+ * Get a specific service point by its carrier code, country code, and id
16511
+ */
16512
+ this.get = ({ carrierCode, countryCode, id }) => {
16513
+ return this.client.get(`/v1/service_points/${carrierCode}/${countryCode}/${id}`);
16514
+ };
16515
+ this.client = client;
16516
+ }
16517
+ }
16518
+
16519
+ var __async$C = (__this, __arguments, generator) => {
16455
16520
  return new Promise((resolve, reject) => {
16456
16521
  var fulfilled = (value) => {
16457
16522
  try {
@@ -16494,7 +16559,7 @@ class ShipmentsAPI {
16494
16559
  * The `create` method allows for creating shipments based on a list of shipment
16495
16560
  * items passed into this method.
16496
16561
  */
16497
- this.create = (...shipments) => __async$B(this, null, function* () {
16562
+ this.create = (...shipments) => __async$C(this, null, function* () {
16498
16563
  return this.client.post("/v1/shipments", {
16499
16564
  shipments
16500
16565
  });
@@ -16617,7 +16682,7 @@ var __spreadValues$4 = (a, b) => {
16617
16682
  return a;
16618
16683
  };
16619
16684
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
16620
- var __async$A = (__this, __arguments, generator) => {
16685
+ var __async$B = (__this, __arguments, generator) => {
16621
16686
  return new Promise((resolve, reject) => {
16622
16687
  var fulfilled = (value) => {
16623
16688
  try {
@@ -16711,7 +16776,7 @@ class ShipEngineAPI {
16711
16776
  );
16712
16777
  return res;
16713
16778
  },
16714
- (err) => __async$A(this, null, function* () {
16779
+ (err) => __async$B(this, null, function* () {
16715
16780
  var _a, _b, _c, _d, _e;
16716
16781
  logger$1.error(
16717
16782
  { err, req: err.config, res: err.response },
@@ -16868,6 +16933,9 @@ class ShipEngineAPI {
16868
16933
  get salesOrders() {
16869
16934
  return new SalesOrdersAPI(this.client);
16870
16935
  }
16936
+ get servicePoints() {
16937
+ return new ServicePointsAPI(this.client);
16938
+ }
16871
16939
  /**
16872
16940
  * The `shipments` method provides access to the Shipment endpoints in ShipEngine
16873
16941
  * API. e.g. Create Shipment, Get Shipment, etc.
@@ -17014,7 +17082,7 @@ const retryUntil = (callbackFn, retries = 10, timeoutBetweenAttempts = 1e3) => P
17014
17082
  throw error;
17015
17083
  });
17016
17084
 
17017
- var __async$z = (__this, __arguments, generator) => {
17085
+ var __async$A = (__this, __arguments, generator) => {
17018
17086
  return new Promise((resolve, reject) => {
17019
17087
  var fulfilled = (value) => {
17020
17088
  try {
@@ -17037,7 +17105,7 @@ var __async$z = (__this, __arguments, generator) => {
17037
17105
  const useCreateAccountImage = () => {
17038
17106
  const { client } = useShipEngine();
17039
17107
  return reactQuery.useMutation({
17040
- mutationFn: (data) => __async$z(void 0, null, function* () {
17108
+ mutationFn: (data) => __async$A(void 0, null, function* () {
17041
17109
  const result = yield client.accountSettings.createImage(data);
17042
17110
  return result.data;
17043
17111
  }),
@@ -17046,7 +17114,7 @@ const useCreateAccountImage = () => {
17046
17114
  });
17047
17115
  };
17048
17116
 
17049
- var __async$y = (__this, __arguments, generator) => {
17117
+ var __async$z = (__this, __arguments, generator) => {
17050
17118
  return new Promise((resolve, reject) => {
17051
17119
  var fulfilled = (value) => {
17052
17120
  try {
@@ -17069,7 +17137,7 @@ var __async$y = (__this, __arguments, generator) => {
17069
17137
  const useDeleteAccountImage = () => {
17070
17138
  const { client } = useShipEngine();
17071
17139
  return reactQuery.useMutation({
17072
- mutationFn: (labelImageId) => __async$y(void 0, null, function* () {
17140
+ mutationFn: (labelImageId) => __async$z(void 0, null, function* () {
17073
17141
  const result = yield client.accountSettings.deleteImage(labelImageId);
17074
17142
  return result.data;
17075
17143
  }),
@@ -17098,7 +17166,7 @@ const useGetAccountSettings = () => {
17098
17166
  });
17099
17167
  };
17100
17168
 
17101
- var __async$x = (__this, __arguments, generator) => {
17169
+ var __async$y = (__this, __arguments, generator) => {
17102
17170
  return new Promise((resolve, reject) => {
17103
17171
  var fulfilled = (value) => {
17104
17172
  try {
@@ -17121,7 +17189,7 @@ var __async$x = (__this, __arguments, generator) => {
17121
17189
  const useUpdateAccountImage = () => {
17122
17190
  const { client } = useShipEngine();
17123
17191
  return reactQuery.useMutation({
17124
- mutationFn: (data) => __async$x(void 0, null, function* () {
17192
+ mutationFn: (data) => __async$y(void 0, null, function* () {
17125
17193
  const result = yield client.accountSettings.updateImage(data);
17126
17194
  return result.data;
17127
17195
  }),
@@ -17130,7 +17198,7 @@ const useUpdateAccountImage = () => {
17130
17198
  });
17131
17199
  };
17132
17200
 
17133
- var __async$w = (__this, __arguments, generator) => {
17201
+ var __async$x = (__this, __arguments, generator) => {
17134
17202
  return new Promise((resolve, reject) => {
17135
17203
  var fulfilled = (value) => {
17136
17204
  try {
@@ -17153,7 +17221,7 @@ var __async$w = (__this, __arguments, generator) => {
17153
17221
  const useUpdateAccountSettings = () => {
17154
17222
  const { client } = useShipEngine();
17155
17223
  return reactQuery.useMutation({
17156
- mutationFn: (settings) => __async$w(void 0, null, function* () {
17224
+ mutationFn: (settings) => __async$x(void 0, null, function* () {
17157
17225
  const result = yield client.accountSettings.update(settings);
17158
17226
  return result.data;
17159
17227
  }),
@@ -17162,7 +17230,7 @@ const useUpdateAccountSettings = () => {
17162
17230
  });
17163
17231
  };
17164
17232
 
17165
- var __async$v = (__this, __arguments, generator) => {
17233
+ var __async$w = (__this, __arguments, generator) => {
17166
17234
  return new Promise((resolve, reject) => {
17167
17235
  var fulfilled = (value) => {
17168
17236
  try {
@@ -17185,7 +17253,7 @@ var __async$v = (__this, __arguments, generator) => {
17185
17253
  const useParseAddress = () => {
17186
17254
  const { client } = useShipEngine();
17187
17255
  return reactQuery.useMutation({
17188
- mutationFn: (_0) => __async$v(void 0, [_0], function* ({ address, text }) {
17256
+ mutationFn: (_0) => __async$w(void 0, [_0], function* ({ address, text }) {
17189
17257
  const result = yield client.addresses.parse(text, address);
17190
17258
  return result.data;
17191
17259
  }),
@@ -17194,7 +17262,7 @@ const useParseAddress = () => {
17194
17262
  });
17195
17263
  };
17196
17264
 
17197
- var __async$u = (__this, __arguments, generator) => {
17265
+ var __async$v = (__this, __arguments, generator) => {
17198
17266
  return new Promise((resolve, reject) => {
17199
17267
  var fulfilled = (value) => {
17200
17268
  try {
@@ -17217,7 +17285,7 @@ var __async$u = (__this, __arguments, generator) => {
17217
17285
  const useValidateAddresses = () => {
17218
17286
  const { client } = useShipEngine();
17219
17287
  return reactQuery.useMutation({
17220
- mutationFn: (addresses) => __async$u(void 0, null, function* () {
17288
+ mutationFn: (addresses) => __async$v(void 0, null, function* () {
17221
17289
  const result = yield client.addresses.validate(addresses);
17222
17290
  return result.data;
17223
17291
  }),
@@ -17226,7 +17294,7 @@ const useValidateAddresses = () => {
17226
17294
  });
17227
17295
  };
17228
17296
 
17229
- var __async$t = (__this, __arguments, generator) => {
17297
+ var __async$u = (__this, __arguments, generator) => {
17230
17298
  return new Promise((resolve, reject) => {
17231
17299
  var fulfilled = (value) => {
17232
17300
  try {
@@ -17249,7 +17317,7 @@ var __async$t = (__this, __arguments, generator) => {
17249
17317
  const useAddFunds = () => {
17250
17318
  const { client } = useShipEngine();
17251
17319
  return reactQuery.useMutation({
17252
- mutationFn: (_0) => __async$t(void 0, [_0], function* ({ carrierId, funds }) {
17320
+ mutationFn: (_0) => __async$u(void 0, [_0], function* ({ carrierId, funds }) {
17253
17321
  const result = yield client.carriers.addFunds(carrierId, funds);
17254
17322
  return result.data;
17255
17323
  }),
@@ -17258,7 +17326,7 @@ const useAddFunds = () => {
17258
17326
  });
17259
17327
  };
17260
17328
 
17261
- var __async$s = (__this, __arguments, generator) => {
17329
+ var __async$t = (__this, __arguments, generator) => {
17262
17330
  return new Promise((resolve, reject) => {
17263
17331
  var fulfilled = (value) => {
17264
17332
  try {
@@ -17281,7 +17349,7 @@ var __async$s = (__this, __arguments, generator) => {
17281
17349
  const useConnectCarrier = () => {
17282
17350
  const { client } = useShipEngine();
17283
17351
  return reactQuery.useMutation({
17284
- mutationFn: (params) => __async$s(void 0, null, function* () {
17352
+ mutationFn: (params) => __async$t(void 0, null, function* () {
17285
17353
  const result = yield client.carriers.connect(params);
17286
17354
  return result.data;
17287
17355
  }),
@@ -17415,7 +17483,7 @@ var __objRest$b = (source, exclude) => {
17415
17483
  }
17416
17484
  return target;
17417
17485
  };
17418
- var __async$r = (__this, __arguments, generator) => {
17486
+ var __async$s = (__this, __arguments, generator) => {
17419
17487
  return new Promise((resolve, reject) => {
17420
17488
  var fulfilled = (value) => {
17421
17489
  try {
@@ -17439,7 +17507,7 @@ const useUpdateAutoFunding = () => {
17439
17507
  const { client } = useShipEngine();
17440
17508
  const queryClient = reactQuery.useQueryClient();
17441
17509
  return reactQuery.useMutation({
17442
- mutationFn: (_a) => __async$r(void 0, null, function* () {
17510
+ mutationFn: (_a) => __async$s(void 0, null, function* () {
17443
17511
  var _b = _a, { carrierId } = _b, options = __objRest$b(_b, ["carrierId"]);
17444
17512
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
17445
17513
  return result.data;
@@ -17523,6 +17591,41 @@ const useListCarrierConnections = (_params) => {
17523
17591
  });
17524
17592
  };
17525
17593
 
17594
+ var __async$r = (__this, __arguments, generator) => {
17595
+ return new Promise((resolve, reject) => {
17596
+ var fulfilled = (value) => {
17597
+ try {
17598
+ step(generator.next(value));
17599
+ } catch (e) {
17600
+ reject(e);
17601
+ }
17602
+ };
17603
+ var rejected = (value) => {
17604
+ try {
17605
+ step(generator.throw(value));
17606
+ } catch (e) {
17607
+ reject(e);
17608
+ }
17609
+ };
17610
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
17611
+ step((generator = generator.apply(__this, __arguments)).next());
17612
+ });
17613
+ };
17614
+ const useConnectCarrierAccount = () => {
17615
+ const { client } = useShipEngine();
17616
+ return reactQuery.useMutation({
17617
+ mutationFn: (_0) => __async$r(void 0, [_0], function* ({ carrierName, formData }) {
17618
+ const result = yield client.connections.connectCarrier(carrierName, formData);
17619
+ if (result.status > 300 && result.status < 309) {
17620
+ result.data.redirectUrl = result.request.res.responseUrl;
17621
+ }
17622
+ return result.data;
17623
+ }),
17624
+ mutationKey: ["useConnectCarrierAccount"],
17625
+ onError
17626
+ });
17627
+ };
17628
+
17526
17629
  const useListCustomPackageTypes = () => {
17527
17630
  const { client } = useShipEngine();
17528
17631
  return reactQuery.useQuery({
@@ -18855,6 +18958,39 @@ const useUpdateAccountBillingPlan = () => {
18855
18958
  });
18856
18959
  };
18857
18960
 
18961
+ const useListServicePoints = (options) => {
18962
+ const { client } = useShipEngine();
18963
+ return reactQuery.useQuery({
18964
+ onError,
18965
+ queryFn: () => client.servicePoints.list(options),
18966
+ queryKey: ["useListServicePoints"],
18967
+ select: (result) => result.data
18968
+ });
18969
+ };
18970
+
18971
+ const useGetServicePoint = ({
18972
+ carrierCode,
18973
+ countryCode,
18974
+ id
18975
+ }) => {
18976
+ const { client } = useShipEngine();
18977
+ return reactQuery.useQuery({
18978
+ enabled: !!carrierCode && !!countryCode && !!id,
18979
+ onError,
18980
+ queryFn: () => {
18981
+ if (carrierCode === void 0)
18982
+ return Promise.reject(new Error("carrierCode required"));
18983
+ if (countryCode === void 0)
18984
+ return Promise.reject(new Error("countryCode required"));
18985
+ if (id === void 0)
18986
+ return Promise.reject(new Error("id required"));
18987
+ return client.servicePoints.get({ carrierCode, countryCode, id });
18988
+ },
18989
+ queryKey: ["useGetServicePoint", carrierCode, countryCode, id],
18990
+ select: (result) => result.data
18991
+ });
18992
+ };
18993
+
18858
18994
  const fallbackThemeData = {
18859
18995
  borderRadius: {
18860
18996
  L: "16px",
@@ -20002,6 +20138,7 @@ exports.RatesAPI = RatesAPI;
20002
20138
  exports.SE = types;
20003
20139
  exports.SalesOrderShipmentsAPI = SalesOrderShipmentsAPI;
20004
20140
  exports.SalesOrdersAPI = SalesOrdersAPI;
20141
+ exports.ServicePointsAPI = ServicePointsAPI;
20005
20142
  exports.ShipEngine = ShipEngine;
20006
20143
  exports.ShipEngineAPI = ShipEngineAPI;
20007
20144
  exports.ShipEngineContext = ShipEngineContext;
@@ -20027,6 +20164,7 @@ exports.useAddInsuranceFunds = useAddInsuranceFunds;
20027
20164
  exports.useAlchemy = useAlchemy;
20028
20165
  exports.useCalculateRates = useCalculateRates;
20029
20166
  exports.useConnectCarrier = useConnectCarrier;
20167
+ exports.useConnectCarrierAccount = useConnectCarrierAccount;
20030
20168
  exports.useCreateAccountImage = useCreateAccountImage;
20031
20169
  exports.useCreateFundingSource = useCreateFundingSource;
20032
20170
  exports.useCreateLabel = useCreateLabel;
@@ -20060,6 +20198,7 @@ exports.useGetPackageRatingGroupByCarrier = useGetPackageRatingGroupByCarrier;
20060
20198
  exports.useGetRateCardById = useGetRateCardById;
20061
20199
  exports.useGetSalesOrder = useGetSalesOrder;
20062
20200
  exports.useGetSalesOrderShipment = useGetSalesOrderShipment;
20201
+ exports.useGetServicePoint = useGetServicePoint;
20063
20202
  exports.useGetServicesByCarrier = useGetServicesByCarrier;
20064
20203
  exports.useGetShipment = useGetShipment;
20065
20204
  exports.useGetShipmentRates = useGetShipmentRates;
@@ -20077,6 +20216,7 @@ exports.useListOrderSources = useListOrderSources;
20077
20216
  exports.useListRateCards = useListRateCards;
20078
20217
  exports.useListSalesOrderShipments = useListSalesOrderShipments;
20079
20218
  exports.useListSalesOrders = useListSalesOrders;
20219
+ exports.useListServicePoints = useListServicePoints;
20080
20220
  exports.useListShipments = useListShipments;
20081
20221
  exports.useListShippingRules = useListShippingRules;
20082
20222
  exports.useListWarehouses = useListWarehouses;
package/index.mjs CHANGED
@@ -10764,17 +10764,17 @@ var AccountBillingPlanChangeType = /* @__PURE__ */ ((AccountBillingPlanChangeTyp
10764
10764
  return AccountBillingPlanChangeType2;
10765
10765
  })(AccountBillingPlanChangeType || {});
10766
10766
 
10767
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
10768
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
10769
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
10767
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
10768
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
10769
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
10770
10770
  var __objRest$e = (source, exclude) => {
10771
10771
  var target = {};
10772
10772
  for (var prop in source)
10773
- if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
10773
+ if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
10774
10774
  target[prop] = source[prop];
10775
- if (source != null && __getOwnPropSymbols$j)
10776
- for (var prop of __getOwnPropSymbols$j(source)) {
10777
- if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
10775
+ if (source != null && __getOwnPropSymbols$k)
10776
+ for (var prop of __getOwnPropSymbols$k(source)) {
10777
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
10778
10778
  target[prop] = source[prop];
10779
10779
  }
10780
10780
  return target;
@@ -10896,17 +10896,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
10896
10896
  RateCardStatus
10897
10897
  }, Symbol.toStringTag, { value: 'Module' }));
10898
10898
 
10899
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
10900
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
10901
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
10899
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
10900
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
10901
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
10902
10902
  var __objRest$d = (source, exclude) => {
10903
10903
  var target = {};
10904
10904
  for (var prop in source)
10905
- if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
10905
+ if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
10906
10906
  target[prop] = source[prop];
10907
- if (source != null && __getOwnPropSymbols$i)
10908
- for (var prop of __getOwnPropSymbols$i(source)) {
10909
- if (exclude.indexOf(prop) < 0 && __propIsEnum$i.call(source, prop))
10907
+ if (source != null && __getOwnPropSymbols$j)
10908
+ for (var prop of __getOwnPropSymbols$j(source)) {
10909
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
10910
10910
  target[prop] = source[prop];
10911
10911
  }
10912
10912
  return target;
@@ -13648,7 +13648,7 @@ var ipaddr = {
13648
13648
  }).call(commonjsGlobal);
13649
13649
  } (ipaddr));
13650
13650
 
13651
- var __async$E = (__this, __arguments, generator) => {
13651
+ var __async$G = (__this, __arguments, generator) => {
13652
13652
  return new Promise((resolve, reject) => {
13653
13653
  var fulfilled = (value) => {
13654
13654
  try {
@@ -13668,7 +13668,7 @@ var __async$E = (__this, __arguments, generator) => {
13668
13668
  step((generator = generator.apply(__this, __arguments)).next());
13669
13669
  });
13670
13670
  };
13671
- const getEndUserIpAddress = () => __async$E(void 0, null, function* () {
13671
+ const getEndUserIpAddress = () => __async$G(void 0, null, function* () {
13672
13672
  try {
13673
13673
  const response = yield axios.get("https://api.ipify.org/?format=json");
13674
13674
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -13680,21 +13680,21 @@ const getEndUserIpAddress = () => __async$E(void 0, null, function* () {
13680
13680
  }
13681
13681
  });
13682
13682
 
13683
- var __defProp$6 = Object.defineProperty;
13683
+ var __defProp$7 = Object.defineProperty;
13684
13684
  var __defProps$3 = Object.defineProperties;
13685
13685
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
13686
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
13687
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
13688
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
13689
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13690
- var __spreadValues$6 = (a, b) => {
13686
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
13687
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
13688
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
13689
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13690
+ var __spreadValues$7 = (a, b) => {
13691
13691
  for (var prop in b || (b = {}))
13692
- if (__hasOwnProp$h.call(b, prop))
13693
- __defNormalProp$6(a, prop, b[prop]);
13694
- if (__getOwnPropSymbols$h)
13695
- for (var prop of __getOwnPropSymbols$h(b)) {
13696
- if (__propIsEnum$h.call(b, prop))
13697
- __defNormalProp$6(a, prop, b[prop]);
13692
+ if (__hasOwnProp$i.call(b, prop))
13693
+ __defNormalProp$7(a, prop, b[prop]);
13694
+ if (__getOwnPropSymbols$i)
13695
+ for (var prop of __getOwnPropSymbols$i(b)) {
13696
+ if (__propIsEnum$i.call(b, prop))
13697
+ __defNormalProp$7(a, prop, b[prop]);
13698
13698
  }
13699
13699
  return a;
13700
13700
  };
@@ -13702,16 +13702,16 @@ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
13702
13702
  var __objRest$c = (source, exclude) => {
13703
13703
  var target = {};
13704
13704
  for (var prop in source)
13705
- if (__hasOwnProp$h.call(source, prop) && exclude.indexOf(prop) < 0)
13705
+ if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
13706
13706
  target[prop] = source[prop];
13707
- if (source != null && __getOwnPropSymbols$h)
13708
- for (var prop of __getOwnPropSymbols$h(source)) {
13709
- if (exclude.indexOf(prop) < 0 && __propIsEnum$h.call(source, prop))
13707
+ if (source != null && __getOwnPropSymbols$i)
13708
+ for (var prop of __getOwnPropSymbols$i(source)) {
13709
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$i.call(source, prop))
13710
13710
  target[prop] = source[prop];
13711
13711
  }
13712
13712
  return target;
13713
13713
  };
13714
- var __async$D = (__this, __arguments, generator) => {
13714
+ var __async$F = (__this, __arguments, generator) => {
13715
13715
  return new Promise((resolve, reject) => {
13716
13716
  var fulfilled = (value) => {
13717
13717
  try {
@@ -13749,12 +13749,12 @@ class CarriersAPI {
13749
13749
  /**
13750
13750
  * The `connect` method connects a carrier account to a user's ShipEngine account.
13751
13751
  */
13752
- this.connect = (_a) => __async$D(this, null, function* () {
13752
+ this.connect = (_a) => __async$F(this, null, function* () {
13753
13753
  var _b = _a, { carrierCode } = _b, connection = __objRest$c(_b, ["carrierCode"]);
13754
13754
  const endUserIpAddress = yield getEndUserIpAddress();
13755
13755
  if (!endUserIpAddress)
13756
13756
  return Promise.reject([new CodedError("Unable to get IP address")]);
13757
- return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$3(__spreadValues$6({}, connection), {
13757
+ return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$3(__spreadValues$7({}, connection), {
13758
13758
  endUserIpAddress
13759
13759
  }));
13760
13760
  });
@@ -13833,6 +13833,26 @@ class CarriersAPI {
13833
13833
  }
13834
13834
  }
13835
13835
 
13836
+ var __async$E = (__this, __arguments, generator) => {
13837
+ return new Promise((resolve, reject) => {
13838
+ var fulfilled = (value) => {
13839
+ try {
13840
+ step(generator.next(value));
13841
+ } catch (e) {
13842
+ reject(e);
13843
+ }
13844
+ };
13845
+ var rejected = (value) => {
13846
+ try {
13847
+ step(generator.throw(value));
13848
+ } catch (e) {
13849
+ reject(e);
13850
+ }
13851
+ };
13852
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
13853
+ step((generator = generator.apply(__this, __arguments)).next());
13854
+ });
13855
+ };
13836
13856
  class ConnectionsAPI {
13837
13857
  constructor(client) {
13838
13858
  this.client = client;
@@ -13852,6 +13872,15 @@ class ConnectionsAPI {
13852
13872
  { params }
13853
13873
  );
13854
13874
  };
13875
+ /**
13876
+ * The `connectCarrier` method connects a carrier to account.
13877
+ */
13878
+ this.connectCarrier = (carrierName, formData) => __async$E(this, null, function* () {
13879
+ return yield this.client.post(
13880
+ `/v1/connections/carriers/${carrierName}`,
13881
+ formData
13882
+ );
13883
+ });
13855
13884
  this.client = client;
13856
13885
  }
13857
13886
  }
@@ -16065,23 +16094,23 @@ class CustomPackagesAPI {
16065
16094
  }
16066
16095
  }
16067
16096
 
16068
- var __defProp$5 = Object.defineProperty;
16069
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
16070
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
16071
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
16072
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16073
- var __spreadValues$5 = (a, b) => {
16097
+ var __defProp$6 = Object.defineProperty;
16098
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
16099
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
16100
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
16101
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16102
+ var __spreadValues$6 = (a, b) => {
16074
16103
  for (var prop in b || (b = {}))
16075
- if (__hasOwnProp$g.call(b, prop))
16076
- __defNormalProp$5(a, prop, b[prop]);
16077
- if (__getOwnPropSymbols$g)
16078
- for (var prop of __getOwnPropSymbols$g(b)) {
16079
- if (__propIsEnum$g.call(b, prop))
16080
- __defNormalProp$5(a, prop, b[prop]);
16104
+ if (__hasOwnProp$h.call(b, prop))
16105
+ __defNormalProp$6(a, prop, b[prop]);
16106
+ if (__getOwnPropSymbols$h)
16107
+ for (var prop of __getOwnPropSymbols$h(b)) {
16108
+ if (__propIsEnum$h.call(b, prop))
16109
+ __defNormalProp$6(a, prop, b[prop]);
16081
16110
  }
16082
16111
  return a;
16083
16112
  };
16084
- var __async$C = (__this, __arguments, generator) => {
16113
+ var __async$D = (__this, __arguments, generator) => {
16085
16114
  return new Promise((resolve, reject) => {
16086
16115
  var fulfilled = (value) => {
16087
16116
  try {
@@ -16120,11 +16149,11 @@ class FundingSourcesAPI {
16120
16149
  * The `create` method creates a new funding source for a given user. This requires
16121
16150
  * payment information to be collected from the user.
16122
16151
  */
16123
- this.create = (createFundingSource) => __async$C(this, null, function* () {
16152
+ this.create = (createFundingSource) => __async$D(this, null, function* () {
16124
16153
  const endUserIpAddress = yield getEndUserIpAddress();
16125
16154
  if (!endUserIpAddress)
16126
16155
  return Promise.reject([new CodedError("Unable to get IP address")]);
16127
- return yield this.client.post("/v1/funding_sources", __spreadValues$5({
16156
+ return yield this.client.post("/v1/funding_sources", __spreadValues$6({
16128
16157
  endUserIpAddress
16129
16158
  }, createFundingSource));
16130
16159
  });
@@ -16133,7 +16162,7 @@ class FundingSourcesAPI {
16133
16162
  * user to update the billing address or payment information associated with the
16134
16163
  * funding source.
16135
16164
  */
16136
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$C(this, null, function* () {
16165
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$D(this, null, function* () {
16137
16166
  const endUserIpAddress = yield getEndUserIpAddress();
16138
16167
  if (!endUserIpAddress)
16139
16168
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16150,18 +16179,18 @@ class FundingSourcesAPI {
16150
16179
  * The `registerCarrier` method registers a carrier account and associates
16151
16180
  * it with a given funding source.
16152
16181
  */
16153
- this.registerCarrier = (carrier) => __async$C(this, null, function* () {
16182
+ this.registerCarrier = (carrier) => __async$D(this, null, function* () {
16154
16183
  const endUserIpAddress = yield getEndUserIpAddress();
16155
16184
  if (!endUserIpAddress)
16156
16185
  return Promise.reject([new CodedError("Unable to get IP address")]);
16157
- return yield this.client.post("/v1/registration/funding_source", __spreadValues$5({
16186
+ return yield this.client.post("/v1/registration/funding_source", __spreadValues$6({
16158
16187
  endUserIpAddress
16159
16188
  }, carrier));
16160
16189
  });
16161
16190
  /**
16162
16191
  * The `addFunds` method allows you to add funds to a funding source.
16163
16192
  */
16164
- this.addFunds = (amount, fundingSourceId) => __async$C(this, null, function* () {
16193
+ this.addFunds = (amount, fundingSourceId) => __async$D(this, null, function* () {
16165
16194
  return yield this.client.put(
16166
16195
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
16167
16196
  amount
@@ -16171,7 +16200,7 @@ class FundingSourcesAPI {
16171
16200
  * The `metadata` method returns seller-specific requirements for creating funding sources
16172
16201
  * and attaching carriers
16173
16202
  */
16174
- this.metadata = () => __async$C(this, null, function* () {
16203
+ this.metadata = () => __async$D(this, null, function* () {
16175
16204
  return yield this.client.get("/v1/funding_sources/metadata");
16176
16205
  });
16177
16206
  /**
@@ -16429,7 +16458,43 @@ class SalesOrdersAPI {
16429
16458
  }
16430
16459
  }
16431
16460
 
16432
- var __async$B = (__this, __arguments, generator) => {
16461
+ var __defProp$5 = Object.defineProperty;
16462
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
16463
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
16464
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
16465
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16466
+ var __spreadValues$5 = (a, b) => {
16467
+ for (var prop in b || (b = {}))
16468
+ if (__hasOwnProp$g.call(b, prop))
16469
+ __defNormalProp$5(a, prop, b[prop]);
16470
+ if (__getOwnPropSymbols$g)
16471
+ for (var prop of __getOwnPropSymbols$g(b)) {
16472
+ if (__propIsEnum$g.call(b, prop))
16473
+ __defNormalProp$5(a, prop, b[prop]);
16474
+ }
16475
+ return a;
16476
+ };
16477
+ class ServicePointsAPI {
16478
+ constructor(client) {
16479
+ /**
16480
+ * The `list` method returns a list of service points based on several factors
16481
+ * A providers list that must contain at least one provider but no more than five
16482
+ * Either an address, coordinates, or an address query
16483
+ */
16484
+ this.list = (options) => {
16485
+ return this.client.post("/v1/service_points/list", __spreadValues$5({}, options));
16486
+ };
16487
+ /**
16488
+ * Get a specific service point by its carrier code, country code, and id
16489
+ */
16490
+ this.get = ({ carrierCode, countryCode, id }) => {
16491
+ return this.client.get(`/v1/service_points/${carrierCode}/${countryCode}/${id}`);
16492
+ };
16493
+ this.client = client;
16494
+ }
16495
+ }
16496
+
16497
+ var __async$C = (__this, __arguments, generator) => {
16433
16498
  return new Promise((resolve, reject) => {
16434
16499
  var fulfilled = (value) => {
16435
16500
  try {
@@ -16472,7 +16537,7 @@ class ShipmentsAPI {
16472
16537
  * The `create` method allows for creating shipments based on a list of shipment
16473
16538
  * items passed into this method.
16474
16539
  */
16475
- this.create = (...shipments) => __async$B(this, null, function* () {
16540
+ this.create = (...shipments) => __async$C(this, null, function* () {
16476
16541
  return this.client.post("/v1/shipments", {
16477
16542
  shipments
16478
16543
  });
@@ -16595,7 +16660,7 @@ var __spreadValues$4 = (a, b) => {
16595
16660
  return a;
16596
16661
  };
16597
16662
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
16598
- var __async$A = (__this, __arguments, generator) => {
16663
+ var __async$B = (__this, __arguments, generator) => {
16599
16664
  return new Promise((resolve, reject) => {
16600
16665
  var fulfilled = (value) => {
16601
16666
  try {
@@ -16689,7 +16754,7 @@ class ShipEngineAPI {
16689
16754
  );
16690
16755
  return res;
16691
16756
  },
16692
- (err) => __async$A(this, null, function* () {
16757
+ (err) => __async$B(this, null, function* () {
16693
16758
  var _a, _b, _c, _d, _e;
16694
16759
  logger$1.error(
16695
16760
  { err, req: err.config, res: err.response },
@@ -16846,6 +16911,9 @@ class ShipEngineAPI {
16846
16911
  get salesOrders() {
16847
16912
  return new SalesOrdersAPI(this.client);
16848
16913
  }
16914
+ get servicePoints() {
16915
+ return new ServicePointsAPI(this.client);
16916
+ }
16849
16917
  /**
16850
16918
  * The `shipments` method provides access to the Shipment endpoints in ShipEngine
16851
16919
  * API. e.g. Create Shipment, Get Shipment, etc.
@@ -16992,7 +17060,7 @@ const retryUntil = (callbackFn, retries = 10, timeoutBetweenAttempts = 1e3) => P
16992
17060
  throw error;
16993
17061
  });
16994
17062
 
16995
- var __async$z = (__this, __arguments, generator) => {
17063
+ var __async$A = (__this, __arguments, generator) => {
16996
17064
  return new Promise((resolve, reject) => {
16997
17065
  var fulfilled = (value) => {
16998
17066
  try {
@@ -17015,7 +17083,7 @@ var __async$z = (__this, __arguments, generator) => {
17015
17083
  const useCreateAccountImage = () => {
17016
17084
  const { client } = useShipEngine();
17017
17085
  return useMutation({
17018
- mutationFn: (data) => __async$z(void 0, null, function* () {
17086
+ mutationFn: (data) => __async$A(void 0, null, function* () {
17019
17087
  const result = yield client.accountSettings.createImage(data);
17020
17088
  return result.data;
17021
17089
  }),
@@ -17024,7 +17092,7 @@ const useCreateAccountImage = () => {
17024
17092
  });
17025
17093
  };
17026
17094
 
17027
- var __async$y = (__this, __arguments, generator) => {
17095
+ var __async$z = (__this, __arguments, generator) => {
17028
17096
  return new Promise((resolve, reject) => {
17029
17097
  var fulfilled = (value) => {
17030
17098
  try {
@@ -17047,7 +17115,7 @@ var __async$y = (__this, __arguments, generator) => {
17047
17115
  const useDeleteAccountImage = () => {
17048
17116
  const { client } = useShipEngine();
17049
17117
  return useMutation({
17050
- mutationFn: (labelImageId) => __async$y(void 0, null, function* () {
17118
+ mutationFn: (labelImageId) => __async$z(void 0, null, function* () {
17051
17119
  const result = yield client.accountSettings.deleteImage(labelImageId);
17052
17120
  return result.data;
17053
17121
  }),
@@ -17076,7 +17144,7 @@ const useGetAccountSettings = () => {
17076
17144
  });
17077
17145
  };
17078
17146
 
17079
- var __async$x = (__this, __arguments, generator) => {
17147
+ var __async$y = (__this, __arguments, generator) => {
17080
17148
  return new Promise((resolve, reject) => {
17081
17149
  var fulfilled = (value) => {
17082
17150
  try {
@@ -17099,7 +17167,7 @@ var __async$x = (__this, __arguments, generator) => {
17099
17167
  const useUpdateAccountImage = () => {
17100
17168
  const { client } = useShipEngine();
17101
17169
  return useMutation({
17102
- mutationFn: (data) => __async$x(void 0, null, function* () {
17170
+ mutationFn: (data) => __async$y(void 0, null, function* () {
17103
17171
  const result = yield client.accountSettings.updateImage(data);
17104
17172
  return result.data;
17105
17173
  }),
@@ -17108,7 +17176,7 @@ const useUpdateAccountImage = () => {
17108
17176
  });
17109
17177
  };
17110
17178
 
17111
- var __async$w = (__this, __arguments, generator) => {
17179
+ var __async$x = (__this, __arguments, generator) => {
17112
17180
  return new Promise((resolve, reject) => {
17113
17181
  var fulfilled = (value) => {
17114
17182
  try {
@@ -17131,7 +17199,7 @@ var __async$w = (__this, __arguments, generator) => {
17131
17199
  const useUpdateAccountSettings = () => {
17132
17200
  const { client } = useShipEngine();
17133
17201
  return useMutation({
17134
- mutationFn: (settings) => __async$w(void 0, null, function* () {
17202
+ mutationFn: (settings) => __async$x(void 0, null, function* () {
17135
17203
  const result = yield client.accountSettings.update(settings);
17136
17204
  return result.data;
17137
17205
  }),
@@ -17140,7 +17208,7 @@ const useUpdateAccountSettings = () => {
17140
17208
  });
17141
17209
  };
17142
17210
 
17143
- var __async$v = (__this, __arguments, generator) => {
17211
+ var __async$w = (__this, __arguments, generator) => {
17144
17212
  return new Promise((resolve, reject) => {
17145
17213
  var fulfilled = (value) => {
17146
17214
  try {
@@ -17163,7 +17231,7 @@ var __async$v = (__this, __arguments, generator) => {
17163
17231
  const useParseAddress = () => {
17164
17232
  const { client } = useShipEngine();
17165
17233
  return useMutation({
17166
- mutationFn: (_0) => __async$v(void 0, [_0], function* ({ address, text }) {
17234
+ mutationFn: (_0) => __async$w(void 0, [_0], function* ({ address, text }) {
17167
17235
  const result = yield client.addresses.parse(text, address);
17168
17236
  return result.data;
17169
17237
  }),
@@ -17172,7 +17240,7 @@ const useParseAddress = () => {
17172
17240
  });
17173
17241
  };
17174
17242
 
17175
- var __async$u = (__this, __arguments, generator) => {
17243
+ var __async$v = (__this, __arguments, generator) => {
17176
17244
  return new Promise((resolve, reject) => {
17177
17245
  var fulfilled = (value) => {
17178
17246
  try {
@@ -17195,7 +17263,7 @@ var __async$u = (__this, __arguments, generator) => {
17195
17263
  const useValidateAddresses = () => {
17196
17264
  const { client } = useShipEngine();
17197
17265
  return useMutation({
17198
- mutationFn: (addresses) => __async$u(void 0, null, function* () {
17266
+ mutationFn: (addresses) => __async$v(void 0, null, function* () {
17199
17267
  const result = yield client.addresses.validate(addresses);
17200
17268
  return result.data;
17201
17269
  }),
@@ -17204,7 +17272,7 @@ const useValidateAddresses = () => {
17204
17272
  });
17205
17273
  };
17206
17274
 
17207
- var __async$t = (__this, __arguments, generator) => {
17275
+ var __async$u = (__this, __arguments, generator) => {
17208
17276
  return new Promise((resolve, reject) => {
17209
17277
  var fulfilled = (value) => {
17210
17278
  try {
@@ -17227,7 +17295,7 @@ var __async$t = (__this, __arguments, generator) => {
17227
17295
  const useAddFunds = () => {
17228
17296
  const { client } = useShipEngine();
17229
17297
  return useMutation({
17230
- mutationFn: (_0) => __async$t(void 0, [_0], function* ({ carrierId, funds }) {
17298
+ mutationFn: (_0) => __async$u(void 0, [_0], function* ({ carrierId, funds }) {
17231
17299
  const result = yield client.carriers.addFunds(carrierId, funds);
17232
17300
  return result.data;
17233
17301
  }),
@@ -17236,7 +17304,7 @@ const useAddFunds = () => {
17236
17304
  });
17237
17305
  };
17238
17306
 
17239
- var __async$s = (__this, __arguments, generator) => {
17307
+ var __async$t = (__this, __arguments, generator) => {
17240
17308
  return new Promise((resolve, reject) => {
17241
17309
  var fulfilled = (value) => {
17242
17310
  try {
@@ -17259,7 +17327,7 @@ var __async$s = (__this, __arguments, generator) => {
17259
17327
  const useConnectCarrier = () => {
17260
17328
  const { client } = useShipEngine();
17261
17329
  return useMutation({
17262
- mutationFn: (params) => __async$s(void 0, null, function* () {
17330
+ mutationFn: (params) => __async$t(void 0, null, function* () {
17263
17331
  const result = yield client.carriers.connect(params);
17264
17332
  return result.data;
17265
17333
  }),
@@ -17393,7 +17461,7 @@ var __objRest$b = (source, exclude) => {
17393
17461
  }
17394
17462
  return target;
17395
17463
  };
17396
- var __async$r = (__this, __arguments, generator) => {
17464
+ var __async$s = (__this, __arguments, generator) => {
17397
17465
  return new Promise((resolve, reject) => {
17398
17466
  var fulfilled = (value) => {
17399
17467
  try {
@@ -17417,7 +17485,7 @@ const useUpdateAutoFunding = () => {
17417
17485
  const { client } = useShipEngine();
17418
17486
  const queryClient = useQueryClient();
17419
17487
  return useMutation({
17420
- mutationFn: (_a) => __async$r(void 0, null, function* () {
17488
+ mutationFn: (_a) => __async$s(void 0, null, function* () {
17421
17489
  var _b = _a, { carrierId } = _b, options = __objRest$b(_b, ["carrierId"]);
17422
17490
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
17423
17491
  return result.data;
@@ -17501,6 +17569,41 @@ const useListCarrierConnections = (_params) => {
17501
17569
  });
17502
17570
  };
17503
17571
 
17572
+ var __async$r = (__this, __arguments, generator) => {
17573
+ return new Promise((resolve, reject) => {
17574
+ var fulfilled = (value) => {
17575
+ try {
17576
+ step(generator.next(value));
17577
+ } catch (e) {
17578
+ reject(e);
17579
+ }
17580
+ };
17581
+ var rejected = (value) => {
17582
+ try {
17583
+ step(generator.throw(value));
17584
+ } catch (e) {
17585
+ reject(e);
17586
+ }
17587
+ };
17588
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
17589
+ step((generator = generator.apply(__this, __arguments)).next());
17590
+ });
17591
+ };
17592
+ const useConnectCarrierAccount = () => {
17593
+ const { client } = useShipEngine();
17594
+ return useMutation({
17595
+ mutationFn: (_0) => __async$r(void 0, [_0], function* ({ carrierName, formData }) {
17596
+ const result = yield client.connections.connectCarrier(carrierName, formData);
17597
+ if (result.status > 300 && result.status < 309) {
17598
+ result.data.redirectUrl = result.request.res.responseUrl;
17599
+ }
17600
+ return result.data;
17601
+ }),
17602
+ mutationKey: ["useConnectCarrierAccount"],
17603
+ onError
17604
+ });
17605
+ };
17606
+
17504
17607
  const useListCustomPackageTypes = () => {
17505
17608
  const { client } = useShipEngine();
17506
17609
  return useQuery({
@@ -18833,6 +18936,39 @@ const useUpdateAccountBillingPlan = () => {
18833
18936
  });
18834
18937
  };
18835
18938
 
18939
+ const useListServicePoints = (options) => {
18940
+ const { client } = useShipEngine();
18941
+ return useQuery({
18942
+ onError,
18943
+ queryFn: () => client.servicePoints.list(options),
18944
+ queryKey: ["useListServicePoints"],
18945
+ select: (result) => result.data
18946
+ });
18947
+ };
18948
+
18949
+ const useGetServicePoint = ({
18950
+ carrierCode,
18951
+ countryCode,
18952
+ id
18953
+ }) => {
18954
+ const { client } = useShipEngine();
18955
+ return useQuery({
18956
+ enabled: !!carrierCode && !!countryCode && !!id,
18957
+ onError,
18958
+ queryFn: () => {
18959
+ if (carrierCode === void 0)
18960
+ return Promise.reject(new Error("carrierCode required"));
18961
+ if (countryCode === void 0)
18962
+ return Promise.reject(new Error("countryCode required"));
18963
+ if (id === void 0)
18964
+ return Promise.reject(new Error("id required"));
18965
+ return client.servicePoints.get({ carrierCode, countryCode, id });
18966
+ },
18967
+ queryKey: ["useGetServicePoint", carrierCode, countryCode, id],
18968
+ select: (result) => result.data
18969
+ });
18970
+ };
18971
+
18836
18972
  const fallbackThemeData = {
18837
18973
  borderRadius: {
18838
18974
  L: "16px",
@@ -19950,4 +20086,4 @@ const alchemy = {
19950
20086
  createElement
19951
20087
  };
19952
20088
 
19953
- export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngine, ShipEngineAPI, ShipEngineContext, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, alchemy, alchemy as default, delay, getEmotionCache, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, logger, onError, parseError, retryUntil, useAddFunds, useAddInsuranceFunds, useAlchemy, useCalculateRates, useConnectCarrier, useCreateAccountImage, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useDeactivateOrderSource, useDeleteAccountImage, useDeleteRateCard, useDeleteShippingRule, useDeleteWarehouse, useDownloadRateCard, useEditShippingRule, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountImages, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCarrierConnectionForm, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetFundingSourceTransactions, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetShippingRuleById, useGetShippingRuleConditionsOptions, useGetThemeById, useGetZonesByCarrier, useI18n, useListCarrierConnections, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListShippingRules, useListWarehouses, useLoadIcons, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountBillingPlan, useUpdateAccountImage, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUploadRateCard, useValidateAddresses, useVoidLabel };
20089
+ export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ServicePointsAPI, ShipEngine, ShipEngineAPI, ShipEngineContext, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, alchemy, alchemy as default, delay, getEmotionCache, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, logger, onError, parseError, retryUntil, useAddFunds, useAddInsuranceFunds, useAlchemy, useCalculateRates, useConnectCarrier, useConnectCarrierAccount, useCreateAccountImage, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useDeactivateOrderSource, useDeleteAccountImage, useDeleteRateCard, useDeleteShippingRule, useDeleteWarehouse, useDownloadRateCard, useEditShippingRule, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountImages, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCarrierConnectionForm, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetFundingSourceTransactions, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicePoint, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetShippingRuleById, useGetShippingRuleConditionsOptions, useGetThemeById, useGetZonesByCarrier, useI18n, useListCarrierConnections, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListServicePoints, useListShipments, useListShippingRules, useListWarehouses, useLoadIcons, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountBillingPlan, useUpdateAccountImage, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUploadRateCard, useValidateAddresses, useVoidLabel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/alchemy",
3
- "version": "5.1.8",
3
+ "version": "5.1.10",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {