@shipengine/alchemy 5.1.5 → 5.1.7

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 +210 -140
  2. package/index.mjs +210 -142
  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$i = Object.getOwnPropertySymbols;
10790
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
10791
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
10792
- var __objRest$d = (source, exclude) => {
10789
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
10790
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
10791
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
10792
+ var __objRest$e = (source, exclude) => {
10793
10793
  var target = {};
10794
10794
  for (var prop in source)
10795
- if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
10795
+ if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
10796
10796
  target[prop] = source[prop];
10797
- if (source != null && __getOwnPropSymbols$i)
10798
- for (var prop of __getOwnPropSymbols$i(source)) {
10799
- if (exclude.indexOf(prop) < 0 && __propIsEnum$i.call(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))
10800
10800
  target[prop] = source[prop];
10801
10801
  }
10802
10802
  return target;
@@ -10810,7 +10810,7 @@ class CodedError {
10810
10810
  this.message = message;
10811
10811
  }
10812
10812
  static fromObject(_a) {
10813
- var _b = _a, { message } = _b, options = __objRest$d(_b, ["message"]);
10813
+ var _b = _a, { message } = _b, options = __objRest$e(_b, ["message"]);
10814
10814
  return new CodedError(message, options);
10815
10815
  }
10816
10816
  }
@@ -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$h = Object.getOwnPropertySymbols;
10922
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
10923
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
10924
- var __objRest$c = (source, exclude) => {
10921
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
10922
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
10923
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
10924
+ var __objRest$d = (source, exclude) => {
10925
10925
  var target = {};
10926
10926
  for (var prop in source)
10927
- if (__hasOwnProp$h.call(source, prop) && exclude.indexOf(prop) < 0)
10927
+ if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
10928
10928
  target[prop] = source[prop];
10929
- if (source != null && __getOwnPropSymbols$h)
10930
- for (var prop of __getOwnPropSymbols$h(source)) {
10931
- if (exclude.indexOf(prop) < 0 && __propIsEnum$h.call(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))
10932
10932
  target[prop] = source[prop];
10933
10933
  }
10934
10934
  return target;
@@ -10960,7 +10960,7 @@ class AccountSettingsAPI {
10960
10960
  * The `updateImage` method updates specific image data for a given image id.
10961
10961
  */
10962
10962
  this.updateImage = (_a) => {
10963
- var _b = _a, { labelImageId } = _b, data = __objRest$c(_b, ["labelImageId"]);
10963
+ var _b = _a, { labelImageId } = _b, data = __objRest$d(_b, ["labelImageId"]);
10964
10964
  return this.client.put(`/v1/account/settings/images/${labelImageId}`, data);
10965
10965
  };
10966
10966
  /**
@@ -11020,6 +11020,21 @@ const parseError = (err) => {
11020
11020
  return [new CodedError(err.message)];
11021
11021
  }
11022
11022
  };
11023
+ const nonTokenRelatedErrors = [
11024
+ "The JWT `scope` claim is invalid.",
11025
+ "Missing required scopes for this request.",
11026
+ "Your Stamps.com username or password are invalid",
11027
+ "Authorization has been denied for this request."
11028
+ ];
11029
+ const isInvalidTokenError = (err) => {
11030
+ var _a;
11031
+ const response = err.response;
11032
+ const responseData = (_a = err.response) == null ? void 0 : _a.data;
11033
+ if ((response == null ? void 0 : response.status) === 401 && responseData.errorSource === "shipengine" && responseData.errorType === "security" && !nonTokenRelatedErrors.includes(responseData.message)) {
11034
+ return true;
11035
+ }
11036
+ return false;
11037
+ };
11023
11038
 
11024
11039
  var axiosExports$1 = {};
11025
11040
  var axios$3 = {
@@ -13655,7 +13670,7 @@ var ipaddr = {
13655
13670
  }).call(commonjsGlobal);
13656
13671
  } (ipaddr));
13657
13672
 
13658
- var __async$D = (__this, __arguments, generator) => {
13673
+ var __async$E = (__this, __arguments, generator) => {
13659
13674
  return new Promise((resolve, reject) => {
13660
13675
  var fulfilled = (value) => {
13661
13676
  try {
@@ -13675,7 +13690,7 @@ var __async$D = (__this, __arguments, generator) => {
13675
13690
  step((generator = generator.apply(__this, __arguments)).next());
13676
13691
  });
13677
13692
  };
13678
- const getEndUserIpAddress = () => __async$D(void 0, null, function* () {
13693
+ const getEndUserIpAddress = () => __async$E(void 0, null, function* () {
13679
13694
  try {
13680
13695
  const response = yield axios.get("https://api.ipify.org/?format=json");
13681
13696
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -13690,35 +13705,35 @@ const getEndUserIpAddress = () => __async$D(void 0, null, function* () {
13690
13705
  var __defProp$6 = Object.defineProperty;
13691
13706
  var __defProps$3 = Object.defineProperties;
13692
13707
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
13693
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
13694
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
13695
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
13708
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
13709
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
13710
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
13696
13711
  var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13697
13712
  var __spreadValues$6 = (a, b) => {
13698
13713
  for (var prop in b || (b = {}))
13699
- if (__hasOwnProp$g.call(b, prop))
13714
+ if (__hasOwnProp$h.call(b, prop))
13700
13715
  __defNormalProp$6(a, prop, b[prop]);
13701
- if (__getOwnPropSymbols$g)
13702
- for (var prop of __getOwnPropSymbols$g(b)) {
13703
- if (__propIsEnum$g.call(b, prop))
13716
+ if (__getOwnPropSymbols$h)
13717
+ for (var prop of __getOwnPropSymbols$h(b)) {
13718
+ if (__propIsEnum$h.call(b, prop))
13704
13719
  __defNormalProp$6(a, prop, b[prop]);
13705
13720
  }
13706
13721
  return a;
13707
13722
  };
13708
13723
  var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
13709
- var __objRest$b = (source, exclude) => {
13724
+ var __objRest$c = (source, exclude) => {
13710
13725
  var target = {};
13711
13726
  for (var prop in source)
13712
- if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
13727
+ if (__hasOwnProp$h.call(source, prop) && exclude.indexOf(prop) < 0)
13713
13728
  target[prop] = source[prop];
13714
- if (source != null && __getOwnPropSymbols$g)
13715
- for (var prop of __getOwnPropSymbols$g(source)) {
13716
- if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(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))
13717
13732
  target[prop] = source[prop];
13718
13733
  }
13719
13734
  return target;
13720
13735
  };
13721
- var __async$C = (__this, __arguments, generator) => {
13736
+ var __async$D = (__this, __arguments, generator) => {
13722
13737
  return new Promise((resolve, reject) => {
13723
13738
  var fulfilled = (value) => {
13724
13739
  try {
@@ -13756,8 +13771,8 @@ class CarriersAPI {
13756
13771
  /**
13757
13772
  * The `connect` method connects a carrier account to a user's ShipEngine account.
13758
13773
  */
13759
- this.connect = (_a) => __async$C(this, null, function* () {
13760
- var _b = _a, { carrierCode } = _b, connection = __objRest$b(_b, ["carrierCode"]);
13774
+ this.connect = (_a) => __async$D(this, null, function* () {
13775
+ var _b = _a, { carrierCode } = _b, connection = __objRest$c(_b, ["carrierCode"]);
13761
13776
  const endUserIpAddress = yield getEndUserIpAddress();
13762
13777
  if (!endUserIpAddress)
13763
13778
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16073,22 +16088,22 @@ class CustomPackagesAPI {
16073
16088
  }
16074
16089
 
16075
16090
  var __defProp$5 = Object.defineProperty;
16076
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
16077
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
16078
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
16091
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
16092
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
16093
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
16079
16094
  var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16080
16095
  var __spreadValues$5 = (a, b) => {
16081
16096
  for (var prop in b || (b = {}))
16082
- if (__hasOwnProp$f.call(b, prop))
16097
+ if (__hasOwnProp$g.call(b, prop))
16083
16098
  __defNormalProp$5(a, prop, b[prop]);
16084
- if (__getOwnPropSymbols$f)
16085
- for (var prop of __getOwnPropSymbols$f(b)) {
16086
- if (__propIsEnum$f.call(b, prop))
16099
+ if (__getOwnPropSymbols$g)
16100
+ for (var prop of __getOwnPropSymbols$g(b)) {
16101
+ if (__propIsEnum$g.call(b, prop))
16087
16102
  __defNormalProp$5(a, prop, b[prop]);
16088
16103
  }
16089
16104
  return a;
16090
16105
  };
16091
- var __async$B = (__this, __arguments, generator) => {
16106
+ var __async$C = (__this, __arguments, generator) => {
16092
16107
  return new Promise((resolve, reject) => {
16093
16108
  var fulfilled = (value) => {
16094
16109
  try {
@@ -16127,7 +16142,7 @@ class FundingSourcesAPI {
16127
16142
  * The `create` method creates a new funding source for a given user. This requires
16128
16143
  * payment information to be collected from the user.
16129
16144
  */
16130
- this.create = (createFundingSource) => __async$B(this, null, function* () {
16145
+ this.create = (createFundingSource) => __async$C(this, null, function* () {
16131
16146
  const endUserIpAddress = yield getEndUserIpAddress();
16132
16147
  if (!endUserIpAddress)
16133
16148
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16140,7 +16155,7 @@ class FundingSourcesAPI {
16140
16155
  * user to update the billing address or payment information associated with the
16141
16156
  * funding source.
16142
16157
  */
16143
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$B(this, null, function* () {
16158
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$C(this, null, function* () {
16144
16159
  const endUserIpAddress = yield getEndUserIpAddress();
16145
16160
  if (!endUserIpAddress)
16146
16161
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16157,7 +16172,7 @@ class FundingSourcesAPI {
16157
16172
  * The `registerCarrier` method registers a carrier account and associates
16158
16173
  * it with a given funding source.
16159
16174
  */
16160
- this.registerCarrier = (carrier) => __async$B(this, null, function* () {
16175
+ this.registerCarrier = (carrier) => __async$C(this, null, function* () {
16161
16176
  const endUserIpAddress = yield getEndUserIpAddress();
16162
16177
  if (!endUserIpAddress)
16163
16178
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16168,7 +16183,7 @@ class FundingSourcesAPI {
16168
16183
  /**
16169
16184
  * The `addFunds` method allows you to add funds to a funding source.
16170
16185
  */
16171
- this.addFunds = (amount, fundingSourceId) => __async$B(this, null, function* () {
16186
+ this.addFunds = (amount, fundingSourceId) => __async$C(this, null, function* () {
16172
16187
  return yield this.client.put(
16173
16188
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
16174
16189
  amount
@@ -16178,7 +16193,7 @@ class FundingSourcesAPI {
16178
16193
  * The `metadata` method returns seller-specific requirements for creating funding sources
16179
16194
  * and attaching carriers
16180
16195
  */
16181
- this.metadata = () => __async$B(this, null, function* () {
16196
+ this.metadata = () => __async$C(this, null, function* () {
16182
16197
  return yield this.client.get("/v1/funding_sources/metadata");
16183
16198
  });
16184
16199
  /**
@@ -16207,6 +16222,15 @@ class InsuranceAPI {
16207
16222
  this.get = (insuranceProvider) => {
16208
16223
  return this.client.get(`/v1/insurance/${insuranceProvider}/balance`);
16209
16224
  };
16225
+ /**
16226
+ * The `addFunds` method add funds to the account balance of the given `insuranceProvider`.
16227
+ */
16228
+ this.addFunds = (insuranceProvider, params) => {
16229
+ return this.client.patch(
16230
+ `/v1/insurance/${insuranceProvider}/add_funds`,
16231
+ params
16232
+ );
16233
+ };
16210
16234
  this.client = client;
16211
16235
  }
16212
16236
  }
@@ -16427,7 +16451,7 @@ class SalesOrdersAPI {
16427
16451
  }
16428
16452
  }
16429
16453
 
16430
- var __async$A = (__this, __arguments, generator) => {
16454
+ var __async$B = (__this, __arguments, generator) => {
16431
16455
  return new Promise((resolve, reject) => {
16432
16456
  var fulfilled = (value) => {
16433
16457
  try {
@@ -16470,7 +16494,7 @@ class ShipmentsAPI {
16470
16494
  * The `create` method allows for creating shipments based on a list of shipment
16471
16495
  * items passed into this method.
16472
16496
  */
16473
- this.create = (...shipments) => __async$A(this, null, function* () {
16497
+ this.create = (...shipments) => __async$B(this, null, function* () {
16474
16498
  return this.client.post("/v1/shipments", {
16475
16499
  shipments
16476
16500
  });
@@ -16577,23 +16601,23 @@ class WarehousesAPI {
16577
16601
  var __defProp$4 = Object.defineProperty;
16578
16602
  var __defProps$2 = Object.defineProperties;
16579
16603
  var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
16580
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
16581
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
16582
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
16604
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
16605
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
16606
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
16583
16607
  var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16584
16608
  var __spreadValues$4 = (a, b) => {
16585
16609
  for (var prop in b || (b = {}))
16586
- if (__hasOwnProp$e.call(b, prop))
16610
+ if (__hasOwnProp$f.call(b, prop))
16587
16611
  __defNormalProp$4(a, prop, b[prop]);
16588
- if (__getOwnPropSymbols$e)
16589
- for (var prop of __getOwnPropSymbols$e(b)) {
16590
- if (__propIsEnum$e.call(b, prop))
16612
+ if (__getOwnPropSymbols$f)
16613
+ for (var prop of __getOwnPropSymbols$f(b)) {
16614
+ if (__propIsEnum$f.call(b, prop))
16591
16615
  __defNormalProp$4(a, prop, b[prop]);
16592
16616
  }
16593
16617
  return a;
16594
16618
  };
16595
16619
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
16596
- var __async$z = (__this, __arguments, generator) => {
16620
+ var __async$A = (__this, __arguments, generator) => {
16597
16621
  return new Promise((resolve, reject) => {
16598
16622
  var fulfilled = (value) => {
16599
16623
  try {
@@ -16687,8 +16711,8 @@ class ShipEngineAPI {
16687
16711
  );
16688
16712
  return res;
16689
16713
  },
16690
- (err) => __async$z(this, null, function* () {
16691
- var _a, _b, _c, _d, _e, _f;
16714
+ (err) => __async$A(this, null, function* () {
16715
+ var _a, _b, _c, _d, _e;
16692
16716
  logger$1.error(
16693
16717
  { err, req: err.config, res: err.response },
16694
16718
  "%s %s: %s %s - %s",
@@ -16698,7 +16722,7 @@ class ShipEngineAPI {
16698
16722
  (_e = err.response) == null ? void 0 : _e.statusText,
16699
16723
  err.message
16700
16724
  );
16701
- if (((_f = err.response) == null ? void 0 : _f.status) === 401) {
16725
+ if (isInvalidTokenError(err)) {
16702
16726
  const token2 = yield getToken();
16703
16727
  const config = err.config;
16704
16728
  if (config) {
@@ -16889,28 +16913,24 @@ const ShipEngine = ({
16889
16913
  getToken,
16890
16914
  onApiError
16891
16915
  }) => {
16916
+ const [client, setClient] = React.useState();
16892
16917
  const [queryClient] = React.useState(() => new reactQuery.QueryClient());
16893
- const [client, setClient] = React.useState(() => {
16918
+ React.useEffect(() => {
16894
16919
  const token = getToken();
16895
- if (typeof token === "string")
16896
- return new ShipEngineAPI(token, {
16897
- baseURL,
16898
- getToken,
16899
- headers: headers != null ? headers : {},
16900
- onApiError
16920
+ const commonClientProps = {
16921
+ baseURL,
16922
+ getToken,
16923
+ headers: headers != null ? headers : {},
16924
+ onApiError
16925
+ };
16926
+ if (typeof token === "string") {
16927
+ setClient(new ShipEngineAPI(token, commonClientProps));
16928
+ } else {
16929
+ token.then((t) => {
16930
+ setClient(new ShipEngineAPI(t, commonClientProps));
16901
16931
  });
16902
- token.then(
16903
- (t) => setClient(
16904
- new ShipEngineAPI(t, {
16905
- baseURL,
16906
- getToken,
16907
- headers: headers != null ? headers : {},
16908
- onApiError
16909
- })
16910
- )
16911
- );
16912
- return void 0;
16913
- });
16932
+ }
16933
+ }, []);
16914
16934
  if (!client) {
16915
16935
  return /* @__PURE__ */ jsxRuntime.jsx(
16916
16936
  "div",
@@ -16945,17 +16965,17 @@ const onError = (_errors) => _default();
16945
16965
  var __defProp$3 = Object.defineProperty;
16946
16966
  var __defProps$1 = Object.defineProperties;
16947
16967
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
16948
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
16949
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
16950
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
16968
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
16969
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
16970
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
16951
16971
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16952
16972
  var __spreadValues$3 = (a, b) => {
16953
16973
  for (var prop in b || (b = {}))
16954
- if (__hasOwnProp$d.call(b, prop))
16974
+ if (__hasOwnProp$e.call(b, prop))
16955
16975
  __defNormalProp$3(a, prop, b[prop]);
16956
- if (__getOwnPropSymbols$d)
16957
- for (var prop of __getOwnPropSymbols$d(b)) {
16958
- if (__propIsEnum$d.call(b, prop))
16976
+ if (__getOwnPropSymbols$e)
16977
+ for (var prop of __getOwnPropSymbols$e(b)) {
16978
+ if (__propIsEnum$e.call(b, prop))
16959
16979
  __defNormalProp$3(a, prop, b[prop]);
16960
16980
  }
16961
16981
  return a;
@@ -16994,7 +17014,7 @@ const retryUntil = (callbackFn, retries = 10, timeoutBetweenAttempts = 1e3) => P
16994
17014
  throw error;
16995
17015
  });
16996
17016
 
16997
- var __async$y = (__this, __arguments, generator) => {
17017
+ var __async$z = (__this, __arguments, generator) => {
16998
17018
  return new Promise((resolve, reject) => {
16999
17019
  var fulfilled = (value) => {
17000
17020
  try {
@@ -17017,7 +17037,7 @@ var __async$y = (__this, __arguments, generator) => {
17017
17037
  const useCreateAccountImage = () => {
17018
17038
  const { client } = useShipEngine();
17019
17039
  return reactQuery.useMutation({
17020
- mutationFn: (data) => __async$y(void 0, null, function* () {
17040
+ mutationFn: (data) => __async$z(void 0, null, function* () {
17021
17041
  const result = yield client.accountSettings.createImage(data);
17022
17042
  return result.data;
17023
17043
  }),
@@ -17026,7 +17046,7 @@ const useCreateAccountImage = () => {
17026
17046
  });
17027
17047
  };
17028
17048
 
17029
- var __async$x = (__this, __arguments, generator) => {
17049
+ var __async$y = (__this, __arguments, generator) => {
17030
17050
  return new Promise((resolve, reject) => {
17031
17051
  var fulfilled = (value) => {
17032
17052
  try {
@@ -17049,7 +17069,7 @@ var __async$x = (__this, __arguments, generator) => {
17049
17069
  const useDeleteAccountImage = () => {
17050
17070
  const { client } = useShipEngine();
17051
17071
  return reactQuery.useMutation({
17052
- mutationFn: (labelImageId) => __async$x(void 0, null, function* () {
17072
+ mutationFn: (labelImageId) => __async$y(void 0, null, function* () {
17053
17073
  const result = yield client.accountSettings.deleteImage(labelImageId);
17054
17074
  return result.data;
17055
17075
  }),
@@ -17078,7 +17098,7 @@ const useGetAccountSettings = () => {
17078
17098
  });
17079
17099
  };
17080
17100
 
17081
- var __async$w = (__this, __arguments, generator) => {
17101
+ var __async$x = (__this, __arguments, generator) => {
17082
17102
  return new Promise((resolve, reject) => {
17083
17103
  var fulfilled = (value) => {
17084
17104
  try {
@@ -17101,7 +17121,7 @@ var __async$w = (__this, __arguments, generator) => {
17101
17121
  const useUpdateAccountImage = () => {
17102
17122
  const { client } = useShipEngine();
17103
17123
  return reactQuery.useMutation({
17104
- mutationFn: (data) => __async$w(void 0, null, function* () {
17124
+ mutationFn: (data) => __async$x(void 0, null, function* () {
17105
17125
  const result = yield client.accountSettings.updateImage(data);
17106
17126
  return result.data;
17107
17127
  }),
@@ -17110,7 +17130,7 @@ const useUpdateAccountImage = () => {
17110
17130
  });
17111
17131
  };
17112
17132
 
17113
- var __async$v = (__this, __arguments, generator) => {
17133
+ var __async$w = (__this, __arguments, generator) => {
17114
17134
  return new Promise((resolve, reject) => {
17115
17135
  var fulfilled = (value) => {
17116
17136
  try {
@@ -17133,7 +17153,7 @@ var __async$v = (__this, __arguments, generator) => {
17133
17153
  const useUpdateAccountSettings = () => {
17134
17154
  const { client } = useShipEngine();
17135
17155
  return reactQuery.useMutation({
17136
- mutationFn: (settings) => __async$v(void 0, null, function* () {
17156
+ mutationFn: (settings) => __async$w(void 0, null, function* () {
17137
17157
  const result = yield client.accountSettings.update(settings);
17138
17158
  return result.data;
17139
17159
  }),
@@ -17142,7 +17162,7 @@ const useUpdateAccountSettings = () => {
17142
17162
  });
17143
17163
  };
17144
17164
 
17145
- var __async$u = (__this, __arguments, generator) => {
17165
+ var __async$v = (__this, __arguments, generator) => {
17146
17166
  return new Promise((resolve, reject) => {
17147
17167
  var fulfilled = (value) => {
17148
17168
  try {
@@ -17165,7 +17185,7 @@ var __async$u = (__this, __arguments, generator) => {
17165
17185
  const useParseAddress = () => {
17166
17186
  const { client } = useShipEngine();
17167
17187
  return reactQuery.useMutation({
17168
- mutationFn: (_0) => __async$u(void 0, [_0], function* ({ address, text }) {
17188
+ mutationFn: (_0) => __async$v(void 0, [_0], function* ({ address, text }) {
17169
17189
  const result = yield client.addresses.parse(text, address);
17170
17190
  return result.data;
17171
17191
  }),
@@ -17174,7 +17194,7 @@ const useParseAddress = () => {
17174
17194
  });
17175
17195
  };
17176
17196
 
17177
- var __async$t = (__this, __arguments, generator) => {
17197
+ var __async$u = (__this, __arguments, generator) => {
17178
17198
  return new Promise((resolve, reject) => {
17179
17199
  var fulfilled = (value) => {
17180
17200
  try {
@@ -17197,7 +17217,7 @@ var __async$t = (__this, __arguments, generator) => {
17197
17217
  const useValidateAddresses = () => {
17198
17218
  const { client } = useShipEngine();
17199
17219
  return reactQuery.useMutation({
17200
- mutationFn: (addresses) => __async$t(void 0, null, function* () {
17220
+ mutationFn: (addresses) => __async$u(void 0, null, function* () {
17201
17221
  const result = yield client.addresses.validate(addresses);
17202
17222
  return result.data;
17203
17223
  }),
@@ -17206,7 +17226,7 @@ const useValidateAddresses = () => {
17206
17226
  });
17207
17227
  };
17208
17228
 
17209
- var __async$s = (__this, __arguments, generator) => {
17229
+ var __async$t = (__this, __arguments, generator) => {
17210
17230
  return new Promise((resolve, reject) => {
17211
17231
  var fulfilled = (value) => {
17212
17232
  try {
@@ -17229,7 +17249,7 @@ var __async$s = (__this, __arguments, generator) => {
17229
17249
  const useAddFunds = () => {
17230
17250
  const { client } = useShipEngine();
17231
17251
  return reactQuery.useMutation({
17232
- mutationFn: (_0) => __async$s(void 0, [_0], function* ({ carrierId, funds }) {
17252
+ mutationFn: (_0) => __async$t(void 0, [_0], function* ({ carrierId, funds }) {
17233
17253
  const result = yield client.carriers.addFunds(carrierId, funds);
17234
17254
  return result.data;
17235
17255
  }),
@@ -17238,7 +17258,7 @@ const useAddFunds = () => {
17238
17258
  });
17239
17259
  };
17240
17260
 
17241
- var __async$r = (__this, __arguments, generator) => {
17261
+ var __async$s = (__this, __arguments, generator) => {
17242
17262
  return new Promise((resolve, reject) => {
17243
17263
  var fulfilled = (value) => {
17244
17264
  try {
@@ -17261,7 +17281,7 @@ var __async$r = (__this, __arguments, generator) => {
17261
17281
  const useConnectCarrier = () => {
17262
17282
  const { client } = useShipEngine();
17263
17283
  return reactQuery.useMutation({
17264
- mutationFn: (params) => __async$r(void 0, null, function* () {
17284
+ mutationFn: (params) => __async$s(void 0, null, function* () {
17265
17285
  const result = yield client.carriers.connect(params);
17266
17286
  return result.data;
17267
17287
  }),
@@ -17380,22 +17400,22 @@ const useListCarriers = () => {
17380
17400
  });
17381
17401
  };
17382
17402
 
17383
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
17384
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
17385
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
17386
- var __objRest$a = (source, exclude) => {
17403
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
17404
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
17405
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
17406
+ var __objRest$b = (source, exclude) => {
17387
17407
  var target = {};
17388
17408
  for (var prop in source)
17389
- if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
17409
+ if (__hasOwnProp$d.call(source, prop) && exclude.indexOf(prop) < 0)
17390
17410
  target[prop] = source[prop];
17391
- if (source != null && __getOwnPropSymbols$c)
17392
- for (var prop of __getOwnPropSymbols$c(source)) {
17393
- if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
17411
+ if (source != null && __getOwnPropSymbols$d)
17412
+ for (var prop of __getOwnPropSymbols$d(source)) {
17413
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$d.call(source, prop))
17394
17414
  target[prop] = source[prop];
17395
17415
  }
17396
17416
  return target;
17397
17417
  };
17398
- var __async$q = (__this, __arguments, generator) => {
17418
+ var __async$r = (__this, __arguments, generator) => {
17399
17419
  return new Promise((resolve, reject) => {
17400
17420
  var fulfilled = (value) => {
17401
17421
  try {
@@ -17419,8 +17439,8 @@ const useUpdateAutoFunding = () => {
17419
17439
  const { client } = useShipEngine();
17420
17440
  const queryClient = reactQuery.useQueryClient();
17421
17441
  return reactQuery.useMutation({
17422
- mutationFn: (_a) => __async$q(void 0, null, function* () {
17423
- var _b = _a, { carrierId } = _b, options = __objRest$a(_b, ["carrierId"]);
17442
+ mutationFn: (_a) => __async$r(void 0, null, function* () {
17443
+ var _b = _a, { carrierId } = _b, options = __objRest$b(_b, ["carrierId"]);
17424
17444
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
17425
17445
  return result.data;
17426
17446
  }),
@@ -17449,24 +17469,24 @@ const useGetZonesByCarrier = (carrierId) => {
17449
17469
  });
17450
17470
  };
17451
17471
 
17452
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
17453
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
17454
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
17455
- var __objRest$9 = (source, exclude) => {
17472
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
17473
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
17474
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
17475
+ var __objRest$a = (source, exclude) => {
17456
17476
  var target = {};
17457
17477
  for (var prop in source)
17458
- if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
17478
+ if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
17459
17479
  target[prop] = source[prop];
17460
- if (source != null && __getOwnPropSymbols$b)
17461
- for (var prop of __getOwnPropSymbols$b(source)) {
17462
- if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
17480
+ if (source != null && __getOwnPropSymbols$c)
17481
+ for (var prop of __getOwnPropSymbols$c(source)) {
17482
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
17463
17483
  target[prop] = source[prop];
17464
17484
  }
17465
17485
  return target;
17466
17486
  };
17467
17487
  const useGetCarrierConnectionForm = (_params) => {
17468
17488
  const { client } = useShipEngine();
17469
- const _a = _params || {}, { carrierName, enabled = true } = _a, params = __objRest$9(_a, ["carrierName", "enabled"]);
17489
+ const _a = _params || {}, { carrierName, enabled = true } = _a, params = __objRest$a(_a, ["carrierName", "enabled"]);
17470
17490
  return reactQuery.useQuery({
17471
17491
  enabled,
17472
17492
  onError,
@@ -17476,24 +17496,24 @@ const useGetCarrierConnectionForm = (_params) => {
17476
17496
  });
17477
17497
  };
17478
17498
 
17479
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
17480
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
17481
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
17482
- var __objRest$8 = (source, exclude) => {
17499
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
17500
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
17501
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
17502
+ var __objRest$9 = (source, exclude) => {
17483
17503
  var target = {};
17484
17504
  for (var prop in source)
17485
- if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
17505
+ if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
17486
17506
  target[prop] = source[prop];
17487
- if (source != null && __getOwnPropSymbols$a)
17488
- for (var prop of __getOwnPropSymbols$a(source)) {
17489
- if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
17507
+ if (source != null && __getOwnPropSymbols$b)
17508
+ for (var prop of __getOwnPropSymbols$b(source)) {
17509
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
17490
17510
  target[prop] = source[prop];
17491
17511
  }
17492
17512
  return target;
17493
17513
  };
17494
17514
  const useListCarrierConnections = (_params) => {
17495
17515
  const { client } = useShipEngine();
17496
- const _a = _params || {}, { enabled = true } = _a, params = __objRest$8(_a, ["enabled"]);
17516
+ const _a = _params || {}, { enabled = true } = _a, params = __objRest$9(_a, ["enabled"]);
17497
17517
  return reactQuery.useQuery({
17498
17518
  enabled,
17499
17519
  onError,
@@ -17513,7 +17533,7 @@ const useListCustomPackageTypes = () => {
17513
17533
  });
17514
17534
  };
17515
17535
 
17516
- var __async$p = (__this, __arguments, generator) => {
17536
+ var __async$q = (__this, __arguments, generator) => {
17517
17537
  return new Promise((resolve, reject) => {
17518
17538
  var fulfilled = (value) => {
17519
17539
  try {
@@ -17536,7 +17556,7 @@ var __async$p = (__this, __arguments, generator) => {
17536
17556
  const useCreateFundingSource = () => {
17537
17557
  const { client } = useShipEngine();
17538
17558
  return reactQuery.useMutation({
17539
- mutationFn: (fundingSource) => __async$p(void 0, null, function* () {
17559
+ mutationFn: (fundingSource) => __async$q(void 0, null, function* () {
17540
17560
  const result = yield client.fundingSources.create(fundingSource);
17541
17561
  return result.data;
17542
17562
  }),
@@ -17545,7 +17565,7 @@ const useCreateFundingSource = () => {
17545
17565
  });
17546
17566
  };
17547
17567
 
17548
- var __async$o = (__this, __arguments, generator) => {
17568
+ var __async$p = (__this, __arguments, generator) => {
17549
17569
  return new Promise((resolve, reject) => {
17550
17570
  var fulfilled = (value) => {
17551
17571
  try {
@@ -17568,7 +17588,7 @@ var __async$o = (__this, __arguments, generator) => {
17568
17588
  const useFundingSourcesAddFunds = () => {
17569
17589
  const { client } = useShipEngine();
17570
17590
  return reactQuery.useMutation({
17571
- mutationFn: (_0) => __async$o(void 0, [_0], function* ({ funds, fundingSourceId }) {
17591
+ mutationFn: (_0) => __async$p(void 0, [_0], function* ({ funds, fundingSourceId }) {
17572
17592
  const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
17573
17593
  return result.data;
17574
17594
  }),
@@ -17597,7 +17617,7 @@ const useListFundingSources = () => {
17597
17617
  });
17598
17618
  };
17599
17619
 
17600
- var __async$n = (__this, __arguments, generator) => {
17620
+ var __async$o = (__this, __arguments, generator) => {
17601
17621
  return new Promise((resolve, reject) => {
17602
17622
  var fulfilled = (value) => {
17603
17623
  try {
@@ -17620,7 +17640,7 @@ var __async$n = (__this, __arguments, generator) => {
17620
17640
  const useRegisterCarrier = () => {
17621
17641
  const { client } = useShipEngine();
17622
17642
  return reactQuery.useMutation({
17623
- mutationFn: (carrier) => __async$n(void 0, null, function* () {
17643
+ mutationFn: (carrier) => __async$o(void 0, null, function* () {
17624
17644
  const result = yield client.fundingSources.registerCarrier(carrier);
17625
17645
  return result.data;
17626
17646
  }),
@@ -17629,7 +17649,7 @@ const useRegisterCarrier = () => {
17629
17649
  });
17630
17650
  };
17631
17651
 
17632
- var __async$m = (__this, __arguments, generator) => {
17652
+ var __async$n = (__this, __arguments, generator) => {
17633
17653
  return new Promise((resolve, reject) => {
17634
17654
  var fulfilled = (value) => {
17635
17655
  try {
@@ -17652,7 +17672,7 @@ var __async$m = (__this, __arguments, generator) => {
17652
17672
  const useUpdateFundingSource = () => {
17653
17673
  const { client } = useShipEngine();
17654
17674
  return reactQuery.useMutation({
17655
- mutationFn: (_0) => __async$m(void 0, [_0], function* ({
17675
+ mutationFn: (_0) => __async$n(void 0, [_0], function* ({
17656
17676
  billingInfo,
17657
17677
  creditCardInfo,
17658
17678
  fundingSourceId
@@ -17706,6 +17726,54 @@ const useGetInsuranceAccount = (insuranceProvider) => {
17706
17726
  });
17707
17727
  };
17708
17728
 
17729
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
17730
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
17731
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
17732
+ var __objRest$8 = (source, exclude) => {
17733
+ var target = {};
17734
+ for (var prop in source)
17735
+ if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
17736
+ target[prop] = source[prop];
17737
+ if (source != null && __getOwnPropSymbols$a)
17738
+ for (var prop of __getOwnPropSymbols$a(source)) {
17739
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
17740
+ target[prop] = source[prop];
17741
+ }
17742
+ return target;
17743
+ };
17744
+ var __async$m = (__this, __arguments, generator) => {
17745
+ return new Promise((resolve, reject) => {
17746
+ var fulfilled = (value) => {
17747
+ try {
17748
+ step(generator.next(value));
17749
+ } catch (e) {
17750
+ reject(e);
17751
+ }
17752
+ };
17753
+ var rejected = (value) => {
17754
+ try {
17755
+ step(generator.throw(value));
17756
+ } catch (e) {
17757
+ reject(e);
17758
+ }
17759
+ };
17760
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
17761
+ step((generator = generator.apply(__this, __arguments)).next());
17762
+ });
17763
+ };
17764
+ const useAddInsuranceFunds = () => {
17765
+ const { client } = useShipEngine();
17766
+ return reactQuery.useMutation({
17767
+ mutationFn: (_a) => __async$m(void 0, null, function* () {
17768
+ var _b = _a, { insuranceProvider } = _b, rest = __objRest$8(_b, ["insuranceProvider"]);
17769
+ const result = yield client.insurance.addFunds(insuranceProvider, rest);
17770
+ return result.data;
17771
+ }),
17772
+ mutationKey: ["useAddInsuranceFunds"],
17773
+ onError
17774
+ });
17775
+ };
17776
+
17709
17777
  var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
17710
17778
  var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
17711
17779
  var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
@@ -19949,11 +20017,13 @@ exports.getEndUserIpAddress = getEndUserIpAddress;
19949
20017
  exports.isCodedError = isCodedError;
19950
20018
  exports.isCodedErrors = isCodedErrors;
19951
20019
  exports.isDataCodedErrors = isDataCodedErrors;
20020
+ exports.isInvalidTokenError = isInvalidTokenError;
19952
20021
  exports.logger = logger;
19953
20022
  exports.onError = onError;
19954
20023
  exports.parseError = parseError;
19955
20024
  exports.retryUntil = retryUntil;
19956
20025
  exports.useAddFunds = useAddFunds;
20026
+ exports.useAddInsuranceFunds = useAddInsuranceFunds;
19957
20027
  exports.useAlchemy = useAlchemy;
19958
20028
  exports.useCalculateRates = useCalculateRates;
19959
20029
  exports.useConnectCarrier = useConnectCarrier;