@shipengine/alchemy 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +103 -64
  2. package/index.mjs +103 -65
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -13600,7 +13600,7 @@ var ipaddr = {
13600
13600
  }).call(commonjsGlobal);
13601
13601
  } (ipaddr));
13602
13602
 
13603
- var __async$w = (__this, __arguments, generator) => {
13603
+ var __async$x = (__this, __arguments, generator) => {
13604
13604
  return new Promise((resolve, reject) => {
13605
13605
  var fulfilled = (value) => {
13606
13606
  try {
@@ -13620,7 +13620,7 @@ var __async$w = (__this, __arguments, generator) => {
13620
13620
  step((generator = generator.apply(__this, __arguments)).next());
13621
13621
  });
13622
13622
  };
13623
- const getEndUserIpAddress = () => __async$w(void 0, null, function* () {
13623
+ const getEndUserIpAddress = () => __async$x(void 0, null, function* () {
13624
13624
  try {
13625
13625
  const response = yield axios.get("https://api.ipify.org/?format=json");
13626
13626
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -13663,7 +13663,7 @@ var __objRest$7 = (source, exclude) => {
13663
13663
  }
13664
13664
  return target;
13665
13665
  };
13666
- var __async$v = (__this, __arguments, generator) => {
13666
+ var __async$w = (__this, __arguments, generator) => {
13667
13667
  return new Promise((resolve, reject) => {
13668
13668
  var fulfilled = (value) => {
13669
13669
  try {
@@ -13701,7 +13701,7 @@ class CarriersAPI {
13701
13701
  /**
13702
13702
  * The `connect` method connects a carrier account to a user's ShipEngine account.
13703
13703
  */
13704
- this.connect = (_a) => __async$v(this, null, function* () {
13704
+ this.connect = (_a) => __async$w(this, null, function* () {
13705
13705
  var _b = _a, { carrierCode } = _b, connection = __objRest$7(_b, ["carrierCode"]);
13706
13706
  const endUserIpAddress = yield getEndUserIpAddress();
13707
13707
  if (!endUserIpAddress)
@@ -16017,7 +16017,7 @@ var __spreadValues$5 = (a, b) => {
16017
16017
  }
16018
16018
  return a;
16019
16019
  };
16020
- var __async$u = (__this, __arguments, generator) => {
16020
+ var __async$v = (__this, __arguments, generator) => {
16021
16021
  return new Promise((resolve, reject) => {
16022
16022
  var fulfilled = (value) => {
16023
16023
  try {
@@ -16056,7 +16056,7 @@ class FundingSourcesAPI {
16056
16056
  * The `create` method creates a new funding source for a given user. This requires
16057
16057
  * payment information to be collected from the user.
16058
16058
  */
16059
- this.create = (createFundingSource) => __async$u(this, null, function* () {
16059
+ this.create = (createFundingSource) => __async$v(this, null, function* () {
16060
16060
  const endUserIpAddress = yield getEndUserIpAddress();
16061
16061
  if (!endUserIpAddress)
16062
16062
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16069,7 +16069,7 @@ class FundingSourcesAPI {
16069
16069
  * user to update the billing address or payment information associated with the
16070
16070
  * funding source.
16071
16071
  */
16072
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$u(this, null, function* () {
16072
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$v(this, null, function* () {
16073
16073
  const endUserIpAddress = yield getEndUserIpAddress();
16074
16074
  if (!endUserIpAddress)
16075
16075
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16086,7 +16086,7 @@ class FundingSourcesAPI {
16086
16086
  * The `registerCarrier` method registers a carrier account and associates
16087
16087
  * it with a given funding source.
16088
16088
  */
16089
- this.registerCarrier = (carrier) => __async$u(this, null, function* () {
16089
+ this.registerCarrier = (carrier) => __async$v(this, null, function* () {
16090
16090
  const endUserIpAddress = yield getEndUserIpAddress();
16091
16091
  if (!endUserIpAddress)
16092
16092
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16097,7 +16097,7 @@ class FundingSourcesAPI {
16097
16097
  /**
16098
16098
  * The `addFunds` method allows you to add funds to a funding source.
16099
16099
  */
16100
- this.addFunds = (amount, fundingSourceId) => __async$u(this, null, function* () {
16100
+ this.addFunds = (amount, fundingSourceId) => __async$v(this, null, function* () {
16101
16101
  return yield this.client.put(
16102
16102
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
16103
16103
  amount
@@ -16107,7 +16107,7 @@ class FundingSourcesAPI {
16107
16107
  * The `metadata` method returns seller-specific requirements for creating funding sources
16108
16108
  * and attaching carriers
16109
16109
  */
16110
- this.metadata = () => __async$u(this, null, function* () {
16110
+ this.metadata = () => __async$v(this, null, function* () {
16111
16111
  return yield this.client.get("/v1/funding_sources/metadata");
16112
16112
  });
16113
16113
  this.client = client;
@@ -16338,7 +16338,7 @@ class SalesOrdersAPI {
16338
16338
  }
16339
16339
  }
16340
16340
 
16341
- var __async$t = (__this, __arguments, generator) => {
16341
+ var __async$u = (__this, __arguments, generator) => {
16342
16342
  return new Promise((resolve, reject) => {
16343
16343
  var fulfilled = (value) => {
16344
16344
  try {
@@ -16381,7 +16381,7 @@ class ShipmentsAPI {
16381
16381
  * The `create` method allows for creating shipments based on a list of shipment
16382
16382
  * items passed into this method.
16383
16383
  */
16384
- this.create = (...shipments) => __async$t(this, null, function* () {
16384
+ this.create = (...shipments) => __async$u(this, null, function* () {
16385
16385
  return this.client.post("/v1/shipments", {
16386
16386
  shipments
16387
16387
  });
@@ -16405,6 +16405,12 @@ class ShippingRulesAPI {
16405
16405
  this.create = (shippingRule) => {
16406
16406
  return this.client.post("/v1/shipping_rules", shippingRule);
16407
16407
  };
16408
+ /**
16409
+ * The `delete` method deletes a shipping rule by `shippingRuleId`.
16410
+ */
16411
+ this.delete = (shippingRuleId) => {
16412
+ return this.client.delete(`/v1/shipping_rules/${shippingRuleId}`);
16413
+ };
16408
16414
  this.client = client;
16409
16415
  }
16410
16416
  }
@@ -16463,7 +16469,7 @@ var __spreadValues$4 = (a, b) => {
16463
16469
  return a;
16464
16470
  };
16465
16471
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
16466
- var __async$s = (__this, __arguments, generator) => {
16472
+ var __async$t = (__this, __arguments, generator) => {
16467
16473
  return new Promise((resolve, reject) => {
16468
16474
  var fulfilled = (value) => {
16469
16475
  try {
@@ -16557,7 +16563,7 @@ class ShipEngineAPI {
16557
16563
  );
16558
16564
  return res;
16559
16565
  },
16560
- (err) => __async$s(this, null, function* () {
16566
+ (err) => __async$t(this, null, function* () {
16561
16567
  var _a, _b, _c, _d, _e, _f, _g;
16562
16568
  logger$1.error(
16563
16569
  { err, req: err.config, res: err.response },
@@ -16862,7 +16868,7 @@ const useGetAccountSettings = () => {
16862
16868
  });
16863
16869
  };
16864
16870
 
16865
- var __async$r = (__this, __arguments, generator) => {
16871
+ var __async$s = (__this, __arguments, generator) => {
16866
16872
  return new Promise((resolve, reject) => {
16867
16873
  var fulfilled = (value) => {
16868
16874
  try {
@@ -16885,7 +16891,7 @@ var __async$r = (__this, __arguments, generator) => {
16885
16891
  const useUpdateAccountSettings = () => {
16886
16892
  const { client } = useShipEngine();
16887
16893
  return reactQuery.useMutation({
16888
- mutationFn: (settings) => __async$r(void 0, null, function* () {
16894
+ mutationFn: (settings) => __async$s(void 0, null, function* () {
16889
16895
  const result = yield client.accountSettings.update(settings);
16890
16896
  return result.data;
16891
16897
  }),
@@ -16894,7 +16900,7 @@ const useUpdateAccountSettings = () => {
16894
16900
  });
16895
16901
  };
16896
16902
 
16897
- var __async$q = (__this, __arguments, generator) => {
16903
+ var __async$r = (__this, __arguments, generator) => {
16898
16904
  return new Promise((resolve, reject) => {
16899
16905
  var fulfilled = (value) => {
16900
16906
  try {
@@ -16917,7 +16923,7 @@ var __async$q = (__this, __arguments, generator) => {
16917
16923
  const useParseAddress = () => {
16918
16924
  const { client } = useShipEngine();
16919
16925
  return reactQuery.useMutation({
16920
- mutationFn: (_0) => __async$q(void 0, [_0], function* ({ address, text }) {
16926
+ mutationFn: (_0) => __async$r(void 0, [_0], function* ({ address, text }) {
16921
16927
  const result = yield client.addresses.parse(text, address);
16922
16928
  return result.data;
16923
16929
  }),
@@ -16926,7 +16932,7 @@ const useParseAddress = () => {
16926
16932
  });
16927
16933
  };
16928
16934
 
16929
- var __async$p = (__this, __arguments, generator) => {
16935
+ var __async$q = (__this, __arguments, generator) => {
16930
16936
  return new Promise((resolve, reject) => {
16931
16937
  var fulfilled = (value) => {
16932
16938
  try {
@@ -16949,7 +16955,7 @@ var __async$p = (__this, __arguments, generator) => {
16949
16955
  const useValidateAddresses = () => {
16950
16956
  const { client } = useShipEngine();
16951
16957
  return reactQuery.useMutation({
16952
- mutationFn: (addresses) => __async$p(void 0, null, function* () {
16958
+ mutationFn: (addresses) => __async$q(void 0, null, function* () {
16953
16959
  const result = yield client.addresses.validate(addresses);
16954
16960
  return result.data;
16955
16961
  }),
@@ -16958,7 +16964,7 @@ const useValidateAddresses = () => {
16958
16964
  });
16959
16965
  };
16960
16966
 
16961
- var __async$o = (__this, __arguments, generator) => {
16967
+ var __async$p = (__this, __arguments, generator) => {
16962
16968
  return new Promise((resolve, reject) => {
16963
16969
  var fulfilled = (value) => {
16964
16970
  try {
@@ -16981,7 +16987,7 @@ var __async$o = (__this, __arguments, generator) => {
16981
16987
  const useAddFunds = () => {
16982
16988
  const { client } = useShipEngine();
16983
16989
  return reactQuery.useMutation({
16984
- mutationFn: (_0) => __async$o(void 0, [_0], function* ({ carrierId, funds }) {
16990
+ mutationFn: (_0) => __async$p(void 0, [_0], function* ({ carrierId, funds }) {
16985
16991
  const result = yield client.carriers.addFunds(carrierId, funds);
16986
16992
  return result.data;
16987
16993
  }),
@@ -16990,7 +16996,7 @@ const useAddFunds = () => {
16990
16996
  });
16991
16997
  };
16992
16998
 
16993
- var __async$n = (__this, __arguments, generator) => {
16999
+ var __async$o = (__this, __arguments, generator) => {
16994
17000
  return new Promise((resolve, reject) => {
16995
17001
  var fulfilled = (value) => {
16996
17002
  try {
@@ -17013,7 +17019,7 @@ var __async$n = (__this, __arguments, generator) => {
17013
17019
  const useConnectCarrier = () => {
17014
17020
  const { client } = useShipEngine();
17015
17021
  return reactQuery.useMutation({
17016
- mutationFn: (params) => __async$n(void 0, null, function* () {
17022
+ mutationFn: (params) => __async$o(void 0, null, function* () {
17017
17023
  const result = yield client.carriers.connect(params);
17018
17024
  return result.data;
17019
17025
  }),
@@ -17150,7 +17156,7 @@ const useListCarriers = () => {
17150
17156
  });
17151
17157
  };
17152
17158
 
17153
- var __async$m = (__this, __arguments, generator) => {
17159
+ var __async$n = (__this, __arguments, generator) => {
17154
17160
  return new Promise((resolve, reject) => {
17155
17161
  var fulfilled = (value) => {
17156
17162
  try {
@@ -17174,7 +17180,7 @@ const useUpdateAutoFunding = (carrierId) => {
17174
17180
  const { client } = useShipEngine();
17175
17181
  const queryClient = reactQuery.useQueryClient();
17176
17182
  return reactQuery.useMutation({
17177
- mutationFn: (options) => __async$m(void 0, null, function* () {
17183
+ mutationFn: (options) => __async$n(void 0, null, function* () {
17178
17184
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
17179
17185
  return result.data;
17180
17186
  }),
@@ -17213,7 +17219,7 @@ const useListCustomPackageTypes = () => {
17213
17219
  });
17214
17220
  };
17215
17221
 
17216
- var __async$l = (__this, __arguments, generator) => {
17222
+ var __async$m = (__this, __arguments, generator) => {
17217
17223
  return new Promise((resolve, reject) => {
17218
17224
  var fulfilled = (value) => {
17219
17225
  try {
@@ -17236,7 +17242,7 @@ var __async$l = (__this, __arguments, generator) => {
17236
17242
  const useCreateFundingSource = () => {
17237
17243
  const { client } = useShipEngine();
17238
17244
  return reactQuery.useMutation({
17239
- mutationFn: (fundingSource) => __async$l(void 0, null, function* () {
17245
+ mutationFn: (fundingSource) => __async$m(void 0, null, function* () {
17240
17246
  const result = yield client.fundingSources.create(fundingSource);
17241
17247
  return result.data;
17242
17248
  }),
@@ -17245,7 +17251,7 @@ const useCreateFundingSource = () => {
17245
17251
  });
17246
17252
  };
17247
17253
 
17248
- var __async$k = (__this, __arguments, generator) => {
17254
+ var __async$l = (__this, __arguments, generator) => {
17249
17255
  return new Promise((resolve, reject) => {
17250
17256
  var fulfilled = (value) => {
17251
17257
  try {
@@ -17268,7 +17274,7 @@ var __async$k = (__this, __arguments, generator) => {
17268
17274
  const useFundingSourcesAddFunds = (fundingSourceId) => {
17269
17275
  const { client } = useShipEngine();
17270
17276
  return reactQuery.useMutation({
17271
- mutationFn: (funds) => __async$k(void 0, null, function* () {
17277
+ mutationFn: (funds) => __async$l(void 0, null, function* () {
17272
17278
  const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
17273
17279
  return result.data;
17274
17280
  }),
@@ -17297,7 +17303,7 @@ const useListFundingSources = () => {
17297
17303
  });
17298
17304
  };
17299
17305
 
17300
- var __async$j = (__this, __arguments, generator) => {
17306
+ var __async$k = (__this, __arguments, generator) => {
17301
17307
  return new Promise((resolve, reject) => {
17302
17308
  var fulfilled = (value) => {
17303
17309
  try {
@@ -17320,7 +17326,7 @@ var __async$j = (__this, __arguments, generator) => {
17320
17326
  const useRegisterCarrier = () => {
17321
17327
  const { client } = useShipEngine();
17322
17328
  return reactQuery.useMutation({
17323
- mutationFn: (carrier) => __async$j(void 0, null, function* () {
17329
+ mutationFn: (carrier) => __async$k(void 0, null, function* () {
17324
17330
  const result = yield client.fundingSources.registerCarrier(carrier);
17325
17331
  return result.data;
17326
17332
  }),
@@ -17329,7 +17335,7 @@ const useRegisterCarrier = () => {
17329
17335
  });
17330
17336
  };
17331
17337
 
17332
- var __async$i = (__this, __arguments, generator) => {
17338
+ var __async$j = (__this, __arguments, generator) => {
17333
17339
  return new Promise((resolve, reject) => {
17334
17340
  var fulfilled = (value) => {
17335
17341
  try {
@@ -17352,7 +17358,7 @@ var __async$i = (__this, __arguments, generator) => {
17352
17358
  const useUpdateFundingSource = () => {
17353
17359
  const { client } = useShipEngine();
17354
17360
  return reactQuery.useMutation({
17355
- mutationFn: (_0) => __async$i(void 0, [_0], function* ({
17361
+ mutationFn: (_0) => __async$j(void 0, [_0], function* ({
17356
17362
  billingInfo,
17357
17363
  creditCardInfo,
17358
17364
  fundingSourceId
@@ -17409,7 +17415,7 @@ var __objRest$6 = (source, exclude) => {
17409
17415
  }
17410
17416
  return target;
17411
17417
  };
17412
- var __async$h = (__this, __arguments, generator) => {
17418
+ var __async$i = (__this, __arguments, generator) => {
17413
17419
  return new Promise((resolve, reject) => {
17414
17420
  var fulfilled = (value) => {
17415
17421
  try {
@@ -17432,7 +17438,7 @@ var __async$h = (__this, __arguments, generator) => {
17432
17438
  const useCreateLabel = () => {
17433
17439
  const { client } = useShipEngine();
17434
17440
  return reactQuery.useMutation({
17435
- mutationFn: (_a) => __async$h(void 0, null, function* () {
17441
+ mutationFn: (_a) => __async$i(void 0, null, function* () {
17436
17442
  var _b = _a, { rateId } = _b, options = __objRest$6(_b, ["rateId"]);
17437
17443
  const result = yield client.labels.createByRateId(rateId, options);
17438
17444
  return result.data;
@@ -17468,7 +17474,7 @@ const useListLabels = (params) => {
17468
17474
  });
17469
17475
  };
17470
17476
 
17471
- var __async$g = (__this, __arguments, generator) => {
17477
+ var __async$h = (__this, __arguments, generator) => {
17472
17478
  return new Promise((resolve, reject) => {
17473
17479
  var fulfilled = (value) => {
17474
17480
  try {
@@ -17491,7 +17497,7 @@ var __async$g = (__this, __arguments, generator) => {
17491
17497
  const useVoidLabel = () => {
17492
17498
  const { client } = useShipEngine();
17493
17499
  return reactQuery.useMutation({
17494
- mutationFn: (labelId) => __async$g(void 0, null, function* () {
17500
+ mutationFn: (labelId) => __async$h(void 0, null, function* () {
17495
17501
  const result = yield client.labels.void(labelId);
17496
17502
  return result.data;
17497
17503
  }),
@@ -17510,7 +17516,7 @@ const useListOrderSources = () => {
17510
17516
  });
17511
17517
  };
17512
17518
 
17513
- var __async$f = (__this, __arguments, generator) => {
17519
+ var __async$g = (__this, __arguments, generator) => {
17514
17520
  return new Promise((resolve, reject) => {
17515
17521
  var fulfilled = (value) => {
17516
17522
  try {
@@ -17533,7 +17539,7 @@ var __async$f = (__this, __arguments, generator) => {
17533
17539
  const useRefreshOrderSourceAsync = () => {
17534
17540
  const { client } = useShipEngine();
17535
17541
  return reactQuery.useMutation({
17536
- mutationFn: (orderSourceId) => __async$f(void 0, null, function* () {
17542
+ mutationFn: (orderSourceId) => __async$g(void 0, null, function* () {
17537
17543
  const result = yield client.orderSources.refresh(orderSourceId);
17538
17544
  return result.data;
17539
17545
  }),
@@ -17544,9 +17550,9 @@ const useRefreshOrderSource = () => {
17544
17550
  const { client } = useShipEngine();
17545
17551
  const { mutateAsync: refreshOrderSourceAsync } = useRefreshOrderSourceAsync();
17546
17552
  return reactQuery.useMutation({
17547
- mutationFn: (orderSourceId) => __async$f(void 0, null, function* () {
17553
+ mutationFn: (orderSourceId) => __async$g(void 0, null, function* () {
17548
17554
  yield refreshOrderSourceAsync(orderSourceId);
17549
- const waitResult = yield retryUntil(() => __async$f(void 0, null, function* () {
17555
+ const waitResult = yield retryUntil(() => __async$g(void 0, null, function* () {
17550
17556
  const { data: checkResult } = yield client.orderSources.get(orderSourceId);
17551
17557
  if (["preparing_update", "updating"].includes(checkResult.refreshInfo.status)) {
17552
17558
  throw new CodedError("Order source is still refreshing");
@@ -17560,7 +17566,7 @@ const useRefreshOrderSource = () => {
17560
17566
  });
17561
17567
  };
17562
17568
 
17563
- var __async$e = (__this, __arguments, generator) => {
17569
+ var __async$f = (__this, __arguments, generator) => {
17564
17570
  return new Promise((resolve, reject) => {
17565
17571
  var fulfilled = (value) => {
17566
17572
  try {
@@ -17583,7 +17589,7 @@ var __async$e = (__this, __arguments, generator) => {
17583
17589
  const useCreateRateCard = () => {
17584
17590
  const { client } = useShipEngine();
17585
17591
  return reactQuery.useMutation({
17586
- mutationFn: (rateCard) => __async$e(void 0, null, function* () {
17592
+ mutationFn: (rateCard) => __async$f(void 0, null, function* () {
17587
17593
  const result = yield client.rateCards.create(rateCard);
17588
17594
  return result.data;
17589
17595
  }),
@@ -17630,7 +17636,7 @@ const useListRateCards = (carrierIds) => {
17630
17636
  });
17631
17637
  };
17632
17638
 
17633
- var __async$d = (__this, __arguments, generator) => {
17639
+ var __async$e = (__this, __arguments, generator) => {
17634
17640
  return new Promise((resolve, reject) => {
17635
17641
  var fulfilled = (value) => {
17636
17642
  try {
@@ -17653,7 +17659,7 @@ var __async$d = (__this, __arguments, generator) => {
17653
17659
  const usePublishRateCard = () => {
17654
17660
  const { client } = useShipEngine();
17655
17661
  return reactQuery.useMutation({
17656
- mutationFn: (rateCardId) => __async$d(void 0, null, function* () {
17662
+ mutationFn: (rateCardId) => __async$e(void 0, null, function* () {
17657
17663
  return yield client.rateCards.publish(rateCardId);
17658
17664
  }),
17659
17665
  mutationKey: ["usePublishRateCard"],
@@ -17661,7 +17667,7 @@ const usePublishRateCard = () => {
17661
17667
  });
17662
17668
  };
17663
17669
 
17664
- var __async$c = (__this, __arguments, generator) => {
17670
+ var __async$d = (__this, __arguments, generator) => {
17665
17671
  return new Promise((resolve, reject) => {
17666
17672
  var fulfilled = (value) => {
17667
17673
  try {
@@ -17684,7 +17690,7 @@ var __async$c = (__this, __arguments, generator) => {
17684
17690
  const useUpdateRateCard = () => {
17685
17691
  const { client } = useShipEngine();
17686
17692
  return reactQuery.useMutation({
17687
- mutationFn: (rateCard) => __async$c(void 0, null, function* () {
17693
+ mutationFn: (rateCard) => __async$d(void 0, null, function* () {
17688
17694
  const result = yield client.rateCards.update(rateCard);
17689
17695
  return result.data;
17690
17696
  }),
@@ -17693,7 +17699,7 @@ const useUpdateRateCard = () => {
17693
17699
  });
17694
17700
  };
17695
17701
 
17696
- var __async$b = (__this, __arguments, generator) => {
17702
+ var __async$c = (__this, __arguments, generator) => {
17697
17703
  return new Promise((resolve, reject) => {
17698
17704
  var fulfilled = (value) => {
17699
17705
  try {
@@ -17716,7 +17722,7 @@ var __async$b = (__this, __arguments, generator) => {
17716
17722
  const useUploadRateCard = () => {
17717
17723
  const { client } = useShipEngine();
17718
17724
  return reactQuery.useMutation({
17719
- mutationFn: (_0) => __async$b(void 0, [_0], function* ({ rateCardId, file }) {
17725
+ mutationFn: (_0) => __async$c(void 0, [_0], function* ({ rateCardId, file }) {
17720
17726
  const result = yield client.rateCards.upload(rateCardId, file);
17721
17727
  return result.data;
17722
17728
  }),
@@ -17725,7 +17731,7 @@ const useUploadRateCard = () => {
17725
17731
  });
17726
17732
  };
17727
17733
 
17728
- var __async$a = (__this, __arguments, generator) => {
17734
+ var __async$b = (__this, __arguments, generator) => {
17729
17735
  return new Promise((resolve, reject) => {
17730
17736
  var fulfilled = (value) => {
17731
17737
  try {
@@ -17748,7 +17754,7 @@ var __async$a = (__this, __arguments, generator) => {
17748
17754
  const useDeleteRateCard = () => {
17749
17755
  const { client } = useShipEngine();
17750
17756
  return reactQuery.useMutation({
17751
- mutationFn: (rateCardId) => __async$a(void 0, null, function* () {
17757
+ mutationFn: (rateCardId) => __async$b(void 0, null, function* () {
17752
17758
  const result = yield client.rateCards.delete(rateCardId);
17753
17759
  return result.data;
17754
17760
  }),
@@ -17757,7 +17763,7 @@ const useDeleteRateCard = () => {
17757
17763
  });
17758
17764
  };
17759
17765
 
17760
- var __async$9 = (__this, __arguments, generator) => {
17766
+ var __async$a = (__this, __arguments, generator) => {
17761
17767
  return new Promise((resolve, reject) => {
17762
17768
  var fulfilled = (value) => {
17763
17769
  try {
@@ -17780,7 +17786,7 @@ var __async$9 = (__this, __arguments, generator) => {
17780
17786
  const useCalculateRates = () => {
17781
17787
  const { client } = useShipEngine();
17782
17788
  return reactQuery.useMutation({
17783
- mutationFn: (_0) => __async$9(void 0, [_0], function* ({ rateOptions, shipmentId }) {
17789
+ mutationFn: (_0) => __async$a(void 0, [_0], function* ({ rateOptions, shipmentId }) {
17784
17790
  const result = yield client.rates.calculateByShipmentId(shipmentId, rateOptions);
17785
17791
  return result.data;
17786
17792
  }),
@@ -17830,7 +17836,7 @@ var __objRest$5 = (source, exclude) => {
17830
17836
  }
17831
17837
  return target;
17832
17838
  };
17833
- var __async$8 = (__this, __arguments, generator) => {
17839
+ var __async$9 = (__this, __arguments, generator) => {
17834
17840
  return new Promise((resolve, reject) => {
17835
17841
  var fulfilled = (value) => {
17836
17842
  try {
@@ -17853,7 +17859,7 @@ var __async$8 = (__this, __arguments, generator) => {
17853
17859
  const useNotifySalesOrderShipped = () => {
17854
17860
  const { client } = useShipEngine();
17855
17861
  return reactQuery.useMutation({
17856
- mutationFn: (_a) => __async$8(void 0, null, function* () {
17862
+ mutationFn: (_a) => __async$9(void 0, null, function* () {
17857
17863
  var _b = _a, { salesOrderId } = _b, tracking = __objRest$5(_b, ["salesOrderId"]);
17858
17864
  const result = yield client.salesOrders.notifyShipped(salesOrderId, tracking);
17859
17865
  return result.data;
@@ -17878,7 +17884,7 @@ var __objRest$4 = (source, exclude) => {
17878
17884
  }
17879
17885
  return target;
17880
17886
  };
17881
- var __async$7 = (__this, __arguments, generator) => {
17887
+ var __async$8 = (__this, __arguments, generator) => {
17882
17888
  return new Promise((resolve, reject) => {
17883
17889
  var fulfilled = (value) => {
17884
17890
  try {
@@ -17901,7 +17907,7 @@ var __async$7 = (__this, __arguments, generator) => {
17901
17907
  const useCreateSalesOrderShipment = () => {
17902
17908
  const { client } = useShipEngine();
17903
17909
  return reactQuery.useMutation({
17904
- mutationFn: (_a) => __async$7(void 0, null, function* () {
17910
+ mutationFn: (_a) => __async$8(void 0, null, function* () {
17905
17911
  var _b = _a, { salesOrderId } = _b, shipment = __objRest$4(_b, ["salesOrderId"]);
17906
17912
  const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
17907
17913
  return result.data;
@@ -17952,7 +17958,7 @@ var __objRest$3 = (source, exclude) => {
17952
17958
  }
17953
17959
  return target;
17954
17960
  };
17955
- var __async$6 = (__this, __arguments, generator) => {
17961
+ var __async$7 = (__this, __arguments, generator) => {
17956
17962
  return new Promise((resolve, reject) => {
17957
17963
  var fulfilled = (value) => {
17958
17964
  try {
@@ -17975,7 +17981,7 @@ var __async$6 = (__this, __arguments, generator) => {
17975
17981
  const useUpdateSalesOrderShipment = () => {
17976
17982
  const { client } = useShipEngine();
17977
17983
  return reactQuery.useMutation({
17978
- mutationFn: (_a) => __async$6(void 0, null, function* () {
17984
+ mutationFn: (_a) => __async$7(void 0, null, function* () {
17979
17985
  var _b = _a, { shipmentId } = _b, shipment = __objRest$3(_b, ["shipmentId"]);
17980
17986
  const result = yield client.salesOrderShipments.update(shipmentId, shipment);
17981
17987
  return result.data;
@@ -18004,7 +18010,7 @@ var __spreadValues$2 = (a, b) => {
18004
18010
  return a;
18005
18011
  };
18006
18012
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
18007
- var __async$5 = (__this, __arguments, generator) => {
18013
+ var __async$6 = (__this, __arguments, generator) => {
18008
18014
  return new Promise((resolve, reject) => {
18009
18015
  var fulfilled = (value) => {
18010
18016
  try {
@@ -18027,7 +18033,7 @@ var __async$5 = (__this, __arguments, generator) => {
18027
18033
  const useCreateShipment = () => {
18028
18034
  const { client } = useShipEngine();
18029
18035
  return reactQuery.useMutation({
18030
- mutationFn: (shipment) => __async$5(void 0, null, function* () {
18036
+ mutationFn: (shipment) => __async$6(void 0, null, function* () {
18031
18037
  var _a;
18032
18038
  if (shipment.warehouseId === void 0) {
18033
18039
  throw new CodedError("errorMessages.noWarehouses", {
@@ -18125,7 +18131,7 @@ const useListShippingRules = () => {
18125
18131
  });
18126
18132
  };
18127
18133
 
18128
- var __async$4 = (__this, __arguments, generator) => {
18134
+ var __async$5 = (__this, __arguments, generator) => {
18129
18135
  return new Promise((resolve, reject) => {
18130
18136
  var fulfilled = (value) => {
18131
18137
  try {
@@ -18148,7 +18154,7 @@ var __async$4 = (__this, __arguments, generator) => {
18148
18154
  const useCreateShippingRule = () => {
18149
18155
  const { client } = useShipEngine();
18150
18156
  return reactQuery.useMutation({
18151
- mutationFn: (shippingRule) => __async$4(void 0, null, function* () {
18157
+ mutationFn: (shippingRule) => __async$5(void 0, null, function* () {
18152
18158
  const result = yield client.shippingRules.create(shippingRule);
18153
18159
  return result.data;
18154
18160
  }),
@@ -18157,6 +18163,38 @@ const useCreateShippingRule = () => {
18157
18163
  });
18158
18164
  };
18159
18165
 
18166
+ var __async$4 = (__this, __arguments, generator) => {
18167
+ return new Promise((resolve, reject) => {
18168
+ var fulfilled = (value) => {
18169
+ try {
18170
+ step(generator.next(value));
18171
+ } catch (e) {
18172
+ reject(e);
18173
+ }
18174
+ };
18175
+ var rejected = (value) => {
18176
+ try {
18177
+ step(generator.throw(value));
18178
+ } catch (e) {
18179
+ reject(e);
18180
+ }
18181
+ };
18182
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18183
+ step((generator = generator.apply(__this, __arguments)).next());
18184
+ });
18185
+ };
18186
+ const useDeleteShippingRule = () => {
18187
+ const { client } = useShipEngine();
18188
+ return reactQuery.useMutation({
18189
+ mutationFn: (shippingRuleId) => __async$4(void 0, null, function* () {
18190
+ const result = yield client.shippingRules.delete(shippingRuleId);
18191
+ return result.data;
18192
+ }),
18193
+ mutationKey: ["useDeleteShippingRule"],
18194
+ onError
18195
+ });
18196
+ };
18197
+
18160
18198
  var __async$3 = (__this, __arguments, generator) => {
18161
18199
  return new Promise((resolve, reject) => {
18162
18200
  var fulfilled = (value) => {
@@ -19463,6 +19501,7 @@ exports.useCreateShipment = useCreateShipment;
19463
19501
  exports.useCreateShippingRule = useCreateShippingRule;
19464
19502
  exports.useCreateWarehouse = useCreateWarehouse;
19465
19503
  exports.useDeleteRateCard = useDeleteRateCard;
19504
+ exports.useDeleteShippingRule = useDeleteShippingRule;
19466
19505
  exports.useDeleteWarehouse = useDeleteWarehouse;
19467
19506
  exports.useDownloadRateCard = useDownloadRateCard;
19468
19507
  exports.useFundingSourcesAddFunds = useFundingSourcesAddFunds;
package/index.mjs CHANGED
@@ -13578,7 +13578,7 @@ var ipaddr = {
13578
13578
  }).call(commonjsGlobal);
13579
13579
  } (ipaddr));
13580
13580
 
13581
- var __async$w = (__this, __arguments, generator) => {
13581
+ var __async$x = (__this, __arguments, generator) => {
13582
13582
  return new Promise((resolve, reject) => {
13583
13583
  var fulfilled = (value) => {
13584
13584
  try {
@@ -13598,7 +13598,7 @@ var __async$w = (__this, __arguments, generator) => {
13598
13598
  step((generator = generator.apply(__this, __arguments)).next());
13599
13599
  });
13600
13600
  };
13601
- const getEndUserIpAddress = () => __async$w(void 0, null, function* () {
13601
+ const getEndUserIpAddress = () => __async$x(void 0, null, function* () {
13602
13602
  try {
13603
13603
  const response = yield axios.get("https://api.ipify.org/?format=json");
13604
13604
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -13641,7 +13641,7 @@ var __objRest$7 = (source, exclude) => {
13641
13641
  }
13642
13642
  return target;
13643
13643
  };
13644
- var __async$v = (__this, __arguments, generator) => {
13644
+ var __async$w = (__this, __arguments, generator) => {
13645
13645
  return new Promise((resolve, reject) => {
13646
13646
  var fulfilled = (value) => {
13647
13647
  try {
@@ -13679,7 +13679,7 @@ class CarriersAPI {
13679
13679
  /**
13680
13680
  * The `connect` method connects a carrier account to a user's ShipEngine account.
13681
13681
  */
13682
- this.connect = (_a) => __async$v(this, null, function* () {
13682
+ this.connect = (_a) => __async$w(this, null, function* () {
13683
13683
  var _b = _a, { carrierCode } = _b, connection = __objRest$7(_b, ["carrierCode"]);
13684
13684
  const endUserIpAddress = yield getEndUserIpAddress();
13685
13685
  if (!endUserIpAddress)
@@ -15995,7 +15995,7 @@ var __spreadValues$5 = (a, b) => {
15995
15995
  }
15996
15996
  return a;
15997
15997
  };
15998
- var __async$u = (__this, __arguments, generator) => {
15998
+ var __async$v = (__this, __arguments, generator) => {
15999
15999
  return new Promise((resolve, reject) => {
16000
16000
  var fulfilled = (value) => {
16001
16001
  try {
@@ -16034,7 +16034,7 @@ class FundingSourcesAPI {
16034
16034
  * The `create` method creates a new funding source for a given user. This requires
16035
16035
  * payment information to be collected from the user.
16036
16036
  */
16037
- this.create = (createFundingSource) => __async$u(this, null, function* () {
16037
+ this.create = (createFundingSource) => __async$v(this, null, function* () {
16038
16038
  const endUserIpAddress = yield getEndUserIpAddress();
16039
16039
  if (!endUserIpAddress)
16040
16040
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16047,7 +16047,7 @@ class FundingSourcesAPI {
16047
16047
  * user to update the billing address or payment information associated with the
16048
16048
  * funding source.
16049
16049
  */
16050
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$u(this, null, function* () {
16050
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$v(this, null, function* () {
16051
16051
  const endUserIpAddress = yield getEndUserIpAddress();
16052
16052
  if (!endUserIpAddress)
16053
16053
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16064,7 +16064,7 @@ class FundingSourcesAPI {
16064
16064
  * The `registerCarrier` method registers a carrier account and associates
16065
16065
  * it with a given funding source.
16066
16066
  */
16067
- this.registerCarrier = (carrier) => __async$u(this, null, function* () {
16067
+ this.registerCarrier = (carrier) => __async$v(this, null, function* () {
16068
16068
  const endUserIpAddress = yield getEndUserIpAddress();
16069
16069
  if (!endUserIpAddress)
16070
16070
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -16075,7 +16075,7 @@ class FundingSourcesAPI {
16075
16075
  /**
16076
16076
  * The `addFunds` method allows you to add funds to a funding source.
16077
16077
  */
16078
- this.addFunds = (amount, fundingSourceId) => __async$u(this, null, function* () {
16078
+ this.addFunds = (amount, fundingSourceId) => __async$v(this, null, function* () {
16079
16079
  return yield this.client.put(
16080
16080
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
16081
16081
  amount
@@ -16085,7 +16085,7 @@ class FundingSourcesAPI {
16085
16085
  * The `metadata` method returns seller-specific requirements for creating funding sources
16086
16086
  * and attaching carriers
16087
16087
  */
16088
- this.metadata = () => __async$u(this, null, function* () {
16088
+ this.metadata = () => __async$v(this, null, function* () {
16089
16089
  return yield this.client.get("/v1/funding_sources/metadata");
16090
16090
  });
16091
16091
  this.client = client;
@@ -16316,7 +16316,7 @@ class SalesOrdersAPI {
16316
16316
  }
16317
16317
  }
16318
16318
 
16319
- var __async$t = (__this, __arguments, generator) => {
16319
+ var __async$u = (__this, __arguments, generator) => {
16320
16320
  return new Promise((resolve, reject) => {
16321
16321
  var fulfilled = (value) => {
16322
16322
  try {
@@ -16359,7 +16359,7 @@ class ShipmentsAPI {
16359
16359
  * The `create` method allows for creating shipments based on a list of shipment
16360
16360
  * items passed into this method.
16361
16361
  */
16362
- this.create = (...shipments) => __async$t(this, null, function* () {
16362
+ this.create = (...shipments) => __async$u(this, null, function* () {
16363
16363
  return this.client.post("/v1/shipments", {
16364
16364
  shipments
16365
16365
  });
@@ -16383,6 +16383,12 @@ class ShippingRulesAPI {
16383
16383
  this.create = (shippingRule) => {
16384
16384
  return this.client.post("/v1/shipping_rules", shippingRule);
16385
16385
  };
16386
+ /**
16387
+ * The `delete` method deletes a shipping rule by `shippingRuleId`.
16388
+ */
16389
+ this.delete = (shippingRuleId) => {
16390
+ return this.client.delete(`/v1/shipping_rules/${shippingRuleId}`);
16391
+ };
16386
16392
  this.client = client;
16387
16393
  }
16388
16394
  }
@@ -16441,7 +16447,7 @@ var __spreadValues$4 = (a, b) => {
16441
16447
  return a;
16442
16448
  };
16443
16449
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
16444
- var __async$s = (__this, __arguments, generator) => {
16450
+ var __async$t = (__this, __arguments, generator) => {
16445
16451
  return new Promise((resolve, reject) => {
16446
16452
  var fulfilled = (value) => {
16447
16453
  try {
@@ -16535,7 +16541,7 @@ class ShipEngineAPI {
16535
16541
  );
16536
16542
  return res;
16537
16543
  },
16538
- (err) => __async$s(this, null, function* () {
16544
+ (err) => __async$t(this, null, function* () {
16539
16545
  var _a, _b, _c, _d, _e, _f, _g;
16540
16546
  logger$1.error(
16541
16547
  { err, req: err.config, res: err.response },
@@ -16840,7 +16846,7 @@ const useGetAccountSettings = () => {
16840
16846
  });
16841
16847
  };
16842
16848
 
16843
- var __async$r = (__this, __arguments, generator) => {
16849
+ var __async$s = (__this, __arguments, generator) => {
16844
16850
  return new Promise((resolve, reject) => {
16845
16851
  var fulfilled = (value) => {
16846
16852
  try {
@@ -16863,7 +16869,7 @@ var __async$r = (__this, __arguments, generator) => {
16863
16869
  const useUpdateAccountSettings = () => {
16864
16870
  const { client } = useShipEngine();
16865
16871
  return useMutation({
16866
- mutationFn: (settings) => __async$r(void 0, null, function* () {
16872
+ mutationFn: (settings) => __async$s(void 0, null, function* () {
16867
16873
  const result = yield client.accountSettings.update(settings);
16868
16874
  return result.data;
16869
16875
  }),
@@ -16872,7 +16878,7 @@ const useUpdateAccountSettings = () => {
16872
16878
  });
16873
16879
  };
16874
16880
 
16875
- var __async$q = (__this, __arguments, generator) => {
16881
+ var __async$r = (__this, __arguments, generator) => {
16876
16882
  return new Promise((resolve, reject) => {
16877
16883
  var fulfilled = (value) => {
16878
16884
  try {
@@ -16895,7 +16901,7 @@ var __async$q = (__this, __arguments, generator) => {
16895
16901
  const useParseAddress = () => {
16896
16902
  const { client } = useShipEngine();
16897
16903
  return useMutation({
16898
- mutationFn: (_0) => __async$q(void 0, [_0], function* ({ address, text }) {
16904
+ mutationFn: (_0) => __async$r(void 0, [_0], function* ({ address, text }) {
16899
16905
  const result = yield client.addresses.parse(text, address);
16900
16906
  return result.data;
16901
16907
  }),
@@ -16904,7 +16910,7 @@ const useParseAddress = () => {
16904
16910
  });
16905
16911
  };
16906
16912
 
16907
- var __async$p = (__this, __arguments, generator) => {
16913
+ var __async$q = (__this, __arguments, generator) => {
16908
16914
  return new Promise((resolve, reject) => {
16909
16915
  var fulfilled = (value) => {
16910
16916
  try {
@@ -16927,7 +16933,7 @@ var __async$p = (__this, __arguments, generator) => {
16927
16933
  const useValidateAddresses = () => {
16928
16934
  const { client } = useShipEngine();
16929
16935
  return useMutation({
16930
- mutationFn: (addresses) => __async$p(void 0, null, function* () {
16936
+ mutationFn: (addresses) => __async$q(void 0, null, function* () {
16931
16937
  const result = yield client.addresses.validate(addresses);
16932
16938
  return result.data;
16933
16939
  }),
@@ -16936,7 +16942,7 @@ const useValidateAddresses = () => {
16936
16942
  });
16937
16943
  };
16938
16944
 
16939
- var __async$o = (__this, __arguments, generator) => {
16945
+ var __async$p = (__this, __arguments, generator) => {
16940
16946
  return new Promise((resolve, reject) => {
16941
16947
  var fulfilled = (value) => {
16942
16948
  try {
@@ -16959,7 +16965,7 @@ var __async$o = (__this, __arguments, generator) => {
16959
16965
  const useAddFunds = () => {
16960
16966
  const { client } = useShipEngine();
16961
16967
  return useMutation({
16962
- mutationFn: (_0) => __async$o(void 0, [_0], function* ({ carrierId, funds }) {
16968
+ mutationFn: (_0) => __async$p(void 0, [_0], function* ({ carrierId, funds }) {
16963
16969
  const result = yield client.carriers.addFunds(carrierId, funds);
16964
16970
  return result.data;
16965
16971
  }),
@@ -16968,7 +16974,7 @@ const useAddFunds = () => {
16968
16974
  });
16969
16975
  };
16970
16976
 
16971
- var __async$n = (__this, __arguments, generator) => {
16977
+ var __async$o = (__this, __arguments, generator) => {
16972
16978
  return new Promise((resolve, reject) => {
16973
16979
  var fulfilled = (value) => {
16974
16980
  try {
@@ -16991,7 +16997,7 @@ var __async$n = (__this, __arguments, generator) => {
16991
16997
  const useConnectCarrier = () => {
16992
16998
  const { client } = useShipEngine();
16993
16999
  return useMutation({
16994
- mutationFn: (params) => __async$n(void 0, null, function* () {
17000
+ mutationFn: (params) => __async$o(void 0, null, function* () {
16995
17001
  const result = yield client.carriers.connect(params);
16996
17002
  return result.data;
16997
17003
  }),
@@ -17128,7 +17134,7 @@ const useListCarriers = () => {
17128
17134
  });
17129
17135
  };
17130
17136
 
17131
- var __async$m = (__this, __arguments, generator) => {
17137
+ var __async$n = (__this, __arguments, generator) => {
17132
17138
  return new Promise((resolve, reject) => {
17133
17139
  var fulfilled = (value) => {
17134
17140
  try {
@@ -17152,7 +17158,7 @@ const useUpdateAutoFunding = (carrierId) => {
17152
17158
  const { client } = useShipEngine();
17153
17159
  const queryClient = useQueryClient();
17154
17160
  return useMutation({
17155
- mutationFn: (options) => __async$m(void 0, null, function* () {
17161
+ mutationFn: (options) => __async$n(void 0, null, function* () {
17156
17162
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
17157
17163
  return result.data;
17158
17164
  }),
@@ -17191,7 +17197,7 @@ const useListCustomPackageTypes = () => {
17191
17197
  });
17192
17198
  };
17193
17199
 
17194
- var __async$l = (__this, __arguments, generator) => {
17200
+ var __async$m = (__this, __arguments, generator) => {
17195
17201
  return new Promise((resolve, reject) => {
17196
17202
  var fulfilled = (value) => {
17197
17203
  try {
@@ -17214,7 +17220,7 @@ var __async$l = (__this, __arguments, generator) => {
17214
17220
  const useCreateFundingSource = () => {
17215
17221
  const { client } = useShipEngine();
17216
17222
  return useMutation({
17217
- mutationFn: (fundingSource) => __async$l(void 0, null, function* () {
17223
+ mutationFn: (fundingSource) => __async$m(void 0, null, function* () {
17218
17224
  const result = yield client.fundingSources.create(fundingSource);
17219
17225
  return result.data;
17220
17226
  }),
@@ -17223,7 +17229,7 @@ const useCreateFundingSource = () => {
17223
17229
  });
17224
17230
  };
17225
17231
 
17226
- var __async$k = (__this, __arguments, generator) => {
17232
+ var __async$l = (__this, __arguments, generator) => {
17227
17233
  return new Promise((resolve, reject) => {
17228
17234
  var fulfilled = (value) => {
17229
17235
  try {
@@ -17246,7 +17252,7 @@ var __async$k = (__this, __arguments, generator) => {
17246
17252
  const useFundingSourcesAddFunds = (fundingSourceId) => {
17247
17253
  const { client } = useShipEngine();
17248
17254
  return useMutation({
17249
- mutationFn: (funds) => __async$k(void 0, null, function* () {
17255
+ mutationFn: (funds) => __async$l(void 0, null, function* () {
17250
17256
  const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
17251
17257
  return result.data;
17252
17258
  }),
@@ -17275,7 +17281,7 @@ const useListFundingSources = () => {
17275
17281
  });
17276
17282
  };
17277
17283
 
17278
- var __async$j = (__this, __arguments, generator) => {
17284
+ var __async$k = (__this, __arguments, generator) => {
17279
17285
  return new Promise((resolve, reject) => {
17280
17286
  var fulfilled = (value) => {
17281
17287
  try {
@@ -17298,7 +17304,7 @@ var __async$j = (__this, __arguments, generator) => {
17298
17304
  const useRegisterCarrier = () => {
17299
17305
  const { client } = useShipEngine();
17300
17306
  return useMutation({
17301
- mutationFn: (carrier) => __async$j(void 0, null, function* () {
17307
+ mutationFn: (carrier) => __async$k(void 0, null, function* () {
17302
17308
  const result = yield client.fundingSources.registerCarrier(carrier);
17303
17309
  return result.data;
17304
17310
  }),
@@ -17307,7 +17313,7 @@ const useRegisterCarrier = () => {
17307
17313
  });
17308
17314
  };
17309
17315
 
17310
- var __async$i = (__this, __arguments, generator) => {
17316
+ var __async$j = (__this, __arguments, generator) => {
17311
17317
  return new Promise((resolve, reject) => {
17312
17318
  var fulfilled = (value) => {
17313
17319
  try {
@@ -17330,7 +17336,7 @@ var __async$i = (__this, __arguments, generator) => {
17330
17336
  const useUpdateFundingSource = () => {
17331
17337
  const { client } = useShipEngine();
17332
17338
  return useMutation({
17333
- mutationFn: (_0) => __async$i(void 0, [_0], function* ({
17339
+ mutationFn: (_0) => __async$j(void 0, [_0], function* ({
17334
17340
  billingInfo,
17335
17341
  creditCardInfo,
17336
17342
  fundingSourceId
@@ -17387,7 +17393,7 @@ var __objRest$6 = (source, exclude) => {
17387
17393
  }
17388
17394
  return target;
17389
17395
  };
17390
- var __async$h = (__this, __arguments, generator) => {
17396
+ var __async$i = (__this, __arguments, generator) => {
17391
17397
  return new Promise((resolve, reject) => {
17392
17398
  var fulfilled = (value) => {
17393
17399
  try {
@@ -17410,7 +17416,7 @@ var __async$h = (__this, __arguments, generator) => {
17410
17416
  const useCreateLabel = () => {
17411
17417
  const { client } = useShipEngine();
17412
17418
  return useMutation({
17413
- mutationFn: (_a) => __async$h(void 0, null, function* () {
17419
+ mutationFn: (_a) => __async$i(void 0, null, function* () {
17414
17420
  var _b = _a, { rateId } = _b, options = __objRest$6(_b, ["rateId"]);
17415
17421
  const result = yield client.labels.createByRateId(rateId, options);
17416
17422
  return result.data;
@@ -17446,7 +17452,7 @@ const useListLabels = (params) => {
17446
17452
  });
17447
17453
  };
17448
17454
 
17449
- var __async$g = (__this, __arguments, generator) => {
17455
+ var __async$h = (__this, __arguments, generator) => {
17450
17456
  return new Promise((resolve, reject) => {
17451
17457
  var fulfilled = (value) => {
17452
17458
  try {
@@ -17469,7 +17475,7 @@ var __async$g = (__this, __arguments, generator) => {
17469
17475
  const useVoidLabel = () => {
17470
17476
  const { client } = useShipEngine();
17471
17477
  return useMutation({
17472
- mutationFn: (labelId) => __async$g(void 0, null, function* () {
17478
+ mutationFn: (labelId) => __async$h(void 0, null, function* () {
17473
17479
  const result = yield client.labels.void(labelId);
17474
17480
  return result.data;
17475
17481
  }),
@@ -17488,7 +17494,7 @@ const useListOrderSources = () => {
17488
17494
  });
17489
17495
  };
17490
17496
 
17491
- var __async$f = (__this, __arguments, generator) => {
17497
+ var __async$g = (__this, __arguments, generator) => {
17492
17498
  return new Promise((resolve, reject) => {
17493
17499
  var fulfilled = (value) => {
17494
17500
  try {
@@ -17511,7 +17517,7 @@ var __async$f = (__this, __arguments, generator) => {
17511
17517
  const useRefreshOrderSourceAsync = () => {
17512
17518
  const { client } = useShipEngine();
17513
17519
  return useMutation({
17514
- mutationFn: (orderSourceId) => __async$f(void 0, null, function* () {
17520
+ mutationFn: (orderSourceId) => __async$g(void 0, null, function* () {
17515
17521
  const result = yield client.orderSources.refresh(orderSourceId);
17516
17522
  return result.data;
17517
17523
  }),
@@ -17522,9 +17528,9 @@ const useRefreshOrderSource = () => {
17522
17528
  const { client } = useShipEngine();
17523
17529
  const { mutateAsync: refreshOrderSourceAsync } = useRefreshOrderSourceAsync();
17524
17530
  return useMutation({
17525
- mutationFn: (orderSourceId) => __async$f(void 0, null, function* () {
17531
+ mutationFn: (orderSourceId) => __async$g(void 0, null, function* () {
17526
17532
  yield refreshOrderSourceAsync(orderSourceId);
17527
- const waitResult = yield retryUntil(() => __async$f(void 0, null, function* () {
17533
+ const waitResult = yield retryUntil(() => __async$g(void 0, null, function* () {
17528
17534
  const { data: checkResult } = yield client.orderSources.get(orderSourceId);
17529
17535
  if (["preparing_update", "updating"].includes(checkResult.refreshInfo.status)) {
17530
17536
  throw new CodedError("Order source is still refreshing");
@@ -17538,7 +17544,7 @@ const useRefreshOrderSource = () => {
17538
17544
  });
17539
17545
  };
17540
17546
 
17541
- var __async$e = (__this, __arguments, generator) => {
17547
+ var __async$f = (__this, __arguments, generator) => {
17542
17548
  return new Promise((resolve, reject) => {
17543
17549
  var fulfilled = (value) => {
17544
17550
  try {
@@ -17561,7 +17567,7 @@ var __async$e = (__this, __arguments, generator) => {
17561
17567
  const useCreateRateCard = () => {
17562
17568
  const { client } = useShipEngine();
17563
17569
  return useMutation({
17564
- mutationFn: (rateCard) => __async$e(void 0, null, function* () {
17570
+ mutationFn: (rateCard) => __async$f(void 0, null, function* () {
17565
17571
  const result = yield client.rateCards.create(rateCard);
17566
17572
  return result.data;
17567
17573
  }),
@@ -17608,7 +17614,7 @@ const useListRateCards = (carrierIds) => {
17608
17614
  });
17609
17615
  };
17610
17616
 
17611
- var __async$d = (__this, __arguments, generator) => {
17617
+ var __async$e = (__this, __arguments, generator) => {
17612
17618
  return new Promise((resolve, reject) => {
17613
17619
  var fulfilled = (value) => {
17614
17620
  try {
@@ -17631,7 +17637,7 @@ var __async$d = (__this, __arguments, generator) => {
17631
17637
  const usePublishRateCard = () => {
17632
17638
  const { client } = useShipEngine();
17633
17639
  return useMutation({
17634
- mutationFn: (rateCardId) => __async$d(void 0, null, function* () {
17640
+ mutationFn: (rateCardId) => __async$e(void 0, null, function* () {
17635
17641
  return yield client.rateCards.publish(rateCardId);
17636
17642
  }),
17637
17643
  mutationKey: ["usePublishRateCard"],
@@ -17639,7 +17645,7 @@ const usePublishRateCard = () => {
17639
17645
  });
17640
17646
  };
17641
17647
 
17642
- var __async$c = (__this, __arguments, generator) => {
17648
+ var __async$d = (__this, __arguments, generator) => {
17643
17649
  return new Promise((resolve, reject) => {
17644
17650
  var fulfilled = (value) => {
17645
17651
  try {
@@ -17662,7 +17668,7 @@ var __async$c = (__this, __arguments, generator) => {
17662
17668
  const useUpdateRateCard = () => {
17663
17669
  const { client } = useShipEngine();
17664
17670
  return useMutation({
17665
- mutationFn: (rateCard) => __async$c(void 0, null, function* () {
17671
+ mutationFn: (rateCard) => __async$d(void 0, null, function* () {
17666
17672
  const result = yield client.rateCards.update(rateCard);
17667
17673
  return result.data;
17668
17674
  }),
@@ -17671,7 +17677,7 @@ const useUpdateRateCard = () => {
17671
17677
  });
17672
17678
  };
17673
17679
 
17674
- var __async$b = (__this, __arguments, generator) => {
17680
+ var __async$c = (__this, __arguments, generator) => {
17675
17681
  return new Promise((resolve, reject) => {
17676
17682
  var fulfilled = (value) => {
17677
17683
  try {
@@ -17694,7 +17700,7 @@ var __async$b = (__this, __arguments, generator) => {
17694
17700
  const useUploadRateCard = () => {
17695
17701
  const { client } = useShipEngine();
17696
17702
  return useMutation({
17697
- mutationFn: (_0) => __async$b(void 0, [_0], function* ({ rateCardId, file }) {
17703
+ mutationFn: (_0) => __async$c(void 0, [_0], function* ({ rateCardId, file }) {
17698
17704
  const result = yield client.rateCards.upload(rateCardId, file);
17699
17705
  return result.data;
17700
17706
  }),
@@ -17703,7 +17709,7 @@ const useUploadRateCard = () => {
17703
17709
  });
17704
17710
  };
17705
17711
 
17706
- var __async$a = (__this, __arguments, generator) => {
17712
+ var __async$b = (__this, __arguments, generator) => {
17707
17713
  return new Promise((resolve, reject) => {
17708
17714
  var fulfilled = (value) => {
17709
17715
  try {
@@ -17726,7 +17732,7 @@ var __async$a = (__this, __arguments, generator) => {
17726
17732
  const useDeleteRateCard = () => {
17727
17733
  const { client } = useShipEngine();
17728
17734
  return useMutation({
17729
- mutationFn: (rateCardId) => __async$a(void 0, null, function* () {
17735
+ mutationFn: (rateCardId) => __async$b(void 0, null, function* () {
17730
17736
  const result = yield client.rateCards.delete(rateCardId);
17731
17737
  return result.data;
17732
17738
  }),
@@ -17735,7 +17741,7 @@ const useDeleteRateCard = () => {
17735
17741
  });
17736
17742
  };
17737
17743
 
17738
- var __async$9 = (__this, __arguments, generator) => {
17744
+ var __async$a = (__this, __arguments, generator) => {
17739
17745
  return new Promise((resolve, reject) => {
17740
17746
  var fulfilled = (value) => {
17741
17747
  try {
@@ -17758,7 +17764,7 @@ var __async$9 = (__this, __arguments, generator) => {
17758
17764
  const useCalculateRates = () => {
17759
17765
  const { client } = useShipEngine();
17760
17766
  return useMutation({
17761
- mutationFn: (_0) => __async$9(void 0, [_0], function* ({ rateOptions, shipmentId }) {
17767
+ mutationFn: (_0) => __async$a(void 0, [_0], function* ({ rateOptions, shipmentId }) {
17762
17768
  const result = yield client.rates.calculateByShipmentId(shipmentId, rateOptions);
17763
17769
  return result.data;
17764
17770
  }),
@@ -17808,7 +17814,7 @@ var __objRest$5 = (source, exclude) => {
17808
17814
  }
17809
17815
  return target;
17810
17816
  };
17811
- var __async$8 = (__this, __arguments, generator) => {
17817
+ var __async$9 = (__this, __arguments, generator) => {
17812
17818
  return new Promise((resolve, reject) => {
17813
17819
  var fulfilled = (value) => {
17814
17820
  try {
@@ -17831,7 +17837,7 @@ var __async$8 = (__this, __arguments, generator) => {
17831
17837
  const useNotifySalesOrderShipped = () => {
17832
17838
  const { client } = useShipEngine();
17833
17839
  return useMutation({
17834
- mutationFn: (_a) => __async$8(void 0, null, function* () {
17840
+ mutationFn: (_a) => __async$9(void 0, null, function* () {
17835
17841
  var _b = _a, { salesOrderId } = _b, tracking = __objRest$5(_b, ["salesOrderId"]);
17836
17842
  const result = yield client.salesOrders.notifyShipped(salesOrderId, tracking);
17837
17843
  return result.data;
@@ -17856,7 +17862,7 @@ var __objRest$4 = (source, exclude) => {
17856
17862
  }
17857
17863
  return target;
17858
17864
  };
17859
- var __async$7 = (__this, __arguments, generator) => {
17865
+ var __async$8 = (__this, __arguments, generator) => {
17860
17866
  return new Promise((resolve, reject) => {
17861
17867
  var fulfilled = (value) => {
17862
17868
  try {
@@ -17879,7 +17885,7 @@ var __async$7 = (__this, __arguments, generator) => {
17879
17885
  const useCreateSalesOrderShipment = () => {
17880
17886
  const { client } = useShipEngine();
17881
17887
  return useMutation({
17882
- mutationFn: (_a) => __async$7(void 0, null, function* () {
17888
+ mutationFn: (_a) => __async$8(void 0, null, function* () {
17883
17889
  var _b = _a, { salesOrderId } = _b, shipment = __objRest$4(_b, ["salesOrderId"]);
17884
17890
  const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
17885
17891
  return result.data;
@@ -17930,7 +17936,7 @@ var __objRest$3 = (source, exclude) => {
17930
17936
  }
17931
17937
  return target;
17932
17938
  };
17933
- var __async$6 = (__this, __arguments, generator) => {
17939
+ var __async$7 = (__this, __arguments, generator) => {
17934
17940
  return new Promise((resolve, reject) => {
17935
17941
  var fulfilled = (value) => {
17936
17942
  try {
@@ -17953,7 +17959,7 @@ var __async$6 = (__this, __arguments, generator) => {
17953
17959
  const useUpdateSalesOrderShipment = () => {
17954
17960
  const { client } = useShipEngine();
17955
17961
  return useMutation({
17956
- mutationFn: (_a) => __async$6(void 0, null, function* () {
17962
+ mutationFn: (_a) => __async$7(void 0, null, function* () {
17957
17963
  var _b = _a, { shipmentId } = _b, shipment = __objRest$3(_b, ["shipmentId"]);
17958
17964
  const result = yield client.salesOrderShipments.update(shipmentId, shipment);
17959
17965
  return result.data;
@@ -17982,7 +17988,7 @@ var __spreadValues$2 = (a, b) => {
17982
17988
  return a;
17983
17989
  };
17984
17990
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
17985
- var __async$5 = (__this, __arguments, generator) => {
17991
+ var __async$6 = (__this, __arguments, generator) => {
17986
17992
  return new Promise((resolve, reject) => {
17987
17993
  var fulfilled = (value) => {
17988
17994
  try {
@@ -18005,7 +18011,7 @@ var __async$5 = (__this, __arguments, generator) => {
18005
18011
  const useCreateShipment = () => {
18006
18012
  const { client } = useShipEngine();
18007
18013
  return useMutation({
18008
- mutationFn: (shipment) => __async$5(void 0, null, function* () {
18014
+ mutationFn: (shipment) => __async$6(void 0, null, function* () {
18009
18015
  var _a;
18010
18016
  if (shipment.warehouseId === void 0) {
18011
18017
  throw new CodedError("errorMessages.noWarehouses", {
@@ -18103,7 +18109,7 @@ const useListShippingRules = () => {
18103
18109
  });
18104
18110
  };
18105
18111
 
18106
- var __async$4 = (__this, __arguments, generator) => {
18112
+ var __async$5 = (__this, __arguments, generator) => {
18107
18113
  return new Promise((resolve, reject) => {
18108
18114
  var fulfilled = (value) => {
18109
18115
  try {
@@ -18126,7 +18132,7 @@ var __async$4 = (__this, __arguments, generator) => {
18126
18132
  const useCreateShippingRule = () => {
18127
18133
  const { client } = useShipEngine();
18128
18134
  return useMutation({
18129
- mutationFn: (shippingRule) => __async$4(void 0, null, function* () {
18135
+ mutationFn: (shippingRule) => __async$5(void 0, null, function* () {
18130
18136
  const result = yield client.shippingRules.create(shippingRule);
18131
18137
  return result.data;
18132
18138
  }),
@@ -18135,6 +18141,38 @@ const useCreateShippingRule = () => {
18135
18141
  });
18136
18142
  };
18137
18143
 
18144
+ var __async$4 = (__this, __arguments, generator) => {
18145
+ return new Promise((resolve, reject) => {
18146
+ var fulfilled = (value) => {
18147
+ try {
18148
+ step(generator.next(value));
18149
+ } catch (e) {
18150
+ reject(e);
18151
+ }
18152
+ };
18153
+ var rejected = (value) => {
18154
+ try {
18155
+ step(generator.throw(value));
18156
+ } catch (e) {
18157
+ reject(e);
18158
+ }
18159
+ };
18160
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18161
+ step((generator = generator.apply(__this, __arguments)).next());
18162
+ });
18163
+ };
18164
+ const useDeleteShippingRule = () => {
18165
+ const { client } = useShipEngine();
18166
+ return useMutation({
18167
+ mutationFn: (shippingRuleId) => __async$4(void 0, null, function* () {
18168
+ const result = yield client.shippingRules.delete(shippingRuleId);
18169
+ return result.data;
18170
+ }),
18171
+ mutationKey: ["useDeleteShippingRule"],
18172
+ onError
18173
+ });
18174
+ };
18175
+
18138
18176
  var __async$3 = (__this, __arguments, generator) => {
18139
18177
  return new Promise((resolve, reject) => {
18140
18178
  var fulfilled = (value) => {
@@ -19384,4 +19422,4 @@ const alchemy = {
19384
19422
  createElement
19385
19423
  };
19386
19424
 
19387
- export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngine, ShipEngineAPI, ShipEngineContext, ShipmentsAPI, ShippingRulesAPI, WarehousesAPI, alchemy, alchemy as default, delay, getEmotionCache, getEndUserIpAddress, isCodedError, isCodedErrors, logger, onError, retryUntil, useAddFunds, useAlchemy, useCalculateRates, useConnectCarrier, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useDeleteRateCard, useDeleteWarehouse, useDownloadRateCard, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetWalletHistory, useGetZonesByCarrier, useI18n, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListShippingRules, useListWarehouses, useLoadIcons, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUploadRateCard, useValidateAddresses, useVoidLabel };
19425
+ export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngine, ShipEngineAPI, ShipEngineContext, ShipmentsAPI, ShippingRulesAPI, WarehousesAPI, alchemy, alchemy as default, delay, getEmotionCache, getEndUserIpAddress, isCodedError, isCodedErrors, logger, onError, retryUntil, useAddFunds, useAlchemy, useCalculateRates, useConnectCarrier, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useDeleteRateCard, useDeleteShippingRule, useDeleteWarehouse, useDownloadRateCard, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetWalletHistory, useGetZonesByCarrier, useI18n, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListShippingRules, useListWarehouses, useLoadIcons, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUploadRateCard, useValidateAddresses, useVoidLabel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/alchemy",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {