@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.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
- import { createContext, forwardRef, useContext, createElement as createElement$1, Fragment, useState, useEffect, useMemo } from 'react';
2
+ import { createContext, forwardRef, useContext, createElement as createElement$1, Fragment, useState, useEffect, useCallback, useMemo } from 'react';
3
3
  import { jsx as jsx$1, jsxs as jsxs$1 } from 'react/jsx-runtime';
4
4
  import { css, Global, ThemeProvider, CacheProvider } from '@emotion/react';
5
5
  import { BrandName } from '@packlink/brands';
6
- import { getEmotionResetStyles, GigerConfigProvider } from '@packlink/giger';
6
+ import { getEmotionResetStyles, createIconCache, GigerConfigProvider } from '@packlink/giger';
7
7
  import { QueryClient, QueryClientProvider, useMutation, useQuery, useQueryClient } from 'react-query';
8
8
  import { Theme } from '@packlink/giger-theme';
9
9
  import { I18nextProvider } from 'react-i18next';
@@ -2455,17 +2455,17 @@ Object.defineProperty(dist, "__esModule", { value: true });
2455
2455
  var _default = dist.default = (function () {
2456
2456
  });
2457
2457
 
2458
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
2459
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
2460
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
2458
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
2459
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
2460
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
2461
2461
  var __objRest$8 = (source, exclude) => {
2462
2462
  var target = {};
2463
2463
  for (var prop in source)
2464
- if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
2464
+ if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
2465
2465
  target[prop] = source[prop];
2466
- if (source != null && __getOwnPropSymbols$c)
2467
- for (var prop of __getOwnPropSymbols$c(source)) {
2468
- if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
2466
+ if (source != null && __getOwnPropSymbols$e)
2467
+ for (var prop of __getOwnPropSymbols$e(source)) {
2468
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
2469
2469
  target[prop] = source[prop];
2470
2470
  }
2471
2471
  return target;
@@ -5209,7 +5209,7 @@ var ipaddr = {
5209
5209
  }).call(commonjsGlobal);
5210
5210
  } (ipaddr));
5211
5211
 
5212
- var __async$u = (__this, __arguments, generator) => {
5212
+ var __async$v = (__this, __arguments, generator) => {
5213
5213
  return new Promise((resolve, reject) => {
5214
5214
  var fulfilled = (value) => {
5215
5215
  try {
@@ -5229,7 +5229,7 @@ var __async$u = (__this, __arguments, generator) => {
5229
5229
  step((generator = generator.apply(__this, __arguments)).next());
5230
5230
  });
5231
5231
  };
5232
- const getEndUserIpAddress = () => __async$u(void 0, null, function* () {
5232
+ const getEndUserIpAddress = () => __async$v(void 0, null, function* () {
5233
5233
  try {
5234
5234
  const response = yield axios.get("https://api.ipify.org/?format=json");
5235
5235
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -5241,38 +5241,38 @@ const getEndUserIpAddress = () => __async$u(void 0, null, function* () {
5241
5241
  }
5242
5242
  });
5243
5243
 
5244
- var __defProp$5 = Object.defineProperty;
5245
- var __defProps$3 = Object.defineProperties;
5246
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
5247
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
5248
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
5249
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
5250
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5251
- var __spreadValues$5 = (a, b) => {
5244
+ var __defProp$7 = Object.defineProperty;
5245
+ var __defProps$5 = Object.defineProperties;
5246
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
5247
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
5248
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
5249
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
5250
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5251
+ var __spreadValues$7 = (a, b) => {
5252
5252
  for (var prop in b || (b = {}))
5253
- if (__hasOwnProp$b.call(b, prop))
5254
- __defNormalProp$5(a, prop, b[prop]);
5255
- if (__getOwnPropSymbols$b)
5256
- for (var prop of __getOwnPropSymbols$b(b)) {
5257
- if (__propIsEnum$b.call(b, prop))
5258
- __defNormalProp$5(a, prop, b[prop]);
5253
+ if (__hasOwnProp$d.call(b, prop))
5254
+ __defNormalProp$7(a, prop, b[prop]);
5255
+ if (__getOwnPropSymbols$d)
5256
+ for (var prop of __getOwnPropSymbols$d(b)) {
5257
+ if (__propIsEnum$d.call(b, prop))
5258
+ __defNormalProp$7(a, prop, b[prop]);
5259
5259
  }
5260
5260
  return a;
5261
5261
  };
5262
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
5262
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
5263
5263
  var __objRest$7 = (source, exclude) => {
5264
5264
  var target = {};
5265
5265
  for (var prop in source)
5266
- if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
5266
+ if (__hasOwnProp$d.call(source, prop) && exclude.indexOf(prop) < 0)
5267
5267
  target[prop] = source[prop];
5268
- if (source != null && __getOwnPropSymbols$b)
5269
- for (var prop of __getOwnPropSymbols$b(source)) {
5270
- if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
5268
+ if (source != null && __getOwnPropSymbols$d)
5269
+ for (var prop of __getOwnPropSymbols$d(source)) {
5270
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$d.call(source, prop))
5271
5271
  target[prop] = source[prop];
5272
5272
  }
5273
5273
  return target;
5274
5274
  };
5275
- var __async$t = (__this, __arguments, generator) => {
5275
+ var __async$u = (__this, __arguments, generator) => {
5276
5276
  return new Promise((resolve, reject) => {
5277
5277
  var fulfilled = (value) => {
5278
5278
  try {
@@ -5301,12 +5301,12 @@ class CarriersAPI {
5301
5301
  this.get = (carrierId) => {
5302
5302
  return this.client.get(`/v1/carriers/${carrierId}`);
5303
5303
  };
5304
- this.connect = (_a) => __async$t(this, null, function* () {
5304
+ this.connect = (_a) => __async$u(this, null, function* () {
5305
5305
  var _b = _a, { carrierCode } = _b, connection = __objRest$7(_b, ["carrierCode"]);
5306
5306
  const endUserIpAddress = yield getEndUserIpAddress();
5307
5307
  if (!endUserIpAddress)
5308
5308
  return Promise.reject([new CodedError("Unable to get IP address")]);
5309
- return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$3(__spreadValues$5({}, connection), {
5309
+ return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$5(__spreadValues$7({}, connection), {
5310
5310
  endUserIpAddress
5311
5311
  }));
5312
5312
  });
@@ -7538,23 +7538,23 @@ class CustomPackagesAPI {
7538
7538
  }
7539
7539
  }
7540
7540
 
7541
- var __defProp$4 = Object.defineProperty;
7542
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
7543
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
7544
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
7545
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7546
- var __spreadValues$4 = (a, b) => {
7541
+ var __defProp$6 = Object.defineProperty;
7542
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
7543
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
7544
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
7545
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7546
+ var __spreadValues$6 = (a, b) => {
7547
7547
  for (var prop in b || (b = {}))
7548
- if (__hasOwnProp$a.call(b, prop))
7549
- __defNormalProp$4(a, prop, b[prop]);
7550
- if (__getOwnPropSymbols$a)
7551
- for (var prop of __getOwnPropSymbols$a(b)) {
7552
- if (__propIsEnum$a.call(b, prop))
7553
- __defNormalProp$4(a, prop, b[prop]);
7548
+ if (__hasOwnProp$c.call(b, prop))
7549
+ __defNormalProp$6(a, prop, b[prop]);
7550
+ if (__getOwnPropSymbols$c)
7551
+ for (var prop of __getOwnPropSymbols$c(b)) {
7552
+ if (__propIsEnum$c.call(b, prop))
7553
+ __defNormalProp$6(a, prop, b[prop]);
7554
7554
  }
7555
7555
  return a;
7556
7556
  };
7557
- var __async$s = (__this, __arguments, generator) => {
7557
+ var __async$t = (__this, __arguments, generator) => {
7558
7558
  return new Promise((resolve, reject) => {
7559
7559
  var fulfilled = (value) => {
7560
7560
  try {
@@ -7583,15 +7583,15 @@ class FundingSourcesAPI {
7583
7583
  this.get = (fundingSourceId) => {
7584
7584
  return this.client.get(`/v1/funding_sources/${fundingSourceId}`);
7585
7585
  };
7586
- this.create = (createFundingSource) => __async$s(this, null, function* () {
7586
+ this.create = (createFundingSource) => __async$t(this, null, function* () {
7587
7587
  const endUserIpAddress = yield getEndUserIpAddress();
7588
7588
  if (!endUserIpAddress)
7589
7589
  return Promise.reject([new CodedError("Unable to get IP address")]);
7590
- return yield this.client.post("/v1/funding_sources", __spreadValues$4({
7590
+ return yield this.client.post("/v1/funding_sources", __spreadValues$6({
7591
7591
  endUserIpAddress
7592
7592
  }, createFundingSource));
7593
7593
  });
7594
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$s(this, null, function* () {
7594
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$t(this, null, function* () {
7595
7595
  const endUserIpAddress = yield getEndUserIpAddress();
7596
7596
  if (!endUserIpAddress)
7597
7597
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7604,15 +7604,15 @@ class FundingSourcesAPI {
7604
7604
  }
7605
7605
  );
7606
7606
  });
7607
- this.registerCarrier = (carrier) => __async$s(this, null, function* () {
7607
+ this.registerCarrier = (carrier) => __async$t(this, null, function* () {
7608
7608
  const endUserIpAddress = yield getEndUserIpAddress();
7609
7609
  if (!endUserIpAddress)
7610
7610
  return Promise.reject([new CodedError("Unable to get IP address")]);
7611
- return yield this.client.post("/v1/registration/funding_source", __spreadValues$4({
7611
+ return yield this.client.post("/v1/registration/funding_source", __spreadValues$6({
7612
7612
  endUserIpAddress
7613
7613
  }, carrier));
7614
7614
  });
7615
- this.addFunds = (amount, fundingSourceId) => __async$s(this, null, function* () {
7615
+ this.addFunds = (amount, fundingSourceId) => __async$t(this, null, function* () {
7616
7616
  return yield this.client.put(
7617
7617
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
7618
7618
  amount
@@ -7692,6 +7692,15 @@ class RateCardsAPI {
7692
7692
  responseType: "blob"
7693
7693
  });
7694
7694
  };
7695
+ this.upload = (rateCardId, file) => {
7696
+ const formData = new FormData();
7697
+ formData.append("file", file);
7698
+ return this.client.put(`/v1/rate_cards/${rateCardId}/rates/upload`, formData, {
7699
+ headers: {
7700
+ ContentType: "multipart/form-data"
7701
+ }
7702
+ });
7703
+ };
7695
7704
  this.client = client;
7696
7705
  }
7697
7706
  }
@@ -7749,7 +7758,7 @@ class SalesOrdersAPI {
7749
7758
  }
7750
7759
  }
7751
7760
 
7752
- var __async$r = (__this, __arguments, generator) => {
7761
+ var __async$s = (__this, __arguments, generator) => {
7753
7762
  return new Promise((resolve, reject) => {
7754
7763
  var fulfilled = (value) => {
7755
7764
  try {
@@ -7781,7 +7790,7 @@ class ShipmentsAPI {
7781
7790
  this.list = (options) => {
7782
7791
  return this.client.get("/v1/shipments", { params: options });
7783
7792
  };
7784
- this.create = (...shipments) => __async$r(this, null, function* () {
7793
+ this.create = (...shipments) => __async$s(this, null, function* () {
7785
7794
  return this.client.post("/v1/shipments", {
7786
7795
  shipments
7787
7796
  });
@@ -7809,26 +7818,26 @@ class WarehousesAPI {
7809
7818
  }
7810
7819
  }
7811
7820
 
7812
- var __defProp$3 = Object.defineProperty;
7813
- var __defProps$2 = Object.defineProperties;
7814
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
7815
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
7816
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
7817
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
7818
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7819
- var __spreadValues$3 = (a, b) => {
7821
+ var __defProp$5 = Object.defineProperty;
7822
+ var __defProps$4 = Object.defineProperties;
7823
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
7824
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
7825
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
7826
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
7827
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7828
+ var __spreadValues$5 = (a, b) => {
7820
7829
  for (var prop in b || (b = {}))
7821
- if (__hasOwnProp$9.call(b, prop))
7822
- __defNormalProp$3(a, prop, b[prop]);
7823
- if (__getOwnPropSymbols$9)
7824
- for (var prop of __getOwnPropSymbols$9(b)) {
7825
- if (__propIsEnum$9.call(b, prop))
7826
- __defNormalProp$3(a, prop, b[prop]);
7830
+ if (__hasOwnProp$b.call(b, prop))
7831
+ __defNormalProp$5(a, prop, b[prop]);
7832
+ if (__getOwnPropSymbols$b)
7833
+ for (var prop of __getOwnPropSymbols$b(b)) {
7834
+ if (__propIsEnum$b.call(b, prop))
7835
+ __defNormalProp$5(a, prop, b[prop]);
7827
7836
  }
7828
7837
  return a;
7829
7838
  };
7830
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
7831
- var __async$q = (__this, __arguments, generator) => {
7839
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
7840
+ var __async$r = (__this, __arguments, generator) => {
7832
7841
  return new Promise((resolve, reject) => {
7833
7842
  var fulfilled = (value) => {
7834
7843
  try {
@@ -7850,7 +7859,7 @@ var __async$q = (__this, __arguments, generator) => {
7850
7859
  };
7851
7860
  const logger$1 = E({
7852
7861
  name: "shipengine-api",
7853
- serializers: __spreadProps$2(__spreadValues$3({}, k), {
7862
+ serializers: __spreadProps$4(__spreadValues$5({}, k), {
7854
7863
  req: (req) => ({
7855
7864
  headers: req.headers,
7856
7865
  method: req.method,
@@ -7875,7 +7884,7 @@ class ShipEngineAPI {
7875
7884
  constructor(token, { baseURL, headers, getToken }) {
7876
7885
  const client = axios.create({
7877
7886
  baseURL,
7878
- headers: __spreadProps$2(__spreadValues$3({}, headers), {
7887
+ headers: __spreadProps$4(__spreadValues$5({}, headers), {
7879
7888
  Authorization: `Bearer ${token}`,
7880
7889
  "Content-Type": "application/json"
7881
7890
  }),
@@ -7909,7 +7918,7 @@ class ShipEngineAPI {
7909
7918
  );
7910
7919
  return res;
7911
7920
  },
7912
- (err) => __async$q(this, null, function* () {
7921
+ (err) => __async$r(this, null, function* () {
7913
7922
  var _a, _b, _c, _d, _e, _f, _g;
7914
7923
  logger$1.error(
7915
7924
  { err, req: err.config, res: err.response },
@@ -8049,25 +8058,25 @@ const delay = (ms) => new Promise((resolve) => {
8049
8058
 
8050
8059
  const onError = (errors) => errors.forEach(console.log);
8051
8060
 
8052
- var __defProp$2 = Object.defineProperty;
8053
- var __defProps$1 = Object.defineProperties;
8054
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
8055
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8056
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8057
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8058
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8059
- var __spreadValues$2 = (a, b) => {
8061
+ var __defProp$4 = Object.defineProperty;
8062
+ var __defProps$3 = Object.defineProperties;
8063
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
8064
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
8065
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8066
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
8067
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8068
+ var __spreadValues$4 = (a, b) => {
8060
8069
  for (var prop in b || (b = {}))
8061
- if (__hasOwnProp$8.call(b, prop))
8062
- __defNormalProp$2(a, prop, b[prop]);
8063
- if (__getOwnPropSymbols$8)
8064
- for (var prop of __getOwnPropSymbols$8(b)) {
8065
- if (__propIsEnum$8.call(b, prop))
8066
- __defNormalProp$2(a, prop, b[prop]);
8070
+ if (__hasOwnProp$a.call(b, prop))
8071
+ __defNormalProp$4(a, prop, b[prop]);
8072
+ if (__getOwnPropSymbols$a)
8073
+ for (var prop of __getOwnPropSymbols$a(b)) {
8074
+ if (__propIsEnum$a.call(b, prop))
8075
+ __defNormalProp$4(a, prop, b[prop]);
8067
8076
  }
8068
8077
  return a;
8069
8078
  };
8070
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
8079
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
8071
8080
  const streams = [];
8072
8081
  if (process.env.NODE_ENV === "production") {
8073
8082
  streams.push({
@@ -8076,7 +8085,7 @@ if (process.env.NODE_ENV === "production") {
8076
8085
  }
8077
8086
  const logger = E({
8078
8087
  name: "shipengine",
8079
- serializers: __spreadProps$1(__spreadValues$2({}, k), {
8088
+ serializers: __spreadProps$3(__spreadValues$4({}, k), {
8080
8089
  req: (req) => ({
8081
8090
  headers: req.headers,
8082
8091
  method: req.method,
@@ -8101,7 +8110,7 @@ const retryUntil = (callbackFn, retries = 10, timeoutBetweenAttempts = 1e3) => P
8101
8110
  throw error;
8102
8111
  });
8103
8112
 
8104
- var __async$p = (__this, __arguments, generator) => {
8113
+ var __async$q = (__this, __arguments, generator) => {
8105
8114
  return new Promise((resolve, reject) => {
8106
8115
  var fulfilled = (value) => {
8107
8116
  try {
@@ -8124,7 +8133,7 @@ var __async$p = (__this, __arguments, generator) => {
8124
8133
  const useAddFunds = (carrierId) => {
8125
8134
  const { client } = useShipEngine();
8126
8135
  return useMutation({
8127
- mutationFn: (funds) => __async$p(void 0, null, function* () {
8136
+ mutationFn: (funds) => __async$q(void 0, null, function* () {
8128
8137
  const result = yield client.carriers.addFunds(carrierId, funds);
8129
8138
  return result.data;
8130
8139
  }),
@@ -8133,7 +8142,7 @@ const useAddFunds = (carrierId) => {
8133
8142
  });
8134
8143
  };
8135
8144
 
8136
- var __async$o = (__this, __arguments, generator) => {
8145
+ var __async$p = (__this, __arguments, generator) => {
8137
8146
  return new Promise((resolve, reject) => {
8138
8147
  var fulfilled = (value) => {
8139
8148
  try {
@@ -8156,7 +8165,7 @@ var __async$o = (__this, __arguments, generator) => {
8156
8165
  const useCalculateRates = () => {
8157
8166
  const { client } = useShipEngine();
8158
8167
  return useMutation({
8159
- mutationFn: (_0) => __async$o(void 0, [_0], function* ({ rateOptions, shipmentId }) {
8168
+ mutationFn: (_0) => __async$p(void 0, [_0], function* ({ rateOptions, shipmentId }) {
8160
8169
  const result = yield client.rates.calculateByShipmentId(shipmentId, rateOptions);
8161
8170
  return result.data;
8162
8171
  }),
@@ -8165,7 +8174,7 @@ const useCalculateRates = () => {
8165
8174
  });
8166
8175
  };
8167
8176
 
8168
- var __async$n = (__this, __arguments, generator) => {
8177
+ var __async$o = (__this, __arguments, generator) => {
8169
8178
  return new Promise((resolve, reject) => {
8170
8179
  var fulfilled = (value) => {
8171
8180
  try {
@@ -8188,7 +8197,7 @@ var __async$n = (__this, __arguments, generator) => {
8188
8197
  const useConnectCarrier = () => {
8189
8198
  const { client } = useShipEngine();
8190
8199
  return useMutation({
8191
- mutationFn: (params) => __async$n(void 0, null, function* () {
8200
+ mutationFn: (params) => __async$o(void 0, null, function* () {
8192
8201
  const result = yield client.carriers.connect(params);
8193
8202
  return result.data;
8194
8203
  }),
@@ -8197,7 +8206,7 @@ const useConnectCarrier = () => {
8197
8206
  });
8198
8207
  };
8199
8208
 
8200
- var __async$m = (__this, __arguments, generator) => {
8209
+ var __async$n = (__this, __arguments, generator) => {
8201
8210
  return new Promise((resolve, reject) => {
8202
8211
  var fulfilled = (value) => {
8203
8212
  try {
@@ -8220,7 +8229,7 @@ var __async$m = (__this, __arguments, generator) => {
8220
8229
  const useCreateFundingSource = () => {
8221
8230
  const { client } = useShipEngine();
8222
8231
  return useMutation({
8223
- mutationFn: (fundingSource) => __async$m(void 0, null, function* () {
8232
+ mutationFn: (fundingSource) => __async$n(void 0, null, function* () {
8224
8233
  const result = yield client.fundingSources.create(fundingSource);
8225
8234
  return result.data;
8226
8235
  }),
@@ -8229,22 +8238,22 @@ const useCreateFundingSource = () => {
8229
8238
  });
8230
8239
  };
8231
8240
 
8232
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8233
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8234
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8241
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8242
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8243
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8235
8244
  var __objRest$6 = (source, exclude) => {
8236
8245
  var target = {};
8237
8246
  for (var prop in source)
8238
- if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
8247
+ if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
8239
8248
  target[prop] = source[prop];
8240
- if (source != null && __getOwnPropSymbols$7)
8241
- for (var prop of __getOwnPropSymbols$7(source)) {
8242
- if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
8249
+ if (source != null && __getOwnPropSymbols$9)
8250
+ for (var prop of __getOwnPropSymbols$9(source)) {
8251
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
8243
8252
  target[prop] = source[prop];
8244
8253
  }
8245
8254
  return target;
8246
8255
  };
8247
- var __async$l = (__this, __arguments, generator) => {
8256
+ var __async$m = (__this, __arguments, generator) => {
8248
8257
  return new Promise((resolve, reject) => {
8249
8258
  var fulfilled = (value) => {
8250
8259
  try {
@@ -8267,7 +8276,7 @@ var __async$l = (__this, __arguments, generator) => {
8267
8276
  const useCreateLabel = () => {
8268
8277
  const { client } = useShipEngine();
8269
8278
  return useMutation({
8270
- mutationFn: (_a) => __async$l(void 0, null, function* () {
8279
+ mutationFn: (_a) => __async$m(void 0, null, function* () {
8271
8280
  var _b = _a, { rateId } = _b, options = __objRest$6(_b, ["rateId"]);
8272
8281
  const result = yield client.labels.createByRateId(rateId, options);
8273
8282
  return result.data;
@@ -8277,7 +8286,7 @@ const useCreateLabel = () => {
8277
8286
  });
8278
8287
  };
8279
8288
 
8280
- var __async$k = (__this, __arguments, generator) => {
8289
+ var __async$l = (__this, __arguments, generator) => {
8281
8290
  return new Promise((resolve, reject) => {
8282
8291
  var fulfilled = (value) => {
8283
8292
  try {
@@ -8300,7 +8309,7 @@ var __async$k = (__this, __arguments, generator) => {
8300
8309
  const useCreateRateCard = () => {
8301
8310
  const { client } = useShipEngine();
8302
8311
  return useMutation({
8303
- mutationFn: (rateCard) => __async$k(void 0, null, function* () {
8312
+ mutationFn: (rateCard) => __async$l(void 0, null, function* () {
8304
8313
  const result = yield client.rateCards.create(rateCard);
8305
8314
  return result.data;
8306
8315
  }),
@@ -8309,22 +8318,22 @@ const useCreateRateCard = () => {
8309
8318
  });
8310
8319
  };
8311
8320
 
8312
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8313
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8314
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8321
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8322
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8323
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8315
8324
  var __objRest$5 = (source, exclude) => {
8316
8325
  var target = {};
8317
8326
  for (var prop in source)
8318
- if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
8327
+ if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
8319
8328
  target[prop] = source[prop];
8320
- if (source != null && __getOwnPropSymbols$6)
8321
- for (var prop of __getOwnPropSymbols$6(source)) {
8322
- if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
8329
+ if (source != null && __getOwnPropSymbols$8)
8330
+ for (var prop of __getOwnPropSymbols$8(source)) {
8331
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
8323
8332
  target[prop] = source[prop];
8324
8333
  }
8325
8334
  return target;
8326
8335
  };
8327
- var __async$j = (__this, __arguments, generator) => {
8336
+ var __async$k = (__this, __arguments, generator) => {
8328
8337
  return new Promise((resolve, reject) => {
8329
8338
  var fulfilled = (value) => {
8330
8339
  try {
@@ -8347,7 +8356,7 @@ var __async$j = (__this, __arguments, generator) => {
8347
8356
  const useCreateSalesOrderShipment = () => {
8348
8357
  const { client } = useShipEngine();
8349
8358
  return useMutation({
8350
- mutationFn: (_a) => __async$j(void 0, null, function* () {
8359
+ mutationFn: (_a) => __async$k(void 0, null, function* () {
8351
8360
  var _b = _a, { salesOrderId } = _b, shipment = __objRest$5(_b, ["salesOrderId"]);
8352
8361
  const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
8353
8362
  return result.data;
@@ -8357,26 +8366,26 @@ const useCreateSalesOrderShipment = () => {
8357
8366
  });
8358
8367
  };
8359
8368
 
8360
- var __defProp$1 = Object.defineProperty;
8361
- var __defProps = Object.defineProperties;
8362
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
8363
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
8364
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
8365
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
8366
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8367
- var __spreadValues$1 = (a, b) => {
8369
+ var __defProp$3 = Object.defineProperty;
8370
+ var __defProps$2 = Object.defineProperties;
8371
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
8372
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8373
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8374
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8375
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8376
+ var __spreadValues$3 = (a, b) => {
8368
8377
  for (var prop in b || (b = {}))
8369
- if (__hasOwnProp$5.call(b, prop))
8370
- __defNormalProp$1(a, prop, b[prop]);
8371
- if (__getOwnPropSymbols$5)
8372
- for (var prop of __getOwnPropSymbols$5(b)) {
8373
- if (__propIsEnum$5.call(b, prop))
8374
- __defNormalProp$1(a, prop, b[prop]);
8378
+ if (__hasOwnProp$7.call(b, prop))
8379
+ __defNormalProp$3(a, prop, b[prop]);
8380
+ if (__getOwnPropSymbols$7)
8381
+ for (var prop of __getOwnPropSymbols$7(b)) {
8382
+ if (__propIsEnum$7.call(b, prop))
8383
+ __defNormalProp$3(a, prop, b[prop]);
8375
8384
  }
8376
8385
  return a;
8377
8386
  };
8378
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8379
- var __async$i = (__this, __arguments, generator) => {
8387
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
8388
+ var __async$j = (__this, __arguments, generator) => {
8380
8389
  return new Promise((resolve, reject) => {
8381
8390
  var fulfilled = (value) => {
8382
8391
  try {
@@ -8399,7 +8408,7 @@ var __async$i = (__this, __arguments, generator) => {
8399
8408
  const useCreateShipment = () => {
8400
8409
  const { client } = useShipEngine();
8401
8410
  return useMutation({
8402
- mutationFn: (shipment) => __async$i(void 0, null, function* () {
8411
+ mutationFn: (shipment) => __async$j(void 0, null, function* () {
8403
8412
  var _a;
8404
8413
  if (shipment.warehouseId === void 0) {
8405
8414
  throw new CodedError("errorMessages.noWarehouses", {
@@ -8417,7 +8426,7 @@ const useCreateShipment = () => {
8417
8426
  postalCode: "",
8418
8427
  stateProvince: ""
8419
8428
  };
8420
- return (yield client.shipments.create(__spreadProps(__spreadValues$1({}, shipment), {
8429
+ return (yield client.shipments.create(__spreadProps$2(__spreadValues$3({}, shipment), {
8421
8430
  shipTo
8422
8431
  }))).data;
8423
8432
  }),
@@ -8426,7 +8435,7 @@ const useCreateShipment = () => {
8426
8435
  });
8427
8436
  };
8428
8437
 
8429
- var __async$h = (__this, __arguments, generator) => {
8438
+ var __async$i = (__this, __arguments, generator) => {
8430
8439
  return new Promise((resolve, reject) => {
8431
8440
  var fulfilled = (value) => {
8432
8441
  try {
@@ -8449,7 +8458,7 @@ var __async$h = (__this, __arguments, generator) => {
8449
8458
  const useCreateWarehouse = () => {
8450
8459
  const { client } = useShipEngine();
8451
8460
  return useMutation({
8452
- mutationFn: (data) => __async$h(void 0, null, function* () {
8461
+ mutationFn: (data) => __async$i(void 0, null, function* () {
8453
8462
  const result = yield client.warehouses.create(data);
8454
8463
  return result.data;
8455
8464
  }),
@@ -8458,7 +8467,7 @@ const useCreateWarehouse = () => {
8458
8467
  });
8459
8468
  };
8460
8469
 
8461
- var __async$g = (__this, __arguments, generator) => {
8470
+ var __async$h = (__this, __arguments, generator) => {
8462
8471
  return new Promise((resolve, reject) => {
8463
8472
  var fulfilled = (value) => {
8464
8473
  try {
@@ -8481,7 +8490,7 @@ var __async$g = (__this, __arguments, generator) => {
8481
8490
  const useDeleteWarehouse = () => {
8482
8491
  const { client } = useShipEngine();
8483
8492
  return useMutation({
8484
- mutationFn: (_0) => __async$g(void 0, [_0], function* ({ warehouseId }) {
8493
+ mutationFn: (_0) => __async$h(void 0, [_0], function* ({ warehouseId }) {
8485
8494
  const result = yield client.warehouses.delete(warehouseId);
8486
8495
  return result.data;
8487
8496
  }),
@@ -8502,7 +8511,7 @@ const useDownloadRateCard = (rateCardId) => {
8502
8511
  });
8503
8512
  };
8504
8513
 
8505
- var __async$f = (__this, __arguments, generator) => {
8514
+ var __async$g = (__this, __arguments, generator) => {
8506
8515
  return new Promise((resolve, reject) => {
8507
8516
  var fulfilled = (value) => {
8508
8517
  try {
@@ -8525,7 +8534,7 @@ var __async$f = (__this, __arguments, generator) => {
8525
8534
  const useFundingSourcesAddFunds = (fundingSourceId) => {
8526
8535
  const { client } = useShipEngine();
8527
8536
  return useMutation({
8528
- mutationFn: (funds) => __async$f(void 0, null, function* () {
8537
+ mutationFn: (funds) => __async$g(void 0, null, function* () {
8529
8538
  const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
8530
8539
  return result.data;
8531
8540
  }),
@@ -8863,17 +8872,17 @@ const useListSalesOrders = (params = {}) => {
8863
8872
  });
8864
8873
  };
8865
8874
 
8866
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
8867
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
8868
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
8875
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8876
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8877
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8869
8878
  var __objRest$4 = (source, exclude) => {
8870
8879
  var target = {};
8871
8880
  for (var prop in source)
8872
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
8881
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
8873
8882
  target[prop] = source[prop];
8874
- if (source != null && __getOwnPropSymbols$4)
8875
- for (var prop of __getOwnPropSymbols$4(source)) {
8876
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
8883
+ if (source != null && __getOwnPropSymbols$6)
8884
+ for (var prop of __getOwnPropSymbols$6(source)) {
8885
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
8877
8886
  target[prop] = source[prop];
8878
8887
  }
8879
8888
  return target;
@@ -8902,22 +8911,22 @@ const useListWarehouses = (options) => {
8902
8911
  });
8903
8912
  };
8904
8913
 
8905
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
8906
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
8907
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
8914
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
8915
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
8916
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
8908
8917
  var __objRest$3 = (source, exclude) => {
8909
8918
  var target = {};
8910
8919
  for (var prop in source)
8911
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
8920
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
8912
8921
  target[prop] = source[prop];
8913
- if (source != null && __getOwnPropSymbols$3)
8914
- for (var prop of __getOwnPropSymbols$3(source)) {
8915
- if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
8922
+ if (source != null && __getOwnPropSymbols$5)
8923
+ for (var prop of __getOwnPropSymbols$5(source)) {
8924
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
8916
8925
  target[prop] = source[prop];
8917
8926
  }
8918
8927
  return target;
8919
8928
  };
8920
- var __async$e = (__this, __arguments, generator) => {
8929
+ var __async$f = (__this, __arguments, generator) => {
8921
8930
  return new Promise((resolve, reject) => {
8922
8931
  var fulfilled = (value) => {
8923
8932
  try {
@@ -8940,7 +8949,7 @@ var __async$e = (__this, __arguments, generator) => {
8940
8949
  const useNotifySalesOrderShipped = () => {
8941
8950
  const { client } = useShipEngine();
8942
8951
  return useMutation({
8943
- mutationFn: (_a) => __async$e(void 0, null, function* () {
8952
+ mutationFn: (_a) => __async$f(void 0, null, function* () {
8944
8953
  var _b = _a, { salesOrderId } = _b, tracking = __objRest$3(_b, ["salesOrderId"]);
8945
8954
  const result = yield client.salesOrders.notifyShipped(salesOrderId, tracking);
8946
8955
  return result.data;
@@ -8950,7 +8959,7 @@ const useNotifySalesOrderShipped = () => {
8950
8959
  });
8951
8960
  };
8952
8961
 
8953
- var __async$d = (__this, __arguments, generator) => {
8962
+ var __async$e = (__this, __arguments, generator) => {
8954
8963
  return new Promise((resolve, reject) => {
8955
8964
  var fulfilled = (value) => {
8956
8965
  try {
@@ -8973,7 +8982,7 @@ var __async$d = (__this, __arguments, generator) => {
8973
8982
  const useParseAddress = () => {
8974
8983
  const { client } = useShipEngine();
8975
8984
  return useMutation({
8976
- mutationFn: (_0) => __async$d(void 0, [_0], function* ({ address, text }) {
8985
+ mutationFn: (_0) => __async$e(void 0, [_0], function* ({ address, text }) {
8977
8986
  const result = yield client.addresses.parse(text, address);
8978
8987
  return result.data;
8979
8988
  }),
@@ -8982,7 +8991,7 @@ const useParseAddress = () => {
8982
8991
  });
8983
8992
  };
8984
8993
 
8985
- var __async$c = (__this, __arguments, generator) => {
8994
+ var __async$d = (__this, __arguments, generator) => {
8986
8995
  return new Promise((resolve, reject) => {
8987
8996
  var fulfilled = (value) => {
8988
8997
  try {
@@ -9005,7 +9014,7 @@ var __async$c = (__this, __arguments, generator) => {
9005
9014
  const useRefreshOrderSourceAsync = () => {
9006
9015
  const { client } = useShipEngine();
9007
9016
  return useMutation({
9008
- mutationFn: (orderSourceId) => __async$c(void 0, null, function* () {
9017
+ mutationFn: (orderSourceId) => __async$d(void 0, null, function* () {
9009
9018
  const result = yield client.orderSources.refresh(orderSourceId);
9010
9019
  return result.data;
9011
9020
  }),
@@ -9016,9 +9025,9 @@ const useRefreshOrderSource = () => {
9016
9025
  const { client } = useShipEngine();
9017
9026
  const { mutateAsync: refreshOrderSourceAsync } = useRefreshOrderSourceAsync();
9018
9027
  return useMutation({
9019
- mutationFn: (orderSourceId) => __async$c(void 0, null, function* () {
9028
+ mutationFn: (orderSourceId) => __async$d(void 0, null, function* () {
9020
9029
  yield refreshOrderSourceAsync(orderSourceId);
9021
- const waitResult = yield retryUntil(() => __async$c(void 0, null, function* () {
9030
+ const waitResult = yield retryUntil(() => __async$d(void 0, null, function* () {
9022
9031
  const { data: checkResult } = yield client.orderSources.get(orderSourceId);
9023
9032
  if (["preparing_update", "updating"].includes(checkResult.refreshInfo.status)) {
9024
9033
  throw new CodedError("Order source is still refreshing");
@@ -9032,7 +9041,7 @@ const useRefreshOrderSource = () => {
9032
9041
  });
9033
9042
  };
9034
9043
 
9035
- var __async$b = (__this, __arguments, generator) => {
9044
+ var __async$c = (__this, __arguments, generator) => {
9036
9045
  return new Promise((resolve, reject) => {
9037
9046
  var fulfilled = (value) => {
9038
9047
  try {
@@ -9055,7 +9064,7 @@ var __async$b = (__this, __arguments, generator) => {
9055
9064
  const useRegisterCarrier = () => {
9056
9065
  const { client } = useShipEngine();
9057
9066
  return useMutation({
9058
- mutationFn: (carrier) => __async$b(void 0, null, function* () {
9067
+ mutationFn: (carrier) => __async$c(void 0, null, function* () {
9059
9068
  const result = yield client.fundingSources.registerCarrier(carrier);
9060
9069
  return result.data;
9061
9070
  }),
@@ -9064,7 +9073,7 @@ const useRegisterCarrier = () => {
9064
9073
  });
9065
9074
  };
9066
9075
 
9067
- var __async$a = (__this, __arguments, generator) => {
9076
+ var __async$b = (__this, __arguments, generator) => {
9068
9077
  return new Promise((resolve, reject) => {
9069
9078
  var fulfilled = (value) => {
9070
9079
  try {
@@ -9087,7 +9096,7 @@ var __async$a = (__this, __arguments, generator) => {
9087
9096
  const useUpdateAccountSettings = () => {
9088
9097
  const { client } = useShipEngine();
9089
9098
  return useMutation({
9090
- mutationFn: (settings) => __async$a(void 0, null, function* () {
9099
+ mutationFn: (settings) => __async$b(void 0, null, function* () {
9091
9100
  const result = yield client.accountSettings.update(settings);
9092
9101
  return result.data;
9093
9102
  }),
@@ -9096,7 +9105,7 @@ const useUpdateAccountSettings = () => {
9096
9105
  });
9097
9106
  };
9098
9107
 
9099
- var __async$9 = (__this, __arguments, generator) => {
9108
+ var __async$a = (__this, __arguments, generator) => {
9100
9109
  return new Promise((resolve, reject) => {
9101
9110
  var fulfilled = (value) => {
9102
9111
  try {
@@ -9120,7 +9129,7 @@ const useUpdateAutoFunding = (carrierId) => {
9120
9129
  const { client } = useShipEngine();
9121
9130
  const queryClient = useQueryClient();
9122
9131
  return useMutation({
9123
- mutationFn: (options) => __async$9(void 0, null, function* () {
9132
+ mutationFn: (options) => __async$a(void 0, null, function* () {
9124
9133
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
9125
9134
  return result.data;
9126
9135
  }),
@@ -9132,7 +9141,7 @@ const useUpdateAutoFunding = (carrierId) => {
9132
9141
  });
9133
9142
  };
9134
9143
 
9135
- var __async$8 = (__this, __arguments, generator) => {
9144
+ var __async$9 = (__this, __arguments, generator) => {
9136
9145
  return new Promise((resolve, reject) => {
9137
9146
  var fulfilled = (value) => {
9138
9147
  try {
@@ -9155,7 +9164,7 @@ var __async$8 = (__this, __arguments, generator) => {
9155
9164
  const useUpdateFundingSource = () => {
9156
9165
  const { client } = useShipEngine();
9157
9166
  return useMutation({
9158
- mutationFn: (_0) => __async$8(void 0, [_0], function* ({
9167
+ mutationFn: (_0) => __async$9(void 0, [_0], function* ({
9159
9168
  billingInfo,
9160
9169
  creditCardInfo,
9161
9170
  fundingSourceId
@@ -9172,7 +9181,7 @@ const useUpdateFundingSource = () => {
9172
9181
  });
9173
9182
  };
9174
9183
 
9175
- var __async$7 = (__this, __arguments, generator) => {
9184
+ var __async$8 = (__this, __arguments, generator) => {
9176
9185
  return new Promise((resolve, reject) => {
9177
9186
  var fulfilled = (value) => {
9178
9187
  try {
@@ -9195,7 +9204,7 @@ var __async$7 = (__this, __arguments, generator) => {
9195
9204
  const useUpdateRateCard = () => {
9196
9205
  const { client } = useShipEngine();
9197
9206
  return useMutation({
9198
- mutationFn: (rateCard) => __async$7(void 0, null, function* () {
9207
+ mutationFn: (rateCard) => __async$8(void 0, null, function* () {
9199
9208
  const result = yield client.rateCards.update(rateCard);
9200
9209
  return result.data;
9201
9210
  }),
@@ -9204,22 +9213,22 @@ const useUpdateRateCard = () => {
9204
9213
  });
9205
9214
  };
9206
9215
 
9207
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
9208
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
9209
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
9216
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
9217
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
9218
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
9210
9219
  var __objRest$2 = (source, exclude) => {
9211
9220
  var target = {};
9212
9221
  for (var prop in source)
9213
- if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
9222
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
9214
9223
  target[prop] = source[prop];
9215
- if (source != null && __getOwnPropSymbols$2)
9216
- for (var prop of __getOwnPropSymbols$2(source)) {
9217
- if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
9224
+ if (source != null && __getOwnPropSymbols$4)
9225
+ for (var prop of __getOwnPropSymbols$4(source)) {
9226
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
9218
9227
  target[prop] = source[prop];
9219
9228
  }
9220
9229
  return target;
9221
9230
  };
9222
- var __async$6 = (__this, __arguments, generator) => {
9231
+ var __async$7 = (__this, __arguments, generator) => {
9223
9232
  return new Promise((resolve, reject) => {
9224
9233
  var fulfilled = (value) => {
9225
9234
  try {
@@ -9242,7 +9251,7 @@ var __async$6 = (__this, __arguments, generator) => {
9242
9251
  const useUpdateSalesOrderShipment = () => {
9243
9252
  const { client } = useShipEngine();
9244
9253
  return useMutation({
9245
- mutationFn: (_a) => __async$6(void 0, null, function* () {
9254
+ mutationFn: (_a) => __async$7(void 0, null, function* () {
9246
9255
  var _b = _a, { shipmentId } = _b, shipment = __objRest$2(_b, ["shipmentId"]);
9247
9256
  const result = yield client.salesOrderShipments.update(shipmentId, shipment);
9248
9257
  return result.data;
@@ -9252,22 +9261,22 @@ const useUpdateSalesOrderShipment = () => {
9252
9261
  });
9253
9262
  };
9254
9263
 
9255
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
9256
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
9257
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
9264
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
9265
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
9266
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
9258
9267
  var __objRest$1 = (source, exclude) => {
9259
9268
  var target = {};
9260
9269
  for (var prop in source)
9261
- if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
9270
+ if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
9262
9271
  target[prop] = source[prop];
9263
- if (source != null && __getOwnPropSymbols$1)
9264
- for (var prop of __getOwnPropSymbols$1(source)) {
9265
- if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
9272
+ if (source != null && __getOwnPropSymbols$3)
9273
+ for (var prop of __getOwnPropSymbols$3(source)) {
9274
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
9266
9275
  target[prop] = source[prop];
9267
9276
  }
9268
9277
  return target;
9269
9278
  };
9270
- var __async$5 = (__this, __arguments, generator) => {
9279
+ var __async$6 = (__this, __arguments, generator) => {
9271
9280
  return new Promise((resolve, reject) => {
9272
9281
  var fulfilled = (value) => {
9273
9282
  try {
@@ -9290,7 +9299,7 @@ var __async$5 = (__this, __arguments, generator) => {
9290
9299
  const useUpdateWarehouse = () => {
9291
9300
  const { client } = useShipEngine();
9292
9301
  return useMutation({
9293
- mutationFn: (_a) => __async$5(void 0, null, function* () {
9302
+ mutationFn: (_a) => __async$6(void 0, null, function* () {
9294
9303
  var _b = _a, { warehouseId } = _b, warehouse = __objRest$1(_b, ["warehouseId"]);
9295
9304
  const result = yield client.warehouses.update(warehouseId, warehouse);
9296
9305
  return result.data;
@@ -9300,6 +9309,37 @@ const useUpdateWarehouse = () => {
9300
9309
  });
9301
9310
  };
9302
9311
 
9312
+ var __async$5 = (__this, __arguments, generator) => {
9313
+ return new Promise((resolve, reject) => {
9314
+ var fulfilled = (value) => {
9315
+ try {
9316
+ step(generator.next(value));
9317
+ } catch (e) {
9318
+ reject(e);
9319
+ }
9320
+ };
9321
+ var rejected = (value) => {
9322
+ try {
9323
+ step(generator.throw(value));
9324
+ } catch (e) {
9325
+ reject(e);
9326
+ }
9327
+ };
9328
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
9329
+ step((generator = generator.apply(__this, __arguments)).next());
9330
+ });
9331
+ };
9332
+ const useUploadRateCard = () => {
9333
+ const { client } = useShipEngine();
9334
+ return useMutation({
9335
+ mutationFn: (_0) => __async$5(void 0, [_0], function* ({ rateCardId, file }) {
9336
+ return yield client.rateCards.upload(rateCardId, file);
9337
+ }),
9338
+ mutationKey: ["useUploadRateCard"],
9339
+ onError
9340
+ });
9341
+ };
9342
+
9303
9343
  var __async$4 = (__this, __arguments, generator) => {
9304
9344
  return new Promise((resolve, reject) => {
9305
9345
  var fulfilled = (value) => {
@@ -9446,81 +9486,83 @@ const useLoadIcons = ({ brandName, cdnURL = "/" }) => {
9446
9486
  }
9447
9487
  }))();
9448
9488
  }, [brandName, cdnURL]);
9449
- return (iconName) => __async$1(void 0, null, function* () {
9450
- if (iconIndex) {
9451
- const iconBrand = (iconIndex[iconName.toLowerCase()] || []).includes(brandName) ? brandName : BrandName.FALLBACK;
9452
- const result = yield axios.get(`/brand/${iconBrand}/icons/${iconName.toLowerCase()}.svg`, {
9453
- baseURL: cdnURL,
9454
- responseType: "text"
9455
- });
9456
- return result.data;
9457
- }
9458
- return void 0;
9459
- });
9460
- };
9461
-
9462
- var __async = (__this, __arguments, generator) => {
9463
- return new Promise((resolve, reject) => {
9464
- var fulfilled = (value) => {
9465
- try {
9466
- step(generator.next(value));
9467
- } catch (e) {
9468
- reject(e);
9469
- }
9470
- };
9471
- var rejected = (value) => {
9472
- try {
9473
- step(generator.throw(value));
9474
- } catch (e) {
9475
- reject(e);
9489
+ return useCallback(
9490
+ (iconName) => __async$1(void 0, null, function* () {
9491
+ if (iconIndex) {
9492
+ const iconBrand = (iconIndex[iconName.toLowerCase()] || []).includes(brandName) ? brandName : BrandName.FALLBACK;
9493
+ const result = yield axios.get(
9494
+ `/brand/${iconBrand}/icons/${iconName.toLowerCase()}.svg`,
9495
+ {
9496
+ baseURL: cdnURL,
9497
+ responseType: "text"
9498
+ }
9499
+ );
9500
+ return result.data;
9476
9501
  }
9477
- };
9478
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
9479
- step((generator = generator.apply(__this, __arguments)).next());
9480
- });
9502
+ return "";
9503
+ }),
9504
+ [brandName, cdnURL, iconIndex]
9505
+ );
9481
9506
  };
9507
+
9482
9508
  const useLoadTheme = ({ cdnURL = "/", brandName }) => {
9483
9509
  const [theme, setTheme] = useState();
9484
9510
  useEffect(() => {
9485
- (() => __async(void 0, null, function* () {
9486
- try {
9487
- const result = yield axios.get(`/brand/${brandName}/theme.json`, { baseURL: cdnURL });
9488
- const theme2 = new Theme(result.data);
9489
- setTheme(theme2);
9490
- } catch (error) {
9491
- logger.error({ error }, `Error loading theme for brand ${brandName}`);
9492
- }
9493
- }))();
9511
+ axios.get(`/brand/${brandName}/theme.json`, { baseURL: cdnURL }).then(({ data }) => setTheme(new Theme(data))).catch((error) => logger.error({ error }, `Error loading theme for brand ${brandName}`));
9494
9512
  }, [brandName, cdnURL]);
9495
9513
  return theme;
9496
9514
  };
9497
9515
 
9516
+ var __defProp$2 = Object.defineProperty;
9517
+ var __defProps$1 = Object.defineProperties;
9518
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
9519
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
9520
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
9521
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
9522
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9523
+ var __spreadValues$2 = (a, b) => {
9524
+ for (var prop in b || (b = {}))
9525
+ if (__hasOwnProp$2.call(b, prop))
9526
+ __defNormalProp$2(a, prop, b[prop]);
9527
+ if (__getOwnPropSymbols$2)
9528
+ for (var prop of __getOwnPropSymbols$2(b)) {
9529
+ if (__propIsEnum$2.call(b, prop))
9530
+ __defNormalProp$2(a, prop, b[prop]);
9531
+ }
9532
+ return a;
9533
+ };
9534
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
9498
9535
  const AlchemyContext = createContext(void 0);
9499
- const Alchemy = ({
9536
+ const renderAlchemyProviders = ({
9537
+ baseURL,
9538
+ children,
9539
+ getToken,
9540
+ theme,
9541
+ scope,
9542
+ fontStyles,
9543
+ iconCache,
9544
+ resolveIcon
9545
+ }) => /* @__PURE__ */ jsxs(ThemeProvider, { theme, children: [
9546
+ /* @__PURE__ */ jsx(Global, { styles: [getEmotionResetStyles(scope), fontStyles] }),
9547
+ /* @__PURE__ */ jsx(GigerConfigProvider, { iconCache, resolveIcon, children: /* @__PURE__ */ jsx(ShipEngine, { baseURL, getToken, children }) })
9548
+ ] });
9549
+ const AlchemyProvider = ({
9500
9550
  baseURL = "https://api.shipengine.com",
9501
9551
  brandName = BrandName.FALLBACK,
9502
9552
  cdnURL = "/",
9503
9553
  children,
9504
9554
  getToken,
9505
- onError,
9555
+ onError = _default,
9506
9556
  scope = "lmnt"
9507
9557
  }) => {
9508
9558
  const theme = useLoadTheme({ brandName, cdnURL });
9509
9559
  const fontStyles = useLoadFonts({ cdnURL, scope, theme });
9510
9560
  const resolveIcon = useLoadIcons({ brandName, cdnURL });
9561
+ const iconCache = useMemo(createIconCache, []);
9511
9562
  if (!theme)
9512
9563
  return null;
9513
- onError = onError != null ? onError : _default;
9514
- return /* @__PURE__ */ jsx(
9515
- AlchemyContext.Provider,
9516
- {
9517
- value: { baseURL, brandName, cdnURL, getToken, onError, scope, theme },
9518
- children: /* @__PURE__ */ jsxs(ThemeProvider, { theme, children: [
9519
- /* @__PURE__ */ jsx(Global, { styles: [getEmotionResetStyles(scope), fontStyles] }),
9520
- /* @__PURE__ */ jsx(GigerConfigProvider, { resolveIcon, children: /* @__PURE__ */ jsx(ShipEngine, { baseURL, getToken, children }) })
9521
- ] })
9522
- }
9523
- );
9564
+ const contextValue = { baseURL, brandName, cdnURL, getToken, onError, scope, theme };
9565
+ return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: renderAlchemyProviders(__spreadProps$1(__spreadValues$2({}, contextValue), { children, fontStyles, iconCache, resolveIcon })) });
9524
9566
  };
9525
9567
  const useAlchemy = () => {
9526
9568
  const context = useContext(AlchemyContext);
@@ -9530,6 +9572,69 @@ const useAlchemy = () => {
9530
9572
  return context;
9531
9573
  };
9532
9574
 
9575
+ var __defProp$1 = Object.defineProperty;
9576
+ var __defProps = Object.defineProperties;
9577
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9578
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
9579
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
9580
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
9581
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9582
+ var __spreadValues$1 = (a, b) => {
9583
+ for (var prop in b || (b = {}))
9584
+ if (__hasOwnProp$1.call(b, prop))
9585
+ __defNormalProp$1(a, prop, b[prop]);
9586
+ if (__getOwnPropSymbols$1)
9587
+ for (var prop of __getOwnPropSymbols$1(b)) {
9588
+ if (__propIsEnum$1.call(b, prop))
9589
+ __defNormalProp$1(a, prop, b[prop]);
9590
+ }
9591
+ return a;
9592
+ };
9593
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9594
+ var __async = (__this, __arguments, generator) => {
9595
+ return new Promise((resolve, reject) => {
9596
+ var fulfilled = (value) => {
9597
+ try {
9598
+ step(generator.next(value));
9599
+ } catch (e) {
9600
+ reject(e);
9601
+ }
9602
+ };
9603
+ var rejected = (value) => {
9604
+ try {
9605
+ step(generator.throw(value));
9606
+ } catch (e) {
9607
+ reject(e);
9608
+ }
9609
+ };
9610
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
9611
+ step((generator = generator.apply(__this, __arguments)).next());
9612
+ });
9613
+ };
9614
+ const AlchemyTestProvider = ({ baseURL, children }) => {
9615
+ const scope = "lmnt";
9616
+ const theme = useMemo(() => new Theme(), []);
9617
+ const fontStyles = css({ [`.${scope}`]: { fontFamily: theme.defaultFontFamily } });
9618
+ const getToken = useCallback(() => "none", []);
9619
+ const iconCache = useMemo(createIconCache, []);
9620
+ const resolveIcon = useCallback(
9621
+ (iconName) => __async(void 0, null, function* () {
9622
+ return `<svg data-svg-id="${iconName}">mock icon-${iconName}</svg>`;
9623
+ }),
9624
+ []
9625
+ );
9626
+ const contextValue = {
9627
+ baseURL,
9628
+ brandName: BrandName.FALLBACK,
9629
+ cdnURL: "mockCdnUrl",
9630
+ getToken,
9631
+ onError: _default,
9632
+ scope,
9633
+ theme
9634
+ };
9635
+ return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: renderAlchemyProviders(__spreadProps(__spreadValues$1({}, contextValue), { children, fontStyles, iconCache, resolveIcon })) });
9636
+ };
9637
+
9533
9638
  var classnamesExports = {};
9534
9639
  var classnames = {
9535
9640
  get exports(){ return classnamesExports; },
@@ -10130,4 +10235,4 @@ const alchemy = {
10130
10235
  createElement
10131
10236
  };
10132
10237
 
10133
- export { AccountSettingsAPI, AddressesAPI, Alchemy, AlchemyContext, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, OrderSourcesAPI, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngine, ShipEngineAPI, ShipEngineContext, ShipmentsAPI, WarehousesAPI, alchemy, alchemy as default, delay, getEndUserIpAddress, isCodedError, isCodedErrors, logger, memoizedCreateCache, onError, retryUntil, useAddFunds, useAlchemy, useCalculateRates, useConnectCarrier, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateWarehouse, useDeleteWarehouse, useDownloadRateCard, useFundingSourcesAddFunds, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetInsuranceAccount, useGetLabel, useGetRateCardById, useGetRatePackageFormatsByCarrier, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetWalletHistory, useI18n, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListWarehouses, useLoadFonts, useLoadIcons, useLoadTheme, useNotifySalesOrderShipped, useParseAddress, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useValidateAddresses, useVoidLabel };
10238
+ export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, OrderSourcesAPI, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngine, ShipEngineAPI, ShipEngineContext, ShipmentsAPI, WarehousesAPI, alchemy, alchemy as default, delay, getEndUserIpAddress, isCodedError, isCodedErrors, logger, memoizedCreateCache, onError, renderAlchemyProviders, retryUntil, useAddFunds, useAlchemy, useCalculateRates, useConnectCarrier, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateWarehouse, useDeleteWarehouse, useDownloadRateCard, useFundingSourcesAddFunds, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetInsuranceAccount, useGetLabel, useGetRateCardById, useGetRatePackageFormatsByCarrier, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetWalletHistory, useI18n, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListWarehouses, useLoadFonts, useLoadIcons, useLoadTheme, useNotifySalesOrderShipped, useParseAddress, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUploadRateCard, useValidateAddresses, useVoidLabel };