@shipengine/alchemy 1.0.5 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -2477,17 +2477,17 @@ Object.defineProperty(dist, "__esModule", { value: true });
2477
2477
  var _default = dist.default = (function () {
2478
2478
  });
2479
2479
 
2480
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
2481
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
2482
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
2480
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
2481
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
2482
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
2483
2483
  var __objRest$8 = (source, exclude) => {
2484
2484
  var target = {};
2485
2485
  for (var prop in source)
2486
- if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
2486
+ if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
2487
2487
  target[prop] = source[prop];
2488
- if (source != null && __getOwnPropSymbols$c)
2489
- for (var prop of __getOwnPropSymbols$c(source)) {
2490
- if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
2488
+ if (source != null && __getOwnPropSymbols$e)
2489
+ for (var prop of __getOwnPropSymbols$e(source)) {
2490
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
2491
2491
  target[prop] = source[prop];
2492
2492
  }
2493
2493
  return target;
@@ -5231,7 +5231,7 @@ var ipaddr = {
5231
5231
  }).call(commonjsGlobal);
5232
5232
  } (ipaddr));
5233
5233
 
5234
- var __async$u = (__this, __arguments, generator) => {
5234
+ var __async$v = (__this, __arguments, generator) => {
5235
5235
  return new Promise((resolve, reject) => {
5236
5236
  var fulfilled = (value) => {
5237
5237
  try {
@@ -5251,7 +5251,7 @@ var __async$u = (__this, __arguments, generator) => {
5251
5251
  step((generator = generator.apply(__this, __arguments)).next());
5252
5252
  });
5253
5253
  };
5254
- const getEndUserIpAddress = () => __async$u(void 0, null, function* () {
5254
+ const getEndUserIpAddress = () => __async$v(void 0, null, function* () {
5255
5255
  try {
5256
5256
  const response = yield axios.get("https://api.ipify.org/?format=json");
5257
5257
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -5263,38 +5263,38 @@ const getEndUserIpAddress = () => __async$u(void 0, null, function* () {
5263
5263
  }
5264
5264
  });
5265
5265
 
5266
- var __defProp$5 = Object.defineProperty;
5267
- var __defProps$3 = Object.defineProperties;
5268
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
5269
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
5270
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
5271
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
5272
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5273
- var __spreadValues$5 = (a, b) => {
5266
+ var __defProp$7 = Object.defineProperty;
5267
+ var __defProps$5 = Object.defineProperties;
5268
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
5269
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
5270
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
5271
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
5272
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5273
+ var __spreadValues$7 = (a, b) => {
5274
5274
  for (var prop in b || (b = {}))
5275
- if (__hasOwnProp$b.call(b, prop))
5276
- __defNormalProp$5(a, prop, b[prop]);
5277
- if (__getOwnPropSymbols$b)
5278
- for (var prop of __getOwnPropSymbols$b(b)) {
5279
- if (__propIsEnum$b.call(b, prop))
5280
- __defNormalProp$5(a, prop, b[prop]);
5275
+ if (__hasOwnProp$d.call(b, prop))
5276
+ __defNormalProp$7(a, prop, b[prop]);
5277
+ if (__getOwnPropSymbols$d)
5278
+ for (var prop of __getOwnPropSymbols$d(b)) {
5279
+ if (__propIsEnum$d.call(b, prop))
5280
+ __defNormalProp$7(a, prop, b[prop]);
5281
5281
  }
5282
5282
  return a;
5283
5283
  };
5284
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
5284
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
5285
5285
  var __objRest$7 = (source, exclude) => {
5286
5286
  var target = {};
5287
5287
  for (var prop in source)
5288
- if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
5288
+ if (__hasOwnProp$d.call(source, prop) && exclude.indexOf(prop) < 0)
5289
5289
  target[prop] = source[prop];
5290
- if (source != null && __getOwnPropSymbols$b)
5291
- for (var prop of __getOwnPropSymbols$b(source)) {
5292
- if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
5290
+ if (source != null && __getOwnPropSymbols$d)
5291
+ for (var prop of __getOwnPropSymbols$d(source)) {
5292
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$d.call(source, prop))
5293
5293
  target[prop] = source[prop];
5294
5294
  }
5295
5295
  return target;
5296
5296
  };
5297
- var __async$t = (__this, __arguments, generator) => {
5297
+ var __async$u = (__this, __arguments, generator) => {
5298
5298
  return new Promise((resolve, reject) => {
5299
5299
  var fulfilled = (value) => {
5300
5300
  try {
@@ -5323,12 +5323,12 @@ class CarriersAPI {
5323
5323
  this.get = (carrierId) => {
5324
5324
  return this.client.get(`/v1/carriers/${carrierId}`);
5325
5325
  };
5326
- this.connect = (_a) => __async$t(this, null, function* () {
5326
+ this.connect = (_a) => __async$u(this, null, function* () {
5327
5327
  var _b = _a, { carrierCode } = _b, connection = __objRest$7(_b, ["carrierCode"]);
5328
5328
  const endUserIpAddress = yield getEndUserIpAddress();
5329
5329
  if (!endUserIpAddress)
5330
5330
  return Promise.reject([new CodedError("Unable to get IP address")]);
5331
- return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$3(__spreadValues$5({}, connection), {
5331
+ return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$5(__spreadValues$7({}, connection), {
5332
5332
  endUserIpAddress
5333
5333
  }));
5334
5334
  });
@@ -7560,23 +7560,23 @@ class CustomPackagesAPI {
7560
7560
  }
7561
7561
  }
7562
7562
 
7563
- var __defProp$4 = Object.defineProperty;
7564
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
7565
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
7566
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
7567
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7568
- var __spreadValues$4 = (a, b) => {
7563
+ var __defProp$6 = Object.defineProperty;
7564
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
7565
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
7566
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
7567
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7568
+ var __spreadValues$6 = (a, b) => {
7569
7569
  for (var prop in b || (b = {}))
7570
- if (__hasOwnProp$a.call(b, prop))
7571
- __defNormalProp$4(a, prop, b[prop]);
7572
- if (__getOwnPropSymbols$a)
7573
- for (var prop of __getOwnPropSymbols$a(b)) {
7574
- if (__propIsEnum$a.call(b, prop))
7575
- __defNormalProp$4(a, prop, b[prop]);
7570
+ if (__hasOwnProp$c.call(b, prop))
7571
+ __defNormalProp$6(a, prop, b[prop]);
7572
+ if (__getOwnPropSymbols$c)
7573
+ for (var prop of __getOwnPropSymbols$c(b)) {
7574
+ if (__propIsEnum$c.call(b, prop))
7575
+ __defNormalProp$6(a, prop, b[prop]);
7576
7576
  }
7577
7577
  return a;
7578
7578
  };
7579
- var __async$s = (__this, __arguments, generator) => {
7579
+ var __async$t = (__this, __arguments, generator) => {
7580
7580
  return new Promise((resolve, reject) => {
7581
7581
  var fulfilled = (value) => {
7582
7582
  try {
@@ -7605,15 +7605,15 @@ class FundingSourcesAPI {
7605
7605
  this.get = (fundingSourceId) => {
7606
7606
  return this.client.get(`/v1/funding_sources/${fundingSourceId}`);
7607
7607
  };
7608
- this.create = (createFundingSource) => __async$s(this, null, function* () {
7608
+ this.create = (createFundingSource) => __async$t(this, null, function* () {
7609
7609
  const endUserIpAddress = yield getEndUserIpAddress();
7610
7610
  if (!endUserIpAddress)
7611
7611
  return Promise.reject([new CodedError("Unable to get IP address")]);
7612
- return yield this.client.post("/v1/funding_sources", __spreadValues$4({
7612
+ return yield this.client.post("/v1/funding_sources", __spreadValues$6({
7613
7613
  endUserIpAddress
7614
7614
  }, createFundingSource));
7615
7615
  });
7616
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$s(this, null, function* () {
7616
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$t(this, null, function* () {
7617
7617
  const endUserIpAddress = yield getEndUserIpAddress();
7618
7618
  if (!endUserIpAddress)
7619
7619
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7626,15 +7626,15 @@ class FundingSourcesAPI {
7626
7626
  }
7627
7627
  );
7628
7628
  });
7629
- this.registerCarrier = (carrier) => __async$s(this, null, function* () {
7629
+ this.registerCarrier = (carrier) => __async$t(this, null, function* () {
7630
7630
  const endUserIpAddress = yield getEndUserIpAddress();
7631
7631
  if (!endUserIpAddress)
7632
7632
  return Promise.reject([new CodedError("Unable to get IP address")]);
7633
- return yield this.client.post("/v1/registration/funding_source", __spreadValues$4({
7633
+ return yield this.client.post("/v1/registration/funding_source", __spreadValues$6({
7634
7634
  endUserIpAddress
7635
7635
  }, carrier));
7636
7636
  });
7637
- this.addFunds = (amount, fundingSourceId) => __async$s(this, null, function* () {
7637
+ this.addFunds = (amount, fundingSourceId) => __async$t(this, null, function* () {
7638
7638
  return yield this.client.put(
7639
7639
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
7640
7640
  amount
@@ -7714,6 +7714,15 @@ class RateCardsAPI {
7714
7714
  responseType: "blob"
7715
7715
  });
7716
7716
  };
7717
+ this.upload = (rateCardId, file) => {
7718
+ const formData = new FormData();
7719
+ formData.append("file", file);
7720
+ return this.client.put(`/v1/rate_cards/${rateCardId}/rates/upload`, formData, {
7721
+ headers: {
7722
+ ContentType: "multipart/form-data"
7723
+ }
7724
+ });
7725
+ };
7717
7726
  this.client = client;
7718
7727
  }
7719
7728
  }
@@ -7771,7 +7780,7 @@ class SalesOrdersAPI {
7771
7780
  }
7772
7781
  }
7773
7782
 
7774
- var __async$r = (__this, __arguments, generator) => {
7783
+ var __async$s = (__this, __arguments, generator) => {
7775
7784
  return new Promise((resolve, reject) => {
7776
7785
  var fulfilled = (value) => {
7777
7786
  try {
@@ -7803,7 +7812,7 @@ class ShipmentsAPI {
7803
7812
  this.list = (options) => {
7804
7813
  return this.client.get("/v1/shipments", { params: options });
7805
7814
  };
7806
- this.create = (...shipments) => __async$r(this, null, function* () {
7815
+ this.create = (...shipments) => __async$s(this, null, function* () {
7807
7816
  return this.client.post("/v1/shipments", {
7808
7817
  shipments
7809
7818
  });
@@ -7831,26 +7840,26 @@ class WarehousesAPI {
7831
7840
  }
7832
7841
  }
7833
7842
 
7834
- var __defProp$3 = Object.defineProperty;
7835
- var __defProps$2 = Object.defineProperties;
7836
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
7837
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
7838
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
7839
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
7840
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7841
- var __spreadValues$3 = (a, b) => {
7843
+ var __defProp$5 = Object.defineProperty;
7844
+ var __defProps$4 = Object.defineProperties;
7845
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
7846
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
7847
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
7848
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
7849
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7850
+ var __spreadValues$5 = (a, b) => {
7842
7851
  for (var prop in b || (b = {}))
7843
- if (__hasOwnProp$9.call(b, prop))
7844
- __defNormalProp$3(a, prop, b[prop]);
7845
- if (__getOwnPropSymbols$9)
7846
- for (var prop of __getOwnPropSymbols$9(b)) {
7847
- if (__propIsEnum$9.call(b, prop))
7848
- __defNormalProp$3(a, prop, b[prop]);
7852
+ if (__hasOwnProp$b.call(b, prop))
7853
+ __defNormalProp$5(a, prop, b[prop]);
7854
+ if (__getOwnPropSymbols$b)
7855
+ for (var prop of __getOwnPropSymbols$b(b)) {
7856
+ if (__propIsEnum$b.call(b, prop))
7857
+ __defNormalProp$5(a, prop, b[prop]);
7849
7858
  }
7850
7859
  return a;
7851
7860
  };
7852
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
7853
- var __async$q = (__this, __arguments, generator) => {
7861
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
7862
+ var __async$r = (__this, __arguments, generator) => {
7854
7863
  return new Promise((resolve, reject) => {
7855
7864
  var fulfilled = (value) => {
7856
7865
  try {
@@ -7872,7 +7881,7 @@ var __async$q = (__this, __arguments, generator) => {
7872
7881
  };
7873
7882
  const logger$1 = E({
7874
7883
  name: "shipengine-api",
7875
- serializers: __spreadProps$2(__spreadValues$3({}, k), {
7884
+ serializers: __spreadProps$4(__spreadValues$5({}, k), {
7876
7885
  req: (req) => ({
7877
7886
  headers: req.headers,
7878
7887
  method: req.method,
@@ -7897,7 +7906,7 @@ class ShipEngineAPI {
7897
7906
  constructor(token, { baseURL, headers, getToken }) {
7898
7907
  const client = axios.create({
7899
7908
  baseURL,
7900
- headers: __spreadProps$2(__spreadValues$3({}, headers), {
7909
+ headers: __spreadProps$4(__spreadValues$5({}, headers), {
7901
7910
  Authorization: `Bearer ${token}`,
7902
7911
  "Content-Type": "application/json"
7903
7912
  }),
@@ -7931,7 +7940,7 @@ class ShipEngineAPI {
7931
7940
  );
7932
7941
  return res;
7933
7942
  },
7934
- (err) => __async$q(this, null, function* () {
7943
+ (err) => __async$r(this, null, function* () {
7935
7944
  var _a, _b, _c, _d, _e, _f, _g;
7936
7945
  logger$1.error(
7937
7946
  { err, req: err.config, res: err.response },
@@ -8071,25 +8080,25 @@ const delay = (ms) => new Promise((resolve) => {
8071
8080
 
8072
8081
  const onError = (errors) => errors.forEach(console.log);
8073
8082
 
8074
- var __defProp$2 = Object.defineProperty;
8075
- var __defProps$1 = Object.defineProperties;
8076
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
8077
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8078
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8079
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8080
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8081
- var __spreadValues$2 = (a, b) => {
8083
+ var __defProp$4 = Object.defineProperty;
8084
+ var __defProps$3 = Object.defineProperties;
8085
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
8086
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
8087
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8088
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
8089
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8090
+ var __spreadValues$4 = (a, b) => {
8082
8091
  for (var prop in b || (b = {}))
8083
- if (__hasOwnProp$8.call(b, prop))
8084
- __defNormalProp$2(a, prop, b[prop]);
8085
- if (__getOwnPropSymbols$8)
8086
- for (var prop of __getOwnPropSymbols$8(b)) {
8087
- if (__propIsEnum$8.call(b, prop))
8088
- __defNormalProp$2(a, prop, b[prop]);
8092
+ if (__hasOwnProp$a.call(b, prop))
8093
+ __defNormalProp$4(a, prop, b[prop]);
8094
+ if (__getOwnPropSymbols$a)
8095
+ for (var prop of __getOwnPropSymbols$a(b)) {
8096
+ if (__propIsEnum$a.call(b, prop))
8097
+ __defNormalProp$4(a, prop, b[prop]);
8089
8098
  }
8090
8099
  return a;
8091
8100
  };
8092
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
8101
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
8093
8102
  const streams = [];
8094
8103
  if (process.env.NODE_ENV === "production") {
8095
8104
  streams.push({
@@ -8098,7 +8107,7 @@ if (process.env.NODE_ENV === "production") {
8098
8107
  }
8099
8108
  const logger = E({
8100
8109
  name: "shipengine",
8101
- serializers: __spreadProps$1(__spreadValues$2({}, k), {
8110
+ serializers: __spreadProps$3(__spreadValues$4({}, k), {
8102
8111
  req: (req) => ({
8103
8112
  headers: req.headers,
8104
8113
  method: req.method,
@@ -8123,7 +8132,7 @@ const retryUntil = (callbackFn, retries = 10, timeoutBetweenAttempts = 1e3) => P
8123
8132
  throw error;
8124
8133
  });
8125
8134
 
8126
- var __async$p = (__this, __arguments, generator) => {
8135
+ var __async$q = (__this, __arguments, generator) => {
8127
8136
  return new Promise((resolve, reject) => {
8128
8137
  var fulfilled = (value) => {
8129
8138
  try {
@@ -8146,7 +8155,7 @@ var __async$p = (__this, __arguments, generator) => {
8146
8155
  const useAddFunds = (carrierId) => {
8147
8156
  const { client } = useShipEngine();
8148
8157
  return reactQuery.useMutation({
8149
- mutationFn: (funds) => __async$p(void 0, null, function* () {
8158
+ mutationFn: (funds) => __async$q(void 0, null, function* () {
8150
8159
  const result = yield client.carriers.addFunds(carrierId, funds);
8151
8160
  return result.data;
8152
8161
  }),
@@ -8155,7 +8164,7 @@ const useAddFunds = (carrierId) => {
8155
8164
  });
8156
8165
  };
8157
8166
 
8158
- var __async$o = (__this, __arguments, generator) => {
8167
+ var __async$p = (__this, __arguments, generator) => {
8159
8168
  return new Promise((resolve, reject) => {
8160
8169
  var fulfilled = (value) => {
8161
8170
  try {
@@ -8178,7 +8187,7 @@ var __async$o = (__this, __arguments, generator) => {
8178
8187
  const useCalculateRates = () => {
8179
8188
  const { client } = useShipEngine();
8180
8189
  return reactQuery.useMutation({
8181
- mutationFn: (_0) => __async$o(void 0, [_0], function* ({ rateOptions, shipmentId }) {
8190
+ mutationFn: (_0) => __async$p(void 0, [_0], function* ({ rateOptions, shipmentId }) {
8182
8191
  const result = yield client.rates.calculateByShipmentId(shipmentId, rateOptions);
8183
8192
  return result.data;
8184
8193
  }),
@@ -8187,7 +8196,7 @@ const useCalculateRates = () => {
8187
8196
  });
8188
8197
  };
8189
8198
 
8190
- var __async$n = (__this, __arguments, generator) => {
8199
+ var __async$o = (__this, __arguments, generator) => {
8191
8200
  return new Promise((resolve, reject) => {
8192
8201
  var fulfilled = (value) => {
8193
8202
  try {
@@ -8210,7 +8219,7 @@ var __async$n = (__this, __arguments, generator) => {
8210
8219
  const useConnectCarrier = () => {
8211
8220
  const { client } = useShipEngine();
8212
8221
  return reactQuery.useMutation({
8213
- mutationFn: (params) => __async$n(void 0, null, function* () {
8222
+ mutationFn: (params) => __async$o(void 0, null, function* () {
8214
8223
  const result = yield client.carriers.connect(params);
8215
8224
  return result.data;
8216
8225
  }),
@@ -8219,7 +8228,7 @@ const useConnectCarrier = () => {
8219
8228
  });
8220
8229
  };
8221
8230
 
8222
- var __async$m = (__this, __arguments, generator) => {
8231
+ var __async$n = (__this, __arguments, generator) => {
8223
8232
  return new Promise((resolve, reject) => {
8224
8233
  var fulfilled = (value) => {
8225
8234
  try {
@@ -8242,7 +8251,7 @@ var __async$m = (__this, __arguments, generator) => {
8242
8251
  const useCreateFundingSource = () => {
8243
8252
  const { client } = useShipEngine();
8244
8253
  return reactQuery.useMutation({
8245
- mutationFn: (fundingSource) => __async$m(void 0, null, function* () {
8254
+ mutationFn: (fundingSource) => __async$n(void 0, null, function* () {
8246
8255
  const result = yield client.fundingSources.create(fundingSource);
8247
8256
  return result.data;
8248
8257
  }),
@@ -8251,22 +8260,22 @@ const useCreateFundingSource = () => {
8251
8260
  });
8252
8261
  };
8253
8262
 
8254
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8255
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8256
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8263
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8264
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8265
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8257
8266
  var __objRest$6 = (source, exclude) => {
8258
8267
  var target = {};
8259
8268
  for (var prop in source)
8260
- if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
8269
+ if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
8261
8270
  target[prop] = source[prop];
8262
- if (source != null && __getOwnPropSymbols$7)
8263
- for (var prop of __getOwnPropSymbols$7(source)) {
8264
- if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
8271
+ if (source != null && __getOwnPropSymbols$9)
8272
+ for (var prop of __getOwnPropSymbols$9(source)) {
8273
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
8265
8274
  target[prop] = source[prop];
8266
8275
  }
8267
8276
  return target;
8268
8277
  };
8269
- var __async$l = (__this, __arguments, generator) => {
8278
+ var __async$m = (__this, __arguments, generator) => {
8270
8279
  return new Promise((resolve, reject) => {
8271
8280
  var fulfilled = (value) => {
8272
8281
  try {
@@ -8289,7 +8298,7 @@ var __async$l = (__this, __arguments, generator) => {
8289
8298
  const useCreateLabel = () => {
8290
8299
  const { client } = useShipEngine();
8291
8300
  return reactQuery.useMutation({
8292
- mutationFn: (_a) => __async$l(void 0, null, function* () {
8301
+ mutationFn: (_a) => __async$m(void 0, null, function* () {
8293
8302
  var _b = _a, { rateId } = _b, options = __objRest$6(_b, ["rateId"]);
8294
8303
  const result = yield client.labels.createByRateId(rateId, options);
8295
8304
  return result.data;
@@ -8299,7 +8308,7 @@ const useCreateLabel = () => {
8299
8308
  });
8300
8309
  };
8301
8310
 
8302
- var __async$k = (__this, __arguments, generator) => {
8311
+ var __async$l = (__this, __arguments, generator) => {
8303
8312
  return new Promise((resolve, reject) => {
8304
8313
  var fulfilled = (value) => {
8305
8314
  try {
@@ -8322,7 +8331,7 @@ var __async$k = (__this, __arguments, generator) => {
8322
8331
  const useCreateRateCard = () => {
8323
8332
  const { client } = useShipEngine();
8324
8333
  return reactQuery.useMutation({
8325
- mutationFn: (rateCard) => __async$k(void 0, null, function* () {
8334
+ mutationFn: (rateCard) => __async$l(void 0, null, function* () {
8326
8335
  const result = yield client.rateCards.create(rateCard);
8327
8336
  return result.data;
8328
8337
  }),
@@ -8331,22 +8340,22 @@ const useCreateRateCard = () => {
8331
8340
  });
8332
8341
  };
8333
8342
 
8334
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8335
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8336
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8343
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8344
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8345
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8337
8346
  var __objRest$5 = (source, exclude) => {
8338
8347
  var target = {};
8339
8348
  for (var prop in source)
8340
- if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
8349
+ if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
8341
8350
  target[prop] = source[prop];
8342
- if (source != null && __getOwnPropSymbols$6)
8343
- for (var prop of __getOwnPropSymbols$6(source)) {
8344
- if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
8351
+ if (source != null && __getOwnPropSymbols$8)
8352
+ for (var prop of __getOwnPropSymbols$8(source)) {
8353
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
8345
8354
  target[prop] = source[prop];
8346
8355
  }
8347
8356
  return target;
8348
8357
  };
8349
- var __async$j = (__this, __arguments, generator) => {
8358
+ var __async$k = (__this, __arguments, generator) => {
8350
8359
  return new Promise((resolve, reject) => {
8351
8360
  var fulfilled = (value) => {
8352
8361
  try {
@@ -8369,7 +8378,7 @@ var __async$j = (__this, __arguments, generator) => {
8369
8378
  const useCreateSalesOrderShipment = () => {
8370
8379
  const { client } = useShipEngine();
8371
8380
  return reactQuery.useMutation({
8372
- mutationFn: (_a) => __async$j(void 0, null, function* () {
8381
+ mutationFn: (_a) => __async$k(void 0, null, function* () {
8373
8382
  var _b = _a, { salesOrderId } = _b, shipment = __objRest$5(_b, ["salesOrderId"]);
8374
8383
  const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
8375
8384
  return result.data;
@@ -8379,26 +8388,26 @@ const useCreateSalesOrderShipment = () => {
8379
8388
  });
8380
8389
  };
8381
8390
 
8382
- var __defProp$1 = Object.defineProperty;
8383
- var __defProps = Object.defineProperties;
8384
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
8385
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
8386
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
8387
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
8388
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8389
- var __spreadValues$1 = (a, b) => {
8391
+ var __defProp$3 = Object.defineProperty;
8392
+ var __defProps$2 = Object.defineProperties;
8393
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
8394
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8395
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8396
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8397
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8398
+ var __spreadValues$3 = (a, b) => {
8390
8399
  for (var prop in b || (b = {}))
8391
- if (__hasOwnProp$5.call(b, prop))
8392
- __defNormalProp$1(a, prop, b[prop]);
8393
- if (__getOwnPropSymbols$5)
8394
- for (var prop of __getOwnPropSymbols$5(b)) {
8395
- if (__propIsEnum$5.call(b, prop))
8396
- __defNormalProp$1(a, prop, b[prop]);
8400
+ if (__hasOwnProp$7.call(b, prop))
8401
+ __defNormalProp$3(a, prop, b[prop]);
8402
+ if (__getOwnPropSymbols$7)
8403
+ for (var prop of __getOwnPropSymbols$7(b)) {
8404
+ if (__propIsEnum$7.call(b, prop))
8405
+ __defNormalProp$3(a, prop, b[prop]);
8397
8406
  }
8398
8407
  return a;
8399
8408
  };
8400
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8401
- var __async$i = (__this, __arguments, generator) => {
8409
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
8410
+ var __async$j = (__this, __arguments, generator) => {
8402
8411
  return new Promise((resolve, reject) => {
8403
8412
  var fulfilled = (value) => {
8404
8413
  try {
@@ -8421,7 +8430,7 @@ var __async$i = (__this, __arguments, generator) => {
8421
8430
  const useCreateShipment = () => {
8422
8431
  const { client } = useShipEngine();
8423
8432
  return reactQuery.useMutation({
8424
- mutationFn: (shipment) => __async$i(void 0, null, function* () {
8433
+ mutationFn: (shipment) => __async$j(void 0, null, function* () {
8425
8434
  var _a;
8426
8435
  if (shipment.warehouseId === void 0) {
8427
8436
  throw new CodedError("errorMessages.noWarehouses", {
@@ -8439,7 +8448,7 @@ const useCreateShipment = () => {
8439
8448
  postalCode: "",
8440
8449
  stateProvince: ""
8441
8450
  };
8442
- return (yield client.shipments.create(__spreadProps(__spreadValues$1({}, shipment), {
8451
+ return (yield client.shipments.create(__spreadProps$2(__spreadValues$3({}, shipment), {
8443
8452
  shipTo
8444
8453
  }))).data;
8445
8454
  }),
@@ -8448,7 +8457,7 @@ const useCreateShipment = () => {
8448
8457
  });
8449
8458
  };
8450
8459
 
8451
- var __async$h = (__this, __arguments, generator) => {
8460
+ var __async$i = (__this, __arguments, generator) => {
8452
8461
  return new Promise((resolve, reject) => {
8453
8462
  var fulfilled = (value) => {
8454
8463
  try {
@@ -8471,7 +8480,7 @@ var __async$h = (__this, __arguments, generator) => {
8471
8480
  const useCreateWarehouse = () => {
8472
8481
  const { client } = useShipEngine();
8473
8482
  return reactQuery.useMutation({
8474
- mutationFn: (data) => __async$h(void 0, null, function* () {
8483
+ mutationFn: (data) => __async$i(void 0, null, function* () {
8475
8484
  const result = yield client.warehouses.create(data);
8476
8485
  return result.data;
8477
8486
  }),
@@ -8480,7 +8489,7 @@ const useCreateWarehouse = () => {
8480
8489
  });
8481
8490
  };
8482
8491
 
8483
- var __async$g = (__this, __arguments, generator) => {
8492
+ var __async$h = (__this, __arguments, generator) => {
8484
8493
  return new Promise((resolve, reject) => {
8485
8494
  var fulfilled = (value) => {
8486
8495
  try {
@@ -8503,7 +8512,7 @@ var __async$g = (__this, __arguments, generator) => {
8503
8512
  const useDeleteWarehouse = () => {
8504
8513
  const { client } = useShipEngine();
8505
8514
  return reactQuery.useMutation({
8506
- mutationFn: (_0) => __async$g(void 0, [_0], function* ({ warehouseId }) {
8515
+ mutationFn: (_0) => __async$h(void 0, [_0], function* ({ warehouseId }) {
8507
8516
  const result = yield client.warehouses.delete(warehouseId);
8508
8517
  return result.data;
8509
8518
  }),
@@ -8524,7 +8533,7 @@ const useDownloadRateCard = (rateCardId) => {
8524
8533
  });
8525
8534
  };
8526
8535
 
8527
- var __async$f = (__this, __arguments, generator) => {
8536
+ var __async$g = (__this, __arguments, generator) => {
8528
8537
  return new Promise((resolve, reject) => {
8529
8538
  var fulfilled = (value) => {
8530
8539
  try {
@@ -8547,7 +8556,7 @@ var __async$f = (__this, __arguments, generator) => {
8547
8556
  const useFundingSourcesAddFunds = (fundingSourceId) => {
8548
8557
  const { client } = useShipEngine();
8549
8558
  return reactQuery.useMutation({
8550
- mutationFn: (funds) => __async$f(void 0, null, function* () {
8559
+ mutationFn: (funds) => __async$g(void 0, null, function* () {
8551
8560
  const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
8552
8561
  return result.data;
8553
8562
  }),
@@ -8885,17 +8894,17 @@ const useListSalesOrders = (params = {}) => {
8885
8894
  });
8886
8895
  };
8887
8896
 
8888
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
8889
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
8890
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
8897
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8898
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8899
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8891
8900
  var __objRest$4 = (source, exclude) => {
8892
8901
  var target = {};
8893
8902
  for (var prop in source)
8894
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
8903
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
8895
8904
  target[prop] = source[prop];
8896
- if (source != null && __getOwnPropSymbols$4)
8897
- for (var prop of __getOwnPropSymbols$4(source)) {
8898
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
8905
+ if (source != null && __getOwnPropSymbols$6)
8906
+ for (var prop of __getOwnPropSymbols$6(source)) {
8907
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
8899
8908
  target[prop] = source[prop];
8900
8909
  }
8901
8910
  return target;
@@ -8924,22 +8933,22 @@ const useListWarehouses = (options) => {
8924
8933
  });
8925
8934
  };
8926
8935
 
8927
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
8928
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
8929
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
8936
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
8937
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
8938
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
8930
8939
  var __objRest$3 = (source, exclude) => {
8931
8940
  var target = {};
8932
8941
  for (var prop in source)
8933
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
8942
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
8934
8943
  target[prop] = source[prop];
8935
- if (source != null && __getOwnPropSymbols$3)
8936
- for (var prop of __getOwnPropSymbols$3(source)) {
8937
- if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
8944
+ if (source != null && __getOwnPropSymbols$5)
8945
+ for (var prop of __getOwnPropSymbols$5(source)) {
8946
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
8938
8947
  target[prop] = source[prop];
8939
8948
  }
8940
8949
  return target;
8941
8950
  };
8942
- var __async$e = (__this, __arguments, generator) => {
8951
+ var __async$f = (__this, __arguments, generator) => {
8943
8952
  return new Promise((resolve, reject) => {
8944
8953
  var fulfilled = (value) => {
8945
8954
  try {
@@ -8962,7 +8971,7 @@ var __async$e = (__this, __arguments, generator) => {
8962
8971
  const useNotifySalesOrderShipped = () => {
8963
8972
  const { client } = useShipEngine();
8964
8973
  return reactQuery.useMutation({
8965
- mutationFn: (_a) => __async$e(void 0, null, function* () {
8974
+ mutationFn: (_a) => __async$f(void 0, null, function* () {
8966
8975
  var _b = _a, { salesOrderId } = _b, tracking = __objRest$3(_b, ["salesOrderId"]);
8967
8976
  const result = yield client.salesOrders.notifyShipped(salesOrderId, tracking);
8968
8977
  return result.data;
@@ -8972,7 +8981,7 @@ const useNotifySalesOrderShipped = () => {
8972
8981
  });
8973
8982
  };
8974
8983
 
8975
- var __async$d = (__this, __arguments, generator) => {
8984
+ var __async$e = (__this, __arguments, generator) => {
8976
8985
  return new Promise((resolve, reject) => {
8977
8986
  var fulfilled = (value) => {
8978
8987
  try {
@@ -8995,7 +9004,7 @@ var __async$d = (__this, __arguments, generator) => {
8995
9004
  const useParseAddress = () => {
8996
9005
  const { client } = useShipEngine();
8997
9006
  return reactQuery.useMutation({
8998
- mutationFn: (_0) => __async$d(void 0, [_0], function* ({ address, text }) {
9007
+ mutationFn: (_0) => __async$e(void 0, [_0], function* ({ address, text }) {
8999
9008
  const result = yield client.addresses.parse(text, address);
9000
9009
  return result.data;
9001
9010
  }),
@@ -9004,7 +9013,7 @@ const useParseAddress = () => {
9004
9013
  });
9005
9014
  };
9006
9015
 
9007
- var __async$c = (__this, __arguments, generator) => {
9016
+ var __async$d = (__this, __arguments, generator) => {
9008
9017
  return new Promise((resolve, reject) => {
9009
9018
  var fulfilled = (value) => {
9010
9019
  try {
@@ -9027,7 +9036,7 @@ var __async$c = (__this, __arguments, generator) => {
9027
9036
  const useRefreshOrderSourceAsync = () => {
9028
9037
  const { client } = useShipEngine();
9029
9038
  return reactQuery.useMutation({
9030
- mutationFn: (orderSourceId) => __async$c(void 0, null, function* () {
9039
+ mutationFn: (orderSourceId) => __async$d(void 0, null, function* () {
9031
9040
  const result = yield client.orderSources.refresh(orderSourceId);
9032
9041
  return result.data;
9033
9042
  }),
@@ -9038,9 +9047,9 @@ const useRefreshOrderSource = () => {
9038
9047
  const { client } = useShipEngine();
9039
9048
  const { mutateAsync: refreshOrderSourceAsync } = useRefreshOrderSourceAsync();
9040
9049
  return reactQuery.useMutation({
9041
- mutationFn: (orderSourceId) => __async$c(void 0, null, function* () {
9050
+ mutationFn: (orderSourceId) => __async$d(void 0, null, function* () {
9042
9051
  yield refreshOrderSourceAsync(orderSourceId);
9043
- const waitResult = yield retryUntil(() => __async$c(void 0, null, function* () {
9052
+ const waitResult = yield retryUntil(() => __async$d(void 0, null, function* () {
9044
9053
  const { data: checkResult } = yield client.orderSources.get(orderSourceId);
9045
9054
  if (["preparing_update", "updating"].includes(checkResult.refreshInfo.status)) {
9046
9055
  throw new CodedError("Order source is still refreshing");
@@ -9054,7 +9063,7 @@ const useRefreshOrderSource = () => {
9054
9063
  });
9055
9064
  };
9056
9065
 
9057
- var __async$b = (__this, __arguments, generator) => {
9066
+ var __async$c = (__this, __arguments, generator) => {
9058
9067
  return new Promise((resolve, reject) => {
9059
9068
  var fulfilled = (value) => {
9060
9069
  try {
@@ -9077,7 +9086,7 @@ var __async$b = (__this, __arguments, generator) => {
9077
9086
  const useRegisterCarrier = () => {
9078
9087
  const { client } = useShipEngine();
9079
9088
  return reactQuery.useMutation({
9080
- mutationFn: (carrier) => __async$b(void 0, null, function* () {
9089
+ mutationFn: (carrier) => __async$c(void 0, null, function* () {
9081
9090
  const result = yield client.fundingSources.registerCarrier(carrier);
9082
9091
  return result.data;
9083
9092
  }),
@@ -9086,7 +9095,7 @@ const useRegisterCarrier = () => {
9086
9095
  });
9087
9096
  };
9088
9097
 
9089
- var __async$a = (__this, __arguments, generator) => {
9098
+ var __async$b = (__this, __arguments, generator) => {
9090
9099
  return new Promise((resolve, reject) => {
9091
9100
  var fulfilled = (value) => {
9092
9101
  try {
@@ -9109,7 +9118,7 @@ var __async$a = (__this, __arguments, generator) => {
9109
9118
  const useUpdateAccountSettings = () => {
9110
9119
  const { client } = useShipEngine();
9111
9120
  return reactQuery.useMutation({
9112
- mutationFn: (settings) => __async$a(void 0, null, function* () {
9121
+ mutationFn: (settings) => __async$b(void 0, null, function* () {
9113
9122
  const result = yield client.accountSettings.update(settings);
9114
9123
  return result.data;
9115
9124
  }),
@@ -9118,7 +9127,7 @@ const useUpdateAccountSettings = () => {
9118
9127
  });
9119
9128
  };
9120
9129
 
9121
- var __async$9 = (__this, __arguments, generator) => {
9130
+ var __async$a = (__this, __arguments, generator) => {
9122
9131
  return new Promise((resolve, reject) => {
9123
9132
  var fulfilled = (value) => {
9124
9133
  try {
@@ -9142,7 +9151,7 @@ const useUpdateAutoFunding = (carrierId) => {
9142
9151
  const { client } = useShipEngine();
9143
9152
  const queryClient = reactQuery.useQueryClient();
9144
9153
  return reactQuery.useMutation({
9145
- mutationFn: (options) => __async$9(void 0, null, function* () {
9154
+ mutationFn: (options) => __async$a(void 0, null, function* () {
9146
9155
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
9147
9156
  return result.data;
9148
9157
  }),
@@ -9154,7 +9163,7 @@ const useUpdateAutoFunding = (carrierId) => {
9154
9163
  });
9155
9164
  };
9156
9165
 
9157
- var __async$8 = (__this, __arguments, generator) => {
9166
+ var __async$9 = (__this, __arguments, generator) => {
9158
9167
  return new Promise((resolve, reject) => {
9159
9168
  var fulfilled = (value) => {
9160
9169
  try {
@@ -9177,7 +9186,7 @@ var __async$8 = (__this, __arguments, generator) => {
9177
9186
  const useUpdateFundingSource = () => {
9178
9187
  const { client } = useShipEngine();
9179
9188
  return reactQuery.useMutation({
9180
- mutationFn: (_0) => __async$8(void 0, [_0], function* ({
9189
+ mutationFn: (_0) => __async$9(void 0, [_0], function* ({
9181
9190
  billingInfo,
9182
9191
  creditCardInfo,
9183
9192
  fundingSourceId
@@ -9194,7 +9203,7 @@ const useUpdateFundingSource = () => {
9194
9203
  });
9195
9204
  };
9196
9205
 
9197
- var __async$7 = (__this, __arguments, generator) => {
9206
+ var __async$8 = (__this, __arguments, generator) => {
9198
9207
  return new Promise((resolve, reject) => {
9199
9208
  var fulfilled = (value) => {
9200
9209
  try {
@@ -9217,7 +9226,7 @@ var __async$7 = (__this, __arguments, generator) => {
9217
9226
  const useUpdateRateCard = () => {
9218
9227
  const { client } = useShipEngine();
9219
9228
  return reactQuery.useMutation({
9220
- mutationFn: (rateCard) => __async$7(void 0, null, function* () {
9229
+ mutationFn: (rateCard) => __async$8(void 0, null, function* () {
9221
9230
  const result = yield client.rateCards.update(rateCard);
9222
9231
  return result.data;
9223
9232
  }),
@@ -9226,22 +9235,22 @@ const useUpdateRateCard = () => {
9226
9235
  });
9227
9236
  };
9228
9237
 
9229
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
9230
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
9231
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
9238
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
9239
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
9240
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
9232
9241
  var __objRest$2 = (source, exclude) => {
9233
9242
  var target = {};
9234
9243
  for (var prop in source)
9235
- if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
9244
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
9236
9245
  target[prop] = source[prop];
9237
- if (source != null && __getOwnPropSymbols$2)
9238
- for (var prop of __getOwnPropSymbols$2(source)) {
9239
- if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
9246
+ if (source != null && __getOwnPropSymbols$4)
9247
+ for (var prop of __getOwnPropSymbols$4(source)) {
9248
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
9240
9249
  target[prop] = source[prop];
9241
9250
  }
9242
9251
  return target;
9243
9252
  };
9244
- var __async$6 = (__this, __arguments, generator) => {
9253
+ var __async$7 = (__this, __arguments, generator) => {
9245
9254
  return new Promise((resolve, reject) => {
9246
9255
  var fulfilled = (value) => {
9247
9256
  try {
@@ -9264,7 +9273,7 @@ var __async$6 = (__this, __arguments, generator) => {
9264
9273
  const useUpdateSalesOrderShipment = () => {
9265
9274
  const { client } = useShipEngine();
9266
9275
  return reactQuery.useMutation({
9267
- mutationFn: (_a) => __async$6(void 0, null, function* () {
9276
+ mutationFn: (_a) => __async$7(void 0, null, function* () {
9268
9277
  var _b = _a, { shipmentId } = _b, shipment = __objRest$2(_b, ["shipmentId"]);
9269
9278
  const result = yield client.salesOrderShipments.update(shipmentId, shipment);
9270
9279
  return result.data;
@@ -9274,22 +9283,22 @@ const useUpdateSalesOrderShipment = () => {
9274
9283
  });
9275
9284
  };
9276
9285
 
9277
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
9278
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
9279
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
9286
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
9287
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
9288
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
9280
9289
  var __objRest$1 = (source, exclude) => {
9281
9290
  var target = {};
9282
9291
  for (var prop in source)
9283
- if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
9292
+ if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
9284
9293
  target[prop] = source[prop];
9285
- if (source != null && __getOwnPropSymbols$1)
9286
- for (var prop of __getOwnPropSymbols$1(source)) {
9287
- if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
9294
+ if (source != null && __getOwnPropSymbols$3)
9295
+ for (var prop of __getOwnPropSymbols$3(source)) {
9296
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
9288
9297
  target[prop] = source[prop];
9289
9298
  }
9290
9299
  return target;
9291
9300
  };
9292
- var __async$5 = (__this, __arguments, generator) => {
9301
+ var __async$6 = (__this, __arguments, generator) => {
9293
9302
  return new Promise((resolve, reject) => {
9294
9303
  var fulfilled = (value) => {
9295
9304
  try {
@@ -9312,7 +9321,7 @@ var __async$5 = (__this, __arguments, generator) => {
9312
9321
  const useUpdateWarehouse = () => {
9313
9322
  const { client } = useShipEngine();
9314
9323
  return reactQuery.useMutation({
9315
- mutationFn: (_a) => __async$5(void 0, null, function* () {
9324
+ mutationFn: (_a) => __async$6(void 0, null, function* () {
9316
9325
  var _b = _a, { warehouseId } = _b, warehouse = __objRest$1(_b, ["warehouseId"]);
9317
9326
  const result = yield client.warehouses.update(warehouseId, warehouse);
9318
9327
  return result.data;
@@ -9322,6 +9331,37 @@ const useUpdateWarehouse = () => {
9322
9331
  });
9323
9332
  };
9324
9333
 
9334
+ var __async$5 = (__this, __arguments, generator) => {
9335
+ return new Promise((resolve, reject) => {
9336
+ var fulfilled = (value) => {
9337
+ try {
9338
+ step(generator.next(value));
9339
+ } catch (e) {
9340
+ reject(e);
9341
+ }
9342
+ };
9343
+ var rejected = (value) => {
9344
+ try {
9345
+ step(generator.throw(value));
9346
+ } catch (e) {
9347
+ reject(e);
9348
+ }
9349
+ };
9350
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
9351
+ step((generator = generator.apply(__this, __arguments)).next());
9352
+ });
9353
+ };
9354
+ const useUploadRateCard = () => {
9355
+ const { client } = useShipEngine();
9356
+ return reactQuery.useMutation({
9357
+ mutationFn: (_0) => __async$5(void 0, [_0], function* ({ rateCardId, file }) {
9358
+ return yield client.rateCards.upload(rateCardId, file);
9359
+ }),
9360
+ mutationKey: ["useUploadRateCard"],
9361
+ onError
9362
+ });
9363
+ };
9364
+
9325
9365
  var __async$4 = (__this, __arguments, generator) => {
9326
9366
  return new Promise((resolve, reject) => {
9327
9367
  var fulfilled = (value) => {
@@ -9468,81 +9508,83 @@ const useLoadIcons = ({ brandName, cdnURL = "/" }) => {
9468
9508
  }
9469
9509
  }))();
9470
9510
  }, [brandName, cdnURL]);
9471
- return (iconName) => __async$1(void 0, null, function* () {
9472
- if (iconIndex) {
9473
- const iconBrand = (iconIndex[iconName.toLowerCase()] || []).includes(brandName) ? brandName : brands.BrandName.FALLBACK;
9474
- const result = yield axios.get(`/brand/${iconBrand}/icons/${iconName.toLowerCase()}.svg`, {
9475
- baseURL: cdnURL,
9476
- responseType: "text"
9477
- });
9478
- return result.data;
9479
- }
9480
- return void 0;
9481
- });
9482
- };
9483
-
9484
- var __async = (__this, __arguments, generator) => {
9485
- return new Promise((resolve, reject) => {
9486
- var fulfilled = (value) => {
9487
- try {
9488
- step(generator.next(value));
9489
- } catch (e) {
9490
- reject(e);
9491
- }
9492
- };
9493
- var rejected = (value) => {
9494
- try {
9495
- step(generator.throw(value));
9496
- } catch (e) {
9497
- reject(e);
9511
+ return React.useCallback(
9512
+ (iconName) => __async$1(void 0, null, function* () {
9513
+ if (iconIndex) {
9514
+ const iconBrand = (iconIndex[iconName.toLowerCase()] || []).includes(brandName) ? brandName : brands.BrandName.FALLBACK;
9515
+ const result = yield axios.get(
9516
+ `/brand/${iconBrand}/icons/${iconName.toLowerCase()}.svg`,
9517
+ {
9518
+ baseURL: cdnURL,
9519
+ responseType: "text"
9520
+ }
9521
+ );
9522
+ return result.data;
9498
9523
  }
9499
- };
9500
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
9501
- step((generator = generator.apply(__this, __arguments)).next());
9502
- });
9524
+ return "";
9525
+ }),
9526
+ [brandName, cdnURL, iconIndex]
9527
+ );
9503
9528
  };
9529
+
9504
9530
  const useLoadTheme = ({ cdnURL = "/", brandName }) => {
9505
9531
  const [theme, setTheme] = React.useState();
9506
9532
  React.useEffect(() => {
9507
- (() => __async(void 0, null, function* () {
9508
- try {
9509
- const result = yield axios.get(`/brand/${brandName}/theme.json`, { baseURL: cdnURL });
9510
- const theme2 = new gigerTheme.Theme(result.data);
9511
- setTheme(theme2);
9512
- } catch (error) {
9513
- logger.error({ error }, `Error loading theme for brand ${brandName}`);
9514
- }
9515
- }))();
9533
+ axios.get(`/brand/${brandName}/theme.json`, { baseURL: cdnURL }).then(({ data }) => setTheme(new gigerTheme.Theme(data))).catch((error) => logger.error({ error }, `Error loading theme for brand ${brandName}`));
9516
9534
  }, [brandName, cdnURL]);
9517
9535
  return theme;
9518
9536
  };
9519
9537
 
9538
+ var __defProp$2 = Object.defineProperty;
9539
+ var __defProps$1 = Object.defineProperties;
9540
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
9541
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
9542
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
9543
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
9544
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9545
+ var __spreadValues$2 = (a, b) => {
9546
+ for (var prop in b || (b = {}))
9547
+ if (__hasOwnProp$2.call(b, prop))
9548
+ __defNormalProp$2(a, prop, b[prop]);
9549
+ if (__getOwnPropSymbols$2)
9550
+ for (var prop of __getOwnPropSymbols$2(b)) {
9551
+ if (__propIsEnum$2.call(b, prop))
9552
+ __defNormalProp$2(a, prop, b[prop]);
9553
+ }
9554
+ return a;
9555
+ };
9556
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
9520
9557
  const AlchemyContext = React.createContext(void 0);
9521
- const Alchemy = ({
9558
+ const renderAlchemyProviders = ({
9559
+ baseURL,
9560
+ children,
9561
+ getToken,
9562
+ theme,
9563
+ scope,
9564
+ fontStyles,
9565
+ iconCache,
9566
+ resolveIcon
9567
+ }) => /* @__PURE__ */ jsxs(react.ThemeProvider, { theme, children: [
9568
+ /* @__PURE__ */ jsx(react.Global, { styles: [giger.getEmotionResetStyles(scope), fontStyles] }),
9569
+ /* @__PURE__ */ jsx(giger.GigerConfigProvider, { iconCache, resolveIcon, children: /* @__PURE__ */ jsx(ShipEngine, { baseURL, getToken, children }) })
9570
+ ] });
9571
+ const AlchemyProvider = ({
9522
9572
  baseURL = "https://api.shipengine.com",
9523
9573
  brandName = brands.BrandName.FALLBACK,
9524
9574
  cdnURL = "/",
9525
9575
  children,
9526
9576
  getToken,
9527
- onError,
9577
+ onError = _default,
9528
9578
  scope = "lmnt"
9529
9579
  }) => {
9530
9580
  const theme = useLoadTheme({ brandName, cdnURL });
9531
9581
  const fontStyles = useLoadFonts({ cdnURL, scope, theme });
9532
9582
  const resolveIcon = useLoadIcons({ brandName, cdnURL });
9583
+ const iconCache = React.useMemo(giger.createIconCache, []);
9533
9584
  if (!theme)
9534
9585
  return null;
9535
- onError = onError != null ? onError : _default;
9536
- return /* @__PURE__ */ jsx(
9537
- AlchemyContext.Provider,
9538
- {
9539
- value: { baseURL, brandName, cdnURL, getToken, onError, scope, theme },
9540
- children: /* @__PURE__ */ jsxs(react.ThemeProvider, { theme, children: [
9541
- /* @__PURE__ */ jsx(react.Global, { styles: [giger.getEmotionResetStyles(scope), fontStyles] }),
9542
- /* @__PURE__ */ jsx(giger.GigerConfigProvider, { resolveIcon, children: /* @__PURE__ */ jsx(ShipEngine, { baseURL, getToken, children }) })
9543
- ] })
9544
- }
9545
- );
9586
+ const contextValue = { baseURL, brandName, cdnURL, getToken, onError, scope, theme };
9587
+ return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: renderAlchemyProviders(__spreadProps$1(__spreadValues$2({}, contextValue), { children, fontStyles, iconCache, resolveIcon })) });
9546
9588
  };
9547
9589
  const useAlchemy = () => {
9548
9590
  const context = React.useContext(AlchemyContext);
@@ -9552,6 +9594,69 @@ const useAlchemy = () => {
9552
9594
  return context;
9553
9595
  };
9554
9596
 
9597
+ var __defProp$1 = Object.defineProperty;
9598
+ var __defProps = Object.defineProperties;
9599
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9600
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
9601
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
9602
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
9603
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9604
+ var __spreadValues$1 = (a, b) => {
9605
+ for (var prop in b || (b = {}))
9606
+ if (__hasOwnProp$1.call(b, prop))
9607
+ __defNormalProp$1(a, prop, b[prop]);
9608
+ if (__getOwnPropSymbols$1)
9609
+ for (var prop of __getOwnPropSymbols$1(b)) {
9610
+ if (__propIsEnum$1.call(b, prop))
9611
+ __defNormalProp$1(a, prop, b[prop]);
9612
+ }
9613
+ return a;
9614
+ };
9615
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9616
+ var __async = (__this, __arguments, generator) => {
9617
+ return new Promise((resolve, reject) => {
9618
+ var fulfilled = (value) => {
9619
+ try {
9620
+ step(generator.next(value));
9621
+ } catch (e) {
9622
+ reject(e);
9623
+ }
9624
+ };
9625
+ var rejected = (value) => {
9626
+ try {
9627
+ step(generator.throw(value));
9628
+ } catch (e) {
9629
+ reject(e);
9630
+ }
9631
+ };
9632
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
9633
+ step((generator = generator.apply(__this, __arguments)).next());
9634
+ });
9635
+ };
9636
+ const AlchemyTestProvider = ({ baseURL, children }) => {
9637
+ const scope = "lmnt";
9638
+ const theme = React.useMemo(() => new gigerTheme.Theme(), []);
9639
+ const fontStyles = react.css({ [`.${scope}`]: { fontFamily: theme.defaultFontFamily } });
9640
+ const getToken = React.useCallback(() => "none", []);
9641
+ const iconCache = React.useMemo(giger.createIconCache, []);
9642
+ const resolveIcon = React.useCallback(
9643
+ (iconName) => __async(void 0, null, function* () {
9644
+ return `<svg data-svg-id="${iconName}">mock icon-${iconName}</svg>`;
9645
+ }),
9646
+ []
9647
+ );
9648
+ const contextValue = {
9649
+ baseURL,
9650
+ brandName: brands.BrandName.FALLBACK,
9651
+ cdnURL: "mockCdnUrl",
9652
+ getToken,
9653
+ onError: _default,
9654
+ scope,
9655
+ theme
9656
+ };
9657
+ return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: renderAlchemyProviders(__spreadProps(__spreadValues$1({}, contextValue), { children, fontStyles, iconCache, resolveIcon })) });
9658
+ };
9659
+
9555
9660
  var classnamesExports = {};
9556
9661
  var classnames = {
9557
9662
  get exports(){ return classnamesExports; },
@@ -10154,8 +10259,9 @@ const alchemy = {
10154
10259
 
10155
10260
  exports.AccountSettingsAPI = AccountSettingsAPI;
10156
10261
  exports.AddressesAPI = AddressesAPI;
10157
- exports.Alchemy = Alchemy;
10158
10262
  exports.AlchemyContext = AlchemyContext;
10263
+ exports.AlchemyProvider = AlchemyProvider;
10264
+ exports.AlchemyTestProvider = AlchemyTestProvider;
10159
10265
  exports.CarriersAPI = CarriersAPI;
10160
10266
  exports.CodedError = CodedError;
10161
10267
  exports.ConfirmationType = ConfirmationType;
@@ -10190,6 +10296,7 @@ exports.isCodedErrors = isCodedErrors;
10190
10296
  exports.logger = logger;
10191
10297
  exports.memoizedCreateCache = memoizedCreateCache;
10192
10298
  exports.onError = onError;
10299
+ exports.renderAlchemyProviders = renderAlchemyProviders;
10193
10300
  exports.retryUntil = retryUntil;
10194
10301
  exports.useAddFunds = useAddFunds;
10195
10302
  exports.useAlchemy = useAlchemy;
@@ -10246,5 +10353,6 @@ exports.useUpdateFundingSource = useUpdateFundingSource;
10246
10353
  exports.useUpdateRateCard = useUpdateRateCard;
10247
10354
  exports.useUpdateSalesOrderShipment = useUpdateSalesOrderShipment;
10248
10355
  exports.useUpdateWarehouse = useUpdateWarehouse;
10356
+ exports.useUploadRateCard = useUploadRateCard;
10249
10357
  exports.useValidateAddresses = useValidateAddresses;
10250
10358
  exports.useVoidLabel = useVoidLabel;