@shipengine/alchemy 2.2.2 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +931 -609
  2. package/index.mjs +932 -611
  3. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4,7 +4,7 @@ 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
6
  import { getEmotionResetStyles, createIconCache, GigerConfigProvider } from '@packlink/giger';
7
- import { QueryClient, QueryClientProvider, useMutation, useQuery, useQueryClient } from 'react-query';
7
+ import { QueryClient, QueryClientProvider, useQuery, useMutation, useQueryClient } from 'react-query';
8
8
  import { Theme } from '@packlink/giger-theme';
9
9
  import { I18nextProvider } from 'react-i18next';
10
10
  import i18n from 'i18next';
@@ -2553,9 +2553,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
2553
2553
  class AccountSettingsAPI {
2554
2554
  constructor(client) {
2555
2555
  this.client = client;
2556
+ /**
2557
+ * The `get` method retrieves the account settings for a given user.
2558
+ */
2556
2559
  this.get = () => {
2557
2560
  return this.client.get("/v1/account/settings");
2558
2561
  };
2562
+ /**
2563
+ * The `update` method updates specific account settings for a given user.
2564
+ *
2565
+ * @params Partial<AccountSettings> The account settings to update.
2566
+ */
2559
2567
  this.update = (settings) => {
2560
2568
  return this.client.put("/v1/account/settings", settings);
2561
2569
  };
@@ -2566,9 +2574,17 @@ class AccountSettingsAPI {
2566
2574
  class AddressesAPI {
2567
2575
  constructor(client) {
2568
2576
  this.client = client;
2577
+ /**
2578
+ * The `validate` method validates a list of addresses.
2579
+ *
2580
+ * @params Address[] The addresses to be validated.
2581
+ */
2569
2582
  this.validate = (addresses) => {
2570
2583
  return this.client.post("/v1/addresses/validate", addresses);
2571
2584
  };
2585
+ /**
2586
+ * The `parse` method parses a string of text to extract addresses.
2587
+ */
2572
2588
  this.parse = (text, address) => {
2573
2589
  return this.client.put("/v1/addresses/recognize", {
2574
2590
  address,
@@ -5216,7 +5232,7 @@ var ipaddr = {
5216
5232
  }).call(commonjsGlobal);
5217
5233
  } (ipaddr));
5218
5234
 
5219
- var __async$w = (__this, __arguments, generator) => {
5235
+ var __async$x = (__this, __arguments, generator) => {
5220
5236
  return new Promise((resolve, reject) => {
5221
5237
  var fulfilled = (value) => {
5222
5238
  try {
@@ -5236,7 +5252,7 @@ var __async$w = (__this, __arguments, generator) => {
5236
5252
  step((generator = generator.apply(__this, __arguments)).next());
5237
5253
  });
5238
5254
  };
5239
- const getEndUserIpAddress = () => __async$w(void 0, null, function* () {
5255
+ const getEndUserIpAddress = () => __async$x(void 0, null, function* () {
5240
5256
  try {
5241
5257
  const response = yield axios.get("https://api.ipify.org/?format=json");
5242
5258
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -5279,7 +5295,7 @@ var __objRest$7 = (source, exclude) => {
5279
5295
  }
5280
5296
  return target;
5281
5297
  };
5282
- var __async$v = (__this, __arguments, generator) => {
5298
+ var __async$w = (__this, __arguments, generator) => {
5283
5299
  return new Promise((resolve, reject) => {
5284
5300
  var fulfilled = (value) => {
5285
5301
  try {
@@ -5302,13 +5318,22 @@ var __async$v = (__this, __arguments, generator) => {
5302
5318
  class CarriersAPI {
5303
5319
  constructor(client) {
5304
5320
  this.client = client;
5321
+ /**
5322
+ * The `list` method retrieves a list of connected carriers for a given user.
5323
+ */
5305
5324
  this.list = () => {
5306
5325
  return this.client.get("/v1/carriers");
5307
5326
  };
5327
+ /**
5328
+ * The `get` method retrieves a specific carrier by `carrierId`.
5329
+ */
5308
5330
  this.get = (carrierId) => {
5309
5331
  return this.client.get(`/v1/carriers/${carrierId}`);
5310
5332
  };
5311
- this.connect = (_a) => __async$v(this, null, function* () {
5333
+ /**
5334
+ * The `connect` method connects a carrier account to a user's ShipEngine account.
5335
+ */
5336
+ this.connect = (_a) => __async$w(this, null, function* () {
5312
5337
  var _b = _a, { carrierCode } = _b, connection = __objRest$7(_b, ["carrierCode"]);
5313
5338
  const endUserIpAddress = yield getEndUserIpAddress();
5314
5339
  if (!endUserIpAddress)
@@ -5317,20 +5342,44 @@ class CarriersAPI {
5317
5342
  endUserIpAddress
5318
5343
  }));
5319
5344
  });
5345
+ /**
5346
+ * The `addFunds` method allows a user to add funds to their carrier account balance.
5347
+ * Not all carrier providers allow you to maintain a balance.
5348
+ *
5349
+ * - For example, FedEx does
5350
+ * not require you to maintain a balance that will be used when purchasing labels.
5351
+ */
5320
5352
  this.addFunds = (carrierId, funds) => {
5321
5353
  return this.client.put(`/v1/carriers/${carrierId}/add_funds`, funds);
5322
5354
  };
5355
+ /**
5356
+ * The `updateAutoFunding` method allows a user to update the auto-funding settings
5357
+ * on their ShipEngine account.
5358
+ *
5359
+ * e.g. Enable auto-funding, set a balance threshold, and a maximum number of time
5360
+ * per day you wish to auto-fund your account.
5361
+ */
5323
5362
  this.updateAutoFunding = (carrierId, options) => {
5324
5363
  return this.client.post(
5325
5364
  `/v1/carriers/${carrierId}/auto_funding`,
5326
5365
  options
5327
5366
  );
5328
5367
  };
5368
+ /**
5369
+ * The `getAutoFunding` method retrieves the current auto-funding settings.
5370
+ *
5371
+ * If no auto-funding rules have been set, the response will contain the default
5372
+ * values for auto-funding. Auto-funding is disabled by default.
5373
+ */
5329
5374
  this.getAutoFunding = (carrierId) => {
5330
5375
  return this.client.get(
5331
5376
  `/v1/carriers/${carrierId}/auto_funding`
5332
5377
  );
5333
5378
  };
5379
+ /**
5380
+ * The `getWalletHistory` method retrieves the wallet transaction history for
5381
+ * a ShipEngine wallet account.
5382
+ */
5334
5383
  this.getWalletHistory = (startDate, endDate, page) => {
5335
5384
  return this.client.get(`/v1/carriers/wallet_history`, {
5336
5385
  params: {
@@ -5340,17 +5389,33 @@ class CarriersAPI {
5340
5389
  }
5341
5390
  });
5342
5391
  };
5392
+ /**
5393
+ * The `getServices` method retrieves a list of shipping services that a given carrier offers.
5394
+ */
5343
5395
  this.getServices = (carrierId) => {
5344
5396
  return this.client.get(`/v1/carriers/${carrierId}/services`);
5345
5397
  };
5398
+ /**
5399
+ * The `getPackageRatingGroup` method retrieves a list of package rating groups.
5400
+ * This is primarily used for carriers that support negotiated rates, and a user
5401
+ * has a rate card with multiple package rating groups.
5402
+ */
5346
5403
  this.getPackageRatingGroup = (carrierId) => {
5347
5404
  return this.client.get(
5348
5405
  `/v1/carriers/${carrierId}/package_rating_group`
5349
5406
  );
5350
5407
  };
5408
+ /**
5409
+ * The `getCountries` method retrieves a list of countries that a given carrier
5410
+ * supports shipping to.
5411
+ */
5351
5412
  this.getCountries = (carrierId) => {
5352
5413
  return this.client.get(`/v1/carriers/${carrierId}/countries`);
5353
5414
  };
5415
+ /**
5416
+ * The `getCurrencies` method retrieves a list of currencies that a given carrier
5417
+ * supports the usage of.
5418
+ */
5354
5419
  this.getCurrencies = (carrierId) => {
5355
5420
  return this.client.get(`/v1/carriers/${carrierId}/currencies`);
5356
5421
  };
@@ -7538,6 +7603,9 @@ var lib = {
7538
7603
  class CustomPackagesAPI {
7539
7604
  constructor(client) {
7540
7605
  this.client = client;
7606
+ /**
7607
+ * The `list` method retrieves a list of custom packages a given user has created.
7608
+ */
7541
7609
  this.list = () => {
7542
7610
  return this.client.get("/v1/packages");
7543
7611
  };
@@ -7561,7 +7629,7 @@ var __spreadValues$6 = (a, b) => {
7561
7629
  }
7562
7630
  return a;
7563
7631
  };
7564
- var __async$u = (__this, __arguments, generator) => {
7632
+ var __async$v = (__this, __arguments, generator) => {
7565
7633
  return new Promise((resolve, reject) => {
7566
7634
  var fulfilled = (value) => {
7567
7635
  try {
@@ -7584,13 +7652,23 @@ var __async$u = (__this, __arguments, generator) => {
7584
7652
  class FundingSourcesAPI {
7585
7653
  constructor(client) {
7586
7654
  this.client = client;
7655
+ /**
7656
+ * The `list` method retrieves a list of funding sources for a given user.
7657
+ */
7587
7658
  this.list = () => {
7588
7659
  return this.client.get("/v1/funding_sources");
7589
7660
  };
7661
+ /**
7662
+ * The `get` method retrieves a specific funding source by `fundingSourceId`.
7663
+ */
7590
7664
  this.get = (fundingSourceId) => {
7591
7665
  return this.client.get(`/v1/funding_sources/${fundingSourceId}`);
7592
7666
  };
7593
- this.create = (createFundingSource) => __async$u(this, null, function* () {
7667
+ /**
7668
+ * The `create` method creates a new funding source for a given user. This requires
7669
+ * payment information to be collected from the user.
7670
+ */
7671
+ this.create = (createFundingSource) => __async$v(this, null, function* () {
7594
7672
  const endUserIpAddress = yield getEndUserIpAddress();
7595
7673
  if (!endUserIpAddress)
7596
7674
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7598,7 +7676,12 @@ class FundingSourcesAPI {
7598
7676
  endUserIpAddress
7599
7677
  }, createFundingSource));
7600
7678
  });
7601
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$u(this, null, function* () {
7679
+ /**
7680
+ * The `update` method updates a funding source for a given user. This allows the
7681
+ * user to update the billing address or payment information associated with the
7682
+ * funding source.
7683
+ */
7684
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$v(this, null, function* () {
7602
7685
  const endUserIpAddress = yield getEndUserIpAddress();
7603
7686
  if (!endUserIpAddress)
7604
7687
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7611,7 +7694,11 @@ class FundingSourcesAPI {
7611
7694
  }
7612
7695
  );
7613
7696
  });
7614
- this.registerCarrier = (carrier) => __async$u(this, null, function* () {
7697
+ /**
7698
+ * The `registerCarrier` method registers a carrier account and associates
7699
+ * it with a given funding source.
7700
+ */
7701
+ this.registerCarrier = (carrier) => __async$v(this, null, function* () {
7615
7702
  const endUserIpAddress = yield getEndUserIpAddress();
7616
7703
  if (!endUserIpAddress)
7617
7704
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7619,7 +7706,10 @@ class FundingSourcesAPI {
7619
7706
  endUserIpAddress
7620
7707
  }, carrier));
7621
7708
  });
7622
- this.addFunds = (amount, fundingSourceId) => __async$u(this, null, function* () {
7709
+ /**
7710
+ * The `addFunds` method allows you to add funds to a funding source.
7711
+ */
7712
+ this.addFunds = (amount, fundingSourceId) => __async$v(this, null, function* () {
7623
7713
  return yield this.client.put(
7624
7714
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
7625
7715
  amount
@@ -7632,6 +7722,10 @@ class FundingSourcesAPI {
7632
7722
  class InsuranceAPI {
7633
7723
  constructor(client) {
7634
7724
  this.client = client;
7725
+ /**
7726
+ * The `get` method retrieves the insurance balance for a given `insuranceProvider`
7727
+ * by ID.
7728
+ */
7635
7729
  this.get = (insuranceProvider) => {
7636
7730
  return this.client.get(`/v1/insurance/${insuranceProvider}/balance`);
7637
7731
  };
@@ -7642,15 +7736,31 @@ class InsuranceAPI {
7642
7736
  class LabelsAPI {
7643
7737
  constructor(client) {
7644
7738
  this.client = client;
7739
+ /**
7740
+ * The `get` method retrieves a specific label by `labelId`.
7741
+ */
7645
7742
  this.get = (labelId) => {
7646
7743
  return this.client.get(`/v1/labels/${labelId}`);
7647
7744
  };
7745
+ /**
7746
+ * The `list` method retrieves a list of labels created by a given user.
7747
+ */
7648
7748
  this.list = (params = {}) => {
7649
7749
  return this.client.get("/v1/labels", { params });
7650
7750
  };
7751
+ /**
7752
+ * The `createByRateId` allows you to create a shipping label by using a `rateId`
7753
+ * which is a unique identifier tied to a specific rate.
7754
+ *
7755
+ * This helps ensure that when a user is rate shopping, they can purchase a
7756
+ * label for the price they were initially rated.
7757
+ */
7651
7758
  this.createByRateId = (rateId, options) => {
7652
7759
  return this.client.post(`/v1/labels/rates/${rateId}`, options);
7653
7760
  };
7761
+ /**
7762
+ * The `void` method allows a user to void a label by `labelId`.
7763
+ */
7654
7764
  this.void = (labelId) => {
7655
7765
  return this.client.put(`/v1/labels/${labelId}/void`);
7656
7766
  };
@@ -7661,12 +7771,22 @@ class LabelsAPI {
7661
7771
  class OrderSourcesAPI {
7662
7772
  constructor(client) {
7663
7773
  this.client = client;
7774
+ /**
7775
+ * The `list` method retrieves a list of connected order sources for a given user.
7776
+ */
7664
7777
  this.list = () => {
7665
7778
  return this.client.get("/v-beta/order_sources");
7666
7779
  };
7780
+ /**
7781
+ * The `get` method retrieves a specific order source by `orderSourceId`.
7782
+ */
7667
7783
  this.get = (orderSourceId) => {
7668
7784
  return this.client.get(`/v-beta/order_sources/${orderSourceId}`);
7669
7785
  };
7786
+ /**
7787
+ * The `refresh` method refreshes a specific order source by `orderSourceId`.
7788
+ * This will pull in any `new orders` since the last order import.
7789
+ */
7670
7790
  this.refresh = (orderSourceId) => {
7671
7791
  return this.client.put(`/v-beta/order_sources/${orderSourceId}/refresh`);
7672
7792
  };
@@ -7677,20 +7797,36 @@ class OrderSourcesAPI {
7677
7797
  class RateCardsAPI {
7678
7798
  constructor(client) {
7679
7799
  this.client = client;
7800
+ /**
7801
+ * The `list` method retrieves a list of rate cards for a given list of carrier ID's.
7802
+ */
7680
7803
  this.list = (carrierIds) => {
7681
7804
  return this.client.get(
7682
7805
  `/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
7683
7806
  );
7684
7807
  };
7808
+ /**
7809
+ * The `get` method retrieves a specific rate card by `rateCardId`.
7810
+ */
7685
7811
  this.get = (rateCardId) => {
7686
7812
  return this.client.get(`/v1/rate_cards/${rateCardId}`);
7687
7813
  };
7814
+ /**
7815
+ * The `create` method creates a new rate card for a given user.
7816
+ */
7688
7817
  this.create = (rateCardInput) => {
7689
7818
  return this.client.post("/v1/rate_cards", rateCardInput);
7690
7819
  };
7820
+ /**
7821
+ * The `update` method updates a specific rate card by `rateCardId` with a new
7822
+ * `RateCard`.
7823
+ */
7691
7824
  this.update = (rateCard) => {
7692
7825
  return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
7693
7826
  };
7827
+ /**
7828
+ * The `download` method allows for downloading a given rate card by `rateCardId`.
7829
+ */
7694
7830
  this.download = (rateCardId) => {
7695
7831
  return this.client.get(`/v1/rate_cards/${rateCardId}/rates/download`, {
7696
7832
  headers: {
@@ -7699,6 +7835,9 @@ class RateCardsAPI {
7699
7835
  responseType: "blob"
7700
7836
  });
7701
7837
  };
7838
+ /**
7839
+ * The `upload` method allows for uploading a given rate card as a spreadsheet file.
7840
+ */
7702
7841
  this.upload = (rateCardId, file) => {
7703
7842
  const formData = new FormData();
7704
7843
  formData.append("file", file);
@@ -7708,9 +7847,18 @@ class RateCardsAPI {
7708
7847
  }
7709
7848
  });
7710
7849
  };
7850
+ /**
7851
+ * The `publish` method allows for publishing a given rate card by `rateCardId`.
7852
+ */
7711
7853
  this.publish = (rateCardId) => {
7712
7854
  return this.client.post(`/v1/rate_cards/${rateCardId}/publish`);
7713
7855
  };
7856
+ /**
7857
+ * @description https://auctane.atlassian.net/wiki/spaces/TE/pages/3837431603/Inc+1+3.+Rate+Card+Details#Delete-Rate-Card
7858
+ */
7859
+ this.delete = (rateCardId) => {
7860
+ return this.client.delete(`/v1/rate_cards/${rateCardId}`);
7861
+ };
7714
7862
  this.client = client;
7715
7863
  }
7716
7864
  }
@@ -7718,6 +7866,10 @@ class RateCardsAPI {
7718
7866
  class RatesAPI {
7719
7867
  constructor(client) {
7720
7868
  this.client = client;
7869
+ /**
7870
+ * The `calculate` method calculates rates for a shipment by shipment ID based
7871
+ * on the shipment's options.
7872
+ */
7721
7873
  this.calculateByShipmentId = (shipmentId, options) => {
7722
7874
  return this.client.post("/v1/rates", {
7723
7875
  rateOptions: options,
@@ -7731,20 +7883,32 @@ class RatesAPI {
7731
7883
  class SalesOrderShipmentsAPI {
7732
7884
  constructor(client) {
7733
7885
  this.client = client;
7886
+ /**
7887
+ * The `list` method retrieves a list of sales order shipments for a given user.
7888
+ */
7734
7889
  this.list = (body = {}, params) => {
7735
7890
  return this.client.post("/v-beta/shipments/list", body, {
7736
7891
  params
7737
7892
  });
7738
7893
  };
7894
+ /**
7895
+ * The `get` method retrieves a specific sales order shipment by `shipmentId`.
7896
+ */
7739
7897
  this.get = (shipmentId) => {
7740
7898
  return this.client.get(`/v-beta/shipments/${shipmentId}`);
7741
7899
  };
7900
+ /**
7901
+ * The `create` method creates a new shipment for a sales order.
7902
+ */
7742
7903
  this.create = (salesOrderId, shipment) => {
7743
7904
  return this.client.post(
7744
7905
  `/v-beta/shipments/sales_order/${salesOrderId}`,
7745
7906
  shipment
7746
7907
  );
7747
7908
  };
7909
+ /**
7910
+ * The `update` method updates a specific sales order shipment by `shipmentId`.
7911
+ */
7748
7912
  this.update = (shipmentId, shipment) => {
7749
7913
  return this.client.put(`/v-beta/shipments/${shipmentId}`, shipment);
7750
7914
  };
@@ -7755,12 +7919,23 @@ class SalesOrderShipmentsAPI {
7755
7919
  class SalesOrdersAPI {
7756
7920
  constructor(client) {
7757
7921
  this.client = client;
7922
+ /**
7923
+ * The `list` method retrieves a list of sales orders.
7924
+ */
7758
7925
  this.list = (params = {}) => {
7759
7926
  return this.client.get("/v-beta/sales_orders", { params });
7760
7927
  };
7928
+ /**
7929
+ * The `get` method retrieves a specific sales order by `salesOrderId`.
7930
+ */
7761
7931
  this.get = (salesOrderId) => {
7762
7932
  return this.client.get(`/v-beta/sales_orders/${salesOrderId}`);
7763
7933
  };
7934
+ /**
7935
+ * The `notifyShipped` method notifies order source that the order has been
7936
+ * shipped. Typically, the order source will then notify the user based on
7937
+ * this update from ShipEngine API.
7938
+ */
7764
7939
  this.notifyShipped = (salesOrderId, tracking) => {
7765
7940
  return this.client.post(`/v-beta/sales_orders/${salesOrderId}/notify`, tracking);
7766
7941
  };
@@ -7768,7 +7943,7 @@ class SalesOrdersAPI {
7768
7943
  }
7769
7944
  }
7770
7945
 
7771
- var __async$t = (__this, __arguments, generator) => {
7946
+ var __async$u = (__this, __arguments, generator) => {
7772
7947
  return new Promise((resolve, reject) => {
7773
7948
  var fulfilled = (value) => {
7774
7949
  try {
@@ -7791,16 +7966,27 @@ var __async$t = (__this, __arguments, generator) => {
7791
7966
  class ShipmentsAPI {
7792
7967
  constructor(client) {
7793
7968
  this.client = client;
7969
+ /**
7970
+ * The `getShipmentRates` method retrieves rates for a given shipment by
7971
+ * shipment ID.
7972
+ */
7794
7973
  this.getShipmentRates = ({ shipmentId, createdAtStart }) => {
7795
7974
  return this.client.get(
7796
7975
  `/v1/shipments/${shipmentId}/rates`,
7797
7976
  createdAtStart !== void 0 ? { params: { createdAtStart } } : void 0
7798
7977
  );
7799
7978
  };
7979
+ /**
7980
+ * The `list` method retrieves a list of shipments for a given user.
7981
+ */
7800
7982
  this.list = (options) => {
7801
7983
  return this.client.get("/v1/shipments", { params: options });
7802
7984
  };
7803
- this.create = (...shipments) => __async$t(this, null, function* () {
7985
+ /**
7986
+ * The `create` method allows for creating shipments based on a list of shipment
7987
+ * items passed into this method.
7988
+ */
7989
+ this.create = (...shipments) => __async$u(this, null, function* () {
7804
7990
  return this.client.post("/v1/shipments", {
7805
7991
  shipments
7806
7992
  });
@@ -7812,15 +7998,31 @@ class ShipmentsAPI {
7812
7998
  class WarehousesAPI {
7813
7999
  constructor(client) {
7814
8000
  this.client = client;
8001
+ /**
8002
+ * The `list` method retrieves a list of `warehouses` (Ship From Locations)
8003
+ * for a given user.
8004
+ */
7815
8005
  this.list = () => {
7816
8006
  return this.client.get("/v1/warehouses");
7817
8007
  };
8008
+ /**
8009
+ * The `create` method allows for creation of warehouses (Ship From Locations)
8010
+ * on a users ShipEngine account.
8011
+ */
7818
8012
  this.create = (warehouse) => {
7819
8013
  return this.client.post("/v1/warehouses", warehouse);
7820
8014
  };
8015
+ /**
8016
+ * The `update` method updates a specific warehouse (Ship From Location) for a
8017
+ * given user by `warehouseId`.
8018
+ */
7821
8019
  this.update = (warehouseId, warehouse) => {
7822
8020
  return this.client.put(`/v1/warehouses/${warehouseId}`, warehouse);
7823
8021
  };
8022
+ /**
8023
+ * The `delete` method deletes a specific warehouse (Ship From Location) by
8024
+ * `warehouseId` from a users ShipEngine account.
8025
+ */
7824
8026
  this.delete = (warehouseId) => {
7825
8027
  return this.client.delete(`/v1/warehouses/${warehouseId}`);
7826
8028
  };
@@ -7847,7 +8049,7 @@ var __spreadValues$5 = (a, b) => {
7847
8049
  return a;
7848
8050
  };
7849
8051
  var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
7850
- var __async$s = (__this, __arguments, generator) => {
8052
+ var __async$t = (__this, __arguments, generator) => {
7851
8053
  return new Promise((resolve, reject) => {
7852
8054
  var fulfilled = (value) => {
7853
8055
  try {
@@ -7941,7 +8143,7 @@ class ShipEngineAPI {
7941
8143
  );
7942
8144
  return res;
7943
8145
  },
7944
- (err) => __async$s(this, null, function* () {
8146
+ (err) => __async$t(this, null, function* () {
7945
8147
  var _a, _b, _c, _d, _e, _f, _g;
7946
8148
  logger$1.error(
7947
8149
  { err, req: err.config, res: err.response },
@@ -7981,48 +8183,135 @@ class ShipEngineAPI {
7981
8183
  );
7982
8184
  this.client = client;
7983
8185
  }
8186
+ /**
8187
+ * The `token` method takes in a string and sets it as the Authorization header for all requests.
8188
+ */
7984
8189
  set token(token) {
7985
8190
  this.client.defaults.headers.common["Authorization"] = `Bearer ${token}`;
7986
8191
  }
8192
+ /**
8193
+ * The `accountSettings` method provides access to the Account Settings endpoints
8194
+ * in ShipEngine API.
8195
+ *
8196
+ * @see {@link AccountSettingsAPI | The Account Settings API module}
8197
+ */
7987
8198
  get accountSettings() {
7988
8199
  return new AccountSettingsAPI(this.client);
7989
8200
  }
8201
+ /**
8202
+ * The `addresses` method provides access to the Address Validation endpoints
8203
+ * in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
8204
+ *
8205
+ * @see {@link AddressesAPI | The Addresses API module}
8206
+ */
7990
8207
  get addresses() {
7991
8208
  return new AddressesAPI(this.client);
7992
8209
  }
8210
+ /**
8211
+ * The `carriers` method provides access to the Carrier endpoints in ShipEngine
8212
+ * API. e.g. List Carriers, Get Carrier, Connect Carrier, etc.
8213
+ *
8214
+ * @see {@link CarriersAPI | The Carriers API module}
8215
+ */
7993
8216
  get carriers() {
7994
8217
  return new CarriersAPI(this.client);
7995
8218
  }
8219
+ /**
8220
+ * The `customPackages` method provides access to the Packages endpoint in ShipEngine
8221
+ * API. e.g. List Packages
8222
+ *
8223
+ * @see {@link CustomPackagesAPI | The Custom Packages API module}
8224
+ */
7996
8225
  get customPackages() {
7997
8226
  return new CustomPackagesAPI(this.client);
7998
8227
  }
8228
+ /**
8229
+ * The `fundingSources` method provides access to the Funding Sources endpoints
8230
+ * in ShipEngine API.
8231
+ *
8232
+ * @see {@link FundingSourcesAPI | The Funding Sources API module}
8233
+ */
7999
8234
  get fundingSources() {
8000
8235
  return new FundingSourcesAPI(this.client);
8001
8236
  }
8237
+ /**
8238
+ * The `insurance` method provides access to the Insurance endpoint in ShipEngine
8239
+ * API. e.g. Get Insurance Balance
8240
+ *
8241
+ * @see {@link InsuranceAPI | The Insurance API module}
8242
+ */
8002
8243
  get insurance() {
8003
8244
  return new InsuranceAPI(this.client);
8004
8245
  }
8246
+ /**
8247
+ * The `labels` method provides access to the Label endpoints in ShipEngine API.
8248
+ * e.g. Create Label, Get Label, Void Label, etc.
8249
+ *
8250
+ * @see {@link LabelsAPI | The Labels API module}
8251
+ */
8005
8252
  get labels() {
8006
8253
  return new LabelsAPI(this.client);
8007
8254
  }
8255
+ /**
8256
+ * The `orderSources` method provides access to the Order Sources endpoints in
8257
+ * ShipEngine API. e.g. List Order Sources, Get Order Source, Refresh Order Source, etc.
8258
+ *
8259
+ * @see {@link OrderSourcesAPI | The Order Sources API module}
8260
+ */
8008
8261
  get orderSources() {
8009
8262
  return new OrderSourcesAPI(this.client);
8010
8263
  }
8264
+ /**
8265
+ * The `rateCards` method provides access to the Rate Cards endpoints in ShipEngine
8266
+ * API.
8267
+ *
8268
+ * @see {@link RateCardsAPI | The Rate Cards API module}
8269
+ */
8011
8270
  get rateCards() {
8012
8271
  return new RateCardsAPI(this.client);
8013
8272
  }
8273
+ /**
8274
+ * The `rates` method provides access to the Rate endpoints in ShipEngine API.
8275
+ * e.g. Get Rates
8276
+ *
8277
+ * @see {@link RatesAPI | The Rates API module}
8278
+ */
8014
8279
  get rates() {
8015
8280
  return new RatesAPI(this.client);
8016
8281
  }
8282
+ /**
8283
+ * The `salesOrderShipments` method provides access to the `v-beta` Sales
8284
+ * Order Shipments endpoints in ShipEngine API.
8285
+ *
8286
+ * @see {@link SalesOrderShipmentsAPI | The Sales Order Shipments API module}
8287
+ */
8017
8288
  get salesOrderShipments() {
8018
8289
  return new SalesOrderShipmentsAPI(this.client);
8019
8290
  }
8291
+ /**
8292
+ * The `salesOrders` method provides access to the `v-beta` Sales Order endpoints
8293
+ * in ShipEngine API.
8294
+ *
8295
+ * @see {@link SalesOrdersAPI | The Sales Orders API module}
8296
+ */
8020
8297
  get salesOrders() {
8021
8298
  return new SalesOrdersAPI(this.client);
8022
8299
  }
8300
+ /**
8301
+ * The `shipments` method provides access to the Shipment endpoints in ShipEngine
8302
+ * API. e.g. Create Shipment, Get Shipment, etc.
8303
+ *
8304
+ * @see {@link ShipmentsAPI | The Shipments API module}
8305
+ */
8023
8306
  get shipments() {
8024
8307
  return new ShipmentsAPI(this.client);
8025
8308
  }
8309
+ /**
8310
+ * The `warehouses` method provides access to the Warehouses endpoints in ShipEngine
8311
+ * API. e.g. List Warehouses, Get Warehouse, etc.
8312
+ *
8313
+ * @see {@link WarehousesAPI | The Warehouses API module}
8314
+ */
8026
8315
  get warehouses() {
8027
8316
  return new WarehousesAPI(this.client);
8028
8317
  }
@@ -8133,7 +8422,17 @@ const retryUntil = (callbackFn, retries = 10, timeoutBetweenAttempts = 1e3) => P
8133
8422
  throw error;
8134
8423
  });
8135
8424
 
8136
- var __async$r = (__this, __arguments, generator) => {
8425
+ const useGetAccountSettings = () => {
8426
+ const { client } = useShipEngine();
8427
+ return useQuery({
8428
+ onError,
8429
+ queryFn: () => client.accountSettings.get(),
8430
+ queryKey: ["getAccountSettings"],
8431
+ select: (result) => result.data
8432
+ });
8433
+ };
8434
+
8435
+ var __async$s = (__this, __arguments, generator) => {
8137
8436
  return new Promise((resolve, reject) => {
8138
8437
  var fulfilled = (value) => {
8139
8438
  try {
@@ -8153,19 +8452,19 @@ var __async$r = (__this, __arguments, generator) => {
8153
8452
  step((generator = generator.apply(__this, __arguments)).next());
8154
8453
  });
8155
8454
  };
8156
- const useAddFunds = (carrierId) => {
8455
+ const useUpdateAccountSettings = () => {
8157
8456
  const { client } = useShipEngine();
8158
8457
  return useMutation({
8159
- mutationFn: (funds) => __async$r(void 0, null, function* () {
8160
- const result = yield client.carriers.addFunds(carrierId, funds);
8458
+ mutationFn: (settings) => __async$s(void 0, null, function* () {
8459
+ const result = yield client.accountSettings.update(settings);
8161
8460
  return result.data;
8162
8461
  }),
8163
- mutationKey: ["useAddFunds"],
8462
+ mutationKey: ["useUpdateAccountSettings"],
8164
8463
  onError
8165
8464
  });
8166
8465
  };
8167
8466
 
8168
- var __async$q = (__this, __arguments, generator) => {
8467
+ var __async$r = (__this, __arguments, generator) => {
8169
8468
  return new Promise((resolve, reject) => {
8170
8469
  var fulfilled = (value) => {
8171
8470
  try {
@@ -8185,19 +8484,19 @@ var __async$q = (__this, __arguments, generator) => {
8185
8484
  step((generator = generator.apply(__this, __arguments)).next());
8186
8485
  });
8187
8486
  };
8188
- const useCalculateRates = () => {
8487
+ const useParseAddress = () => {
8189
8488
  const { client } = useShipEngine();
8190
8489
  return useMutation({
8191
- mutationFn: (_0) => __async$q(void 0, [_0], function* ({ rateOptions, shipmentId }) {
8192
- const result = yield client.rates.calculateByShipmentId(shipmentId, rateOptions);
8490
+ mutationFn: (_0) => __async$r(void 0, [_0], function* ({ address, text }) {
8491
+ const result = yield client.addresses.parse(text, address);
8193
8492
  return result.data;
8194
8493
  }),
8195
- mutationKey: ["useCalculateRates"],
8494
+ mutationKey: ["useParseAddress"],
8196
8495
  onError
8197
8496
  });
8198
8497
  };
8199
8498
 
8200
- var __async$p = (__this, __arguments, generator) => {
8499
+ var __async$q = (__this, __arguments, generator) => {
8201
8500
  return new Promise((resolve, reject) => {
8202
8501
  var fulfilled = (value) => {
8203
8502
  try {
@@ -8217,19 +8516,19 @@ var __async$p = (__this, __arguments, generator) => {
8217
8516
  step((generator = generator.apply(__this, __arguments)).next());
8218
8517
  });
8219
8518
  };
8220
- const useConnectCarrier = () => {
8519
+ const useValidateAddresses = () => {
8221
8520
  const { client } = useShipEngine();
8222
8521
  return useMutation({
8223
- mutationFn: (params) => __async$p(void 0, null, function* () {
8224
- const result = yield client.carriers.connect(params);
8522
+ mutationFn: (addresses) => __async$q(void 0, null, function* () {
8523
+ const result = yield client.addresses.validate(addresses);
8225
8524
  return result.data;
8226
8525
  }),
8227
- mutationKey: ["useConnectCarrier"],
8526
+ mutationKey: ["useValidateAddresses"],
8228
8527
  onError
8229
8528
  });
8230
8529
  };
8231
8530
 
8232
- var __async$o = (__this, __arguments, generator) => {
8531
+ var __async$p = (__this, __arguments, generator) => {
8233
8532
  return new Promise((resolve, reject) => {
8234
8533
  var fulfilled = (value) => {
8235
8534
  try {
@@ -8249,34 +8548,19 @@ var __async$o = (__this, __arguments, generator) => {
8249
8548
  step((generator = generator.apply(__this, __arguments)).next());
8250
8549
  });
8251
8550
  };
8252
- const useCreateFundingSource = () => {
8551
+ const useAddFunds = (carrierId) => {
8253
8552
  const { client } = useShipEngine();
8254
8553
  return useMutation({
8255
- mutationFn: (fundingSource) => __async$o(void 0, null, function* () {
8256
- const result = yield client.fundingSources.create(fundingSource);
8554
+ mutationFn: (funds) => __async$p(void 0, null, function* () {
8555
+ const result = yield client.carriers.addFunds(carrierId, funds);
8257
8556
  return result.data;
8258
8557
  }),
8259
- mutationKey: ["useCreateFundingSource"],
8558
+ mutationKey: ["useAddFunds"],
8260
8559
  onError
8261
8560
  });
8262
8561
  };
8263
8562
 
8264
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8265
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8266
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8267
- var __objRest$6 = (source, exclude) => {
8268
- var target = {};
8269
- for (var prop in source)
8270
- if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
8271
- target[prop] = source[prop];
8272
- if (source != null && __getOwnPropSymbols$9)
8273
- for (var prop of __getOwnPropSymbols$9(source)) {
8274
- if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
8275
- target[prop] = source[prop];
8276
- }
8277
- return target;
8278
- };
8279
- var __async$n = (__this, __arguments, generator) => {
8563
+ var __async$o = (__this, __arguments, generator) => {
8280
8564
  return new Promise((resolve, reject) => {
8281
8565
  var fulfilled = (value) => {
8282
8566
  try {
@@ -8296,20 +8580,147 @@ var __async$n = (__this, __arguments, generator) => {
8296
8580
  step((generator = generator.apply(__this, __arguments)).next());
8297
8581
  });
8298
8582
  };
8299
- const useCreateLabel = () => {
8583
+ const useConnectCarrier = () => {
8300
8584
  const { client } = useShipEngine();
8301
8585
  return useMutation({
8302
- mutationFn: (_a) => __async$n(void 0, null, function* () {
8303
- var _b = _a, { rateId } = _b, options = __objRest$6(_b, ["rateId"]);
8304
- const result = yield client.labels.createByRateId(rateId, options);
8586
+ mutationFn: (params) => __async$o(void 0, null, function* () {
8587
+ const result = yield client.carriers.connect(params);
8305
8588
  return result.data;
8306
8589
  }),
8307
- mutationKey: ["useCreateLabel"],
8590
+ mutationKey: ["useConnectCarrier"],
8308
8591
  onError
8309
8592
  });
8310
8593
  };
8311
8594
 
8312
- var __async$m = (__this, __arguments, generator) => {
8595
+ const useGetAutoFundingConfiguration = (carrierId) => {
8596
+ const { client } = useShipEngine();
8597
+ return useQuery({
8598
+ enabled: carrierId !== void 0,
8599
+ onError,
8600
+ queryFn: () => {
8601
+ if (carrierId)
8602
+ return client.carriers.getAutoFunding(carrierId);
8603
+ return Promise.reject(new Error("carrierId is required."));
8604
+ },
8605
+ queryKey: ["useGetAutoFundingConfiguration", carrierId],
8606
+ select: (result) => result.data
8607
+ });
8608
+ };
8609
+
8610
+ const useGetCarrierById = (carrierId) => {
8611
+ const { client } = useShipEngine();
8612
+ return useQuery({
8613
+ enabled: !!carrierId,
8614
+ onError,
8615
+ queryFn: () => {
8616
+ if (carrierId)
8617
+ return client.carriers.get(carrierId);
8618
+ return Promise.reject(new Error("carrierId is require"));
8619
+ },
8620
+ queryKey: ["useGetCarrierById", carrierId],
8621
+ select: (result) => result.data,
8622
+ // Fresh for 5 minutes
8623
+ staleTime: 5 * 60 * 1e3
8624
+ });
8625
+ };
8626
+
8627
+ const useGetCountriesByCarrier = (carrierId) => {
8628
+ const { client } = useShipEngine();
8629
+ return useQuery({
8630
+ enabled: !!carrierId,
8631
+ onError,
8632
+ queryFn: () => {
8633
+ if (carrierId)
8634
+ return client.carriers.getCountries(carrierId);
8635
+ return Promise.reject(new Error("carrierId is require"));
8636
+ },
8637
+ queryKey: ["useGetCountriesByCarrier", carrierId],
8638
+ select: (result) => result.data.countries,
8639
+ // Fresh for 5 minutes
8640
+ staleTime: 5 * 60 * 1e3
8641
+ });
8642
+ };
8643
+
8644
+ const useGetCurrenciesByCarrier = (carrierId) => {
8645
+ const { client } = useShipEngine();
8646
+ return useQuery({
8647
+ enabled: !!carrierId,
8648
+ onError,
8649
+ queryFn: () => {
8650
+ if (carrierId)
8651
+ return client.carriers.getCurrencies(carrierId);
8652
+ return Promise.reject(new Error("carrierId is require"));
8653
+ },
8654
+ queryKey: ["useGetCurrenciesByCarrier", carrierId],
8655
+ select: (result) => result.data.currencies,
8656
+ // Fresh for 5 minutes
8657
+ staleTime: 5 * 60 * 1e3
8658
+ });
8659
+ };
8660
+
8661
+ const useGetPackageRatingGroupByCarrier = (carrierId) => {
8662
+ const { client } = useShipEngine();
8663
+ return useQuery({
8664
+ enabled: !!carrierId,
8665
+ onError,
8666
+ queryFn: () => {
8667
+ if (carrierId)
8668
+ return client.carriers.getPackageRatingGroup(carrierId);
8669
+ return Promise.reject(new Error("carrierId is required"));
8670
+ },
8671
+ queryKey: ["useGetRatePackageFormatsByCarrier", carrierId],
8672
+ select: (result) => result.data.packageRatingGroup,
8673
+ // Fresh for 5 minutes
8674
+ staleTime: 5 * 60 * 1e3
8675
+ });
8676
+ };
8677
+
8678
+ const useGetServicesByCarrier = (carrierId) => {
8679
+ const { client } = useShipEngine();
8680
+ return useQuery({
8681
+ enabled: !!carrierId,
8682
+ onError,
8683
+ queryFn: () => {
8684
+ if (carrierId)
8685
+ return client.carriers.getServices(carrierId);
8686
+ return Promise.reject(new Error("carrierId is required"));
8687
+ },
8688
+ queryKey: ["useGetServicesByCarrier", carrierId],
8689
+ select: (result) => result.data.services,
8690
+ // Fresh for 5 minutes
8691
+ staleTime: 5 * 60 * 1e3
8692
+ });
8693
+ };
8694
+
8695
+ const useGetWalletHistory = ({
8696
+ enabled,
8697
+ page,
8698
+ range
8699
+ }) => {
8700
+ const { client } = useShipEngine();
8701
+ const [startDate, endDate] = range;
8702
+ return useQuery({
8703
+ enabled,
8704
+ keepPreviousData: true,
8705
+ // See https://react-query-v3.tanstack.com/guides/paginated-queries#better-paginated-queries-with-keeppreviousdata
8706
+ onError,
8707
+ queryFn: () => client.carriers.getWalletHistory(startDate, endDate, page),
8708
+ queryKey: ["useGetWalletHistory", startDate, endDate, page],
8709
+ select: (result) => result.data
8710
+ });
8711
+ };
8712
+
8713
+ const useListCarriers = () => {
8714
+ const { client } = useShipEngine();
8715
+ return useQuery({
8716
+ onError,
8717
+ queryFn: () => client.carriers.list(),
8718
+ queryKey: ["useListCarriers"],
8719
+ select: (result) => result.data.carriers
8720
+ });
8721
+ };
8722
+
8723
+ var __async$n = (__this, __arguments, generator) => {
8313
8724
  return new Promise((resolve, reject) => {
8314
8725
  var fulfilled = (value) => {
8315
8726
  try {
@@ -8329,34 +8740,33 @@ var __async$m = (__this, __arguments, generator) => {
8329
8740
  step((generator = generator.apply(__this, __arguments)).next());
8330
8741
  });
8331
8742
  };
8332
- const useCreateRateCard = () => {
8743
+ const useUpdateAutoFunding = (carrierId) => {
8333
8744
  const { client } = useShipEngine();
8745
+ const queryClient = useQueryClient();
8334
8746
  return useMutation({
8335
- mutationFn: (rateCard) => __async$m(void 0, null, function* () {
8336
- const result = yield client.rateCards.create(rateCard);
8747
+ mutationFn: (options) => __async$n(void 0, null, function* () {
8748
+ const result = yield client.carriers.updateAutoFunding(carrierId, options);
8337
8749
  return result.data;
8338
8750
  }),
8339
- mutationKey: ["useCreateRateCard"],
8340
- onError
8751
+ mutationKey: ["useUpdateAutoFunding"],
8752
+ onError,
8753
+ onSuccess: (_) => {
8754
+ queryClient.invalidateQueries(["useGetAutoFunding", carrierId], { exact: true });
8755
+ }
8341
8756
  });
8342
8757
  };
8343
8758
 
8344
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8345
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8346
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8347
- var __objRest$5 = (source, exclude) => {
8348
- var target = {};
8349
- for (var prop in source)
8350
- if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
8351
- target[prop] = source[prop];
8352
- if (source != null && __getOwnPropSymbols$8)
8353
- for (var prop of __getOwnPropSymbols$8(source)) {
8354
- if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
8355
- target[prop] = source[prop];
8356
- }
8357
- return target;
8759
+ const useListCustomPackageTypes = () => {
8760
+ const { client } = useShipEngine();
8761
+ return useQuery({
8762
+ onError,
8763
+ queryFn: () => client.customPackages.list(),
8764
+ queryKey: ["useListCustomPackageTypes"],
8765
+ select: (result) => result.data.packages
8766
+ });
8358
8767
  };
8359
- var __async$l = (__this, __arguments, generator) => {
8768
+
8769
+ var __async$m = (__this, __arguments, generator) => {
8360
8770
  return new Promise((resolve, reject) => {
8361
8771
  var fulfilled = (value) => {
8362
8772
  try {
@@ -8376,39 +8786,19 @@ var __async$l = (__this, __arguments, generator) => {
8376
8786
  step((generator = generator.apply(__this, __arguments)).next());
8377
8787
  });
8378
8788
  };
8379
- const useCreateSalesOrderShipment = () => {
8789
+ const useCreateFundingSource = () => {
8380
8790
  const { client } = useShipEngine();
8381
8791
  return useMutation({
8382
- mutationFn: (_a) => __async$l(void 0, null, function* () {
8383
- var _b = _a, { salesOrderId } = _b, shipment = __objRest$5(_b, ["salesOrderId"]);
8384
- const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
8792
+ mutationFn: (fundingSource) => __async$m(void 0, null, function* () {
8793
+ const result = yield client.fundingSources.create(fundingSource);
8385
8794
  return result.data;
8386
8795
  }),
8387
- mutationKey: ["useCreateSalesOrderShipment"],
8796
+ mutationKey: ["useCreateFundingSource"],
8388
8797
  onError
8389
8798
  });
8390
8799
  };
8391
8800
 
8392
- var __defProp$3 = Object.defineProperty;
8393
- var __defProps$2 = Object.defineProperties;
8394
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
8395
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8396
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8397
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8398
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8399
- var __spreadValues$3 = (a, b) => {
8400
- for (var prop in b || (b = {}))
8401
- if (__hasOwnProp$7.call(b, prop))
8402
- __defNormalProp$3(a, prop, b[prop]);
8403
- if (__getOwnPropSymbols$7)
8404
- for (var prop of __getOwnPropSymbols$7(b)) {
8405
- if (__propIsEnum$7.call(b, prop))
8406
- __defNormalProp$3(a, prop, b[prop]);
8407
- }
8408
- return a;
8409
- };
8410
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
8411
- var __async$k = (__this, __arguments, generator) => {
8801
+ var __async$l = (__this, __arguments, generator) => {
8412
8802
  return new Promise((resolve, reject) => {
8413
8803
  var fulfilled = (value) => {
8414
8804
  try {
@@ -8428,69 +8818,39 @@ var __async$k = (__this, __arguments, generator) => {
8428
8818
  step((generator = generator.apply(__this, __arguments)).next());
8429
8819
  });
8430
8820
  };
8431
- const useCreateShipment = () => {
8821
+ const useFundingSourcesAddFunds = (fundingSourceId) => {
8432
8822
  const { client } = useShipEngine();
8433
8823
  return useMutation({
8434
- mutationFn: (shipment) => __async$k(void 0, null, function* () {
8435
- var _a;
8436
- if (shipment.warehouseId === void 0) {
8437
- throw new CodedError("errorMessages.noWarehouses", {
8438
- errorCode: "unknown",
8439
- errorSource: "client",
8440
- errorType: "business_rules"
8441
- });
8442
- }
8443
- const shipTo = (_a = shipment.shipTo) != null ? _a : {
8444
- addressLine1: "",
8445
- cityLocality: "",
8446
- countryCode: "",
8447
- name: "",
8448
- phone: "",
8449
- postalCode: "",
8450
- stateProvince: ""
8451
- };
8452
- return (yield client.shipments.create(__spreadProps$2(__spreadValues$3({}, shipment), {
8453
- shipTo
8454
- }))).data;
8824
+ mutationFn: (funds) => __async$l(void 0, null, function* () {
8825
+ const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
8826
+ return result.data;
8455
8827
  }),
8456
- mutationKey: ["useCreateShipment"],
8828
+ mutationKey: ["useFundingSourcesAddFunds"],
8457
8829
  onError
8458
8830
  });
8459
8831
  };
8460
8832
 
8461
- var __async$j = (__this, __arguments, generator) => {
8462
- return new Promise((resolve, reject) => {
8463
- var fulfilled = (value) => {
8464
- try {
8465
- step(generator.next(value));
8466
- } catch (e) {
8467
- reject(e);
8468
- }
8469
- };
8470
- var rejected = (value) => {
8471
- try {
8472
- step(generator.throw(value));
8473
- } catch (e) {
8474
- reject(e);
8475
- }
8476
- };
8477
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
8478
- step((generator = generator.apply(__this, __arguments)).next());
8833
+ const useGetFundingSourceById = (fundingSourceId) => {
8834
+ const { client } = useShipEngine();
8835
+ return useQuery({
8836
+ onError,
8837
+ queryFn: () => client.fundingSources.get(fundingSourceId),
8838
+ queryKey: ["getFundingSourceById"],
8839
+ select: (result) => result.data
8479
8840
  });
8480
8841
  };
8481
- const useCreateWarehouse = () => {
8842
+
8843
+ const useListFundingSources = () => {
8482
8844
  const { client } = useShipEngine();
8483
- return useMutation({
8484
- mutationFn: (data) => __async$j(void 0, null, function* () {
8485
- const result = yield client.warehouses.create(data);
8486
- return result.data;
8487
- }),
8488
- mutationKey: ["useCreateWarehouse"],
8489
- onError
8845
+ return useQuery({
8846
+ onError,
8847
+ queryFn: () => client.fundingSources.list(),
8848
+ queryKey: ["useListFundingSources"],
8849
+ select: (result) => result.data.fundingSources
8490
8850
  });
8491
8851
  };
8492
8852
 
8493
- var __async$i = (__this, __arguments, generator) => {
8853
+ var __async$k = (__this, __arguments, generator) => {
8494
8854
  return new Promise((resolve, reject) => {
8495
8855
  var fulfilled = (value) => {
8496
8856
  try {
@@ -8510,31 +8870,19 @@ var __async$i = (__this, __arguments, generator) => {
8510
8870
  step((generator = generator.apply(__this, __arguments)).next());
8511
8871
  });
8512
8872
  };
8513
- const useDeleteWarehouse = () => {
8873
+ const useRegisterCarrier = () => {
8514
8874
  const { client } = useShipEngine();
8515
8875
  return useMutation({
8516
- mutationFn: (_0) => __async$i(void 0, [_0], function* ({ warehouseId }) {
8517
- const result = yield client.warehouses.delete(warehouseId);
8876
+ mutationFn: (carrier) => __async$k(void 0, null, function* () {
8877
+ const result = yield client.fundingSources.registerCarrier(carrier);
8518
8878
  return result.data;
8519
8879
  }),
8520
- mutationKey: ["useDeleteWarehouse"],
8880
+ mutationKey: ["useRegisterCarrier"],
8521
8881
  onError
8522
8882
  });
8523
8883
  };
8524
8884
 
8525
- const useDownloadRateCard = (rateCardId) => {
8526
- const { client } = useShipEngine();
8527
- return useQuery({
8528
- enabled: !!rateCardId.length,
8529
- onError,
8530
- queryFn: () => {
8531
- return client.rateCards.download(rateCardId);
8532
- },
8533
- queryKey: ["useDownloadRateCard", rateCardId]
8534
- });
8535
- };
8536
-
8537
- var __async$h = (__this, __arguments, generator) => {
8885
+ var __async$j = (__this, __arguments, generator) => {
8538
8886
  return new Promise((resolve, reject) => {
8539
8887
  var fulfilled = (value) => {
8540
8888
  try {
@@ -8554,104 +8902,26 @@ var __async$h = (__this, __arguments, generator) => {
8554
8902
  step((generator = generator.apply(__this, __arguments)).next());
8555
8903
  });
8556
8904
  };
8557
- const useFundingSourcesAddFunds = (fundingSourceId) => {
8905
+ const useUpdateFundingSource = () => {
8558
8906
  const { client } = useShipEngine();
8559
8907
  return useMutation({
8560
- mutationFn: (funds) => __async$h(void 0, null, function* () {
8561
- const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
8908
+ mutationFn: (_0) => __async$j(void 0, [_0], function* ({
8909
+ billingInfo,
8910
+ creditCardInfo,
8911
+ fundingSourceId
8912
+ }) {
8913
+ const result = yield client.fundingSources.update(
8914
+ billingInfo,
8915
+ creditCardInfo,
8916
+ fundingSourceId
8917
+ );
8562
8918
  return result.data;
8563
8919
  }),
8564
- mutationKey: ["useFundingSourcesAddFunds"],
8920
+ mutationKey: ["useUpdateFundingSource"],
8565
8921
  onError
8566
8922
  });
8567
8923
  };
8568
8924
 
8569
- const useGetAccountSettings = () => {
8570
- const { client } = useShipEngine();
8571
- return useQuery({
8572
- onError,
8573
- queryFn: () => client.accountSettings.get(),
8574
- queryKey: ["getAccountSettings"],
8575
- select: (result) => result.data
8576
- });
8577
- };
8578
-
8579
- const useGetAutoFundingConfiguration = (carrierId) => {
8580
- const { client } = useShipEngine();
8581
- return useQuery({
8582
- enabled: carrierId !== void 0,
8583
- onError,
8584
- queryFn: () => {
8585
- if (carrierId)
8586
- return client.carriers.getAutoFunding(carrierId);
8587
- return Promise.reject(new Error("carrierId is required."));
8588
- },
8589
- queryKey: ["useGetAutoFundingConfiguration", carrierId],
8590
- select: (result) => result.data
8591
- });
8592
- };
8593
-
8594
- const useGetCarrierById = (carrierId) => {
8595
- const { client } = useShipEngine();
8596
- return useQuery({
8597
- enabled: !!carrierId,
8598
- onError,
8599
- queryFn: () => {
8600
- if (carrierId)
8601
- return client.carriers.get(carrierId);
8602
- return Promise.reject(new Error("carrierId is require"));
8603
- },
8604
- queryKey: ["useGetCarrierById", carrierId],
8605
- select: (result) => result.data,
8606
- // Fresh for 5 minutes
8607
- staleTime: 5 * 60 * 1e3
8608
- });
8609
- };
8610
-
8611
- const useGetCountriesByCarrier = (carrierId) => {
8612
- const { client } = useShipEngine();
8613
- return useQuery({
8614
- enabled: !!carrierId,
8615
- onError,
8616
- queryFn: () => {
8617
- if (carrierId)
8618
- return client.carriers.getCountries(carrierId);
8619
- return Promise.reject(new Error("carrierId is require"));
8620
- },
8621
- queryKey: ["useGetCountriesByCarrier", carrierId],
8622
- select: (result) => result.data.countries,
8623
- // Fresh for 5 minutes
8624
- staleTime: 5 * 60 * 1e3
8625
- });
8626
- };
8627
-
8628
- const useGetCurrenciesByCarrier = (carrierId) => {
8629
- const { client } = useShipEngine();
8630
- return useQuery({
8631
- enabled: !!carrierId,
8632
- onError,
8633
- queryFn: () => {
8634
- if (carrierId)
8635
- return client.carriers.getCurrencies(carrierId);
8636
- return Promise.reject(new Error("carrierId is require"));
8637
- },
8638
- queryKey: ["useGetCurrenciesByCarrier", carrierId],
8639
- select: (result) => result.data.currencies,
8640
- // Fresh for 5 minutes
8641
- staleTime: 5 * 60 * 1e3
8642
- });
8643
- };
8644
-
8645
- const useGetFundingSourceById = (fundingSourceId) => {
8646
- const { client } = useShipEngine();
8647
- return useQuery({
8648
- onError,
8649
- queryFn: () => client.fundingSources.get(fundingSourceId),
8650
- queryKey: ["getFundingSourceById"],
8651
- select: (result) => result.data
8652
- });
8653
- };
8654
-
8655
8925
  const useGetInsuranceAccount = (insuranceProvider) => {
8656
8926
  const { client } = useShipEngine();
8657
8927
  return useQuery({
@@ -8667,288 +8937,122 @@ const useGetInsuranceAccount = (insuranceProvider) => {
8667
8937
  });
8668
8938
  };
8669
8939
 
8670
- const useGetLabel = (labelId) => {
8671
- const { client } = useShipEngine();
8672
- return useQuery({
8673
- enabled: labelId !== void 0,
8674
- onError,
8675
- queryFn: () => {
8676
- if (labelId)
8677
- return client.labels.get(labelId);
8678
- return Promise.reject(new Error("labelId is require"));
8679
- },
8680
- queryKey: ["useGetLabel", labelId],
8681
- select: (result) => result.data
8682
- });
8683
- };
8684
-
8685
- const useGetRateCardById = (rateCardId) => {
8686
- const { client } = useShipEngine();
8687
- return useQuery({
8688
- enabled: !!rateCardId,
8689
- onError,
8690
- queryFn: () => {
8691
- return client.rateCards.get(rateCardId);
8692
- },
8693
- queryKey: ["useGetRateCardById", rateCardId],
8694
- select: (result) => result.data
8695
- });
8696
- };
8697
-
8698
- const useGetPackageRatingGroupByCarrier = (carrierId) => {
8699
- const { client } = useShipEngine();
8700
- return useQuery({
8701
- enabled: !!carrierId,
8702
- onError,
8703
- queryFn: () => {
8704
- if (carrierId)
8705
- return client.carriers.getPackageRatingGroup(carrierId);
8706
- return Promise.reject(new Error("carrierId is required"));
8707
- },
8708
- queryKey: ["useGetRatePackageFormatsByCarrier", carrierId],
8709
- select: (result) => result.data.packageRatingGroup,
8710
- // Fresh for 5 minutes
8711
- staleTime: 5 * 60 * 1e3
8712
- });
8713
- };
8714
-
8715
- const useGetSalesOrderShipment = (shipmentId) => {
8716
- const { client } = useShipEngine();
8717
- return useQuery({
8718
- enabled: shipmentId !== void 0,
8719
- onError,
8720
- queryFn: () => {
8721
- if (shipmentId)
8722
- return client.salesOrderShipments.get(shipmentId);
8723
- return Promise.reject(new Error("shipmentId is required"));
8724
- },
8725
- queryKey: ["useGetSalesOrderShipment", shipmentId],
8726
- select: (result) => result.data
8727
- });
8728
- };
8729
-
8730
- const useGetSalesOrder = (salesOrderId) => {
8731
- const { client } = useShipEngine();
8732
- return useQuery({
8733
- enabled: salesOrderId !== void 0,
8734
- onError,
8735
- queryFn: () => {
8736
- if (salesOrderId)
8737
- return client.salesOrders.get(salesOrderId);
8738
- return Promise.reject(new Error("salesOrderId is required"));
8739
- },
8740
- queryKey: ["useGetSalesOrder", salesOrderId],
8741
- select: (result) => result.data
8742
- });
8743
- };
8744
-
8745
- const useGetServicesByCarrier = (carrierId) => {
8746
- const { client } = useShipEngine();
8747
- return useQuery({
8748
- enabled: !!carrierId,
8749
- onError,
8750
- queryFn: () => {
8751
- if (carrierId)
8752
- return client.carriers.getServices(carrierId);
8753
- return Promise.reject(new Error("carrierId is required"));
8754
- },
8755
- queryKey: ["useGetServicesByCarrier", carrierId],
8756
- select: (result) => result.data.services,
8757
- // Fresh for 5 minutes
8758
- staleTime: 5 * 60 * 1e3
8759
- });
8760
- };
8761
-
8762
- const useGetShipmentRates = (shipmentId, createdAtStart) => {
8763
- const { client } = useShipEngine();
8764
- return useQuery({
8765
- enabled: shipmentId !== void 0,
8766
- onError,
8767
- queryFn: () => {
8768
- if (shipmentId) {
8769
- return client.shipments.getShipmentRates({ createdAtStart, shipmentId });
8770
- }
8771
- return Promise.reject(new Error("shipmentId is required"));
8772
- },
8773
- queryKey: ["useGetShipmentRates", shipmentId, createdAtStart],
8774
- select: (result) => result.data
8775
- });
8776
- };
8777
-
8778
- const useGetShipment = (shipmentId) => {
8779
- const { client } = useShipEngine();
8780
- return useQuery({
8781
- enabled: shipmentId !== void 0,
8782
- onError,
8783
- queryFn: () => {
8784
- if (!shipmentId) {
8785
- return Promise.reject(new Error("shipmentId is required"));
8786
- }
8787
- return client.salesOrderShipments.get(shipmentId);
8788
- },
8789
- queryKey: ["useGetShipment", shipmentId],
8790
- select: (result) => result.data
8791
- });
8792
- };
8793
-
8794
- const useGetWalletHistory = ({
8795
- enabled,
8796
- page,
8797
- range
8798
- }) => {
8799
- const { client } = useShipEngine();
8800
- const [startDate, endDate] = range;
8801
- return useQuery({
8802
- enabled,
8803
- keepPreviousData: true,
8804
- // See https://react-query-v3.tanstack.com/guides/paginated-queries#better-paginated-queries-with-keeppreviousdata
8805
- onError,
8806
- queryFn: () => client.carriers.getWalletHistory(startDate, endDate, page),
8807
- queryKey: ["useGetWalletHistory", startDate, endDate, page],
8808
- select: (result) => result.data
8809
- });
8810
- };
8811
-
8812
- const useListCarriers = () => {
8813
- const { client } = useShipEngine();
8814
- return useQuery({
8815
- onError,
8816
- queryFn: () => client.carriers.list(),
8817
- queryKey: ["useListCarriers"],
8818
- select: (result) => result.data.carriers
8819
- });
8820
- };
8821
-
8822
- const useListCustomPackageTypes = () => {
8823
- const { client } = useShipEngine();
8824
- return useQuery({
8825
- onError,
8826
- queryFn: () => client.customPackages.list(),
8827
- queryKey: ["useListCustomPackageTypes"],
8828
- select: (result) => result.data.packages
8829
- });
8830
- };
8831
-
8832
- const useListFundingSources = () => {
8833
- const { client } = useShipEngine();
8834
- return useQuery({
8835
- onError,
8836
- queryFn: () => client.fundingSources.list(),
8837
- queryKey: ["useListFundingSources"],
8838
- select: (result) => result.data.fundingSources
8839
- });
8840
- };
8841
-
8842
- const useListLabels = (params) => {
8843
- const { client } = useShipEngine();
8844
- return useQuery({
8845
- enabled: params && Object.values(params).some((v) => v !== void 0),
8846
- onError,
8847
- queryFn: () => client.labels.list(params),
8848
- queryKey: ["useListLabels", params],
8849
- select: (result) => result.data.labels
8940
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8941
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8942
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8943
+ var __objRest$6 = (source, exclude) => {
8944
+ var target = {};
8945
+ for (var prop in source)
8946
+ if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
8947
+ target[prop] = source[prop];
8948
+ if (source != null && __getOwnPropSymbols$9)
8949
+ for (var prop of __getOwnPropSymbols$9(source)) {
8950
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
8951
+ target[prop] = source[prop];
8952
+ }
8953
+ return target;
8954
+ };
8955
+ var __async$i = (__this, __arguments, generator) => {
8956
+ return new Promise((resolve, reject) => {
8957
+ var fulfilled = (value) => {
8958
+ try {
8959
+ step(generator.next(value));
8960
+ } catch (e) {
8961
+ reject(e);
8962
+ }
8963
+ };
8964
+ var rejected = (value) => {
8965
+ try {
8966
+ step(generator.throw(value));
8967
+ } catch (e) {
8968
+ reject(e);
8969
+ }
8970
+ };
8971
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
8972
+ step((generator = generator.apply(__this, __arguments)).next());
8850
8973
  });
8851
8974
  };
8852
-
8853
- const useListOrderSources = () => {
8975
+ const useCreateLabel = () => {
8854
8976
  const { client } = useShipEngine();
8855
- return useQuery({
8856
- onError,
8857
- queryFn: () => client.orderSources.list(),
8858
- queryKey: ["useListOrderSources"],
8859
- select: (result) => result.data.orderSources
8977
+ return useMutation({
8978
+ mutationFn: (_a) => __async$i(void 0, null, function* () {
8979
+ var _b = _a, { rateId } = _b, options = __objRest$6(_b, ["rateId"]);
8980
+ const result = yield client.labels.createByRateId(rateId, options);
8981
+ return result.data;
8982
+ }),
8983
+ mutationKey: ["useCreateLabel"],
8984
+ onError
8860
8985
  });
8861
8986
  };
8862
8987
 
8863
- const useListRateCards = (carrierIds) => {
8988
+ const useGetLabel = (labelId) => {
8864
8989
  const { client } = useShipEngine();
8865
8990
  return useQuery({
8866
- enabled: !!carrierIds.length,
8991
+ enabled: labelId !== void 0,
8867
8992
  onError,
8868
8993
  queryFn: () => {
8869
- return client.rateCards.list(carrierIds);
8994
+ if (labelId)
8995
+ return client.labels.get(labelId);
8996
+ return Promise.reject(new Error("labelId is require"));
8870
8997
  },
8871
- queryKey: ["useListRateCards", carrierIds],
8872
- select: (result) => result.data.rateCards
8998
+ queryKey: ["useGetLabel", labelId],
8999
+ select: (result) => result.data
8873
9000
  });
8874
9001
  };
8875
9002
 
8876
- const useListSalesOrderShipments = (params) => {
9003
+ const useListLabels = (params) => {
8877
9004
  const { client } = useShipEngine();
8878
9005
  return useQuery({
8879
9006
  enabled: params && Object.values(params).some((v) => v !== void 0),
8880
9007
  onError,
8881
- queryFn: () => client.salesOrderShipments.list(params),
8882
- queryKey: ["useListSalesOrderShipments", params],
8883
- select: (result) => result.data.shipments
9008
+ queryFn: () => client.labels.list(params),
9009
+ queryKey: ["useListLabels", params],
9010
+ select: (result) => result.data.labels
8884
9011
  });
8885
9012
  };
8886
9013
 
8887
- const useListSalesOrders = (params = {}) => {
8888
- const { client } = useShipEngine();
8889
- return useQuery({
8890
- enabled: params && Object.values(params).some((v) => v !== void 0),
8891
- onError,
8892
- queryFn: () => client.salesOrders.list(params),
8893
- queryKey: ["useListSalesOrders", params],
8894
- select: (result) => result.data.salesOrders
9014
+ var __async$h = (__this, __arguments, generator) => {
9015
+ return new Promise((resolve, reject) => {
9016
+ var fulfilled = (value) => {
9017
+ try {
9018
+ step(generator.next(value));
9019
+ } catch (e) {
9020
+ reject(e);
9021
+ }
9022
+ };
9023
+ var rejected = (value) => {
9024
+ try {
9025
+ step(generator.throw(value));
9026
+ } catch (e) {
9027
+ reject(e);
9028
+ }
9029
+ };
9030
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
9031
+ step((generator = generator.apply(__this, __arguments)).next());
8895
9032
  });
8896
9033
  };
8897
-
8898
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8899
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8900
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8901
- var __objRest$4 = (source, exclude) => {
8902
- var target = {};
8903
- for (var prop in source)
8904
- if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
8905
- target[prop] = source[prop];
8906
- if (source != null && __getOwnPropSymbols$6)
8907
- for (var prop of __getOwnPropSymbols$6(source)) {
8908
- if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
8909
- target[prop] = source[prop];
8910
- }
8911
- return target;
8912
- };
8913
- const useListShipments = (_params) => {
8914
- const _a = _params || {}, { enabled = true } = _a, params = __objRest$4(_a, ["enabled"]);
9034
+ const useVoidLabel = () => {
8915
9035
  const { client } = useShipEngine();
8916
- return useQuery({
8917
- enabled,
8918
- onError,
8919
- queryFn: () => client.shipments.list(params),
8920
- queryKey: ["useListShipments", params],
8921
- select: (result) => result.data
9036
+ return useMutation({
9037
+ mutationFn: (labelId) => __async$h(void 0, null, function* () {
9038
+ const result = yield client.labels.void(labelId);
9039
+ return result.data;
9040
+ }),
9041
+ mutationKey: ["useVoidLabel"],
9042
+ onError
8922
9043
  });
8923
9044
  };
8924
9045
 
8925
- const useListWarehouses = (options) => {
8926
- var _a;
9046
+ const useListOrderSources = () => {
8927
9047
  const { client } = useShipEngine();
8928
9048
  return useQuery({
8929
- enabled: (_a = options == null ? void 0 : options.enabled) != null ? _a : true,
8930
9049
  onError,
8931
- queryFn: () => client.warehouses.list(),
8932
- queryKey: ["useListWarehouses"],
8933
- select: (result) => result.data.warehouses
9050
+ queryFn: () => client.orderSources.list(),
9051
+ queryKey: ["useListOrderSources"],
9052
+ select: (result) => result.data.orderSources
8934
9053
  });
8935
9054
  };
8936
9055
 
8937
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
8938
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
8939
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
8940
- var __objRest$3 = (source, exclude) => {
8941
- var target = {};
8942
- for (var prop in source)
8943
- if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
8944
- target[prop] = source[prop];
8945
- if (source != null && __getOwnPropSymbols$5)
8946
- for (var prop of __getOwnPropSymbols$5(source)) {
8947
- if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
8948
- target[prop] = source[prop];
8949
- }
8950
- return target;
8951
- };
8952
9056
  var __async$g = (__this, __arguments, generator) => {
8953
9057
  return new Promise((resolve, reject) => {
8954
9058
  var fulfilled = (value) => {
@@ -8969,15 +9073,32 @@ var __async$g = (__this, __arguments, generator) => {
8969
9073
  step((generator = generator.apply(__this, __arguments)).next());
8970
9074
  });
8971
9075
  };
8972
- const useNotifySalesOrderShipped = () => {
9076
+ const useRefreshOrderSourceAsync = () => {
8973
9077
  const { client } = useShipEngine();
8974
9078
  return useMutation({
8975
- mutationFn: (_a) => __async$g(void 0, null, function* () {
8976
- var _b = _a, { salesOrderId } = _b, tracking = __objRest$3(_b, ["salesOrderId"]);
8977
- const result = yield client.salesOrders.notifyShipped(salesOrderId, tracking);
9079
+ mutationFn: (orderSourceId) => __async$g(void 0, null, function* () {
9080
+ const result = yield client.orderSources.refresh(orderSourceId);
8978
9081
  return result.data;
8979
9082
  }),
8980
- mutationKey: ["useNotifySalesOrder"],
9083
+ mutationKey: ["useRefreshOrderSourceAsync"]
9084
+ });
9085
+ };
9086
+ const useRefreshOrderSource = () => {
9087
+ const { client } = useShipEngine();
9088
+ const { mutateAsync: refreshOrderSourceAsync } = useRefreshOrderSourceAsync();
9089
+ return useMutation({
9090
+ mutationFn: (orderSourceId) => __async$g(void 0, null, function* () {
9091
+ yield refreshOrderSourceAsync(orderSourceId);
9092
+ const waitResult = yield retryUntil(() => __async$g(void 0, null, function* () {
9093
+ const { data: checkResult } = yield client.orderSources.get(orderSourceId);
9094
+ if (["preparing_update", "updating"].includes(checkResult.refreshInfo.status)) {
9095
+ throw new CodedError("Order source is still refreshing");
9096
+ }
9097
+ return checkResult;
9098
+ }), 20);
9099
+ return waitResult;
9100
+ }),
9101
+ mutationKey: ["useRefreshOrderSource"],
8981
9102
  onError
8982
9103
  });
8983
9104
  };
@@ -9002,18 +9123,56 @@ var __async$f = (__this, __arguments, generator) => {
9002
9123
  step((generator = generator.apply(__this, __arguments)).next());
9003
9124
  });
9004
9125
  };
9005
- const useParseAddress = () => {
9126
+ const useCreateRateCard = () => {
9006
9127
  const { client } = useShipEngine();
9007
9128
  return useMutation({
9008
- mutationFn: (_0) => __async$f(void 0, [_0], function* ({ address, text }) {
9009
- const result = yield client.addresses.parse(text, address);
9129
+ mutationFn: (rateCard) => __async$f(void 0, null, function* () {
9130
+ const result = yield client.rateCards.create(rateCard);
9010
9131
  return result.data;
9011
9132
  }),
9012
- mutationKey: ["useParseAddress"],
9133
+ mutationKey: ["useCreateRateCard"],
9013
9134
  onError
9014
9135
  });
9015
9136
  };
9016
9137
 
9138
+ const useDownloadRateCard = (rateCardId) => {
9139
+ const { client } = useShipEngine();
9140
+ return useQuery({
9141
+ enabled: !!rateCardId.length,
9142
+ onError,
9143
+ queryFn: () => {
9144
+ return client.rateCards.download(rateCardId);
9145
+ },
9146
+ queryKey: ["useDownloadRateCard", rateCardId]
9147
+ });
9148
+ };
9149
+
9150
+ const useGetRateCardById = (rateCardId) => {
9151
+ const { client } = useShipEngine();
9152
+ return useQuery({
9153
+ enabled: !!rateCardId,
9154
+ onError,
9155
+ queryFn: () => {
9156
+ return client.rateCards.get(rateCardId);
9157
+ },
9158
+ queryKey: ["useGetRateCardById", rateCardId],
9159
+ select: (result) => result.data
9160
+ });
9161
+ };
9162
+
9163
+ const useListRateCards = (carrierIds) => {
9164
+ const { client } = useShipEngine();
9165
+ return useQuery({
9166
+ enabled: !!carrierIds.length,
9167
+ onError,
9168
+ queryFn: () => {
9169
+ return client.rateCards.list(carrierIds);
9170
+ },
9171
+ queryKey: ["useListRateCards", carrierIds],
9172
+ select: (result) => result.data.rateCards
9173
+ });
9174
+ };
9175
+
9017
9176
  var __async$e = (__this, __arguments, generator) => {
9018
9177
  return new Promise((resolve, reject) => {
9019
9178
  var fulfilled = (value) => {
@@ -9065,32 +9224,14 @@ var __async$d = (__this, __arguments, generator) => {
9065
9224
  step((generator = generator.apply(__this, __arguments)).next());
9066
9225
  });
9067
9226
  };
9068
- const useRefreshOrderSourceAsync = () => {
9227
+ const useUpdateRateCard = () => {
9069
9228
  const { client } = useShipEngine();
9070
9229
  return useMutation({
9071
- mutationFn: (orderSourceId) => __async$d(void 0, null, function* () {
9072
- const result = yield client.orderSources.refresh(orderSourceId);
9230
+ mutationFn: (rateCard) => __async$d(void 0, null, function* () {
9231
+ const result = yield client.rateCards.update(rateCard);
9073
9232
  return result.data;
9074
9233
  }),
9075
- mutationKey: ["useRefreshOrderSourceAsync"]
9076
- });
9077
- };
9078
- const useRefreshOrderSource = () => {
9079
- const { client } = useShipEngine();
9080
- const { mutateAsync: refreshOrderSourceAsync } = useRefreshOrderSourceAsync();
9081
- return useMutation({
9082
- mutationFn: (orderSourceId) => __async$d(void 0, null, function* () {
9083
- yield refreshOrderSourceAsync(orderSourceId);
9084
- const waitResult = yield retryUntil(() => __async$d(void 0, null, function* () {
9085
- const { data: checkResult } = yield client.orderSources.get(orderSourceId);
9086
- if (["preparing_update", "updating"].includes(checkResult.refreshInfo.status)) {
9087
- throw new CodedError("Order source is still refreshing");
9088
- }
9089
- return checkResult;
9090
- }), 20);
9091
- return waitResult;
9092
- }),
9093
- mutationKey: ["useRefreshOrderSource"],
9234
+ mutationKey: ["useUpdateRateCard"],
9094
9235
  onError
9095
9236
  });
9096
9237
  };
@@ -9115,14 +9256,14 @@ var __async$c = (__this, __arguments, generator) => {
9115
9256
  step((generator = generator.apply(__this, __arguments)).next());
9116
9257
  });
9117
9258
  };
9118
- const useRegisterCarrier = () => {
9259
+ const useUploadRateCard = () => {
9119
9260
  const { client } = useShipEngine();
9120
9261
  return useMutation({
9121
- mutationFn: (carrier) => __async$c(void 0, null, function* () {
9122
- const result = yield client.fundingSources.registerCarrier(carrier);
9262
+ mutationFn: (_0) => __async$c(void 0, [_0], function* ({ rateCardId, file }) {
9263
+ const result = yield client.rateCards.upload(rateCardId, file);
9123
9264
  return result.data;
9124
9265
  }),
9125
- mutationKey: ["useRegisterCarrier"],
9266
+ mutationKey: ["useUploadRateCard"],
9126
9267
  onError
9127
9268
  });
9128
9269
  };
@@ -9147,14 +9288,14 @@ var __async$b = (__this, __arguments, generator) => {
9147
9288
  step((generator = generator.apply(__this, __arguments)).next());
9148
9289
  });
9149
9290
  };
9150
- const useUpdateAccountSettings = () => {
9291
+ const useDeleteRateCard = () => {
9151
9292
  const { client } = useShipEngine();
9152
9293
  return useMutation({
9153
- mutationFn: (settings) => __async$b(void 0, null, function* () {
9154
- const result = yield client.accountSettings.update(settings);
9294
+ mutationFn: (rateCardId) => __async$b(void 0, null, function* () {
9295
+ const result = yield client.rateCards.delete(rateCardId);
9155
9296
  return result.data;
9156
9297
  }),
9157
- mutationKey: ["useUpdateAccountSettings"],
9298
+ mutationKey: ["useDeleteRateCard"],
9158
9299
  onError
9159
9300
  });
9160
9301
  };
@@ -9179,22 +9320,59 @@ var __async$a = (__this, __arguments, generator) => {
9179
9320
  step((generator = generator.apply(__this, __arguments)).next());
9180
9321
  });
9181
9322
  };
9182
- const useUpdateAutoFunding = (carrierId) => {
9323
+ const useCalculateRates = () => {
9183
9324
  const { client } = useShipEngine();
9184
- const queryClient = useQueryClient();
9185
9325
  return useMutation({
9186
- mutationFn: (options) => __async$a(void 0, null, function* () {
9187
- const result = yield client.carriers.updateAutoFunding(carrierId, options);
9326
+ mutationFn: (_0) => __async$a(void 0, [_0], function* ({ rateOptions, shipmentId }) {
9327
+ const result = yield client.rates.calculateByShipmentId(shipmentId, rateOptions);
9188
9328
  return result.data;
9189
9329
  }),
9190
- mutationKey: ["useUpdateAutoFunding"],
9330
+ mutationKey: ["useCalculateRates"],
9331
+ onError
9332
+ });
9333
+ };
9334
+
9335
+ const useGetSalesOrder = (salesOrderId) => {
9336
+ const { client } = useShipEngine();
9337
+ return useQuery({
9338
+ enabled: salesOrderId !== void 0,
9339
+ onError,
9340
+ queryFn: () => {
9341
+ if (salesOrderId)
9342
+ return client.salesOrders.get(salesOrderId);
9343
+ return Promise.reject(new Error("salesOrderId is required"));
9344
+ },
9345
+ queryKey: ["useGetSalesOrder", salesOrderId],
9346
+ select: (result) => result.data
9347
+ });
9348
+ };
9349
+
9350
+ const useListSalesOrders = (params = {}) => {
9351
+ const { client } = useShipEngine();
9352
+ return useQuery({
9353
+ enabled: params && Object.values(params).some((v) => v !== void 0),
9191
9354
  onError,
9192
- onSuccess: (_) => {
9193
- queryClient.invalidateQueries(["useGetAutoFunding", carrierId], { exact: true });
9194
- }
9355
+ queryFn: () => client.salesOrders.list(params),
9356
+ queryKey: ["useListSalesOrders", params],
9357
+ select: (result) => result.data.salesOrders
9195
9358
  });
9196
9359
  };
9197
9360
 
9361
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
9362
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
9363
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
9364
+ var __objRest$5 = (source, exclude) => {
9365
+ var target = {};
9366
+ for (var prop in source)
9367
+ if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
9368
+ target[prop] = source[prop];
9369
+ if (source != null && __getOwnPropSymbols$8)
9370
+ for (var prop of __getOwnPropSymbols$8(source)) {
9371
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
9372
+ target[prop] = source[prop];
9373
+ }
9374
+ return target;
9375
+ };
9198
9376
  var __async$9 = (__this, __arguments, generator) => {
9199
9377
  return new Promise((resolve, reject) => {
9200
9378
  var fulfilled = (value) => {
@@ -9215,26 +9393,34 @@ var __async$9 = (__this, __arguments, generator) => {
9215
9393
  step((generator = generator.apply(__this, __arguments)).next());
9216
9394
  });
9217
9395
  };
9218
- const useUpdateFundingSource = () => {
9396
+ const useNotifySalesOrderShipped = () => {
9219
9397
  const { client } = useShipEngine();
9220
9398
  return useMutation({
9221
- mutationFn: (_0) => __async$9(void 0, [_0], function* ({
9222
- billingInfo,
9223
- creditCardInfo,
9224
- fundingSourceId
9225
- }) {
9226
- const result = yield client.fundingSources.update(
9227
- billingInfo,
9228
- creditCardInfo,
9229
- fundingSourceId
9230
- );
9399
+ mutationFn: (_a) => __async$9(void 0, null, function* () {
9400
+ var _b = _a, { salesOrderId } = _b, tracking = __objRest$5(_b, ["salesOrderId"]);
9401
+ const result = yield client.salesOrders.notifyShipped(salesOrderId, tracking);
9231
9402
  return result.data;
9232
9403
  }),
9233
- mutationKey: ["useUpdateFundingSource"],
9404
+ mutationKey: ["useNotifySalesOrder"],
9234
9405
  onError
9235
9406
  });
9236
9407
  };
9237
9408
 
9409
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
9410
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
9411
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
9412
+ var __objRest$4 = (source, exclude) => {
9413
+ var target = {};
9414
+ for (var prop in source)
9415
+ if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
9416
+ target[prop] = source[prop];
9417
+ if (source != null && __getOwnPropSymbols$7)
9418
+ for (var prop of __getOwnPropSymbols$7(source)) {
9419
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
9420
+ target[prop] = source[prop];
9421
+ }
9422
+ return target;
9423
+ };
9238
9424
  var __async$8 = (__this, __arguments, generator) => {
9239
9425
  return new Promise((resolve, reject) => {
9240
9426
  var fulfilled = (value) => {
@@ -9255,29 +9441,56 @@ var __async$8 = (__this, __arguments, generator) => {
9255
9441
  step((generator = generator.apply(__this, __arguments)).next());
9256
9442
  });
9257
9443
  };
9258
- const useUpdateRateCard = () => {
9444
+ const useCreateSalesOrderShipment = () => {
9259
9445
  const { client } = useShipEngine();
9260
9446
  return useMutation({
9261
- mutationFn: (rateCard) => __async$8(void 0, null, function* () {
9262
- const result = yield client.rateCards.update(rateCard);
9447
+ mutationFn: (_a) => __async$8(void 0, null, function* () {
9448
+ var _b = _a, { salesOrderId } = _b, shipment = __objRest$4(_b, ["salesOrderId"]);
9449
+ const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
9263
9450
  return result.data;
9264
9451
  }),
9265
- mutationKey: ["useUpdateRateCard"],
9452
+ mutationKey: ["useCreateSalesOrderShipment"],
9266
9453
  onError
9267
9454
  });
9268
9455
  };
9269
9456
 
9270
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
9271
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
9272
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
9273
- var __objRest$2 = (source, exclude) => {
9457
+ const useGetSalesOrderShipment = (shipmentId) => {
9458
+ const { client } = useShipEngine();
9459
+ return useQuery({
9460
+ enabled: shipmentId !== void 0,
9461
+ onError,
9462
+ queryFn: () => {
9463
+ if (shipmentId)
9464
+ return client.salesOrderShipments.get(shipmentId);
9465
+ return Promise.reject(new Error("shipmentId is required"));
9466
+ },
9467
+ queryKey: ["useGetSalesOrderShipment", shipmentId],
9468
+ select: (result) => result.data
9469
+ });
9470
+ };
9471
+
9472
+ const useListSalesOrderShipments = (params) => {
9473
+ const { client } = useShipEngine();
9474
+ return useQuery({
9475
+ enabled: params && Object.values(params).some((v) => v !== void 0),
9476
+ onError,
9477
+ queryFn: () => client.salesOrderShipments.list(params),
9478
+ queryKey: ["useListSalesOrderShipments", params],
9479
+ select: (result) => result.data.shipments
9480
+ });
9481
+ };
9482
+
9483
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
9484
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
9485
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
9486
+ var __objRest$3 = (source, exclude) => {
9274
9487
  var target = {};
9275
9488
  for (var prop in source)
9276
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
9489
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
9277
9490
  target[prop] = source[prop];
9278
- if (source != null && __getOwnPropSymbols$4)
9279
- for (var prop of __getOwnPropSymbols$4(source)) {
9280
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
9491
+ if (source != null && __getOwnPropSymbols$6)
9492
+ for (var prop of __getOwnPropSymbols$6(source)) {
9493
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
9281
9494
  target[prop] = source[prop];
9282
9495
  }
9283
9496
  return target;
@@ -9306,7 +9519,7 @@ const useUpdateSalesOrderShipment = () => {
9306
9519
  const { client } = useShipEngine();
9307
9520
  return useMutation({
9308
9521
  mutationFn: (_a) => __async$7(void 0, null, function* () {
9309
- var _b = _a, { shipmentId } = _b, shipment = __objRest$2(_b, ["shipmentId"]);
9522
+ var _b = _a, { shipmentId } = _b, shipment = __objRest$3(_b, ["shipmentId"]);
9310
9523
  const result = yield client.salesOrderShipments.update(shipmentId, shipment);
9311
9524
  return result.data;
9312
9525
  }),
@@ -9315,21 +9528,25 @@ const useUpdateSalesOrderShipment = () => {
9315
9528
  });
9316
9529
  };
9317
9530
 
9318
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
9319
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
9320
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
9321
- var __objRest$1 = (source, exclude) => {
9322
- var target = {};
9323
- for (var prop in source)
9324
- if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
9325
- target[prop] = source[prop];
9326
- if (source != null && __getOwnPropSymbols$3)
9327
- for (var prop of __getOwnPropSymbols$3(source)) {
9328
- if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
9329
- target[prop] = source[prop];
9531
+ var __defProp$3 = Object.defineProperty;
9532
+ var __defProps$2 = Object.defineProperties;
9533
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
9534
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
9535
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
9536
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
9537
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9538
+ var __spreadValues$3 = (a, b) => {
9539
+ for (var prop in b || (b = {}))
9540
+ if (__hasOwnProp$5.call(b, prop))
9541
+ __defNormalProp$3(a, prop, b[prop]);
9542
+ if (__getOwnPropSymbols$5)
9543
+ for (var prop of __getOwnPropSymbols$5(b)) {
9544
+ if (__propIsEnum$5.call(b, prop))
9545
+ __defNormalProp$3(a, prop, b[prop]);
9330
9546
  }
9331
- return target;
9547
+ return a;
9332
9548
  };
9549
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
9333
9550
  var __async$6 = (__this, __arguments, generator) => {
9334
9551
  return new Promise((resolve, reject) => {
9335
9552
  var fulfilled = (value) => {
@@ -9350,19 +9567,95 @@ var __async$6 = (__this, __arguments, generator) => {
9350
9567
  step((generator = generator.apply(__this, __arguments)).next());
9351
9568
  });
9352
9569
  };
9353
- const useUpdateWarehouse = () => {
9570
+ const useCreateShipment = () => {
9354
9571
  const { client } = useShipEngine();
9355
9572
  return useMutation({
9356
- mutationFn: (_a) => __async$6(void 0, null, function* () {
9357
- var _b = _a, { warehouseId } = _b, warehouse = __objRest$1(_b, ["warehouseId"]);
9358
- const result = yield client.warehouses.update(warehouseId, warehouse);
9359
- return result.data;
9573
+ mutationFn: (shipment) => __async$6(void 0, null, function* () {
9574
+ var _a;
9575
+ if (shipment.warehouseId === void 0) {
9576
+ throw new CodedError("errorMessages.noWarehouses", {
9577
+ errorCode: "unknown",
9578
+ errorSource: "client",
9579
+ errorType: "business_rules"
9580
+ });
9581
+ }
9582
+ const shipTo = (_a = shipment.shipTo) != null ? _a : {
9583
+ addressLine1: "",
9584
+ cityLocality: "",
9585
+ countryCode: "",
9586
+ name: "",
9587
+ phone: "",
9588
+ postalCode: "",
9589
+ stateProvince: ""
9590
+ };
9591
+ return (yield client.shipments.create(__spreadProps$2(__spreadValues$3({}, shipment), {
9592
+ shipTo
9593
+ }))).data;
9360
9594
  }),
9361
- mutationKey: ["useUpdateWarehouse"],
9595
+ mutationKey: ["useCreateShipment"],
9362
9596
  onError
9363
9597
  });
9364
9598
  };
9365
9599
 
9600
+ const useGetShipmentRates = (shipmentId, createdAtStart) => {
9601
+ const { client } = useShipEngine();
9602
+ return useQuery({
9603
+ enabled: shipmentId !== void 0,
9604
+ onError,
9605
+ queryFn: () => {
9606
+ if (shipmentId) {
9607
+ return client.shipments.getShipmentRates({ createdAtStart, shipmentId });
9608
+ }
9609
+ return Promise.reject(new Error("shipmentId is required"));
9610
+ },
9611
+ queryKey: ["useGetShipmentRates", shipmentId, createdAtStart],
9612
+ select: (result) => result.data
9613
+ });
9614
+ };
9615
+
9616
+ const useGetShipment = (shipmentId) => {
9617
+ const { client } = useShipEngine();
9618
+ return useQuery({
9619
+ enabled: shipmentId !== void 0,
9620
+ onError,
9621
+ queryFn: () => {
9622
+ if (!shipmentId) {
9623
+ return Promise.reject(new Error("shipmentId is required"));
9624
+ }
9625
+ return client.salesOrderShipments.get(shipmentId);
9626
+ },
9627
+ queryKey: ["useGetShipment", shipmentId],
9628
+ select: (result) => result.data
9629
+ });
9630
+ };
9631
+
9632
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
9633
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
9634
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
9635
+ var __objRest$2 = (source, exclude) => {
9636
+ var target = {};
9637
+ for (var prop in source)
9638
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
9639
+ target[prop] = source[prop];
9640
+ if (source != null && __getOwnPropSymbols$4)
9641
+ for (var prop of __getOwnPropSymbols$4(source)) {
9642
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
9643
+ target[prop] = source[prop];
9644
+ }
9645
+ return target;
9646
+ };
9647
+ const useListShipments = (_params) => {
9648
+ const _a = _params || {}, { enabled = true } = _a, params = __objRest$2(_a, ["enabled"]);
9649
+ const { client } = useShipEngine();
9650
+ return useQuery({
9651
+ enabled,
9652
+ onError,
9653
+ queryFn: () => client.shipments.list(params),
9654
+ queryKey: ["useListShipments", params],
9655
+ select: (result) => result.data
9656
+ });
9657
+ };
9658
+
9366
9659
  var __async$5 = (__this, __arguments, generator) => {
9367
9660
  return new Promise((resolve, reject) => {
9368
9661
  var fulfilled = (value) => {
@@ -9383,14 +9676,14 @@ var __async$5 = (__this, __arguments, generator) => {
9383
9676
  step((generator = generator.apply(__this, __arguments)).next());
9384
9677
  });
9385
9678
  };
9386
- const useUploadRateCard = () => {
9679
+ const useCreateWarehouse = () => {
9387
9680
  const { client } = useShipEngine();
9388
9681
  return useMutation({
9389
- mutationFn: (_0) => __async$5(void 0, [_0], function* ({ rateCardId, file }) {
9390
- const result = yield client.rateCards.upload(rateCardId, file);
9682
+ mutationFn: (data) => __async$5(void 0, null, function* () {
9683
+ const result = yield client.warehouses.create(data);
9391
9684
  return result.data;
9392
9685
  }),
9393
- mutationKey: ["useUploadRateCard"],
9686
+ mutationKey: ["useCreateWarehouse"],
9394
9687
  onError
9395
9688
  });
9396
9689
  };
@@ -9415,18 +9708,45 @@ var __async$4 = (__this, __arguments, generator) => {
9415
9708
  step((generator = generator.apply(__this, __arguments)).next());
9416
9709
  });
9417
9710
  };
9418
- const useValidateAddresses = () => {
9711
+ const useDeleteWarehouse = () => {
9419
9712
  const { client } = useShipEngine();
9420
9713
  return useMutation({
9421
- mutationFn: (addresses) => __async$4(void 0, null, function* () {
9422
- const result = yield client.addresses.validate(addresses);
9714
+ mutationFn: (_0) => __async$4(void 0, [_0], function* ({ warehouseId }) {
9715
+ const result = yield client.warehouses.delete(warehouseId);
9423
9716
  return result.data;
9424
9717
  }),
9425
- mutationKey: ["useValidateAddresses"],
9718
+ mutationKey: ["useDeleteWarehouse"],
9426
9719
  onError
9427
9720
  });
9428
9721
  };
9429
9722
 
9723
+ const useListWarehouses = (options) => {
9724
+ var _a;
9725
+ const { client } = useShipEngine();
9726
+ return useQuery({
9727
+ enabled: (_a = options == null ? void 0 : options.enabled) != null ? _a : true,
9728
+ onError,
9729
+ queryFn: () => client.warehouses.list(),
9730
+ queryKey: ["useListWarehouses"],
9731
+ select: (result) => result.data.warehouses
9732
+ });
9733
+ };
9734
+
9735
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
9736
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
9737
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
9738
+ var __objRest$1 = (source, exclude) => {
9739
+ var target = {};
9740
+ for (var prop in source)
9741
+ if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
9742
+ target[prop] = source[prop];
9743
+ if (source != null && __getOwnPropSymbols$3)
9744
+ for (var prop of __getOwnPropSymbols$3(source)) {
9745
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
9746
+ target[prop] = source[prop];
9747
+ }
9748
+ return target;
9749
+ };
9430
9750
  var __async$3 = (__this, __arguments, generator) => {
9431
9751
  return new Promise((resolve, reject) => {
9432
9752
  var fulfilled = (value) => {
@@ -9447,14 +9767,15 @@ var __async$3 = (__this, __arguments, generator) => {
9447
9767
  step((generator = generator.apply(__this, __arguments)).next());
9448
9768
  });
9449
9769
  };
9450
- const useVoidLabel = () => {
9770
+ const useUpdateWarehouse = () => {
9451
9771
  const { client } = useShipEngine();
9452
9772
  return useMutation({
9453
- mutationFn: (labelId) => __async$3(void 0, null, function* () {
9454
- const result = yield client.labels.void(labelId);
9773
+ mutationFn: (_a) => __async$3(void 0, null, function* () {
9774
+ var _b = _a, { warehouseId } = _b, warehouse = __objRest$1(_b, ["warehouseId"]);
9775
+ const result = yield client.warehouses.update(warehouseId, warehouse);
9455
9776
  return result.data;
9456
9777
  }),
9457
- mutationKey: ["useVoidLabel"],
9778
+ mutationKey: ["useUpdateWarehouse"],
9458
9779
  onError
9459
9780
  });
9460
9781
  };
@@ -10309,4 +10630,4 @@ const alchemy = {
10309
10630
  createElement
10310
10631
  };
10311
10632
 
10312
- export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ElementContainerProvider, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, OrderSourcesAPI, RateCardStatus, 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, useElementContainer, useFundingSourcesAddFunds, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetWalletHistory, useI18n, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListWarehouses, useLoadFonts, useLoadIcons, useLoadTheme, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUploadRateCard, useValidateAddresses, useVoidLabel };
10633
+ export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ElementContainerProvider, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, OrderSourcesAPI, RateCardStatus, 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, useDeleteRateCard, useDeleteWarehouse, useDownloadRateCard, useElementContainer, useFundingSourcesAddFunds, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetWalletHistory, useI18n, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListWarehouses, useLoadFonts, useLoadIcons, useLoadTheme, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUploadRateCard, useValidateAddresses, useVoidLabel };