@shipengine/alchemy 1.0.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -2477,17 +2477,17 @@ Object.defineProperty(dist, "__esModule", { value: true });
2477
2477
  var _default = dist.default = (function () {
2478
2478
  });
2479
2479
 
2480
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
2481
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
2482
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
2480
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
2481
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
2482
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
2483
2483
  var __objRest$8 = (source, exclude) => {
2484
2484
  var target = {};
2485
2485
  for (var prop in source)
2486
- if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
2486
+ if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
2487
2487
  target[prop] = source[prop];
2488
- if (source != null && __getOwnPropSymbols$c)
2489
- for (var prop of __getOwnPropSymbols$c(source)) {
2490
- if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
2488
+ if (source != null && __getOwnPropSymbols$e)
2489
+ for (var prop of __getOwnPropSymbols$e(source)) {
2490
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
2491
2491
  target[prop] = source[prop];
2492
2492
  }
2493
2493
  return target;
@@ -5263,33 +5263,33 @@ const getEndUserIpAddress = () => __async$u(void 0, null, function* () {
5263
5263
  }
5264
5264
  });
5265
5265
 
5266
- var __defProp$5 = Object.defineProperty;
5267
- var __defProps$3 = Object.defineProperties;
5268
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
5269
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
5270
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
5271
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
5272
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5273
- var __spreadValues$5 = (a, b) => {
5266
+ var __defProp$7 = Object.defineProperty;
5267
+ var __defProps$5 = Object.defineProperties;
5268
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
5269
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
5270
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
5271
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
5272
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5273
+ var __spreadValues$7 = (a, b) => {
5274
5274
  for (var prop in b || (b = {}))
5275
- if (__hasOwnProp$b.call(b, prop))
5276
- __defNormalProp$5(a, prop, b[prop]);
5277
- if (__getOwnPropSymbols$b)
5278
- for (var prop of __getOwnPropSymbols$b(b)) {
5279
- if (__propIsEnum$b.call(b, prop))
5280
- __defNormalProp$5(a, prop, b[prop]);
5275
+ if (__hasOwnProp$d.call(b, prop))
5276
+ __defNormalProp$7(a, prop, b[prop]);
5277
+ if (__getOwnPropSymbols$d)
5278
+ for (var prop of __getOwnPropSymbols$d(b)) {
5279
+ if (__propIsEnum$d.call(b, prop))
5280
+ __defNormalProp$7(a, prop, b[prop]);
5281
5281
  }
5282
5282
  return a;
5283
5283
  };
5284
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
5284
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
5285
5285
  var __objRest$7 = (source, exclude) => {
5286
5286
  var target = {};
5287
5287
  for (var prop in source)
5288
- if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
5288
+ if (__hasOwnProp$d.call(source, prop) && exclude.indexOf(prop) < 0)
5289
5289
  target[prop] = source[prop];
5290
- if (source != null && __getOwnPropSymbols$b)
5291
- for (var prop of __getOwnPropSymbols$b(source)) {
5292
- if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
5290
+ if (source != null && __getOwnPropSymbols$d)
5291
+ for (var prop of __getOwnPropSymbols$d(source)) {
5292
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$d.call(source, prop))
5293
5293
  target[prop] = source[prop];
5294
5294
  }
5295
5295
  return target;
@@ -5328,7 +5328,7 @@ class CarriersAPI {
5328
5328
  const endUserIpAddress = yield getEndUserIpAddress();
5329
5329
  if (!endUserIpAddress)
5330
5330
  return Promise.reject([new CodedError("Unable to get IP address")]);
5331
- return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$3(__spreadValues$5({}, connection), {
5331
+ return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$5(__spreadValues$7({}, connection), {
5332
5332
  endUserIpAddress
5333
5333
  }));
5334
5334
  });
@@ -7560,19 +7560,19 @@ class CustomPackagesAPI {
7560
7560
  }
7561
7561
  }
7562
7562
 
7563
- var __defProp$4 = Object.defineProperty;
7564
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
7565
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
7566
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
7567
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7568
- var __spreadValues$4 = (a, b) => {
7563
+ var __defProp$6 = Object.defineProperty;
7564
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
7565
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
7566
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
7567
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7568
+ var __spreadValues$6 = (a, b) => {
7569
7569
  for (var prop in b || (b = {}))
7570
- if (__hasOwnProp$a.call(b, prop))
7571
- __defNormalProp$4(a, prop, b[prop]);
7572
- if (__getOwnPropSymbols$a)
7573
- for (var prop of __getOwnPropSymbols$a(b)) {
7574
- if (__propIsEnum$a.call(b, prop))
7575
- __defNormalProp$4(a, prop, b[prop]);
7570
+ if (__hasOwnProp$c.call(b, prop))
7571
+ __defNormalProp$6(a, prop, b[prop]);
7572
+ if (__getOwnPropSymbols$c)
7573
+ for (var prop of __getOwnPropSymbols$c(b)) {
7574
+ if (__propIsEnum$c.call(b, prop))
7575
+ __defNormalProp$6(a, prop, b[prop]);
7576
7576
  }
7577
7577
  return a;
7578
7578
  };
@@ -7609,7 +7609,7 @@ class FundingSourcesAPI {
7609
7609
  const endUserIpAddress = yield getEndUserIpAddress();
7610
7610
  if (!endUserIpAddress)
7611
7611
  return Promise.reject([new CodedError("Unable to get IP address")]);
7612
- return yield this.client.post("/v1/funding_sources", __spreadValues$4({
7612
+ return yield this.client.post("/v1/funding_sources", __spreadValues$6({
7613
7613
  endUserIpAddress
7614
7614
  }, createFundingSource));
7615
7615
  });
@@ -7630,7 +7630,7 @@ class FundingSourcesAPI {
7630
7630
  const endUserIpAddress = yield getEndUserIpAddress();
7631
7631
  if (!endUserIpAddress)
7632
7632
  return Promise.reject([new CodedError("Unable to get IP address")]);
7633
- return yield this.client.post("/v1/registration/funding_source", __spreadValues$4({
7633
+ return yield this.client.post("/v1/registration/funding_source", __spreadValues$6({
7634
7634
  endUserIpAddress
7635
7635
  }, carrier));
7636
7636
  });
@@ -7831,25 +7831,25 @@ class WarehousesAPI {
7831
7831
  }
7832
7832
  }
7833
7833
 
7834
- var __defProp$3 = Object.defineProperty;
7835
- var __defProps$2 = Object.defineProperties;
7836
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
7837
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
7838
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
7839
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
7840
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7841
- var __spreadValues$3 = (a, b) => {
7834
+ var __defProp$5 = Object.defineProperty;
7835
+ var __defProps$4 = Object.defineProperties;
7836
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
7837
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
7838
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
7839
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
7840
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7841
+ var __spreadValues$5 = (a, b) => {
7842
7842
  for (var prop in b || (b = {}))
7843
- if (__hasOwnProp$9.call(b, prop))
7844
- __defNormalProp$3(a, prop, b[prop]);
7845
- if (__getOwnPropSymbols$9)
7846
- for (var prop of __getOwnPropSymbols$9(b)) {
7847
- if (__propIsEnum$9.call(b, prop))
7848
- __defNormalProp$3(a, prop, b[prop]);
7843
+ if (__hasOwnProp$b.call(b, prop))
7844
+ __defNormalProp$5(a, prop, b[prop]);
7845
+ if (__getOwnPropSymbols$b)
7846
+ for (var prop of __getOwnPropSymbols$b(b)) {
7847
+ if (__propIsEnum$b.call(b, prop))
7848
+ __defNormalProp$5(a, prop, b[prop]);
7849
7849
  }
7850
7850
  return a;
7851
7851
  };
7852
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
7852
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
7853
7853
  var __async$q = (__this, __arguments, generator) => {
7854
7854
  return new Promise((resolve, reject) => {
7855
7855
  var fulfilled = (value) => {
@@ -7872,7 +7872,7 @@ var __async$q = (__this, __arguments, generator) => {
7872
7872
  };
7873
7873
  const logger$1 = E({
7874
7874
  name: "shipengine-api",
7875
- serializers: __spreadProps$2(__spreadValues$3({}, k), {
7875
+ serializers: __spreadProps$4(__spreadValues$5({}, k), {
7876
7876
  req: (req) => ({
7877
7877
  headers: req.headers,
7878
7878
  method: req.method,
@@ -7897,7 +7897,7 @@ class ShipEngineAPI {
7897
7897
  constructor(token, { baseURL, headers, getToken }) {
7898
7898
  const client = axios.create({
7899
7899
  baseURL,
7900
- headers: __spreadProps$2(__spreadValues$3({}, headers), {
7900
+ headers: __spreadProps$4(__spreadValues$5({}, headers), {
7901
7901
  Authorization: `Bearer ${token}`,
7902
7902
  "Content-Type": "application/json"
7903
7903
  }),
@@ -8071,25 +8071,25 @@ const delay = (ms) => new Promise((resolve) => {
8071
8071
 
8072
8072
  const onError = (errors) => errors.forEach(console.log);
8073
8073
 
8074
- var __defProp$2 = Object.defineProperty;
8075
- var __defProps$1 = Object.defineProperties;
8076
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
8077
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8078
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8079
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8080
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8081
- var __spreadValues$2 = (a, b) => {
8074
+ var __defProp$4 = Object.defineProperty;
8075
+ var __defProps$3 = Object.defineProperties;
8076
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
8077
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
8078
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8079
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
8080
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8081
+ var __spreadValues$4 = (a, b) => {
8082
8082
  for (var prop in b || (b = {}))
8083
- if (__hasOwnProp$8.call(b, prop))
8084
- __defNormalProp$2(a, prop, b[prop]);
8085
- if (__getOwnPropSymbols$8)
8086
- for (var prop of __getOwnPropSymbols$8(b)) {
8087
- if (__propIsEnum$8.call(b, prop))
8088
- __defNormalProp$2(a, prop, b[prop]);
8083
+ if (__hasOwnProp$a.call(b, prop))
8084
+ __defNormalProp$4(a, prop, b[prop]);
8085
+ if (__getOwnPropSymbols$a)
8086
+ for (var prop of __getOwnPropSymbols$a(b)) {
8087
+ if (__propIsEnum$a.call(b, prop))
8088
+ __defNormalProp$4(a, prop, b[prop]);
8089
8089
  }
8090
8090
  return a;
8091
8091
  };
8092
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
8092
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
8093
8093
  const streams = [];
8094
8094
  if (process.env.NODE_ENV === "production") {
8095
8095
  streams.push({
@@ -8098,7 +8098,7 @@ if (process.env.NODE_ENV === "production") {
8098
8098
  }
8099
8099
  const logger = E({
8100
8100
  name: "shipengine",
8101
- serializers: __spreadProps$1(__spreadValues$2({}, k), {
8101
+ serializers: __spreadProps$3(__spreadValues$4({}, k), {
8102
8102
  req: (req) => ({
8103
8103
  headers: req.headers,
8104
8104
  method: req.method,
@@ -8251,17 +8251,17 @@ const useCreateFundingSource = () => {
8251
8251
  });
8252
8252
  };
8253
8253
 
8254
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8255
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8256
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8254
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8255
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8256
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8257
8257
  var __objRest$6 = (source, exclude) => {
8258
8258
  var target = {};
8259
8259
  for (var prop in source)
8260
- if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
8260
+ if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
8261
8261
  target[prop] = source[prop];
8262
- if (source != null && __getOwnPropSymbols$7)
8263
- for (var prop of __getOwnPropSymbols$7(source)) {
8264
- if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
8262
+ if (source != null && __getOwnPropSymbols$9)
8263
+ for (var prop of __getOwnPropSymbols$9(source)) {
8264
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
8265
8265
  target[prop] = source[prop];
8266
8266
  }
8267
8267
  return target;
@@ -8331,17 +8331,17 @@ const useCreateRateCard = () => {
8331
8331
  });
8332
8332
  };
8333
8333
 
8334
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8335
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8336
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8334
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8335
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8336
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8337
8337
  var __objRest$5 = (source, exclude) => {
8338
8338
  var target = {};
8339
8339
  for (var prop in source)
8340
- if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
8340
+ if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
8341
8341
  target[prop] = source[prop];
8342
- if (source != null && __getOwnPropSymbols$6)
8343
- for (var prop of __getOwnPropSymbols$6(source)) {
8344
- if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
8342
+ if (source != null && __getOwnPropSymbols$8)
8343
+ for (var prop of __getOwnPropSymbols$8(source)) {
8344
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
8345
8345
  target[prop] = source[prop];
8346
8346
  }
8347
8347
  return target;
@@ -8379,25 +8379,25 @@ const useCreateSalesOrderShipment = () => {
8379
8379
  });
8380
8380
  };
8381
8381
 
8382
- var __defProp$1 = Object.defineProperty;
8383
- var __defProps = Object.defineProperties;
8384
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
8385
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
8386
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
8387
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
8388
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8389
- var __spreadValues$1 = (a, b) => {
8382
+ var __defProp$3 = Object.defineProperty;
8383
+ var __defProps$2 = Object.defineProperties;
8384
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
8385
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8386
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8387
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8388
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8389
+ var __spreadValues$3 = (a, b) => {
8390
8390
  for (var prop in b || (b = {}))
8391
- if (__hasOwnProp$5.call(b, prop))
8392
- __defNormalProp$1(a, prop, b[prop]);
8393
- if (__getOwnPropSymbols$5)
8394
- for (var prop of __getOwnPropSymbols$5(b)) {
8395
- if (__propIsEnum$5.call(b, prop))
8396
- __defNormalProp$1(a, prop, b[prop]);
8391
+ if (__hasOwnProp$7.call(b, prop))
8392
+ __defNormalProp$3(a, prop, b[prop]);
8393
+ if (__getOwnPropSymbols$7)
8394
+ for (var prop of __getOwnPropSymbols$7(b)) {
8395
+ if (__propIsEnum$7.call(b, prop))
8396
+ __defNormalProp$3(a, prop, b[prop]);
8397
8397
  }
8398
8398
  return a;
8399
8399
  };
8400
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8400
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
8401
8401
  var __async$i = (__this, __arguments, generator) => {
8402
8402
  return new Promise((resolve, reject) => {
8403
8403
  var fulfilled = (value) => {
@@ -8439,7 +8439,7 @@ const useCreateShipment = () => {
8439
8439
  postalCode: "",
8440
8440
  stateProvince: ""
8441
8441
  };
8442
- return (yield client.shipments.create(__spreadProps(__spreadValues$1({}, shipment), {
8442
+ return (yield client.shipments.create(__spreadProps$2(__spreadValues$3({}, shipment), {
8443
8443
  shipTo
8444
8444
  }))).data;
8445
8445
  }),
@@ -8885,17 +8885,17 @@ const useListSalesOrders = (params = {}) => {
8885
8885
  });
8886
8886
  };
8887
8887
 
8888
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
8889
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
8890
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
8888
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8889
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8890
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8891
8891
  var __objRest$4 = (source, exclude) => {
8892
8892
  var target = {};
8893
8893
  for (var prop in source)
8894
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
8894
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
8895
8895
  target[prop] = source[prop];
8896
- if (source != null && __getOwnPropSymbols$4)
8897
- for (var prop of __getOwnPropSymbols$4(source)) {
8898
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
8896
+ if (source != null && __getOwnPropSymbols$6)
8897
+ for (var prop of __getOwnPropSymbols$6(source)) {
8898
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
8899
8899
  target[prop] = source[prop];
8900
8900
  }
8901
8901
  return target;
@@ -8924,17 +8924,17 @@ const useListWarehouses = (options) => {
8924
8924
  });
8925
8925
  };
8926
8926
 
8927
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
8928
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
8929
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
8927
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
8928
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
8929
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
8930
8930
  var __objRest$3 = (source, exclude) => {
8931
8931
  var target = {};
8932
8932
  for (var prop in source)
8933
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
8933
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
8934
8934
  target[prop] = source[prop];
8935
- if (source != null && __getOwnPropSymbols$3)
8936
- for (var prop of __getOwnPropSymbols$3(source)) {
8937
- if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
8935
+ if (source != null && __getOwnPropSymbols$5)
8936
+ for (var prop of __getOwnPropSymbols$5(source)) {
8937
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
8938
8938
  target[prop] = source[prop];
8939
8939
  }
8940
8940
  return target;
@@ -9226,17 +9226,17 @@ const useUpdateRateCard = () => {
9226
9226
  });
9227
9227
  };
9228
9228
 
9229
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
9230
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
9231
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
9229
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
9230
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
9231
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
9232
9232
  var __objRest$2 = (source, exclude) => {
9233
9233
  var target = {};
9234
9234
  for (var prop in source)
9235
- if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
9235
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
9236
9236
  target[prop] = source[prop];
9237
- if (source != null && __getOwnPropSymbols$2)
9238
- for (var prop of __getOwnPropSymbols$2(source)) {
9239
- if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
9237
+ if (source != null && __getOwnPropSymbols$4)
9238
+ for (var prop of __getOwnPropSymbols$4(source)) {
9239
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
9240
9240
  target[prop] = source[prop];
9241
9241
  }
9242
9242
  return target;
@@ -9274,17 +9274,17 @@ const useUpdateSalesOrderShipment = () => {
9274
9274
  });
9275
9275
  };
9276
9276
 
9277
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
9278
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
9279
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
9277
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
9278
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
9279
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
9280
9280
  var __objRest$1 = (source, exclude) => {
9281
9281
  var target = {};
9282
9282
  for (var prop in source)
9283
- if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
9283
+ if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
9284
9284
  target[prop] = source[prop];
9285
- if (source != null && __getOwnPropSymbols$1)
9286
- for (var prop of __getOwnPropSymbols$1(source)) {
9287
- if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
9285
+ if (source != null && __getOwnPropSymbols$3)
9286
+ for (var prop of __getOwnPropSymbols$3(source)) {
9287
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
9288
9288
  target[prop] = source[prop];
9289
9289
  }
9290
9290
  return target;
@@ -9468,81 +9468,83 @@ const useLoadIcons = ({ brandName, cdnURL = "/" }) => {
9468
9468
  }
9469
9469
  }))();
9470
9470
  }, [brandName, cdnURL]);
9471
- return (iconName) => __async$1(void 0, null, function* () {
9472
- if (iconIndex) {
9473
- const iconBrand = (iconIndex[iconName.toLowerCase()] || []).includes(brandName) ? brandName : brands.BrandName.FALLBACK;
9474
- const result = yield axios.get(`/brand/${iconBrand}/icons/${iconName.toLowerCase()}.svg`, {
9475
- baseURL: cdnURL,
9476
- responseType: "text"
9477
- });
9478
- return result.data;
9479
- }
9480
- return void 0;
9481
- });
9482
- };
9483
-
9484
- var __async = (__this, __arguments, generator) => {
9485
- return new Promise((resolve, reject) => {
9486
- var fulfilled = (value) => {
9487
- try {
9488
- step(generator.next(value));
9489
- } catch (e) {
9490
- reject(e);
9491
- }
9492
- };
9493
- var rejected = (value) => {
9494
- try {
9495
- step(generator.throw(value));
9496
- } catch (e) {
9497
- reject(e);
9471
+ return React.useCallback(
9472
+ (iconName) => __async$1(void 0, null, function* () {
9473
+ if (iconIndex) {
9474
+ const iconBrand = (iconIndex[iconName.toLowerCase()] || []).includes(brandName) ? brandName : brands.BrandName.FALLBACK;
9475
+ const result = yield axios.get(
9476
+ `/brand/${iconBrand}/icons/${iconName.toLowerCase()}.svg`,
9477
+ {
9478
+ baseURL: cdnURL,
9479
+ responseType: "text"
9480
+ }
9481
+ );
9482
+ return result.data;
9498
9483
  }
9499
- };
9500
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
9501
- step((generator = generator.apply(__this, __arguments)).next());
9502
- });
9484
+ return "";
9485
+ }),
9486
+ [brandName, cdnURL, iconIndex]
9487
+ );
9503
9488
  };
9489
+
9504
9490
  const useLoadTheme = ({ cdnURL = "/", brandName }) => {
9505
9491
  const [theme, setTheme] = React.useState();
9506
9492
  React.useEffect(() => {
9507
- (() => __async(void 0, null, function* () {
9508
- try {
9509
- const result = yield axios.get(`/brand/${brandName}/theme.json`, { baseURL: cdnURL });
9510
- const theme2 = new gigerTheme.Theme(result.data);
9511
- setTheme(theme2);
9512
- } catch (error) {
9513
- logger.error({ error }, `Error loading theme for brand ${brandName}`);
9514
- }
9515
- }))();
9493
+ axios.get(`/brand/${brandName}/theme.json`, { baseURL: cdnURL }).then(({ data }) => setTheme(new gigerTheme.Theme(data))).catch((error) => logger.error({ error }, `Error loading theme for brand ${brandName}`));
9516
9494
  }, [brandName, cdnURL]);
9517
9495
  return theme;
9518
9496
  };
9519
9497
 
9498
+ var __defProp$2 = Object.defineProperty;
9499
+ var __defProps$1 = Object.defineProperties;
9500
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
9501
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
9502
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
9503
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
9504
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9505
+ var __spreadValues$2 = (a, b) => {
9506
+ for (var prop in b || (b = {}))
9507
+ if (__hasOwnProp$2.call(b, prop))
9508
+ __defNormalProp$2(a, prop, b[prop]);
9509
+ if (__getOwnPropSymbols$2)
9510
+ for (var prop of __getOwnPropSymbols$2(b)) {
9511
+ if (__propIsEnum$2.call(b, prop))
9512
+ __defNormalProp$2(a, prop, b[prop]);
9513
+ }
9514
+ return a;
9515
+ };
9516
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
9520
9517
  const AlchemyContext = React.createContext(void 0);
9521
- const Alchemy = ({
9518
+ const renderAlchemyProviders = ({
9519
+ baseURL,
9520
+ children,
9521
+ getToken,
9522
+ theme,
9523
+ scope,
9524
+ fontStyles,
9525
+ iconCache,
9526
+ resolveIcon
9527
+ }) => /* @__PURE__ */ jsxs(react.ThemeProvider, { theme, children: [
9528
+ /* @__PURE__ */ jsx(react.Global, { styles: [giger.getEmotionResetStyles(scope), fontStyles] }),
9529
+ /* @__PURE__ */ jsx(giger.GigerConfigProvider, { iconCache, resolveIcon, children: /* @__PURE__ */ jsx(ShipEngine, { baseURL, getToken, children }) })
9530
+ ] });
9531
+ const AlchemyProvider = ({
9522
9532
  baseURL = "https://api.shipengine.com",
9523
9533
  brandName = brands.BrandName.FALLBACK,
9524
9534
  cdnURL = "/",
9525
9535
  children,
9526
9536
  getToken,
9527
- onError,
9537
+ onError = _default,
9528
9538
  scope = "lmnt"
9529
9539
  }) => {
9530
9540
  const theme = useLoadTheme({ brandName, cdnURL });
9531
9541
  const fontStyles = useLoadFonts({ cdnURL, scope, theme });
9532
9542
  const resolveIcon = useLoadIcons({ brandName, cdnURL });
9543
+ const iconCache = React.useMemo(giger.createIconCache, []);
9533
9544
  if (!theme)
9534
9545
  return null;
9535
- onError = onError != null ? onError : _default;
9536
- return /* @__PURE__ */ jsx(
9537
- AlchemyContext.Provider,
9538
- {
9539
- value: { baseURL, brandName, cdnURL, getToken, onError, scope, theme },
9540
- children: /* @__PURE__ */ jsxs(react.ThemeProvider, { theme, children: [
9541
- /* @__PURE__ */ jsx(react.Global, { styles: [giger.getEmotionResetStyles(scope), fontStyles] }),
9542
- /* @__PURE__ */ jsx(giger.GigerConfigProvider, { resolveIcon, children: /* @__PURE__ */ jsx(ShipEngine, { baseURL, getToken, children }) })
9543
- ] })
9544
- }
9545
- );
9546
+ const contextValue = { baseURL, brandName, cdnURL, getToken, onError, scope, theme };
9547
+ return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: renderAlchemyProviders(__spreadProps$1(__spreadValues$2({}, contextValue), { children, fontStyles, iconCache, resolveIcon })) });
9546
9548
  };
9547
9549
  const useAlchemy = () => {
9548
9550
  const context = React.useContext(AlchemyContext);
@@ -9552,6 +9554,69 @@ const useAlchemy = () => {
9552
9554
  return context;
9553
9555
  };
9554
9556
 
9557
+ var __defProp$1 = Object.defineProperty;
9558
+ var __defProps = Object.defineProperties;
9559
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9560
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
9561
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
9562
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
9563
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9564
+ var __spreadValues$1 = (a, b) => {
9565
+ for (var prop in b || (b = {}))
9566
+ if (__hasOwnProp$1.call(b, prop))
9567
+ __defNormalProp$1(a, prop, b[prop]);
9568
+ if (__getOwnPropSymbols$1)
9569
+ for (var prop of __getOwnPropSymbols$1(b)) {
9570
+ if (__propIsEnum$1.call(b, prop))
9571
+ __defNormalProp$1(a, prop, b[prop]);
9572
+ }
9573
+ return a;
9574
+ };
9575
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9576
+ var __async = (__this, __arguments, generator) => {
9577
+ return new Promise((resolve, reject) => {
9578
+ var fulfilled = (value) => {
9579
+ try {
9580
+ step(generator.next(value));
9581
+ } catch (e) {
9582
+ reject(e);
9583
+ }
9584
+ };
9585
+ var rejected = (value) => {
9586
+ try {
9587
+ step(generator.throw(value));
9588
+ } catch (e) {
9589
+ reject(e);
9590
+ }
9591
+ };
9592
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
9593
+ step((generator = generator.apply(__this, __arguments)).next());
9594
+ });
9595
+ };
9596
+ const AlchemyTestProvider = ({ baseURL, children }) => {
9597
+ const scope = "lmnt";
9598
+ const theme = React.useMemo(() => new gigerTheme.Theme(), []);
9599
+ const fontStyles = react.css({ [`.${scope}`]: { fontFamily: theme.defaultFontFamily } });
9600
+ const getToken = React.useCallback(() => "none", []);
9601
+ const iconCache = React.useMemo(giger.createIconCache, []);
9602
+ const resolveIcon = React.useCallback(
9603
+ (iconName) => __async(void 0, null, function* () {
9604
+ return `<svg data-svg-id="${iconName}">mock icon-${iconName}</svg>`;
9605
+ }),
9606
+ []
9607
+ );
9608
+ const contextValue = {
9609
+ baseURL,
9610
+ brandName: brands.BrandName.FALLBACK,
9611
+ cdnURL: "mockCdnUrl",
9612
+ getToken,
9613
+ onError: _default,
9614
+ scope,
9615
+ theme
9616
+ };
9617
+ return /* @__PURE__ */ jsx(AlchemyContext.Provider, { value: contextValue, children: renderAlchemyProviders(__spreadProps(__spreadValues$1({}, contextValue), { children, fontStyles, iconCache, resolveIcon })) });
9618
+ };
9619
+
9555
9620
  var classnamesExports = {};
9556
9621
  var classnames = {
9557
9622
  get exports(){ return classnamesExports; },
@@ -10154,8 +10219,9 @@ const alchemy = {
10154
10219
 
10155
10220
  exports.AccountSettingsAPI = AccountSettingsAPI;
10156
10221
  exports.AddressesAPI = AddressesAPI;
10157
- exports.Alchemy = Alchemy;
10158
10222
  exports.AlchemyContext = AlchemyContext;
10223
+ exports.AlchemyProvider = AlchemyProvider;
10224
+ exports.AlchemyTestProvider = AlchemyTestProvider;
10159
10225
  exports.CarriersAPI = CarriersAPI;
10160
10226
  exports.CodedError = CodedError;
10161
10227
  exports.ConfirmationType = ConfirmationType;
@@ -10190,6 +10256,7 @@ exports.isCodedErrors = isCodedErrors;
10190
10256
  exports.logger = logger;
10191
10257
  exports.memoizedCreateCache = memoizedCreateCache;
10192
10258
  exports.onError = onError;
10259
+ exports.renderAlchemyProviders = renderAlchemyProviders;
10193
10260
  exports.retryUntil = retryUntil;
10194
10261
  exports.useAddFunds = useAddFunds;
10195
10262
  exports.useAlchemy = useAlchemy;