@shipengine/alchemy 4.1.4 → 4.1.5

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 +100 -61
  2. package/index.mjs +100 -62
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -5247,7 +5247,7 @@ var ipaddr = {
5247
5247
  }).call(commonjsGlobal);
5248
5248
  } (ipaddr));
5249
5249
 
5250
- var __async$v = (__this, __arguments, generator) => {
5250
+ var __async$w = (__this, __arguments, generator) => {
5251
5251
  return new Promise((resolve, reject) => {
5252
5252
  var fulfilled = (value) => {
5253
5253
  try {
@@ -5267,7 +5267,7 @@ var __async$v = (__this, __arguments, generator) => {
5267
5267
  step((generator = generator.apply(__this, __arguments)).next());
5268
5268
  });
5269
5269
  };
5270
- const getEndUserIpAddress = () => __async$v(void 0, null, function* () {
5270
+ const getEndUserIpAddress = () => __async$w(void 0, null, function* () {
5271
5271
  try {
5272
5272
  const response = yield axios.get("https://api.ipify.org/?format=json");
5273
5273
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -5310,7 +5310,7 @@ var __objRest$7 = (source, exclude) => {
5310
5310
  }
5311
5311
  return target;
5312
5312
  };
5313
- var __async$u = (__this, __arguments, generator) => {
5313
+ var __async$v = (__this, __arguments, generator) => {
5314
5314
  return new Promise((resolve, reject) => {
5315
5315
  var fulfilled = (value) => {
5316
5316
  try {
@@ -5348,7 +5348,7 @@ class CarriersAPI {
5348
5348
  /**
5349
5349
  * The `connect` method connects a carrier account to a user's ShipEngine account.
5350
5350
  */
5351
- this.connect = (_a) => __async$u(this, null, function* () {
5351
+ this.connect = (_a) => __async$v(this, null, function* () {
5352
5352
  var _b = _a, { carrierCode } = _b, connection = __objRest$7(_b, ["carrierCode"]);
5353
5353
  const endUserIpAddress = yield getEndUserIpAddress();
5354
5354
  if (!endUserIpAddress)
@@ -7664,7 +7664,7 @@ var __spreadValues$5 = (a, b) => {
7664
7664
  }
7665
7665
  return a;
7666
7666
  };
7667
- var __async$t = (__this, __arguments, generator) => {
7667
+ var __async$u = (__this, __arguments, generator) => {
7668
7668
  return new Promise((resolve, reject) => {
7669
7669
  var fulfilled = (value) => {
7670
7670
  try {
@@ -7703,7 +7703,7 @@ class FundingSourcesAPI {
7703
7703
  * The `create` method creates a new funding source for a given user. This requires
7704
7704
  * payment information to be collected from the user.
7705
7705
  */
7706
- this.create = (createFundingSource) => __async$t(this, null, function* () {
7706
+ this.create = (createFundingSource) => __async$u(this, null, function* () {
7707
7707
  const endUserIpAddress = yield getEndUserIpAddress();
7708
7708
  if (!endUserIpAddress)
7709
7709
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7716,7 +7716,7 @@ class FundingSourcesAPI {
7716
7716
  * user to update the billing address or payment information associated with the
7717
7717
  * funding source.
7718
7718
  */
7719
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$t(this, null, function* () {
7719
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$u(this, null, function* () {
7720
7720
  const endUserIpAddress = yield getEndUserIpAddress();
7721
7721
  if (!endUserIpAddress)
7722
7722
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7733,7 +7733,7 @@ class FundingSourcesAPI {
7733
7733
  * The `registerCarrier` method registers a carrier account and associates
7734
7734
  * it with a given funding source.
7735
7735
  */
7736
- this.registerCarrier = (carrier) => __async$t(this, null, function* () {
7736
+ this.registerCarrier = (carrier) => __async$u(this, null, function* () {
7737
7737
  const endUserIpAddress = yield getEndUserIpAddress();
7738
7738
  if (!endUserIpAddress)
7739
7739
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7744,7 +7744,7 @@ class FundingSourcesAPI {
7744
7744
  /**
7745
7745
  * The `addFunds` method allows you to add funds to a funding source.
7746
7746
  */
7747
- this.addFunds = (amount, fundingSourceId) => __async$t(this, null, function* () {
7747
+ this.addFunds = (amount, fundingSourceId) => __async$u(this, null, function* () {
7748
7748
  return yield this.client.put(
7749
7749
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
7750
7750
  amount
@@ -7978,7 +7978,7 @@ class SalesOrdersAPI {
7978
7978
  }
7979
7979
  }
7980
7980
 
7981
- var __async$s = (__this, __arguments, generator) => {
7981
+ var __async$t = (__this, __arguments, generator) => {
7982
7982
  return new Promise((resolve, reject) => {
7983
7983
  var fulfilled = (value) => {
7984
7984
  try {
@@ -8021,7 +8021,7 @@ class ShipmentsAPI {
8021
8021
  * The `create` method allows for creating shipments based on a list of shipment
8022
8022
  * items passed into this method.
8023
8023
  */
8024
- this.create = (...shipments) => __async$s(this, null, function* () {
8024
+ this.create = (...shipments) => __async$t(this, null, function* () {
8025
8025
  return this.client.post("/v1/shipments", {
8026
8026
  shipments
8027
8027
  });
@@ -8039,6 +8039,12 @@ class ShippingRulesAPI {
8039
8039
  this.list = () => {
8040
8040
  return this.client.get(`/v1/shipping_rules`);
8041
8041
  };
8042
+ /**
8043
+ * The `create` method creates a new shipping rule for a given user.
8044
+ */
8045
+ this.create = (shippingRule) => {
8046
+ return this.client.post("/v1/shipping_rules", shippingRule);
8047
+ };
8042
8048
  this.client = client;
8043
8049
  }
8044
8050
  }
@@ -8097,7 +8103,7 @@ var __spreadValues$4 = (a, b) => {
8097
8103
  return a;
8098
8104
  };
8099
8105
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
8100
- var __async$r = (__this, __arguments, generator) => {
8106
+ var __async$s = (__this, __arguments, generator) => {
8101
8107
  return new Promise((resolve, reject) => {
8102
8108
  var fulfilled = (value) => {
8103
8109
  try {
@@ -8191,7 +8197,7 @@ class ShipEngineAPI {
8191
8197
  );
8192
8198
  return res;
8193
8199
  },
8194
- (err) => __async$r(this, null, function* () {
8200
+ (err) => __async$s(this, null, function* () {
8195
8201
  var _a, _b, _c, _d, _e, _f, _g;
8196
8202
  logger$1.error(
8197
8203
  { err, req: err.config, res: err.response },
@@ -8496,7 +8502,7 @@ const useGetAccountSettings = () => {
8496
8502
  });
8497
8503
  };
8498
8504
 
8499
- var __async$q = (__this, __arguments, generator) => {
8505
+ var __async$r = (__this, __arguments, generator) => {
8500
8506
  return new Promise((resolve, reject) => {
8501
8507
  var fulfilled = (value) => {
8502
8508
  try {
@@ -8519,7 +8525,7 @@ var __async$q = (__this, __arguments, generator) => {
8519
8525
  const useUpdateAccountSettings = () => {
8520
8526
  const { client } = useShipEngine();
8521
8527
  return reactQuery.useMutation({
8522
- mutationFn: (settings) => __async$q(void 0, null, function* () {
8528
+ mutationFn: (settings) => __async$r(void 0, null, function* () {
8523
8529
  const result = yield client.accountSettings.update(settings);
8524
8530
  return result.data;
8525
8531
  }),
@@ -8528,7 +8534,7 @@ const useUpdateAccountSettings = () => {
8528
8534
  });
8529
8535
  };
8530
8536
 
8531
- var __async$p = (__this, __arguments, generator) => {
8537
+ var __async$q = (__this, __arguments, generator) => {
8532
8538
  return new Promise((resolve, reject) => {
8533
8539
  var fulfilled = (value) => {
8534
8540
  try {
@@ -8551,7 +8557,7 @@ var __async$p = (__this, __arguments, generator) => {
8551
8557
  const useParseAddress = () => {
8552
8558
  const { client } = useShipEngine();
8553
8559
  return reactQuery.useMutation({
8554
- mutationFn: (_0) => __async$p(void 0, [_0], function* ({ address, text }) {
8560
+ mutationFn: (_0) => __async$q(void 0, [_0], function* ({ address, text }) {
8555
8561
  const result = yield client.addresses.parse(text, address);
8556
8562
  return result.data;
8557
8563
  }),
@@ -8560,7 +8566,7 @@ const useParseAddress = () => {
8560
8566
  });
8561
8567
  };
8562
8568
 
8563
- var __async$o = (__this, __arguments, generator) => {
8569
+ var __async$p = (__this, __arguments, generator) => {
8564
8570
  return new Promise((resolve, reject) => {
8565
8571
  var fulfilled = (value) => {
8566
8572
  try {
@@ -8583,7 +8589,7 @@ var __async$o = (__this, __arguments, generator) => {
8583
8589
  const useValidateAddresses = () => {
8584
8590
  const { client } = useShipEngine();
8585
8591
  return reactQuery.useMutation({
8586
- mutationFn: (addresses) => __async$o(void 0, null, function* () {
8592
+ mutationFn: (addresses) => __async$p(void 0, null, function* () {
8587
8593
  const result = yield client.addresses.validate(addresses);
8588
8594
  return result.data;
8589
8595
  }),
@@ -8592,7 +8598,7 @@ const useValidateAddresses = () => {
8592
8598
  });
8593
8599
  };
8594
8600
 
8595
- var __async$n = (__this, __arguments, generator) => {
8601
+ var __async$o = (__this, __arguments, generator) => {
8596
8602
  return new Promise((resolve, reject) => {
8597
8603
  var fulfilled = (value) => {
8598
8604
  try {
@@ -8615,7 +8621,7 @@ var __async$n = (__this, __arguments, generator) => {
8615
8621
  const useAddFunds = (carrierId) => {
8616
8622
  const { client } = useShipEngine();
8617
8623
  return reactQuery.useMutation({
8618
- mutationFn: (funds) => __async$n(void 0, null, function* () {
8624
+ mutationFn: (funds) => __async$o(void 0, null, function* () {
8619
8625
  const result = yield client.carriers.addFunds(carrierId, funds);
8620
8626
  return result.data;
8621
8627
  }),
@@ -8624,7 +8630,7 @@ const useAddFunds = (carrierId) => {
8624
8630
  });
8625
8631
  };
8626
8632
 
8627
- var __async$m = (__this, __arguments, generator) => {
8633
+ var __async$n = (__this, __arguments, generator) => {
8628
8634
  return new Promise((resolve, reject) => {
8629
8635
  var fulfilled = (value) => {
8630
8636
  try {
@@ -8647,7 +8653,7 @@ var __async$m = (__this, __arguments, generator) => {
8647
8653
  const useConnectCarrier = () => {
8648
8654
  const { client } = useShipEngine();
8649
8655
  return reactQuery.useMutation({
8650
- mutationFn: (params) => __async$m(void 0, null, function* () {
8656
+ mutationFn: (params) => __async$n(void 0, null, function* () {
8651
8657
  const result = yield client.carriers.connect(params);
8652
8658
  return result.data;
8653
8659
  }),
@@ -8784,7 +8790,7 @@ const useListCarriers = () => {
8784
8790
  });
8785
8791
  };
8786
8792
 
8787
- var __async$l = (__this, __arguments, generator) => {
8793
+ var __async$m = (__this, __arguments, generator) => {
8788
8794
  return new Promise((resolve, reject) => {
8789
8795
  var fulfilled = (value) => {
8790
8796
  try {
@@ -8808,7 +8814,7 @@ const useUpdateAutoFunding = (carrierId) => {
8808
8814
  const { client } = useShipEngine();
8809
8815
  const queryClient = reactQuery.useQueryClient();
8810
8816
  return reactQuery.useMutation({
8811
- mutationFn: (options) => __async$l(void 0, null, function* () {
8817
+ mutationFn: (options) => __async$m(void 0, null, function* () {
8812
8818
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
8813
8819
  return result.data;
8814
8820
  }),
@@ -8847,7 +8853,7 @@ const useListCustomPackageTypes = () => {
8847
8853
  });
8848
8854
  };
8849
8855
 
8850
- var __async$k = (__this, __arguments, generator) => {
8856
+ var __async$l = (__this, __arguments, generator) => {
8851
8857
  return new Promise((resolve, reject) => {
8852
8858
  var fulfilled = (value) => {
8853
8859
  try {
@@ -8870,7 +8876,7 @@ var __async$k = (__this, __arguments, generator) => {
8870
8876
  const useCreateFundingSource = () => {
8871
8877
  const { client } = useShipEngine();
8872
8878
  return reactQuery.useMutation({
8873
- mutationFn: (fundingSource) => __async$k(void 0, null, function* () {
8879
+ mutationFn: (fundingSource) => __async$l(void 0, null, function* () {
8874
8880
  const result = yield client.fundingSources.create(fundingSource);
8875
8881
  return result.data;
8876
8882
  }),
@@ -8879,7 +8885,7 @@ const useCreateFundingSource = () => {
8879
8885
  });
8880
8886
  };
8881
8887
 
8882
- var __async$j = (__this, __arguments, generator) => {
8888
+ var __async$k = (__this, __arguments, generator) => {
8883
8889
  return new Promise((resolve, reject) => {
8884
8890
  var fulfilled = (value) => {
8885
8891
  try {
@@ -8902,7 +8908,7 @@ var __async$j = (__this, __arguments, generator) => {
8902
8908
  const useFundingSourcesAddFunds = (fundingSourceId) => {
8903
8909
  const { client } = useShipEngine();
8904
8910
  return reactQuery.useMutation({
8905
- mutationFn: (funds) => __async$j(void 0, null, function* () {
8911
+ mutationFn: (funds) => __async$k(void 0, null, function* () {
8906
8912
  const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
8907
8913
  return result.data;
8908
8914
  }),
@@ -8931,7 +8937,7 @@ const useListFundingSources = () => {
8931
8937
  });
8932
8938
  };
8933
8939
 
8934
- var __async$i = (__this, __arguments, generator) => {
8940
+ var __async$j = (__this, __arguments, generator) => {
8935
8941
  return new Promise((resolve, reject) => {
8936
8942
  var fulfilled = (value) => {
8937
8943
  try {
@@ -8954,7 +8960,7 @@ var __async$i = (__this, __arguments, generator) => {
8954
8960
  const useRegisterCarrier = () => {
8955
8961
  const { client } = useShipEngine();
8956
8962
  return reactQuery.useMutation({
8957
- mutationFn: (carrier) => __async$i(void 0, null, function* () {
8963
+ mutationFn: (carrier) => __async$j(void 0, null, function* () {
8958
8964
  const result = yield client.fundingSources.registerCarrier(carrier);
8959
8965
  return result.data;
8960
8966
  }),
@@ -8963,7 +8969,7 @@ const useRegisterCarrier = () => {
8963
8969
  });
8964
8970
  };
8965
8971
 
8966
- var __async$h = (__this, __arguments, generator) => {
8972
+ var __async$i = (__this, __arguments, generator) => {
8967
8973
  return new Promise((resolve, reject) => {
8968
8974
  var fulfilled = (value) => {
8969
8975
  try {
@@ -8986,7 +8992,7 @@ var __async$h = (__this, __arguments, generator) => {
8986
8992
  const useUpdateFundingSource = () => {
8987
8993
  const { client } = useShipEngine();
8988
8994
  return reactQuery.useMutation({
8989
- mutationFn: (_0) => __async$h(void 0, [_0], function* ({
8995
+ mutationFn: (_0) => __async$i(void 0, [_0], function* ({
8990
8996
  billingInfo,
8991
8997
  creditCardInfo,
8992
8998
  fundingSourceId
@@ -9033,7 +9039,7 @@ var __objRest$6 = (source, exclude) => {
9033
9039
  }
9034
9040
  return target;
9035
9041
  };
9036
- var __async$g = (__this, __arguments, generator) => {
9042
+ var __async$h = (__this, __arguments, generator) => {
9037
9043
  return new Promise((resolve, reject) => {
9038
9044
  var fulfilled = (value) => {
9039
9045
  try {
@@ -9056,7 +9062,7 @@ var __async$g = (__this, __arguments, generator) => {
9056
9062
  const useCreateLabel = () => {
9057
9063
  const { client } = useShipEngine();
9058
9064
  return reactQuery.useMutation({
9059
- mutationFn: (_a) => __async$g(void 0, null, function* () {
9065
+ mutationFn: (_a) => __async$h(void 0, null, function* () {
9060
9066
  var _b = _a, { rateId } = _b, options = __objRest$6(_b, ["rateId"]);
9061
9067
  const result = yield client.labels.createByRateId(rateId, options);
9062
9068
  return result.data;
@@ -9092,7 +9098,7 @@ const useListLabels = (params) => {
9092
9098
  });
9093
9099
  };
9094
9100
 
9095
- var __async$f = (__this, __arguments, generator) => {
9101
+ var __async$g = (__this, __arguments, generator) => {
9096
9102
  return new Promise((resolve, reject) => {
9097
9103
  var fulfilled = (value) => {
9098
9104
  try {
@@ -9115,7 +9121,7 @@ var __async$f = (__this, __arguments, generator) => {
9115
9121
  const useVoidLabel = () => {
9116
9122
  const { client } = useShipEngine();
9117
9123
  return reactQuery.useMutation({
9118
- mutationFn: (labelId) => __async$f(void 0, null, function* () {
9124
+ mutationFn: (labelId) => __async$g(void 0, null, function* () {
9119
9125
  const result = yield client.labels.void(labelId);
9120
9126
  return result.data;
9121
9127
  }),
@@ -9134,7 +9140,7 @@ const useListOrderSources = () => {
9134
9140
  });
9135
9141
  };
9136
9142
 
9137
- var __async$e = (__this, __arguments, generator) => {
9143
+ var __async$f = (__this, __arguments, generator) => {
9138
9144
  return new Promise((resolve, reject) => {
9139
9145
  var fulfilled = (value) => {
9140
9146
  try {
@@ -9157,7 +9163,7 @@ var __async$e = (__this, __arguments, generator) => {
9157
9163
  const useRefreshOrderSourceAsync = () => {
9158
9164
  const { client } = useShipEngine();
9159
9165
  return reactQuery.useMutation({
9160
- mutationFn: (orderSourceId) => __async$e(void 0, null, function* () {
9166
+ mutationFn: (orderSourceId) => __async$f(void 0, null, function* () {
9161
9167
  const result = yield client.orderSources.refresh(orderSourceId);
9162
9168
  return result.data;
9163
9169
  }),
@@ -9168,9 +9174,9 @@ const useRefreshOrderSource = () => {
9168
9174
  const { client } = useShipEngine();
9169
9175
  const { mutateAsync: refreshOrderSourceAsync } = useRefreshOrderSourceAsync();
9170
9176
  return reactQuery.useMutation({
9171
- mutationFn: (orderSourceId) => __async$e(void 0, null, function* () {
9177
+ mutationFn: (orderSourceId) => __async$f(void 0, null, function* () {
9172
9178
  yield refreshOrderSourceAsync(orderSourceId);
9173
- const waitResult = yield retryUntil(() => __async$e(void 0, null, function* () {
9179
+ const waitResult = yield retryUntil(() => __async$f(void 0, null, function* () {
9174
9180
  const { data: checkResult } = yield client.orderSources.get(orderSourceId);
9175
9181
  if (["preparing_update", "updating"].includes(checkResult.refreshInfo.status)) {
9176
9182
  throw new CodedError("Order source is still refreshing");
@@ -9184,7 +9190,7 @@ const useRefreshOrderSource = () => {
9184
9190
  });
9185
9191
  };
9186
9192
 
9187
- var __async$d = (__this, __arguments, generator) => {
9193
+ var __async$e = (__this, __arguments, generator) => {
9188
9194
  return new Promise((resolve, reject) => {
9189
9195
  var fulfilled = (value) => {
9190
9196
  try {
@@ -9207,7 +9213,7 @@ var __async$d = (__this, __arguments, generator) => {
9207
9213
  const useCreateRateCard = () => {
9208
9214
  const { client } = useShipEngine();
9209
9215
  return reactQuery.useMutation({
9210
- mutationFn: (rateCard) => __async$d(void 0, null, function* () {
9216
+ mutationFn: (rateCard) => __async$e(void 0, null, function* () {
9211
9217
  const result = yield client.rateCards.create(rateCard);
9212
9218
  return result.data;
9213
9219
  }),
@@ -9254,7 +9260,7 @@ const useListRateCards = (carrierIds) => {
9254
9260
  });
9255
9261
  };
9256
9262
 
9257
- var __async$c = (__this, __arguments, generator) => {
9263
+ var __async$d = (__this, __arguments, generator) => {
9258
9264
  return new Promise((resolve, reject) => {
9259
9265
  var fulfilled = (value) => {
9260
9266
  try {
@@ -9277,7 +9283,7 @@ var __async$c = (__this, __arguments, generator) => {
9277
9283
  const usePublishRateCard = () => {
9278
9284
  const { client } = useShipEngine();
9279
9285
  return reactQuery.useMutation({
9280
- mutationFn: (rateCardId) => __async$c(void 0, null, function* () {
9286
+ mutationFn: (rateCardId) => __async$d(void 0, null, function* () {
9281
9287
  return yield client.rateCards.publish(rateCardId);
9282
9288
  }),
9283
9289
  mutationKey: ["usePublishRateCard"],
@@ -9285,7 +9291,7 @@ const usePublishRateCard = () => {
9285
9291
  });
9286
9292
  };
9287
9293
 
9288
- var __async$b = (__this, __arguments, generator) => {
9294
+ var __async$c = (__this, __arguments, generator) => {
9289
9295
  return new Promise((resolve, reject) => {
9290
9296
  var fulfilled = (value) => {
9291
9297
  try {
@@ -9308,7 +9314,7 @@ var __async$b = (__this, __arguments, generator) => {
9308
9314
  const useUpdateRateCard = () => {
9309
9315
  const { client } = useShipEngine();
9310
9316
  return reactQuery.useMutation({
9311
- mutationFn: (rateCard) => __async$b(void 0, null, function* () {
9317
+ mutationFn: (rateCard) => __async$c(void 0, null, function* () {
9312
9318
  const result = yield client.rateCards.update(rateCard);
9313
9319
  return result.data;
9314
9320
  }),
@@ -9317,7 +9323,7 @@ const useUpdateRateCard = () => {
9317
9323
  });
9318
9324
  };
9319
9325
 
9320
- var __async$a = (__this, __arguments, generator) => {
9326
+ var __async$b = (__this, __arguments, generator) => {
9321
9327
  return new Promise((resolve, reject) => {
9322
9328
  var fulfilled = (value) => {
9323
9329
  try {
@@ -9340,7 +9346,7 @@ var __async$a = (__this, __arguments, generator) => {
9340
9346
  const useUploadRateCard = () => {
9341
9347
  const { client } = useShipEngine();
9342
9348
  return reactQuery.useMutation({
9343
- mutationFn: (_0) => __async$a(void 0, [_0], function* ({ rateCardId, file }) {
9349
+ mutationFn: (_0) => __async$b(void 0, [_0], function* ({ rateCardId, file }) {
9344
9350
  const result = yield client.rateCards.upload(rateCardId, file);
9345
9351
  return result.data;
9346
9352
  }),
@@ -9349,7 +9355,7 @@ const useUploadRateCard = () => {
9349
9355
  });
9350
9356
  };
9351
9357
 
9352
- var __async$9 = (__this, __arguments, generator) => {
9358
+ var __async$a = (__this, __arguments, generator) => {
9353
9359
  return new Promise((resolve, reject) => {
9354
9360
  var fulfilled = (value) => {
9355
9361
  try {
@@ -9372,7 +9378,7 @@ var __async$9 = (__this, __arguments, generator) => {
9372
9378
  const useDeleteRateCard = () => {
9373
9379
  const { client } = useShipEngine();
9374
9380
  return reactQuery.useMutation({
9375
- mutationFn: (rateCardId) => __async$9(void 0, null, function* () {
9381
+ mutationFn: (rateCardId) => __async$a(void 0, null, function* () {
9376
9382
  const result = yield client.rateCards.delete(rateCardId);
9377
9383
  return result.data;
9378
9384
  }),
@@ -9381,7 +9387,7 @@ const useDeleteRateCard = () => {
9381
9387
  });
9382
9388
  };
9383
9389
 
9384
- var __async$8 = (__this, __arguments, generator) => {
9390
+ var __async$9 = (__this, __arguments, generator) => {
9385
9391
  return new Promise((resolve, reject) => {
9386
9392
  var fulfilled = (value) => {
9387
9393
  try {
@@ -9404,7 +9410,7 @@ var __async$8 = (__this, __arguments, generator) => {
9404
9410
  const useCalculateRates = () => {
9405
9411
  const { client } = useShipEngine();
9406
9412
  return reactQuery.useMutation({
9407
- mutationFn: (_0) => __async$8(void 0, [_0], function* ({ rateOptions, shipmentId }) {
9413
+ mutationFn: (_0) => __async$9(void 0, [_0], function* ({ rateOptions, shipmentId }) {
9408
9414
  const result = yield client.rates.calculateByShipmentId(shipmentId, rateOptions);
9409
9415
  return result.data;
9410
9416
  }),
@@ -9454,7 +9460,7 @@ var __objRest$5 = (source, exclude) => {
9454
9460
  }
9455
9461
  return target;
9456
9462
  };
9457
- var __async$7 = (__this, __arguments, generator) => {
9463
+ var __async$8 = (__this, __arguments, generator) => {
9458
9464
  return new Promise((resolve, reject) => {
9459
9465
  var fulfilled = (value) => {
9460
9466
  try {
@@ -9477,7 +9483,7 @@ var __async$7 = (__this, __arguments, generator) => {
9477
9483
  const useNotifySalesOrderShipped = () => {
9478
9484
  const { client } = useShipEngine();
9479
9485
  return reactQuery.useMutation({
9480
- mutationFn: (_a) => __async$7(void 0, null, function* () {
9486
+ mutationFn: (_a) => __async$8(void 0, null, function* () {
9481
9487
  var _b = _a, { salesOrderId } = _b, tracking = __objRest$5(_b, ["salesOrderId"]);
9482
9488
  const result = yield client.salesOrders.notifyShipped(salesOrderId, tracking);
9483
9489
  return result.data;
@@ -9502,7 +9508,7 @@ var __objRest$4 = (source, exclude) => {
9502
9508
  }
9503
9509
  return target;
9504
9510
  };
9505
- var __async$6 = (__this, __arguments, generator) => {
9511
+ var __async$7 = (__this, __arguments, generator) => {
9506
9512
  return new Promise((resolve, reject) => {
9507
9513
  var fulfilled = (value) => {
9508
9514
  try {
@@ -9525,7 +9531,7 @@ var __async$6 = (__this, __arguments, generator) => {
9525
9531
  const useCreateSalesOrderShipment = () => {
9526
9532
  const { client } = useShipEngine();
9527
9533
  return reactQuery.useMutation({
9528
- mutationFn: (_a) => __async$6(void 0, null, function* () {
9534
+ mutationFn: (_a) => __async$7(void 0, null, function* () {
9529
9535
  var _b = _a, { salesOrderId } = _b, shipment = __objRest$4(_b, ["salesOrderId"]);
9530
9536
  const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
9531
9537
  return result.data;
@@ -9576,7 +9582,7 @@ var __objRest$3 = (source, exclude) => {
9576
9582
  }
9577
9583
  return target;
9578
9584
  };
9579
- var __async$5 = (__this, __arguments, generator) => {
9585
+ var __async$6 = (__this, __arguments, generator) => {
9580
9586
  return new Promise((resolve, reject) => {
9581
9587
  var fulfilled = (value) => {
9582
9588
  try {
@@ -9599,7 +9605,7 @@ var __async$5 = (__this, __arguments, generator) => {
9599
9605
  const useUpdateSalesOrderShipment = () => {
9600
9606
  const { client } = useShipEngine();
9601
9607
  return reactQuery.useMutation({
9602
- mutationFn: (_a) => __async$5(void 0, null, function* () {
9608
+ mutationFn: (_a) => __async$6(void 0, null, function* () {
9603
9609
  var _b = _a, { shipmentId } = _b, shipment = __objRest$3(_b, ["shipmentId"]);
9604
9610
  const result = yield client.salesOrderShipments.update(shipmentId, shipment);
9605
9611
  return result.data;
@@ -9628,7 +9634,7 @@ var __spreadValues$2 = (a, b) => {
9628
9634
  return a;
9629
9635
  };
9630
9636
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9631
- var __async$4 = (__this, __arguments, generator) => {
9637
+ var __async$5 = (__this, __arguments, generator) => {
9632
9638
  return new Promise((resolve, reject) => {
9633
9639
  var fulfilled = (value) => {
9634
9640
  try {
@@ -9651,7 +9657,7 @@ var __async$4 = (__this, __arguments, generator) => {
9651
9657
  const useCreateShipment = () => {
9652
9658
  const { client } = useShipEngine();
9653
9659
  return reactQuery.useMutation({
9654
- mutationFn: (shipment) => __async$4(void 0, null, function* () {
9660
+ mutationFn: (shipment) => __async$5(void 0, null, function* () {
9655
9661
  var _a;
9656
9662
  if (shipment.warehouseId === void 0) {
9657
9663
  throw new CodedError("errorMessages.noWarehouses", {
@@ -9749,6 +9755,38 @@ const useListShippingRules = () => {
9749
9755
  });
9750
9756
  };
9751
9757
 
9758
+ var __async$4 = (__this, __arguments, generator) => {
9759
+ return new Promise((resolve, reject) => {
9760
+ var fulfilled = (value) => {
9761
+ try {
9762
+ step(generator.next(value));
9763
+ } catch (e) {
9764
+ reject(e);
9765
+ }
9766
+ };
9767
+ var rejected = (value) => {
9768
+ try {
9769
+ step(generator.throw(value));
9770
+ } catch (e) {
9771
+ reject(e);
9772
+ }
9773
+ };
9774
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
9775
+ step((generator = generator.apply(__this, __arguments)).next());
9776
+ });
9777
+ };
9778
+ const useCreateShippingRule = () => {
9779
+ const { client } = useShipEngine();
9780
+ return reactQuery.useMutation({
9781
+ mutationFn: (shippingRule) => __async$4(void 0, null, function* () {
9782
+ const result = yield client.shippingRules.create(shippingRule);
9783
+ return result.data;
9784
+ }),
9785
+ mutationKey: ["useCreateShippingRule"],
9786
+ onError
9787
+ });
9788
+ };
9789
+
9752
9790
  var __async$3 = (__this, __arguments, generator) => {
9753
9791
  return new Promise((resolve, reject) => {
9754
9792
  var fulfilled = (value) => {
@@ -11049,6 +11087,7 @@ exports.useCreateLabel = useCreateLabel;
11049
11087
  exports.useCreateRateCard = useCreateRateCard;
11050
11088
  exports.useCreateSalesOrderShipment = useCreateSalesOrderShipment;
11051
11089
  exports.useCreateShipment = useCreateShipment;
11090
+ exports.useCreateShippingRule = useCreateShippingRule;
11052
11091
  exports.useCreateWarehouse = useCreateWarehouse;
11053
11092
  exports.useDeleteRateCard = useDeleteRateCard;
11054
11093
  exports.useDeleteWarehouse = useDeleteWarehouse;
package/index.mjs CHANGED
@@ -5225,7 +5225,7 @@ var ipaddr = {
5225
5225
  }).call(commonjsGlobal);
5226
5226
  } (ipaddr));
5227
5227
 
5228
- var __async$v = (__this, __arguments, generator) => {
5228
+ var __async$w = (__this, __arguments, generator) => {
5229
5229
  return new Promise((resolve, reject) => {
5230
5230
  var fulfilled = (value) => {
5231
5231
  try {
@@ -5245,7 +5245,7 @@ var __async$v = (__this, __arguments, generator) => {
5245
5245
  step((generator = generator.apply(__this, __arguments)).next());
5246
5246
  });
5247
5247
  };
5248
- const getEndUserIpAddress = () => __async$v(void 0, null, function* () {
5248
+ const getEndUserIpAddress = () => __async$w(void 0, null, function* () {
5249
5249
  try {
5250
5250
  const response = yield axios.get("https://api.ipify.org/?format=json");
5251
5251
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -5288,7 +5288,7 @@ var __objRest$7 = (source, exclude) => {
5288
5288
  }
5289
5289
  return target;
5290
5290
  };
5291
- var __async$u = (__this, __arguments, generator) => {
5291
+ var __async$v = (__this, __arguments, generator) => {
5292
5292
  return new Promise((resolve, reject) => {
5293
5293
  var fulfilled = (value) => {
5294
5294
  try {
@@ -5326,7 +5326,7 @@ class CarriersAPI {
5326
5326
  /**
5327
5327
  * The `connect` method connects a carrier account to a user's ShipEngine account.
5328
5328
  */
5329
- this.connect = (_a) => __async$u(this, null, function* () {
5329
+ this.connect = (_a) => __async$v(this, null, function* () {
5330
5330
  var _b = _a, { carrierCode } = _b, connection = __objRest$7(_b, ["carrierCode"]);
5331
5331
  const endUserIpAddress = yield getEndUserIpAddress();
5332
5332
  if (!endUserIpAddress)
@@ -7642,7 +7642,7 @@ var __spreadValues$5 = (a, b) => {
7642
7642
  }
7643
7643
  return a;
7644
7644
  };
7645
- var __async$t = (__this, __arguments, generator) => {
7645
+ var __async$u = (__this, __arguments, generator) => {
7646
7646
  return new Promise((resolve, reject) => {
7647
7647
  var fulfilled = (value) => {
7648
7648
  try {
@@ -7681,7 +7681,7 @@ class FundingSourcesAPI {
7681
7681
  * The `create` method creates a new funding source for a given user. This requires
7682
7682
  * payment information to be collected from the user.
7683
7683
  */
7684
- this.create = (createFundingSource) => __async$t(this, null, function* () {
7684
+ this.create = (createFundingSource) => __async$u(this, null, function* () {
7685
7685
  const endUserIpAddress = yield getEndUserIpAddress();
7686
7686
  if (!endUserIpAddress)
7687
7687
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7694,7 +7694,7 @@ class FundingSourcesAPI {
7694
7694
  * user to update the billing address or payment information associated with the
7695
7695
  * funding source.
7696
7696
  */
7697
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$t(this, null, function* () {
7697
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$u(this, null, function* () {
7698
7698
  const endUserIpAddress = yield getEndUserIpAddress();
7699
7699
  if (!endUserIpAddress)
7700
7700
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7711,7 +7711,7 @@ class FundingSourcesAPI {
7711
7711
  * The `registerCarrier` method registers a carrier account and associates
7712
7712
  * it with a given funding source.
7713
7713
  */
7714
- this.registerCarrier = (carrier) => __async$t(this, null, function* () {
7714
+ this.registerCarrier = (carrier) => __async$u(this, null, function* () {
7715
7715
  const endUserIpAddress = yield getEndUserIpAddress();
7716
7716
  if (!endUserIpAddress)
7717
7717
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -7722,7 +7722,7 @@ class FundingSourcesAPI {
7722
7722
  /**
7723
7723
  * The `addFunds` method allows you to add funds to a funding source.
7724
7724
  */
7725
- this.addFunds = (amount, fundingSourceId) => __async$t(this, null, function* () {
7725
+ this.addFunds = (amount, fundingSourceId) => __async$u(this, null, function* () {
7726
7726
  return yield this.client.put(
7727
7727
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
7728
7728
  amount
@@ -7956,7 +7956,7 @@ class SalesOrdersAPI {
7956
7956
  }
7957
7957
  }
7958
7958
 
7959
- var __async$s = (__this, __arguments, generator) => {
7959
+ var __async$t = (__this, __arguments, generator) => {
7960
7960
  return new Promise((resolve, reject) => {
7961
7961
  var fulfilled = (value) => {
7962
7962
  try {
@@ -7999,7 +7999,7 @@ class ShipmentsAPI {
7999
7999
  * The `create` method allows for creating shipments based on a list of shipment
8000
8000
  * items passed into this method.
8001
8001
  */
8002
- this.create = (...shipments) => __async$s(this, null, function* () {
8002
+ this.create = (...shipments) => __async$t(this, null, function* () {
8003
8003
  return this.client.post("/v1/shipments", {
8004
8004
  shipments
8005
8005
  });
@@ -8017,6 +8017,12 @@ class ShippingRulesAPI {
8017
8017
  this.list = () => {
8018
8018
  return this.client.get(`/v1/shipping_rules`);
8019
8019
  };
8020
+ /**
8021
+ * The `create` method creates a new shipping rule for a given user.
8022
+ */
8023
+ this.create = (shippingRule) => {
8024
+ return this.client.post("/v1/shipping_rules", shippingRule);
8025
+ };
8020
8026
  this.client = client;
8021
8027
  }
8022
8028
  }
@@ -8075,7 +8081,7 @@ var __spreadValues$4 = (a, b) => {
8075
8081
  return a;
8076
8082
  };
8077
8083
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
8078
- var __async$r = (__this, __arguments, generator) => {
8084
+ var __async$s = (__this, __arguments, generator) => {
8079
8085
  return new Promise((resolve, reject) => {
8080
8086
  var fulfilled = (value) => {
8081
8087
  try {
@@ -8169,7 +8175,7 @@ class ShipEngineAPI {
8169
8175
  );
8170
8176
  return res;
8171
8177
  },
8172
- (err) => __async$r(this, null, function* () {
8178
+ (err) => __async$s(this, null, function* () {
8173
8179
  var _a, _b, _c, _d, _e, _f, _g;
8174
8180
  logger$1.error(
8175
8181
  { err, req: err.config, res: err.response },
@@ -8474,7 +8480,7 @@ const useGetAccountSettings = () => {
8474
8480
  });
8475
8481
  };
8476
8482
 
8477
- var __async$q = (__this, __arguments, generator) => {
8483
+ var __async$r = (__this, __arguments, generator) => {
8478
8484
  return new Promise((resolve, reject) => {
8479
8485
  var fulfilled = (value) => {
8480
8486
  try {
@@ -8497,7 +8503,7 @@ var __async$q = (__this, __arguments, generator) => {
8497
8503
  const useUpdateAccountSettings = () => {
8498
8504
  const { client } = useShipEngine();
8499
8505
  return useMutation({
8500
- mutationFn: (settings) => __async$q(void 0, null, function* () {
8506
+ mutationFn: (settings) => __async$r(void 0, null, function* () {
8501
8507
  const result = yield client.accountSettings.update(settings);
8502
8508
  return result.data;
8503
8509
  }),
@@ -8506,7 +8512,7 @@ const useUpdateAccountSettings = () => {
8506
8512
  });
8507
8513
  };
8508
8514
 
8509
- var __async$p = (__this, __arguments, generator) => {
8515
+ var __async$q = (__this, __arguments, generator) => {
8510
8516
  return new Promise((resolve, reject) => {
8511
8517
  var fulfilled = (value) => {
8512
8518
  try {
@@ -8529,7 +8535,7 @@ var __async$p = (__this, __arguments, generator) => {
8529
8535
  const useParseAddress = () => {
8530
8536
  const { client } = useShipEngine();
8531
8537
  return useMutation({
8532
- mutationFn: (_0) => __async$p(void 0, [_0], function* ({ address, text }) {
8538
+ mutationFn: (_0) => __async$q(void 0, [_0], function* ({ address, text }) {
8533
8539
  const result = yield client.addresses.parse(text, address);
8534
8540
  return result.data;
8535
8541
  }),
@@ -8538,7 +8544,7 @@ const useParseAddress = () => {
8538
8544
  });
8539
8545
  };
8540
8546
 
8541
- var __async$o = (__this, __arguments, generator) => {
8547
+ var __async$p = (__this, __arguments, generator) => {
8542
8548
  return new Promise((resolve, reject) => {
8543
8549
  var fulfilled = (value) => {
8544
8550
  try {
@@ -8561,7 +8567,7 @@ var __async$o = (__this, __arguments, generator) => {
8561
8567
  const useValidateAddresses = () => {
8562
8568
  const { client } = useShipEngine();
8563
8569
  return useMutation({
8564
- mutationFn: (addresses) => __async$o(void 0, null, function* () {
8570
+ mutationFn: (addresses) => __async$p(void 0, null, function* () {
8565
8571
  const result = yield client.addresses.validate(addresses);
8566
8572
  return result.data;
8567
8573
  }),
@@ -8570,7 +8576,7 @@ const useValidateAddresses = () => {
8570
8576
  });
8571
8577
  };
8572
8578
 
8573
- var __async$n = (__this, __arguments, generator) => {
8579
+ var __async$o = (__this, __arguments, generator) => {
8574
8580
  return new Promise((resolve, reject) => {
8575
8581
  var fulfilled = (value) => {
8576
8582
  try {
@@ -8593,7 +8599,7 @@ var __async$n = (__this, __arguments, generator) => {
8593
8599
  const useAddFunds = (carrierId) => {
8594
8600
  const { client } = useShipEngine();
8595
8601
  return useMutation({
8596
- mutationFn: (funds) => __async$n(void 0, null, function* () {
8602
+ mutationFn: (funds) => __async$o(void 0, null, function* () {
8597
8603
  const result = yield client.carriers.addFunds(carrierId, funds);
8598
8604
  return result.data;
8599
8605
  }),
@@ -8602,7 +8608,7 @@ const useAddFunds = (carrierId) => {
8602
8608
  });
8603
8609
  };
8604
8610
 
8605
- var __async$m = (__this, __arguments, generator) => {
8611
+ var __async$n = (__this, __arguments, generator) => {
8606
8612
  return new Promise((resolve, reject) => {
8607
8613
  var fulfilled = (value) => {
8608
8614
  try {
@@ -8625,7 +8631,7 @@ var __async$m = (__this, __arguments, generator) => {
8625
8631
  const useConnectCarrier = () => {
8626
8632
  const { client } = useShipEngine();
8627
8633
  return useMutation({
8628
- mutationFn: (params) => __async$m(void 0, null, function* () {
8634
+ mutationFn: (params) => __async$n(void 0, null, function* () {
8629
8635
  const result = yield client.carriers.connect(params);
8630
8636
  return result.data;
8631
8637
  }),
@@ -8762,7 +8768,7 @@ const useListCarriers = () => {
8762
8768
  });
8763
8769
  };
8764
8770
 
8765
- var __async$l = (__this, __arguments, generator) => {
8771
+ var __async$m = (__this, __arguments, generator) => {
8766
8772
  return new Promise((resolve, reject) => {
8767
8773
  var fulfilled = (value) => {
8768
8774
  try {
@@ -8786,7 +8792,7 @@ const useUpdateAutoFunding = (carrierId) => {
8786
8792
  const { client } = useShipEngine();
8787
8793
  const queryClient = useQueryClient();
8788
8794
  return useMutation({
8789
- mutationFn: (options) => __async$l(void 0, null, function* () {
8795
+ mutationFn: (options) => __async$m(void 0, null, function* () {
8790
8796
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
8791
8797
  return result.data;
8792
8798
  }),
@@ -8825,7 +8831,7 @@ const useListCustomPackageTypes = () => {
8825
8831
  });
8826
8832
  };
8827
8833
 
8828
- var __async$k = (__this, __arguments, generator) => {
8834
+ var __async$l = (__this, __arguments, generator) => {
8829
8835
  return new Promise((resolve, reject) => {
8830
8836
  var fulfilled = (value) => {
8831
8837
  try {
@@ -8848,7 +8854,7 @@ var __async$k = (__this, __arguments, generator) => {
8848
8854
  const useCreateFundingSource = () => {
8849
8855
  const { client } = useShipEngine();
8850
8856
  return useMutation({
8851
- mutationFn: (fundingSource) => __async$k(void 0, null, function* () {
8857
+ mutationFn: (fundingSource) => __async$l(void 0, null, function* () {
8852
8858
  const result = yield client.fundingSources.create(fundingSource);
8853
8859
  return result.data;
8854
8860
  }),
@@ -8857,7 +8863,7 @@ const useCreateFundingSource = () => {
8857
8863
  });
8858
8864
  };
8859
8865
 
8860
- var __async$j = (__this, __arguments, generator) => {
8866
+ var __async$k = (__this, __arguments, generator) => {
8861
8867
  return new Promise((resolve, reject) => {
8862
8868
  var fulfilled = (value) => {
8863
8869
  try {
@@ -8880,7 +8886,7 @@ var __async$j = (__this, __arguments, generator) => {
8880
8886
  const useFundingSourcesAddFunds = (fundingSourceId) => {
8881
8887
  const { client } = useShipEngine();
8882
8888
  return useMutation({
8883
- mutationFn: (funds) => __async$j(void 0, null, function* () {
8889
+ mutationFn: (funds) => __async$k(void 0, null, function* () {
8884
8890
  const result = yield client.fundingSources.addFunds(funds, fundingSourceId);
8885
8891
  return result.data;
8886
8892
  }),
@@ -8909,7 +8915,7 @@ const useListFundingSources = () => {
8909
8915
  });
8910
8916
  };
8911
8917
 
8912
- var __async$i = (__this, __arguments, generator) => {
8918
+ var __async$j = (__this, __arguments, generator) => {
8913
8919
  return new Promise((resolve, reject) => {
8914
8920
  var fulfilled = (value) => {
8915
8921
  try {
@@ -8932,7 +8938,7 @@ var __async$i = (__this, __arguments, generator) => {
8932
8938
  const useRegisterCarrier = () => {
8933
8939
  const { client } = useShipEngine();
8934
8940
  return useMutation({
8935
- mutationFn: (carrier) => __async$i(void 0, null, function* () {
8941
+ mutationFn: (carrier) => __async$j(void 0, null, function* () {
8936
8942
  const result = yield client.fundingSources.registerCarrier(carrier);
8937
8943
  return result.data;
8938
8944
  }),
@@ -8941,7 +8947,7 @@ const useRegisterCarrier = () => {
8941
8947
  });
8942
8948
  };
8943
8949
 
8944
- var __async$h = (__this, __arguments, generator) => {
8950
+ var __async$i = (__this, __arguments, generator) => {
8945
8951
  return new Promise((resolve, reject) => {
8946
8952
  var fulfilled = (value) => {
8947
8953
  try {
@@ -8964,7 +8970,7 @@ var __async$h = (__this, __arguments, generator) => {
8964
8970
  const useUpdateFundingSource = () => {
8965
8971
  const { client } = useShipEngine();
8966
8972
  return useMutation({
8967
- mutationFn: (_0) => __async$h(void 0, [_0], function* ({
8973
+ mutationFn: (_0) => __async$i(void 0, [_0], function* ({
8968
8974
  billingInfo,
8969
8975
  creditCardInfo,
8970
8976
  fundingSourceId
@@ -9011,7 +9017,7 @@ var __objRest$6 = (source, exclude) => {
9011
9017
  }
9012
9018
  return target;
9013
9019
  };
9014
- var __async$g = (__this, __arguments, generator) => {
9020
+ var __async$h = (__this, __arguments, generator) => {
9015
9021
  return new Promise((resolve, reject) => {
9016
9022
  var fulfilled = (value) => {
9017
9023
  try {
@@ -9034,7 +9040,7 @@ var __async$g = (__this, __arguments, generator) => {
9034
9040
  const useCreateLabel = () => {
9035
9041
  const { client } = useShipEngine();
9036
9042
  return useMutation({
9037
- mutationFn: (_a) => __async$g(void 0, null, function* () {
9043
+ mutationFn: (_a) => __async$h(void 0, null, function* () {
9038
9044
  var _b = _a, { rateId } = _b, options = __objRest$6(_b, ["rateId"]);
9039
9045
  const result = yield client.labels.createByRateId(rateId, options);
9040
9046
  return result.data;
@@ -9070,7 +9076,7 @@ const useListLabels = (params) => {
9070
9076
  });
9071
9077
  };
9072
9078
 
9073
- var __async$f = (__this, __arguments, generator) => {
9079
+ var __async$g = (__this, __arguments, generator) => {
9074
9080
  return new Promise((resolve, reject) => {
9075
9081
  var fulfilled = (value) => {
9076
9082
  try {
@@ -9093,7 +9099,7 @@ var __async$f = (__this, __arguments, generator) => {
9093
9099
  const useVoidLabel = () => {
9094
9100
  const { client } = useShipEngine();
9095
9101
  return useMutation({
9096
- mutationFn: (labelId) => __async$f(void 0, null, function* () {
9102
+ mutationFn: (labelId) => __async$g(void 0, null, function* () {
9097
9103
  const result = yield client.labels.void(labelId);
9098
9104
  return result.data;
9099
9105
  }),
@@ -9112,7 +9118,7 @@ const useListOrderSources = () => {
9112
9118
  });
9113
9119
  };
9114
9120
 
9115
- var __async$e = (__this, __arguments, generator) => {
9121
+ var __async$f = (__this, __arguments, generator) => {
9116
9122
  return new Promise((resolve, reject) => {
9117
9123
  var fulfilled = (value) => {
9118
9124
  try {
@@ -9135,7 +9141,7 @@ var __async$e = (__this, __arguments, generator) => {
9135
9141
  const useRefreshOrderSourceAsync = () => {
9136
9142
  const { client } = useShipEngine();
9137
9143
  return useMutation({
9138
- mutationFn: (orderSourceId) => __async$e(void 0, null, function* () {
9144
+ mutationFn: (orderSourceId) => __async$f(void 0, null, function* () {
9139
9145
  const result = yield client.orderSources.refresh(orderSourceId);
9140
9146
  return result.data;
9141
9147
  }),
@@ -9146,9 +9152,9 @@ const useRefreshOrderSource = () => {
9146
9152
  const { client } = useShipEngine();
9147
9153
  const { mutateAsync: refreshOrderSourceAsync } = useRefreshOrderSourceAsync();
9148
9154
  return useMutation({
9149
- mutationFn: (orderSourceId) => __async$e(void 0, null, function* () {
9155
+ mutationFn: (orderSourceId) => __async$f(void 0, null, function* () {
9150
9156
  yield refreshOrderSourceAsync(orderSourceId);
9151
- const waitResult = yield retryUntil(() => __async$e(void 0, null, function* () {
9157
+ const waitResult = yield retryUntil(() => __async$f(void 0, null, function* () {
9152
9158
  const { data: checkResult } = yield client.orderSources.get(orderSourceId);
9153
9159
  if (["preparing_update", "updating"].includes(checkResult.refreshInfo.status)) {
9154
9160
  throw new CodedError("Order source is still refreshing");
@@ -9162,7 +9168,7 @@ const useRefreshOrderSource = () => {
9162
9168
  });
9163
9169
  };
9164
9170
 
9165
- var __async$d = (__this, __arguments, generator) => {
9171
+ var __async$e = (__this, __arguments, generator) => {
9166
9172
  return new Promise((resolve, reject) => {
9167
9173
  var fulfilled = (value) => {
9168
9174
  try {
@@ -9185,7 +9191,7 @@ var __async$d = (__this, __arguments, generator) => {
9185
9191
  const useCreateRateCard = () => {
9186
9192
  const { client } = useShipEngine();
9187
9193
  return useMutation({
9188
- mutationFn: (rateCard) => __async$d(void 0, null, function* () {
9194
+ mutationFn: (rateCard) => __async$e(void 0, null, function* () {
9189
9195
  const result = yield client.rateCards.create(rateCard);
9190
9196
  return result.data;
9191
9197
  }),
@@ -9232,7 +9238,7 @@ const useListRateCards = (carrierIds) => {
9232
9238
  });
9233
9239
  };
9234
9240
 
9235
- var __async$c = (__this, __arguments, generator) => {
9241
+ var __async$d = (__this, __arguments, generator) => {
9236
9242
  return new Promise((resolve, reject) => {
9237
9243
  var fulfilled = (value) => {
9238
9244
  try {
@@ -9255,7 +9261,7 @@ var __async$c = (__this, __arguments, generator) => {
9255
9261
  const usePublishRateCard = () => {
9256
9262
  const { client } = useShipEngine();
9257
9263
  return useMutation({
9258
- mutationFn: (rateCardId) => __async$c(void 0, null, function* () {
9264
+ mutationFn: (rateCardId) => __async$d(void 0, null, function* () {
9259
9265
  return yield client.rateCards.publish(rateCardId);
9260
9266
  }),
9261
9267
  mutationKey: ["usePublishRateCard"],
@@ -9263,7 +9269,7 @@ const usePublishRateCard = () => {
9263
9269
  });
9264
9270
  };
9265
9271
 
9266
- var __async$b = (__this, __arguments, generator) => {
9272
+ var __async$c = (__this, __arguments, generator) => {
9267
9273
  return new Promise((resolve, reject) => {
9268
9274
  var fulfilled = (value) => {
9269
9275
  try {
@@ -9286,7 +9292,7 @@ var __async$b = (__this, __arguments, generator) => {
9286
9292
  const useUpdateRateCard = () => {
9287
9293
  const { client } = useShipEngine();
9288
9294
  return useMutation({
9289
- mutationFn: (rateCard) => __async$b(void 0, null, function* () {
9295
+ mutationFn: (rateCard) => __async$c(void 0, null, function* () {
9290
9296
  const result = yield client.rateCards.update(rateCard);
9291
9297
  return result.data;
9292
9298
  }),
@@ -9295,7 +9301,7 @@ const useUpdateRateCard = () => {
9295
9301
  });
9296
9302
  };
9297
9303
 
9298
- var __async$a = (__this, __arguments, generator) => {
9304
+ var __async$b = (__this, __arguments, generator) => {
9299
9305
  return new Promise((resolve, reject) => {
9300
9306
  var fulfilled = (value) => {
9301
9307
  try {
@@ -9318,7 +9324,7 @@ var __async$a = (__this, __arguments, generator) => {
9318
9324
  const useUploadRateCard = () => {
9319
9325
  const { client } = useShipEngine();
9320
9326
  return useMutation({
9321
- mutationFn: (_0) => __async$a(void 0, [_0], function* ({ rateCardId, file }) {
9327
+ mutationFn: (_0) => __async$b(void 0, [_0], function* ({ rateCardId, file }) {
9322
9328
  const result = yield client.rateCards.upload(rateCardId, file);
9323
9329
  return result.data;
9324
9330
  }),
@@ -9327,7 +9333,7 @@ const useUploadRateCard = () => {
9327
9333
  });
9328
9334
  };
9329
9335
 
9330
- var __async$9 = (__this, __arguments, generator) => {
9336
+ var __async$a = (__this, __arguments, generator) => {
9331
9337
  return new Promise((resolve, reject) => {
9332
9338
  var fulfilled = (value) => {
9333
9339
  try {
@@ -9350,7 +9356,7 @@ var __async$9 = (__this, __arguments, generator) => {
9350
9356
  const useDeleteRateCard = () => {
9351
9357
  const { client } = useShipEngine();
9352
9358
  return useMutation({
9353
- mutationFn: (rateCardId) => __async$9(void 0, null, function* () {
9359
+ mutationFn: (rateCardId) => __async$a(void 0, null, function* () {
9354
9360
  const result = yield client.rateCards.delete(rateCardId);
9355
9361
  return result.data;
9356
9362
  }),
@@ -9359,7 +9365,7 @@ const useDeleteRateCard = () => {
9359
9365
  });
9360
9366
  };
9361
9367
 
9362
- var __async$8 = (__this, __arguments, generator) => {
9368
+ var __async$9 = (__this, __arguments, generator) => {
9363
9369
  return new Promise((resolve, reject) => {
9364
9370
  var fulfilled = (value) => {
9365
9371
  try {
@@ -9382,7 +9388,7 @@ var __async$8 = (__this, __arguments, generator) => {
9382
9388
  const useCalculateRates = () => {
9383
9389
  const { client } = useShipEngine();
9384
9390
  return useMutation({
9385
- mutationFn: (_0) => __async$8(void 0, [_0], function* ({ rateOptions, shipmentId }) {
9391
+ mutationFn: (_0) => __async$9(void 0, [_0], function* ({ rateOptions, shipmentId }) {
9386
9392
  const result = yield client.rates.calculateByShipmentId(shipmentId, rateOptions);
9387
9393
  return result.data;
9388
9394
  }),
@@ -9432,7 +9438,7 @@ var __objRest$5 = (source, exclude) => {
9432
9438
  }
9433
9439
  return target;
9434
9440
  };
9435
- var __async$7 = (__this, __arguments, generator) => {
9441
+ var __async$8 = (__this, __arguments, generator) => {
9436
9442
  return new Promise((resolve, reject) => {
9437
9443
  var fulfilled = (value) => {
9438
9444
  try {
@@ -9455,7 +9461,7 @@ var __async$7 = (__this, __arguments, generator) => {
9455
9461
  const useNotifySalesOrderShipped = () => {
9456
9462
  const { client } = useShipEngine();
9457
9463
  return useMutation({
9458
- mutationFn: (_a) => __async$7(void 0, null, function* () {
9464
+ mutationFn: (_a) => __async$8(void 0, null, function* () {
9459
9465
  var _b = _a, { salesOrderId } = _b, tracking = __objRest$5(_b, ["salesOrderId"]);
9460
9466
  const result = yield client.salesOrders.notifyShipped(salesOrderId, tracking);
9461
9467
  return result.data;
@@ -9480,7 +9486,7 @@ var __objRest$4 = (source, exclude) => {
9480
9486
  }
9481
9487
  return target;
9482
9488
  };
9483
- var __async$6 = (__this, __arguments, generator) => {
9489
+ var __async$7 = (__this, __arguments, generator) => {
9484
9490
  return new Promise((resolve, reject) => {
9485
9491
  var fulfilled = (value) => {
9486
9492
  try {
@@ -9503,7 +9509,7 @@ var __async$6 = (__this, __arguments, generator) => {
9503
9509
  const useCreateSalesOrderShipment = () => {
9504
9510
  const { client } = useShipEngine();
9505
9511
  return useMutation({
9506
- mutationFn: (_a) => __async$6(void 0, null, function* () {
9512
+ mutationFn: (_a) => __async$7(void 0, null, function* () {
9507
9513
  var _b = _a, { salesOrderId } = _b, shipment = __objRest$4(_b, ["salesOrderId"]);
9508
9514
  const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
9509
9515
  return result.data;
@@ -9554,7 +9560,7 @@ var __objRest$3 = (source, exclude) => {
9554
9560
  }
9555
9561
  return target;
9556
9562
  };
9557
- var __async$5 = (__this, __arguments, generator) => {
9563
+ var __async$6 = (__this, __arguments, generator) => {
9558
9564
  return new Promise((resolve, reject) => {
9559
9565
  var fulfilled = (value) => {
9560
9566
  try {
@@ -9577,7 +9583,7 @@ var __async$5 = (__this, __arguments, generator) => {
9577
9583
  const useUpdateSalesOrderShipment = () => {
9578
9584
  const { client } = useShipEngine();
9579
9585
  return useMutation({
9580
- mutationFn: (_a) => __async$5(void 0, null, function* () {
9586
+ mutationFn: (_a) => __async$6(void 0, null, function* () {
9581
9587
  var _b = _a, { shipmentId } = _b, shipment = __objRest$3(_b, ["shipmentId"]);
9582
9588
  const result = yield client.salesOrderShipments.update(shipmentId, shipment);
9583
9589
  return result.data;
@@ -9606,7 +9612,7 @@ var __spreadValues$2 = (a, b) => {
9606
9612
  return a;
9607
9613
  };
9608
9614
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9609
- var __async$4 = (__this, __arguments, generator) => {
9615
+ var __async$5 = (__this, __arguments, generator) => {
9610
9616
  return new Promise((resolve, reject) => {
9611
9617
  var fulfilled = (value) => {
9612
9618
  try {
@@ -9629,7 +9635,7 @@ var __async$4 = (__this, __arguments, generator) => {
9629
9635
  const useCreateShipment = () => {
9630
9636
  const { client } = useShipEngine();
9631
9637
  return useMutation({
9632
- mutationFn: (shipment) => __async$4(void 0, null, function* () {
9638
+ mutationFn: (shipment) => __async$5(void 0, null, function* () {
9633
9639
  var _a;
9634
9640
  if (shipment.warehouseId === void 0) {
9635
9641
  throw new CodedError("errorMessages.noWarehouses", {
@@ -9727,6 +9733,38 @@ const useListShippingRules = () => {
9727
9733
  });
9728
9734
  };
9729
9735
 
9736
+ var __async$4 = (__this, __arguments, generator) => {
9737
+ return new Promise((resolve, reject) => {
9738
+ var fulfilled = (value) => {
9739
+ try {
9740
+ step(generator.next(value));
9741
+ } catch (e) {
9742
+ reject(e);
9743
+ }
9744
+ };
9745
+ var rejected = (value) => {
9746
+ try {
9747
+ step(generator.throw(value));
9748
+ } catch (e) {
9749
+ reject(e);
9750
+ }
9751
+ };
9752
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
9753
+ step((generator = generator.apply(__this, __arguments)).next());
9754
+ });
9755
+ };
9756
+ const useCreateShippingRule = () => {
9757
+ const { client } = useShipEngine();
9758
+ return useMutation({
9759
+ mutationFn: (shippingRule) => __async$4(void 0, null, function* () {
9760
+ const result = yield client.shippingRules.create(shippingRule);
9761
+ return result.data;
9762
+ }),
9763
+ mutationKey: ["useCreateShippingRule"],
9764
+ onError
9765
+ });
9766
+ };
9767
+
9730
9768
  var __async$3 = (__this, __arguments, generator) => {
9731
9769
  return new Promise((resolve, reject) => {
9732
9770
  var fulfilled = (value) => {
@@ -10976,4 +11014,4 @@ const alchemy = {
10976
11014
  createElement
10977
11015
  };
10978
11016
 
10979
- export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, 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, useCreateWarehouse, useDeleteRateCard, useDeleteWarehouse, useDownloadRateCard, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, 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 };
11017
+ export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, 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, 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": "4.1.4",
3
+ "version": "4.1.5",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {