@shipengine/alchemy 2.2.4 → 2.3.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$e = Object.getOwnPropertySymbols;
2481
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
2482
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
2480
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
2481
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
2482
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
2483
2483
  var __objRest$8 = (source, exclude) => {
2484
2484
  var target = {};
2485
2485
  for (var prop in source)
2486
- if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
2486
+ if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
2487
2487
  target[prop] = 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))
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))
2491
2491
  target[prop] = source[prop];
2492
2492
  }
2493
2493
  return target;
@@ -5254,7 +5254,7 @@ var ipaddr = {
5254
5254
  }).call(commonjsGlobal);
5255
5255
  } (ipaddr));
5256
5256
 
5257
- var __async$x = (__this, __arguments, generator) => {
5257
+ var __async$w = (__this, __arguments, generator) => {
5258
5258
  return new Promise((resolve, reject) => {
5259
5259
  var fulfilled = (value) => {
5260
5260
  try {
@@ -5274,7 +5274,7 @@ var __async$x = (__this, __arguments, generator) => {
5274
5274
  step((generator = generator.apply(__this, __arguments)).next());
5275
5275
  });
5276
5276
  };
5277
- const getEndUserIpAddress = () => __async$x(void 0, null, function* () {
5277
+ const getEndUserIpAddress = () => __async$w(void 0, null, function* () {
5278
5278
  try {
5279
5279
  const response = yield axios.get("https://api.ipify.org/?format=json");
5280
5280
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -5286,38 +5286,38 @@ const getEndUserIpAddress = () => __async$x(void 0, null, function* () {
5286
5286
  }
5287
5287
  });
5288
5288
 
5289
- var __defProp$7 = Object.defineProperty;
5290
- var __defProps$5 = Object.defineProperties;
5291
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
5292
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
5293
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
5294
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
5295
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5296
- var __spreadValues$7 = (a, b) => {
5289
+ var __defProp$5 = Object.defineProperty;
5290
+ var __defProps$3 = Object.defineProperties;
5291
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
5292
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
5293
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
5294
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
5295
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5296
+ var __spreadValues$5 = (a, b) => {
5297
5297
  for (var prop in b || (b = {}))
5298
- if (__hasOwnProp$d.call(b, prop))
5299
- __defNormalProp$7(a, prop, b[prop]);
5300
- if (__getOwnPropSymbols$d)
5301
- for (var prop of __getOwnPropSymbols$d(b)) {
5302
- if (__propIsEnum$d.call(b, prop))
5303
- __defNormalProp$7(a, prop, b[prop]);
5298
+ if (__hasOwnProp$b.call(b, prop))
5299
+ __defNormalProp$5(a, prop, b[prop]);
5300
+ if (__getOwnPropSymbols$b)
5301
+ for (var prop of __getOwnPropSymbols$b(b)) {
5302
+ if (__propIsEnum$b.call(b, prop))
5303
+ __defNormalProp$5(a, prop, b[prop]);
5304
5304
  }
5305
5305
  return a;
5306
5306
  };
5307
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
5307
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
5308
5308
  var __objRest$7 = (source, exclude) => {
5309
5309
  var target = {};
5310
5310
  for (var prop in source)
5311
- if (__hasOwnProp$d.call(source, prop) && exclude.indexOf(prop) < 0)
5311
+ if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
5312
5312
  target[prop] = source[prop];
5313
- if (source != null && __getOwnPropSymbols$d)
5314
- for (var prop of __getOwnPropSymbols$d(source)) {
5315
- if (exclude.indexOf(prop) < 0 && __propIsEnum$d.call(source, prop))
5313
+ if (source != null && __getOwnPropSymbols$b)
5314
+ for (var prop of __getOwnPropSymbols$b(source)) {
5315
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
5316
5316
  target[prop] = source[prop];
5317
5317
  }
5318
5318
  return target;
5319
5319
  };
5320
- var __async$w = (__this, __arguments, generator) => {
5320
+ var __async$v = (__this, __arguments, generator) => {
5321
5321
  return new Promise((resolve, reject) => {
5322
5322
  var fulfilled = (value) => {
5323
5323
  try {
@@ -5355,12 +5355,12 @@ class CarriersAPI {
5355
5355
  /**
5356
5356
  * The `connect` method connects a carrier account to a user's ShipEngine account.
5357
5357
  */
5358
- this.connect = (_a) => __async$w(this, null, function* () {
5358
+ this.connect = (_a) => __async$v(this, null, function* () {
5359
5359
  var _b = _a, { carrierCode } = _b, connection = __objRest$7(_b, ["carrierCode"]);
5360
5360
  const endUserIpAddress = yield getEndUserIpAddress();
5361
5361
  if (!endUserIpAddress)
5362
5362
  return Promise.reject([new CodedError("Unable to get IP address")]);
5363
- return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$5(__spreadValues$7({}, connection), {
5363
+ return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$3(__spreadValues$5({}, connection), {
5364
5364
  endUserIpAddress
5365
5365
  }));
5366
5366
  });
@@ -5441,6 +5441,13 @@ class CarriersAPI {
5441
5441
  this.getCurrencies = (carrierId) => {
5442
5442
  return this.client.get(`/v1/carriers/${carrierId}/currencies`);
5443
5443
  };
5444
+ /**
5445
+ * The `getZones` method retrieves a list of zones for which the attached carrier
5446
+ * provides support to.
5447
+ */
5448
+ this.getZones = (carrierId) => {
5449
+ return this.client.get(`/v1/carriers/${carrierId}/zones`);
5450
+ };
5444
5451
  this.client = client;
5445
5452
  }
5446
5453
  }
@@ -7635,23 +7642,23 @@ class CustomPackagesAPI {
7635
7642
  }
7636
7643
  }
7637
7644
 
7638
- var __defProp$6 = Object.defineProperty;
7639
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
7640
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
7641
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
7642
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7643
- var __spreadValues$6 = (a, b) => {
7645
+ var __defProp$4 = Object.defineProperty;
7646
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
7647
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
7648
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
7649
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7650
+ var __spreadValues$4 = (a, b) => {
7644
7651
  for (var prop in b || (b = {}))
7645
- if (__hasOwnProp$c.call(b, prop))
7646
- __defNormalProp$6(a, prop, b[prop]);
7647
- if (__getOwnPropSymbols$c)
7648
- for (var prop of __getOwnPropSymbols$c(b)) {
7649
- if (__propIsEnum$c.call(b, prop))
7650
- __defNormalProp$6(a, prop, b[prop]);
7652
+ if (__hasOwnProp$a.call(b, prop))
7653
+ __defNormalProp$4(a, prop, b[prop]);
7654
+ if (__getOwnPropSymbols$a)
7655
+ for (var prop of __getOwnPropSymbols$a(b)) {
7656
+ if (__propIsEnum$a.call(b, prop))
7657
+ __defNormalProp$4(a, prop, b[prop]);
7651
7658
  }
7652
7659
  return a;
7653
7660
  };
7654
- var __async$v = (__this, __arguments, generator) => {
7661
+ var __async$u = (__this, __arguments, generator) => {
7655
7662
  return new Promise((resolve, reject) => {
7656
7663
  var fulfilled = (value) => {
7657
7664
  try {
@@ -7690,11 +7697,11 @@ class FundingSourcesAPI {
7690
7697
  * The `create` method creates a new funding source for a given user. This requires
7691
7698
  * payment information to be collected from the user.
7692
7699
  */
7693
- this.create = (createFundingSource) => __async$v(this, null, function* () {
7700
+ this.create = (createFundingSource) => __async$u(this, null, function* () {
7694
7701
  const endUserIpAddress = yield getEndUserIpAddress();
7695
7702
  if (!endUserIpAddress)
7696
7703
  return Promise.reject([new CodedError("Unable to get IP address")]);
7697
- return yield this.client.post("/v1/funding_sources", __spreadValues$6({
7704
+ return yield this.client.post("/v1/funding_sources", __spreadValues$4({
7698
7705
  endUserIpAddress
7699
7706
  }, createFundingSource));
7700
7707
  });
@@ -7703,7 +7710,7 @@ class FundingSourcesAPI {
7703
7710
  * user to update the billing address or payment information associated with the
7704
7711
  * funding source.
7705
7712
  */
7706
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$v(this, null, function* () {
7713
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$u(this, null, function* () {
7707
7714
  const endUserIpAddress = yield getEndUserIpAddress();
7708
7715
  if (!endUserIpAddress)
7709
7716
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7720,18 +7727,18 @@ class FundingSourcesAPI {
7720
7727
  * The `registerCarrier` method registers a carrier account and associates
7721
7728
  * it with a given funding source.
7722
7729
  */
7723
- this.registerCarrier = (carrier) => __async$v(this, null, function* () {
7730
+ this.registerCarrier = (carrier) => __async$u(this, null, function* () {
7724
7731
  const endUserIpAddress = yield getEndUserIpAddress();
7725
7732
  if (!endUserIpAddress)
7726
7733
  return Promise.reject([new CodedError("Unable to get IP address")]);
7727
- return yield this.client.post("/v1/registration/funding_source", __spreadValues$6({
7734
+ return yield this.client.post("/v1/registration/funding_source", __spreadValues$4({
7728
7735
  endUserIpAddress
7729
7736
  }, carrier));
7730
7737
  });
7731
7738
  /**
7732
7739
  * The `addFunds` method allows you to add funds to a funding source.
7733
7740
  */
7734
- this.addFunds = (amount, fundingSourceId) => __async$v(this, null, function* () {
7741
+ this.addFunds = (amount, fundingSourceId) => __async$u(this, null, function* () {
7735
7742
  return yield this.client.put(
7736
7743
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
7737
7744
  amount
@@ -7965,7 +7972,7 @@ class SalesOrdersAPI {
7965
7972
  }
7966
7973
  }
7967
7974
 
7968
- var __async$u = (__this, __arguments, generator) => {
7975
+ var __async$t = (__this, __arguments, generator) => {
7969
7976
  return new Promise((resolve, reject) => {
7970
7977
  var fulfilled = (value) => {
7971
7978
  try {
@@ -8008,7 +8015,7 @@ class ShipmentsAPI {
8008
8015
  * The `create` method allows for creating shipments based on a list of shipment
8009
8016
  * items passed into this method.
8010
8017
  */
8011
- this.create = (...shipments) => __async$u(this, null, function* () {
8018
+ this.create = (...shipments) => __async$t(this, null, function* () {
8012
8019
  return this.client.post("/v1/shipments", {
8013
8020
  shipments
8014
8021
  });
@@ -8052,26 +8059,26 @@ class WarehousesAPI {
8052
8059
  }
8053
8060
  }
8054
8061
 
8055
- var __defProp$5 = Object.defineProperty;
8056
- var __defProps$4 = Object.defineProperties;
8057
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
8058
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
8059
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
8060
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
8061
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8062
- var __spreadValues$5 = (a, b) => {
8062
+ var __defProp$3 = Object.defineProperty;
8063
+ var __defProps$2 = Object.defineProperties;
8064
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
8065
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8066
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8067
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8068
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8069
+ var __spreadValues$3 = (a, b) => {
8063
8070
  for (var prop in b || (b = {}))
8064
- if (__hasOwnProp$b.call(b, prop))
8065
- __defNormalProp$5(a, prop, b[prop]);
8066
- if (__getOwnPropSymbols$b)
8067
- for (var prop of __getOwnPropSymbols$b(b)) {
8068
- if (__propIsEnum$b.call(b, prop))
8069
- __defNormalProp$5(a, prop, b[prop]);
8071
+ if (__hasOwnProp$9.call(b, prop))
8072
+ __defNormalProp$3(a, prop, b[prop]);
8073
+ if (__getOwnPropSymbols$9)
8074
+ for (var prop of __getOwnPropSymbols$9(b)) {
8075
+ if (__propIsEnum$9.call(b, prop))
8076
+ __defNormalProp$3(a, prop, b[prop]);
8070
8077
  }
8071
8078
  return a;
8072
8079
  };
8073
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
8074
- var __async$t = (__this, __arguments, generator) => {
8080
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
8081
+ var __async$s = (__this, __arguments, generator) => {
8075
8082
  return new Promise((resolve, reject) => {
8076
8083
  var fulfilled = (value) => {
8077
8084
  try {
@@ -8093,7 +8100,7 @@ var __async$t = (__this, __arguments, generator) => {
8093
8100
  };
8094
8101
  const logger$1 = E({
8095
8102
  name: "shipengine-api",
8096
- serializers: __spreadProps$4(__spreadValues$5({}, k), {
8103
+ serializers: __spreadProps$2(__spreadValues$3({}, k), {
8097
8104
  req: (req) => ({
8098
8105
  headers: req.headers,
8099
8106
  method: req.method,
@@ -8118,7 +8125,7 @@ class ShipEngineAPI {
8118
8125
  constructor(token, { baseURL, headers, getToken }) {
8119
8126
  const client = axios.create({
8120
8127
  baseURL,
8121
- headers: __spreadProps$4(__spreadValues$5({}, headers), {
8128
+ headers: __spreadProps$2(__spreadValues$3({}, headers), {
8122
8129
  Authorization: `Bearer ${token}`,
8123
8130
  "Content-Type": "application/json"
8124
8131
  }),
@@ -8165,7 +8172,7 @@ class ShipEngineAPI {
8165
8172
  );
8166
8173
  return res;
8167
8174
  },
8168
- (err) => __async$t(this, null, function* () {
8175
+ (err) => __async$s(this, null, function* () {
8169
8176
  var _a, _b, _c, _d, _e, _f, _g;
8170
8177
  logger$1.error(
8171
8178
  { err, req: err.config, res: err.response },
@@ -8392,25 +8399,25 @@ const delay = (ms) => new Promise((resolve) => {
8392
8399
 
8393
8400
  const onError = (errors) => errors.forEach(console.log);
8394
8401
 
8395
- var __defProp$4 = Object.defineProperty;
8396
- var __defProps$3 = Object.defineProperties;
8397
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
8398
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
8399
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8400
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
8401
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8402
- var __spreadValues$4 = (a, b) => {
8402
+ var __defProp$2 = Object.defineProperty;
8403
+ var __defProps$1 = Object.defineProperties;
8404
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
8405
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8406
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8407
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8408
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8409
+ var __spreadValues$2 = (a, b) => {
8403
8410
  for (var prop in b || (b = {}))
8404
- if (__hasOwnProp$a.call(b, prop))
8405
- __defNormalProp$4(a, prop, b[prop]);
8406
- if (__getOwnPropSymbols$a)
8407
- for (var prop of __getOwnPropSymbols$a(b)) {
8408
- if (__propIsEnum$a.call(b, prop))
8409
- __defNormalProp$4(a, prop, b[prop]);
8411
+ if (__hasOwnProp$8.call(b, prop))
8412
+ __defNormalProp$2(a, prop, b[prop]);
8413
+ if (__getOwnPropSymbols$8)
8414
+ for (var prop of __getOwnPropSymbols$8(b)) {
8415
+ if (__propIsEnum$8.call(b, prop))
8416
+ __defNormalProp$2(a, prop, b[prop]);
8410
8417
  }
8411
8418
  return a;
8412
8419
  };
8413
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
8420
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
8414
8421
  const streams = [];
8415
8422
  if (process.env.NODE_ENV === "production") {
8416
8423
  streams.push({
@@ -8419,7 +8426,7 @@ if (process.env.NODE_ENV === "production") {
8419
8426
  }
8420
8427
  const logger = E({
8421
8428
  name: "shipengine",
8422
- serializers: __spreadProps$3(__spreadValues$4({}, k), {
8429
+ serializers: __spreadProps$1(__spreadValues$2({}, k), {
8423
8430
  req: (req) => ({
8424
8431
  headers: req.headers,
8425
8432
  method: req.method,
@@ -8454,7 +8461,7 @@ const useGetAccountSettings = () => {
8454
8461
  });
8455
8462
  };
8456
8463
 
8457
- var __async$s = (__this, __arguments, generator) => {
8464
+ var __async$r = (__this, __arguments, generator) => {
8458
8465
  return new Promise((resolve, reject) => {
8459
8466
  var fulfilled = (value) => {
8460
8467
  try {
@@ -8477,7 +8484,7 @@ var __async$s = (__this, __arguments, generator) => {
8477
8484
  const useUpdateAccountSettings = () => {
8478
8485
  const { client } = useShipEngine();
8479
8486
  return reactQuery.useMutation({
8480
- mutationFn: (settings) => __async$s(void 0, null, function* () {
8487
+ mutationFn: (settings) => __async$r(void 0, null, function* () {
8481
8488
  const result = yield client.accountSettings.update(settings);
8482
8489
  return result.data;
8483
8490
  }),
@@ -8486,7 +8493,7 @@ const useUpdateAccountSettings = () => {
8486
8493
  });
8487
8494
  };
8488
8495
 
8489
- var __async$r = (__this, __arguments, generator) => {
8496
+ var __async$q = (__this, __arguments, generator) => {
8490
8497
  return new Promise((resolve, reject) => {
8491
8498
  var fulfilled = (value) => {
8492
8499
  try {
@@ -8509,7 +8516,7 @@ var __async$r = (__this, __arguments, generator) => {
8509
8516
  const useParseAddress = () => {
8510
8517
  const { client } = useShipEngine();
8511
8518
  return reactQuery.useMutation({
8512
- mutationFn: (_0) => __async$r(void 0, [_0], function* ({ address, text }) {
8519
+ mutationFn: (_0) => __async$q(void 0, [_0], function* ({ address, text }) {
8513
8520
  const result = yield client.addresses.parse(text, address);
8514
8521
  return result.data;
8515
8522
  }),
@@ -8518,7 +8525,7 @@ const useParseAddress = () => {
8518
8525
  });
8519
8526
  };
8520
8527
 
8521
- var __async$q = (__this, __arguments, generator) => {
8528
+ var __async$p = (__this, __arguments, generator) => {
8522
8529
  return new Promise((resolve, reject) => {
8523
8530
  var fulfilled = (value) => {
8524
8531
  try {
@@ -8541,7 +8548,7 @@ var __async$q = (__this, __arguments, generator) => {
8541
8548
  const useValidateAddresses = () => {
8542
8549
  const { client } = useShipEngine();
8543
8550
  return reactQuery.useMutation({
8544
- mutationFn: (addresses) => __async$q(void 0, null, function* () {
8551
+ mutationFn: (addresses) => __async$p(void 0, null, function* () {
8545
8552
  const result = yield client.addresses.validate(addresses);
8546
8553
  return result.data;
8547
8554
  }),
@@ -8550,7 +8557,7 @@ const useValidateAddresses = () => {
8550
8557
  });
8551
8558
  };
8552
8559
 
8553
- var __async$p = (__this, __arguments, generator) => {
8560
+ var __async$o = (__this, __arguments, generator) => {
8554
8561
  return new Promise((resolve, reject) => {
8555
8562
  var fulfilled = (value) => {
8556
8563
  try {
@@ -8573,7 +8580,7 @@ var __async$p = (__this, __arguments, generator) => {
8573
8580
  const useAddFunds = (carrierId) => {
8574
8581
  const { client } = useShipEngine();
8575
8582
  return reactQuery.useMutation({
8576
- mutationFn: (funds) => __async$p(void 0, null, function* () {
8583
+ mutationFn: (funds) => __async$o(void 0, null, function* () {
8577
8584
  const result = yield client.carriers.addFunds(carrierId, funds);
8578
8585
  return result.data;
8579
8586
  }),
@@ -8582,7 +8589,7 @@ const useAddFunds = (carrierId) => {
8582
8589
  });
8583
8590
  };
8584
8591
 
8585
- var __async$o = (__this, __arguments, generator) => {
8592
+ var __async$n = (__this, __arguments, generator) => {
8586
8593
  return new Promise((resolve, reject) => {
8587
8594
  var fulfilled = (value) => {
8588
8595
  try {
@@ -8605,7 +8612,7 @@ var __async$o = (__this, __arguments, generator) => {
8605
8612
  const useConnectCarrier = () => {
8606
8613
  const { client } = useShipEngine();
8607
8614
  return reactQuery.useMutation({
8608
- mutationFn: (params) => __async$o(void 0, null, function* () {
8615
+ mutationFn: (params) => __async$n(void 0, null, function* () {
8609
8616
  const result = yield client.carriers.connect(params);
8610
8617
  return result.data;
8611
8618
  }),
@@ -8742,7 +8749,7 @@ const useListCarriers = () => {
8742
8749
  });
8743
8750
  };
8744
8751
 
8745
- var __async$n = (__this, __arguments, generator) => {
8752
+ var __async$m = (__this, __arguments, generator) => {
8746
8753
  return new Promise((resolve, reject) => {
8747
8754
  var fulfilled = (value) => {
8748
8755
  try {
@@ -8766,7 +8773,7 @@ const useUpdateAutoFunding = (carrierId) => {
8766
8773
  const { client } = useShipEngine();
8767
8774
  const queryClient = reactQuery.useQueryClient();
8768
8775
  return reactQuery.useMutation({
8769
- mutationFn: (options) => __async$n(void 0, null, function* () {
8776
+ mutationFn: (options) => __async$m(void 0, null, function* () {
8770
8777
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
8771
8778
  return result.data;
8772
8779
  }),
@@ -8778,6 +8785,23 @@ const useUpdateAutoFunding = (carrierId) => {
8778
8785
  });
8779
8786
  };
8780
8787
 
8788
+ const useGetZonesByCarrier = (carrierId) => {
8789
+ const { client } = useShipEngine();
8790
+ return reactQuery.useQuery({
8791
+ enabled: !!carrierId,
8792
+ onError,
8793
+ queryFn: () => {
8794
+ if (carrierId)
8795
+ return client.carriers.getZones(carrierId);
8796
+ return Promise.reject(new Error("carrierId is required"));
8797
+ },
8798
+ queryKey: ["useGetZonesByCarrier", carrierId],
8799
+ select: (result) => result.data.zones,
8800
+ // Fresh for 5 minutes
8801
+ staleTime: 5 * 60 * 1e3
8802
+ });
8803
+ };
8804
+
8781
8805
  const useListCustomPackageTypes = () => {
8782
8806
  const { client } = useShipEngine();
8783
8807
  return reactQuery.useQuery({
@@ -8788,7 +8812,7 @@ const useListCustomPackageTypes = () => {
8788
8812
  });
8789
8813
  };
8790
8814
 
8791
- var __async$m = (__this, __arguments, generator) => {
8815
+ var __async$l = (__this, __arguments, generator) => {
8792
8816
  return new Promise((resolve, reject) => {
8793
8817
  var fulfilled = (value) => {
8794
8818
  try {
@@ -8811,7 +8835,7 @@ var __async$m = (__this, __arguments, generator) => {
8811
8835
  const useCreateFundingSource = () => {
8812
8836
  const { client } = useShipEngine();
8813
8837
  return reactQuery.useMutation({
8814
- mutationFn: (fundingSource) => __async$m(void 0, null, function* () {
8838
+ mutationFn: (fundingSource) => __async$l(void 0, null, function* () {
8815
8839
  const result = yield client.fundingSources.create(fundingSource);
8816
8840
  return result.data;
8817
8841
  }),
@@ -8820,7 +8844,7 @@ const useCreateFundingSource = () => {
8820
8844
  });
8821
8845
  };
8822
8846
 
8823
- var __async$l = (__this, __arguments, generator) => {
8847
+ var __async$k = (__this, __arguments, generator) => {
8824
8848
  return new Promise((resolve, reject) => {
8825
8849
  var fulfilled = (value) => {
8826
8850
  try {
@@ -8843,7 +8867,7 @@ var __async$l = (__this, __arguments, generator) => {
8843
8867
  const useFundingSourcesAddFunds = (fundingSourceId) => {
8844
8868
  const { client } = useShipEngine();
8845
8869
  return reactQuery.useMutation({
8846
- mutationFn: (funds) => __async$l(void 0, null, function* () {
8870
+ mutationFn: (funds) => __async$k(void 0, null, function* () {
8847
8871
  const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
8848
8872
  return result.data;
8849
8873
  }),
@@ -8872,7 +8896,7 @@ const useListFundingSources = () => {
8872
8896
  });
8873
8897
  };
8874
8898
 
8875
- var __async$k = (__this, __arguments, generator) => {
8899
+ var __async$j = (__this, __arguments, generator) => {
8876
8900
  return new Promise((resolve, reject) => {
8877
8901
  var fulfilled = (value) => {
8878
8902
  try {
@@ -8895,7 +8919,7 @@ var __async$k = (__this, __arguments, generator) => {
8895
8919
  const useRegisterCarrier = () => {
8896
8920
  const { client } = useShipEngine();
8897
8921
  return reactQuery.useMutation({
8898
- mutationFn: (carrier) => __async$k(void 0, null, function* () {
8922
+ mutationFn: (carrier) => __async$j(void 0, null, function* () {
8899
8923
  const result = yield client.fundingSources.registerCarrier(carrier);
8900
8924
  return result.data;
8901
8925
  }),
@@ -8904,7 +8928,7 @@ const useRegisterCarrier = () => {
8904
8928
  });
8905
8929
  };
8906
8930
 
8907
- var __async$j = (__this, __arguments, generator) => {
8931
+ var __async$i = (__this, __arguments, generator) => {
8908
8932
  return new Promise((resolve, reject) => {
8909
8933
  var fulfilled = (value) => {
8910
8934
  try {
@@ -8927,7 +8951,7 @@ var __async$j = (__this, __arguments, generator) => {
8927
8951
  const useUpdateFundingSource = () => {
8928
8952
  const { client } = useShipEngine();
8929
8953
  return reactQuery.useMutation({
8930
- mutationFn: (_0) => __async$j(void 0, [_0], function* ({
8954
+ mutationFn: (_0) => __async$i(void 0, [_0], function* ({
8931
8955
  billingInfo,
8932
8956
  creditCardInfo,
8933
8957
  fundingSourceId
@@ -8959,22 +8983,22 @@ const useGetInsuranceAccount = (insuranceProvider) => {
8959
8983
  });
8960
8984
  };
8961
8985
 
8962
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8963
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8964
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8986
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8987
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8988
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8965
8989
  var __objRest$6 = (source, exclude) => {
8966
8990
  var target = {};
8967
8991
  for (var prop in source)
8968
- if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
8992
+ if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
8969
8993
  target[prop] = source[prop];
8970
- if (source != null && __getOwnPropSymbols$9)
8971
- for (var prop of __getOwnPropSymbols$9(source)) {
8972
- if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
8994
+ if (source != null && __getOwnPropSymbols$7)
8995
+ for (var prop of __getOwnPropSymbols$7(source)) {
8996
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
8973
8997
  target[prop] = source[prop];
8974
8998
  }
8975
8999
  return target;
8976
9000
  };
8977
- var __async$i = (__this, __arguments, generator) => {
9001
+ var __async$h = (__this, __arguments, generator) => {
8978
9002
  return new Promise((resolve, reject) => {
8979
9003
  var fulfilled = (value) => {
8980
9004
  try {
@@ -8997,7 +9021,7 @@ var __async$i = (__this, __arguments, generator) => {
8997
9021
  const useCreateLabel = () => {
8998
9022
  const { client } = useShipEngine();
8999
9023
  return reactQuery.useMutation({
9000
- mutationFn: (_a) => __async$i(void 0, null, function* () {
9024
+ mutationFn: (_a) => __async$h(void 0, null, function* () {
9001
9025
  var _b = _a, { rateId } = _b, options = __objRest$6(_b, ["rateId"]);
9002
9026
  const result = yield client.labels.createByRateId(rateId, options);
9003
9027
  return result.data;
@@ -9033,7 +9057,7 @@ const useListLabels = (params) => {
9033
9057
  });
9034
9058
  };
9035
9059
 
9036
- var __async$h = (__this, __arguments, generator) => {
9060
+ var __async$g = (__this, __arguments, generator) => {
9037
9061
  return new Promise((resolve, reject) => {
9038
9062
  var fulfilled = (value) => {
9039
9063
  try {
@@ -9056,7 +9080,7 @@ var __async$h = (__this, __arguments, generator) => {
9056
9080
  const useVoidLabel = () => {
9057
9081
  const { client } = useShipEngine();
9058
9082
  return reactQuery.useMutation({
9059
- mutationFn: (labelId) => __async$h(void 0, null, function* () {
9083
+ mutationFn: (labelId) => __async$g(void 0, null, function* () {
9060
9084
  const result = yield client.labels.void(labelId);
9061
9085
  return result.data;
9062
9086
  }),
@@ -9075,7 +9099,7 @@ const useListOrderSources = () => {
9075
9099
  });
9076
9100
  };
9077
9101
 
9078
- var __async$g = (__this, __arguments, generator) => {
9102
+ var __async$f = (__this, __arguments, generator) => {
9079
9103
  return new Promise((resolve, reject) => {
9080
9104
  var fulfilled = (value) => {
9081
9105
  try {
@@ -9098,7 +9122,7 @@ var __async$g = (__this, __arguments, generator) => {
9098
9122
  const useRefreshOrderSourceAsync = () => {
9099
9123
  const { client } = useShipEngine();
9100
9124
  return reactQuery.useMutation({
9101
- mutationFn: (orderSourceId) => __async$g(void 0, null, function* () {
9125
+ mutationFn: (orderSourceId) => __async$f(void 0, null, function* () {
9102
9126
  const result = yield client.orderSources.refresh(orderSourceId);
9103
9127
  return result.data;
9104
9128
  }),
@@ -9109,9 +9133,9 @@ const useRefreshOrderSource = () => {
9109
9133
  const { client } = useShipEngine();
9110
9134
  const { mutateAsync: refreshOrderSourceAsync } = useRefreshOrderSourceAsync();
9111
9135
  return reactQuery.useMutation({
9112
- mutationFn: (orderSourceId) => __async$g(void 0, null, function* () {
9136
+ mutationFn: (orderSourceId) => __async$f(void 0, null, function* () {
9113
9137
  yield refreshOrderSourceAsync(orderSourceId);
9114
- const waitResult = yield retryUntil(() => __async$g(void 0, null, function* () {
9138
+ const waitResult = yield retryUntil(() => __async$f(void 0, null, function* () {
9115
9139
  const { data: checkResult } = yield client.orderSources.get(orderSourceId);
9116
9140
  if (["preparing_update", "updating"].includes(checkResult.refreshInfo.status)) {
9117
9141
  throw new CodedError("Order source is still refreshing");
@@ -9125,7 +9149,7 @@ const useRefreshOrderSource = () => {
9125
9149
  });
9126
9150
  };
9127
9151
 
9128
- var __async$f = (__this, __arguments, generator) => {
9152
+ var __async$e = (__this, __arguments, generator) => {
9129
9153
  return new Promise((resolve, reject) => {
9130
9154
  var fulfilled = (value) => {
9131
9155
  try {
@@ -9148,7 +9172,7 @@ var __async$f = (__this, __arguments, generator) => {
9148
9172
  const useCreateRateCard = () => {
9149
9173
  const { client } = useShipEngine();
9150
9174
  return reactQuery.useMutation({
9151
- mutationFn: (rateCard) => __async$f(void 0, null, function* () {
9175
+ mutationFn: (rateCard) => __async$e(void 0, null, function* () {
9152
9176
  const result = yield client.rateCards.create(rateCard);
9153
9177
  return result.data;
9154
9178
  }),
@@ -9195,7 +9219,7 @@ const useListRateCards = (carrierIds) => {
9195
9219
  });
9196
9220
  };
9197
9221
 
9198
- var __async$e = (__this, __arguments, generator) => {
9222
+ var __async$d = (__this, __arguments, generator) => {
9199
9223
  return new Promise((resolve, reject) => {
9200
9224
  var fulfilled = (value) => {
9201
9225
  try {
@@ -9218,7 +9242,7 @@ var __async$e = (__this, __arguments, generator) => {
9218
9242
  const usePublishRateCard = () => {
9219
9243
  const { client } = useShipEngine();
9220
9244
  return reactQuery.useMutation({
9221
- mutationFn: (rateCardId) => __async$e(void 0, null, function* () {
9245
+ mutationFn: (rateCardId) => __async$d(void 0, null, function* () {
9222
9246
  return yield client.rateCards.publish(rateCardId);
9223
9247
  }),
9224
9248
  mutationKey: ["usePublishRateCard"],
@@ -9226,7 +9250,7 @@ const usePublishRateCard = () => {
9226
9250
  });
9227
9251
  };
9228
9252
 
9229
- var __async$d = (__this, __arguments, generator) => {
9253
+ var __async$c = (__this, __arguments, generator) => {
9230
9254
  return new Promise((resolve, reject) => {
9231
9255
  var fulfilled = (value) => {
9232
9256
  try {
@@ -9249,7 +9273,7 @@ var __async$d = (__this, __arguments, generator) => {
9249
9273
  const useUpdateRateCard = () => {
9250
9274
  const { client } = useShipEngine();
9251
9275
  return reactQuery.useMutation({
9252
- mutationFn: (rateCard) => __async$d(void 0, null, function* () {
9276
+ mutationFn: (rateCard) => __async$c(void 0, null, function* () {
9253
9277
  const result = yield client.rateCards.update(rateCard);
9254
9278
  return result.data;
9255
9279
  }),
@@ -9258,7 +9282,7 @@ const useUpdateRateCard = () => {
9258
9282
  });
9259
9283
  };
9260
9284
 
9261
- var __async$c = (__this, __arguments, generator) => {
9285
+ var __async$b = (__this, __arguments, generator) => {
9262
9286
  return new Promise((resolve, reject) => {
9263
9287
  var fulfilled = (value) => {
9264
9288
  try {
@@ -9281,7 +9305,7 @@ var __async$c = (__this, __arguments, generator) => {
9281
9305
  const useUploadRateCard = () => {
9282
9306
  const { client } = useShipEngine();
9283
9307
  return reactQuery.useMutation({
9284
- mutationFn: (_0) => __async$c(void 0, [_0], function* ({ rateCardId, file }) {
9308
+ mutationFn: (_0) => __async$b(void 0, [_0], function* ({ rateCardId, file }) {
9285
9309
  const result = yield client.rateCards.upload(rateCardId, file);
9286
9310
  return result.data;
9287
9311
  }),
@@ -9290,7 +9314,7 @@ const useUploadRateCard = () => {
9290
9314
  });
9291
9315
  };
9292
9316
 
9293
- var __async$b = (__this, __arguments, generator) => {
9317
+ var __async$a = (__this, __arguments, generator) => {
9294
9318
  return new Promise((resolve, reject) => {
9295
9319
  var fulfilled = (value) => {
9296
9320
  try {
@@ -9313,7 +9337,7 @@ var __async$b = (__this, __arguments, generator) => {
9313
9337
  const useDeleteRateCard = () => {
9314
9338
  const { client } = useShipEngine();
9315
9339
  return reactQuery.useMutation({
9316
- mutationFn: (rateCardId) => __async$b(void 0, null, function* () {
9340
+ mutationFn: (rateCardId) => __async$a(void 0, null, function* () {
9317
9341
  const result = yield client.rateCards.delete(rateCardId);
9318
9342
  return result.data;
9319
9343
  }),
@@ -9322,7 +9346,7 @@ const useDeleteRateCard = () => {
9322
9346
  });
9323
9347
  };
9324
9348
 
9325
- var __async$a = (__this, __arguments, generator) => {
9349
+ var __async$9 = (__this, __arguments, generator) => {
9326
9350
  return new Promise((resolve, reject) => {
9327
9351
  var fulfilled = (value) => {
9328
9352
  try {
@@ -9345,7 +9369,7 @@ var __async$a = (__this, __arguments, generator) => {
9345
9369
  const useCalculateRates = () => {
9346
9370
  const { client } = useShipEngine();
9347
9371
  return reactQuery.useMutation({
9348
- mutationFn: (_0) => __async$a(void 0, [_0], function* ({ rateOptions, shipmentId }) {
9372
+ mutationFn: (_0) => __async$9(void 0, [_0], function* ({ rateOptions, shipmentId }) {
9349
9373
  const result = yield client.rates.calculateByShipmentId(shipmentId, rateOptions);
9350
9374
  return result.data;
9351
9375
  }),
@@ -9380,22 +9404,22 @@ const useListSalesOrders = (params = {}) => {
9380
9404
  });
9381
9405
  };
9382
9406
 
9383
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
9384
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
9385
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
9407
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
9408
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
9409
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
9386
9410
  var __objRest$5 = (source, exclude) => {
9387
9411
  var target = {};
9388
9412
  for (var prop in source)
9389
- if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
9413
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
9390
9414
  target[prop] = source[prop];
9391
- if (source != null && __getOwnPropSymbols$8)
9392
- for (var prop of __getOwnPropSymbols$8(source)) {
9393
- if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
9415
+ if (source != null && __getOwnPropSymbols$6)
9416
+ for (var prop of __getOwnPropSymbols$6(source)) {
9417
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
9394
9418
  target[prop] = source[prop];
9395
9419
  }
9396
9420
  return target;
9397
9421
  };
9398
- var __async$9 = (__this, __arguments, generator) => {
9422
+ var __async$8 = (__this, __arguments, generator) => {
9399
9423
  return new Promise((resolve, reject) => {
9400
9424
  var fulfilled = (value) => {
9401
9425
  try {
@@ -9418,7 +9442,7 @@ var __async$9 = (__this, __arguments, generator) => {
9418
9442
  const useNotifySalesOrderShipped = () => {
9419
9443
  const { client } = useShipEngine();
9420
9444
  return reactQuery.useMutation({
9421
- mutationFn: (_a) => __async$9(void 0, null, function* () {
9445
+ mutationFn: (_a) => __async$8(void 0, null, function* () {
9422
9446
  var _b = _a, { salesOrderId } = _b, tracking = __objRest$5(_b, ["salesOrderId"]);
9423
9447
  const result = yield client.salesOrders.notifyShipped(salesOrderId, tracking);
9424
9448
  return result.data;
@@ -9428,22 +9452,22 @@ const useNotifySalesOrderShipped = () => {
9428
9452
  });
9429
9453
  };
9430
9454
 
9431
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
9432
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
9433
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
9455
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
9456
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
9457
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
9434
9458
  var __objRest$4 = (source, exclude) => {
9435
9459
  var target = {};
9436
9460
  for (var prop in source)
9437
- if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
9461
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
9438
9462
  target[prop] = source[prop];
9439
- if (source != null && __getOwnPropSymbols$7)
9440
- for (var prop of __getOwnPropSymbols$7(source)) {
9441
- if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
9463
+ if (source != null && __getOwnPropSymbols$5)
9464
+ for (var prop of __getOwnPropSymbols$5(source)) {
9465
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
9442
9466
  target[prop] = source[prop];
9443
9467
  }
9444
9468
  return target;
9445
9469
  };
9446
- var __async$8 = (__this, __arguments, generator) => {
9470
+ var __async$7 = (__this, __arguments, generator) => {
9447
9471
  return new Promise((resolve, reject) => {
9448
9472
  var fulfilled = (value) => {
9449
9473
  try {
@@ -9466,7 +9490,7 @@ var __async$8 = (__this, __arguments, generator) => {
9466
9490
  const useCreateSalesOrderShipment = () => {
9467
9491
  const { client } = useShipEngine();
9468
9492
  return reactQuery.useMutation({
9469
- mutationFn: (_a) => __async$8(void 0, null, function* () {
9493
+ mutationFn: (_a) => __async$7(void 0, null, function* () {
9470
9494
  var _b = _a, { salesOrderId } = _b, shipment = __objRest$4(_b, ["salesOrderId"]);
9471
9495
  const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
9472
9496
  return result.data;
@@ -9502,22 +9526,22 @@ const useListSalesOrderShipments = (params) => {
9502
9526
  });
9503
9527
  };
9504
9528
 
9505
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
9506
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
9507
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
9529
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
9530
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
9531
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
9508
9532
  var __objRest$3 = (source, exclude) => {
9509
9533
  var target = {};
9510
9534
  for (var prop in source)
9511
- if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
9535
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
9512
9536
  target[prop] = source[prop];
9513
- if (source != null && __getOwnPropSymbols$6)
9514
- for (var prop of __getOwnPropSymbols$6(source)) {
9515
- if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
9537
+ if (source != null && __getOwnPropSymbols$4)
9538
+ for (var prop of __getOwnPropSymbols$4(source)) {
9539
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
9516
9540
  target[prop] = source[prop];
9517
9541
  }
9518
9542
  return target;
9519
9543
  };
9520
- var __async$7 = (__this, __arguments, generator) => {
9544
+ var __async$6 = (__this, __arguments, generator) => {
9521
9545
  return new Promise((resolve, reject) => {
9522
9546
  var fulfilled = (value) => {
9523
9547
  try {
@@ -9540,7 +9564,7 @@ var __async$7 = (__this, __arguments, generator) => {
9540
9564
  const useUpdateSalesOrderShipment = () => {
9541
9565
  const { client } = useShipEngine();
9542
9566
  return reactQuery.useMutation({
9543
- mutationFn: (_a) => __async$7(void 0, null, function* () {
9567
+ mutationFn: (_a) => __async$6(void 0, null, function* () {
9544
9568
  var _b = _a, { shipmentId } = _b, shipment = __objRest$3(_b, ["shipmentId"]);
9545
9569
  const result = yield client.salesOrderShipments.update(shipmentId, shipment);
9546
9570
  return result.data;
@@ -9550,26 +9574,26 @@ const useUpdateSalesOrderShipment = () => {
9550
9574
  });
9551
9575
  };
9552
9576
 
9553
- var __defProp$3 = Object.defineProperty;
9554
- var __defProps$2 = Object.defineProperties;
9555
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
9556
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
9557
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
9558
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
9559
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9560
- var __spreadValues$3 = (a, b) => {
9577
+ var __defProp$1 = Object.defineProperty;
9578
+ var __defProps = Object.defineProperties;
9579
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9580
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
9581
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
9582
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
9583
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9584
+ var __spreadValues$1 = (a, b) => {
9561
9585
  for (var prop in b || (b = {}))
9562
- if (__hasOwnProp$5.call(b, prop))
9563
- __defNormalProp$3(a, prop, b[prop]);
9564
- if (__getOwnPropSymbols$5)
9565
- for (var prop of __getOwnPropSymbols$5(b)) {
9566
- if (__propIsEnum$5.call(b, prop))
9567
- __defNormalProp$3(a, prop, b[prop]);
9586
+ if (__hasOwnProp$3.call(b, prop))
9587
+ __defNormalProp$1(a, prop, b[prop]);
9588
+ if (__getOwnPropSymbols$3)
9589
+ for (var prop of __getOwnPropSymbols$3(b)) {
9590
+ if (__propIsEnum$3.call(b, prop))
9591
+ __defNormalProp$1(a, prop, b[prop]);
9568
9592
  }
9569
9593
  return a;
9570
9594
  };
9571
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
9572
- var __async$6 = (__this, __arguments, generator) => {
9595
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9596
+ var __async$5 = (__this, __arguments, generator) => {
9573
9597
  return new Promise((resolve, reject) => {
9574
9598
  var fulfilled = (value) => {
9575
9599
  try {
@@ -9592,7 +9616,7 @@ var __async$6 = (__this, __arguments, generator) => {
9592
9616
  const useCreateShipment = () => {
9593
9617
  const { client } = useShipEngine();
9594
9618
  return reactQuery.useMutation({
9595
- mutationFn: (shipment) => __async$6(void 0, null, function* () {
9619
+ mutationFn: (shipment) => __async$5(void 0, null, function* () {
9596
9620
  var _a;
9597
9621
  if (shipment.warehouseId === void 0) {
9598
9622
  throw new CodedError("errorMessages.noWarehouses", {
@@ -9610,7 +9634,7 @@ const useCreateShipment = () => {
9610
9634
  postalCode: "",
9611
9635
  stateProvince: ""
9612
9636
  };
9613
- return (yield client.shipments.create(__spreadProps$2(__spreadValues$3({}, shipment), {
9637
+ return (yield client.shipments.create(__spreadProps(__spreadValues$1({}, shipment), {
9614
9638
  shipTo
9615
9639
  }))).data;
9616
9640
  }),
@@ -9651,17 +9675,17 @@ const useGetShipment = (shipmentId) => {
9651
9675
  });
9652
9676
  };
9653
9677
 
9654
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
9655
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
9656
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
9678
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
9679
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
9680
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
9657
9681
  var __objRest$2 = (source, exclude) => {
9658
9682
  var target = {};
9659
9683
  for (var prop in source)
9660
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
9684
+ if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
9661
9685
  target[prop] = source[prop];
9662
- if (source != null && __getOwnPropSymbols$4)
9663
- for (var prop of __getOwnPropSymbols$4(source)) {
9664
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
9686
+ if (source != null && __getOwnPropSymbols$2)
9687
+ for (var prop of __getOwnPropSymbols$2(source)) {
9688
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
9665
9689
  target[prop] = source[prop];
9666
9690
  }
9667
9691
  return target;
@@ -9678,7 +9702,7 @@ const useListShipments = (_params) => {
9678
9702
  });
9679
9703
  };
9680
9704
 
9681
- var __async$5 = (__this, __arguments, generator) => {
9705
+ var __async$4 = (__this, __arguments, generator) => {
9682
9706
  return new Promise((resolve, reject) => {
9683
9707
  var fulfilled = (value) => {
9684
9708
  try {
@@ -9701,7 +9725,7 @@ var __async$5 = (__this, __arguments, generator) => {
9701
9725
  const useCreateWarehouse = () => {
9702
9726
  const { client } = useShipEngine();
9703
9727
  return reactQuery.useMutation({
9704
- mutationFn: (data) => __async$5(void 0, null, function* () {
9728
+ mutationFn: (data) => __async$4(void 0, null, function* () {
9705
9729
  const result = yield client.warehouses.create(data);
9706
9730
  return result.data;
9707
9731
  }),
@@ -9710,7 +9734,7 @@ const useCreateWarehouse = () => {
9710
9734
  });
9711
9735
  };
9712
9736
 
9713
- var __async$4 = (__this, __arguments, generator) => {
9737
+ var __async$3 = (__this, __arguments, generator) => {
9714
9738
  return new Promise((resolve, reject) => {
9715
9739
  var fulfilled = (value) => {
9716
9740
  try {
@@ -9733,7 +9757,7 @@ var __async$4 = (__this, __arguments, generator) => {
9733
9757
  const useDeleteWarehouse = () => {
9734
9758
  const { client } = useShipEngine();
9735
9759
  return reactQuery.useMutation({
9736
- mutationFn: (_0) => __async$4(void 0, [_0], function* ({ warehouseId }) {
9760
+ mutationFn: (_0) => __async$3(void 0, [_0], function* ({ warehouseId }) {
9737
9761
  const result = yield client.warehouses.delete(warehouseId);
9738
9762
  return result.data;
9739
9763
  }),
@@ -9754,22 +9778,22 @@ const useListWarehouses = (options) => {
9754
9778
  });
9755
9779
  };
9756
9780
 
9757
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
9758
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
9759
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
9781
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
9782
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
9783
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
9760
9784
  var __objRest$1 = (source, exclude) => {
9761
9785
  var target = {};
9762
9786
  for (var prop in source)
9763
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
9787
+ if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
9764
9788
  target[prop] = source[prop];
9765
- if (source != null && __getOwnPropSymbols$3)
9766
- for (var prop of __getOwnPropSymbols$3(source)) {
9767
- if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
9789
+ if (source != null && __getOwnPropSymbols$1)
9790
+ for (var prop of __getOwnPropSymbols$1(source)) {
9791
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
9768
9792
  target[prop] = source[prop];
9769
9793
  }
9770
9794
  return target;
9771
9795
  };
9772
- var __async$3 = (__this, __arguments, generator) => {
9796
+ var __async$2 = (__this, __arguments, generator) => {
9773
9797
  return new Promise((resolve, reject) => {
9774
9798
  var fulfilled = (value) => {
9775
9799
  try {
@@ -9792,7 +9816,7 @@ var __async$3 = (__this, __arguments, generator) => {
9792
9816
  const useUpdateWarehouse = () => {
9793
9817
  const { client } = useShipEngine();
9794
9818
  return reactQuery.useMutation({
9795
- mutationFn: (_a) => __async$3(void 0, null, function* () {
9819
+ mutationFn: (_a) => __async$2(void 0, null, function* () {
9796
9820
  var _b = _a, { warehouseId } = _b, warehouse = __objRest$1(_b, ["warehouseId"]);
9797
9821
  const result = yield client.warehouses.update(warehouseId, warehouse);
9798
9822
  return result.data;
@@ -9802,7 +9826,7 @@ const useUpdateWarehouse = () => {
9802
9826
  });
9803
9827
  };
9804
9828
 
9805
- var __async$2 = (__this, __arguments, generator) => {
9829
+ var __async$1 = (__this, __arguments, generator) => {
9806
9830
  return new Promise((resolve, reject) => {
9807
9831
  var fulfilled = (value) => {
9808
9832
  try {
@@ -9825,12 +9849,12 @@ var __async$2 = (__this, __arguments, generator) => {
9825
9849
  const useLoadFonts = ({ cdnURL = "/", scope, theme }) => {
9826
9850
  const [fontFamily, setFontFamily] = React.useState();
9827
9851
  React.useEffect(() => {
9828
- (() => __async$2(void 0, null, function* () {
9852
+ (() => __async$1(void 0, null, function* () {
9829
9853
  var _a;
9830
9854
  try {
9831
9855
  const fontFaces = (_a = theme == null ? void 0 : theme.fontFaces) != null ? _a : [];
9832
9856
  yield Promise.all(
9833
- fontFaces.map((_0) => __async$2(void 0, [_0], function* ({ family, source, descriptors }) {
9857
+ fontFaces.map((_0) => __async$1(void 0, [_0], function* ({ family, source, descriptors }) {
9834
9858
  const fontSources = source.map((url) => `url(${url.replace("$cdnUrl", cdnURL)})`).join(", ");
9835
9859
  try {
9836
9860
  const font = new FontFace(family, fontSources, descriptors);
@@ -9852,7 +9876,7 @@ const useLoadFonts = ({ cdnURL = "/", scope, theme }) => {
9852
9876
  });
9853
9877
  };
9854
9878
 
9855
- var __async$1 = (__this, __arguments, generator) => {
9879
+ var __async = (__this, __arguments, generator) => {
9856
9880
  return new Promise((resolve, reject) => {
9857
9881
  var fulfilled = (value) => {
9858
9882
  try {
@@ -9875,7 +9899,7 @@ var __async$1 = (__this, __arguments, generator) => {
9875
9899
  const useLoadIcons = ({ brandName, cdnURL = "/" }) => {
9876
9900
  const [iconIndex, setIconIndex] = React.useState();
9877
9901
  React.useEffect(() => {
9878
- (() => __async$1(void 0, null, function* () {
9902
+ (() => __async(void 0, null, function* () {
9879
9903
  try {
9880
9904
  const result = yield axios.get("/brand/iconIndex.json", { baseURL: cdnURL });
9881
9905
  setIconIndex(result.data);
@@ -9885,7 +9909,7 @@ const useLoadIcons = ({ brandName, cdnURL = "/" }) => {
9885
9909
  }))();
9886
9910
  }, [brandName, cdnURL]);
9887
9911
  return React.useCallback(
9888
- (iconName) => __async$1(void 0, null, function* () {
9912
+ (iconName) => __async(void 0, null, function* () {
9889
9913
  if (iconIndex) {
9890
9914
  const iconBrand = (iconIndex[iconName.toLowerCase()] || []).includes(brandName) ? brandName : brands.BrandName.FALLBACK;
9891
9915
  const result = yield axios.get(
@@ -9911,39 +9935,7 @@ const useLoadTheme = ({ cdnURL = "/", brandName }) => {
9911
9935
  return theme;
9912
9936
  };
9913
9937
 
9914
- var __defProp$2 = Object.defineProperty;
9915
- var __defProps$1 = Object.defineProperties;
9916
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
9917
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
9918
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
9919
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
9920
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9921
- var __spreadValues$2 = (a, b) => {
9922
- for (var prop in b || (b = {}))
9923
- if (__hasOwnProp$2.call(b, prop))
9924
- __defNormalProp$2(a, prop, b[prop]);
9925
- if (__getOwnPropSymbols$2)
9926
- for (var prop of __getOwnPropSymbols$2(b)) {
9927
- if (__propIsEnum$2.call(b, prop))
9928
- __defNormalProp$2(a, prop, b[prop]);
9929
- }
9930
- return a;
9931
- };
9932
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
9933
9938
  const AlchemyContext = React.createContext(void 0);
9934
- const renderAlchemyProviders = ({
9935
- baseURL,
9936
- children,
9937
- getToken,
9938
- theme,
9939
- scope,
9940
- fontStyles,
9941
- iconCache,
9942
- resolveIcon
9943
- }) => /* @__PURE__ */ jsxs(react.ThemeProvider, { theme, children: [
9944
- /* @__PURE__ */ jsx(react.Global, { styles: [giger.getEmotionResetStyles(scope), fontStyles] }),
9945
- /* @__PURE__ */ jsx(giger.GigerConfigProvider, { iconCache, resolveIcon, children: /* @__PURE__ */ jsx(ShipEngine, { baseURL, getToken, children }) })
9946
- ] });
9947
9939
  const AlchemyProvider = ({
9948
9940
  baseURL = "https://api.shipengine.com",
9949
9941
  brandName = brands.BrandName.FALLBACK,
@@ -9961,7 +9953,10 @@ const AlchemyProvider = ({
9961
9953
  if (!theme)
9962
9954
  return null;
9963
9955
  const contextValue = { baseURL, brandName, cdnURL, getToken, locale, onError, scope, theme };
9964
- return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: renderAlchemyProviders(__spreadProps$1(__spreadValues$2({}, contextValue), { children, fontStyles, iconCache, resolveIcon })) });
9956
+ return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs(react.ThemeProvider, { theme, children: [
9957
+ /* @__PURE__ */ jsx(react.Global, { styles: [giger.getEmotionResetStyles(scope), fontStyles] }),
9958
+ /* @__PURE__ */ jsx(giger.GigerConfigProvider, { iconCache, resolveIcon, children: /* @__PURE__ */ jsx(ShipEngine, { baseURL, getToken, children }) })
9959
+ ] }) });
9965
9960
  };
9966
9961
  const useAlchemy = () => {
9967
9962
  const context = React.useContext(AlchemyContext);
@@ -9971,57 +9966,10 @@ const useAlchemy = () => {
9971
9966
  return context;
9972
9967
  };
9973
9968
 
9974
- var __defProp$1 = Object.defineProperty;
9975
- var __defProps = Object.defineProperties;
9976
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9977
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
9978
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
9979
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
9980
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9981
- var __spreadValues$1 = (a, b) => {
9982
- for (var prop in b || (b = {}))
9983
- if (__hasOwnProp$1.call(b, prop))
9984
- __defNormalProp$1(a, prop, b[prop]);
9985
- if (__getOwnPropSymbols$1)
9986
- for (var prop of __getOwnPropSymbols$1(b)) {
9987
- if (__propIsEnum$1.call(b, prop))
9988
- __defNormalProp$1(a, prop, b[prop]);
9989
- }
9990
- return a;
9991
- };
9992
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9993
- var __async = (__this, __arguments, generator) => {
9994
- return new Promise((resolve, reject) => {
9995
- var fulfilled = (value) => {
9996
- try {
9997
- step(generator.next(value));
9998
- } catch (e) {
9999
- reject(e);
10000
- }
10001
- };
10002
- var rejected = (value) => {
10003
- try {
10004
- step(generator.throw(value));
10005
- } catch (e) {
10006
- reject(e);
10007
- }
10008
- };
10009
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
10010
- step((generator = generator.apply(__this, __arguments)).next());
10011
- });
10012
- };
10013
9969
  const AlchemyTestProvider = ({ baseURL, children }) => {
10014
9970
  const scope = "lmnt";
10015
9971
  const theme = React.useMemo(() => new gigerTheme.Theme(), []);
10016
- const fontStyles = react.css({ [`.${scope}`]: { fontFamily: theme.defaultFontFamily } });
10017
9972
  const getToken = React.useCallback(() => "none", []);
10018
- const iconCache = React.useMemo(giger.createIconCache, []);
10019
- const resolveIcon = React.useCallback(
10020
- (iconName) => __async(void 0, null, function* () {
10021
- return `<svg data-svg-id="${iconName}">mock icon-${iconName}</svg>`;
10022
- }),
10023
- []
10024
- );
10025
9973
  const contextValue = {
10026
9974
  baseURL,
10027
9975
  brandName: brands.BrandName.FALLBACK,
@@ -10031,7 +9979,7 @@ const AlchemyTestProvider = ({ baseURL, children }) => {
10031
9979
  scope,
10032
9980
  theme
10033
9981
  };
10034
- return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: renderAlchemyProviders(__spreadProps(__spreadValues$1({}, contextValue), { children, fontStyles, iconCache, resolveIcon })) });
9982
+ return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(giger.GigerTestProvider, { theme, children: /* @__PURE__ */ jsx(ShipEngine, { baseURL, getToken, children }) }) });
10035
9983
  };
10036
9984
 
10037
9985
  var classnamesExports = {};
@@ -10693,7 +10641,6 @@ exports.isCodedErrors = isCodedErrors;
10693
10641
  exports.logger = logger;
10694
10642
  exports.memoizedCreateCache = memoizedCreateCache;
10695
10643
  exports.onError = onError;
10696
- exports.renderAlchemyProviders = renderAlchemyProviders;
10697
10644
  exports.retryUntil = retryUntil;
10698
10645
  exports.useAddFunds = useAddFunds;
10699
10646
  exports.useAlchemy = useAlchemy;
@@ -10726,6 +10673,7 @@ exports.useGetServicesByCarrier = useGetServicesByCarrier;
10726
10673
  exports.useGetShipment = useGetShipment;
10727
10674
  exports.useGetShipmentRates = useGetShipmentRates;
10728
10675
  exports.useGetWalletHistory = useGetWalletHistory;
10676
+ exports.useGetZonesByCarrier = useGetZonesByCarrier;
10729
10677
  exports.useI18n = useI18n;
10730
10678
  exports.useListCarriers = useListCarriers;
10731
10679
  exports.useListCustomPackageTypes = useListCustomPackageTypes;