@shipengine/react-api 1.11.1 → 1.11.3

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.
@@ -5,4 +5,6 @@ import { ListLabelsParams } from "@shipengine/js-api";
5
5
  * @see [ShipEngine Developer Docs](https://www.shipengine.com/docs/reference/list-labels/)
6
6
  * @see [ShipEngine API Reference](https://shipengine.github.io/shipengine-openapi/#operation/list_labels)
7
7
  */
8
- export declare const useListLabels: (params?: ListLabelsParams) => import("@tanstack/react-query").UseQueryResult<import("@shipengine/js-api").Label[], import("@shipengine/js-api").CodedError[]>;
8
+ export declare const useListLabels: (_params?: ListLabelsParams & {
9
+ enabled?: boolean;
10
+ }) => import("@tanstack/react-query").UseQueryResult<import("@shipengine/js-api").ListLabelsResult, import("@shipengine/js-api").CodedError[]>;
@@ -3,3 +3,4 @@ export * from "./use-create-shipping-rule";
3
3
  export * from "./use-delete-shipping-rule";
4
4
  export * from "./use-edit-shipping-rule";
5
5
  export * from "./use-get-shipping-rule-conditions-options";
6
+ export * from "./use-get-shipping-rule-by-id";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @category ShipEngine API Hooks
3
+ *
4
+ */
5
+ export declare const useGetShippingRuleById: (shippingRuleId: string) => import("@tanstack/react-query").UseQueryResult<import("@shipengine/js-api").ShippingRule, import("@shipengine/js-api").CodedError[]>;
package/index.js CHANGED
@@ -65,17 +65,17 @@ var o={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},l={};function a(e){r
65
65
  var __defProp$1 = Object.defineProperty;
66
66
  var __defProps$1 = Object.defineProperties;
67
67
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
68
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
69
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
70
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
68
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
69
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
70
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
71
71
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
72
72
  var __spreadValues$1 = (a, b) => {
73
73
  for (var prop in b || (b = {}))
74
- if (__hasOwnProp$7.call(b, prop))
74
+ if (__hasOwnProp$8.call(b, prop))
75
75
  __defNormalProp$1(a, prop, b[prop]);
76
- if (__getOwnPropSymbols$7)
77
- for (var prop of __getOwnPropSymbols$7(b)) {
78
- if (__propIsEnum$7.call(b, prop))
76
+ if (__getOwnPropSymbols$8)
77
+ for (var prop of __getOwnPropSymbols$8(b)) {
78
+ if (__propIsEnum$8.call(b, prop))
79
79
  __defNormalProp$1(a, prop, b[prop]);
80
80
  }
81
81
  return a;
@@ -773,17 +773,17 @@ const useGetInsuranceAccount = (insuranceProvider) => {
773
773
  });
774
774
  };
775
775
 
776
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
777
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
778
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
779
- var __objRest$5 = (source, exclude) => {
776
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
777
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
778
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
779
+ var __objRest$6 = (source, exclude) => {
780
780
  var target = {};
781
781
  for (var prop in source)
782
- if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
782
+ if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
783
783
  target[prop] = source[prop];
784
- if (source != null && __getOwnPropSymbols$6)
785
- for (var prop of __getOwnPropSymbols$6(source)) {
786
- if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
784
+ if (source != null && __getOwnPropSymbols$7)
785
+ for (var prop of __getOwnPropSymbols$7(source)) {
786
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
787
787
  target[prop] = source[prop];
788
788
  }
789
789
  return target;
@@ -812,7 +812,7 @@ const useCreateLabel = () => {
812
812
  const { client } = useShipEngine();
813
813
  return reactQuery.useMutation({
814
814
  mutationFn: (_a) => __async$j(void 0, null, function* () {
815
- var _b = _a, { rateId } = _b, options = __objRest$5(_b, ["rateId"]);
815
+ var _b = _a, { rateId } = _b, options = __objRest$6(_b, ["rateId"]);
816
816
  const result = yield client.labels.createByRateId(rateId, options);
817
817
  return result.data;
818
818
  }),
@@ -836,14 +836,30 @@ const useGetLabel = (labelId) => {
836
836
  });
837
837
  };
838
838
 
839
- const useListLabels = (params) => {
839
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
840
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
841
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
842
+ var __objRest$5 = (source, exclude) => {
843
+ var target = {};
844
+ for (var prop in source)
845
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
846
+ target[prop] = source[prop];
847
+ if (source != null && __getOwnPropSymbols$6)
848
+ for (var prop of __getOwnPropSymbols$6(source)) {
849
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
850
+ target[prop] = source[prop];
851
+ }
852
+ return target;
853
+ };
854
+ const useListLabels = (_params) => {
840
855
  const { client } = useShipEngine();
856
+ const _a = _params || {}, { enabled = true } = _a, params = __objRest$5(_a, ["enabled"]);
841
857
  return reactQuery.useQuery({
842
- enabled: params && Object.values(params).some((v) => v !== void 0),
858
+ enabled,
843
859
  onError,
844
860
  queryFn: () => client.labels.list(params),
845
861
  queryKey: ["useListLabels", params],
846
- select: (result) => result.data.labels
862
+ select: (result) => result.data
847
863
  });
848
864
  };
849
865
 
@@ -1612,6 +1628,19 @@ const useGetShippingRuleConditionsOptions = () => {
1612
1628
  });
1613
1629
  };
1614
1630
 
1631
+ const useGetShippingRuleById = (shippingRuleId) => {
1632
+ const { client } = useShipEngine();
1633
+ return reactQuery.useQuery({
1634
+ enabled: !!shippingRuleId,
1635
+ onError,
1636
+ queryFn: () => {
1637
+ return client.shippingRules.get(shippingRuleId);
1638
+ },
1639
+ queryKey: ["useGetShippingRuleById", shippingRuleId],
1640
+ select: (result) => result.data
1641
+ });
1642
+ };
1643
+
1615
1644
  var __async$3 = (__this, __arguments, generator) => {
1616
1645
  return new Promise((resolve, reject) => {
1617
1646
  var fulfilled = (value) => {
@@ -1821,6 +1850,7 @@ exports.useGetSalesOrderShipment = useGetSalesOrderShipment;
1821
1850
  exports.useGetServicesByCarrier = useGetServicesByCarrier;
1822
1851
  exports.useGetShipment = useGetShipment;
1823
1852
  exports.useGetShipmentRates = useGetShipmentRates;
1853
+ exports.useGetShippingRuleById = useGetShippingRuleById;
1824
1854
  exports.useGetShippingRuleConditionsOptions = useGetShippingRuleConditionsOptions;
1825
1855
  exports.useGetWalletHistory = useGetWalletHistory;
1826
1856
  exports.useGetZonesByCarrier = useGetZonesByCarrier;
package/index.mjs CHANGED
@@ -62,17 +62,17 @@ var o={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},l={};function a(e){r
62
62
  var __defProp$1 = Object.defineProperty;
63
63
  var __defProps$1 = Object.defineProperties;
64
64
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
65
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
66
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
67
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
65
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
66
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
67
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
68
68
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
69
69
  var __spreadValues$1 = (a, b) => {
70
70
  for (var prop in b || (b = {}))
71
- if (__hasOwnProp$7.call(b, prop))
71
+ if (__hasOwnProp$8.call(b, prop))
72
72
  __defNormalProp$1(a, prop, b[prop]);
73
- if (__getOwnPropSymbols$7)
74
- for (var prop of __getOwnPropSymbols$7(b)) {
75
- if (__propIsEnum$7.call(b, prop))
73
+ if (__getOwnPropSymbols$8)
74
+ for (var prop of __getOwnPropSymbols$8(b)) {
75
+ if (__propIsEnum$8.call(b, prop))
76
76
  __defNormalProp$1(a, prop, b[prop]);
77
77
  }
78
78
  return a;
@@ -770,17 +770,17 @@ const useGetInsuranceAccount = (insuranceProvider) => {
770
770
  });
771
771
  };
772
772
 
773
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
774
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
775
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
776
- var __objRest$5 = (source, exclude) => {
773
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
774
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
775
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
776
+ var __objRest$6 = (source, exclude) => {
777
777
  var target = {};
778
778
  for (var prop in source)
779
- if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
779
+ if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
780
780
  target[prop] = source[prop];
781
- if (source != null && __getOwnPropSymbols$6)
782
- for (var prop of __getOwnPropSymbols$6(source)) {
783
- if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
781
+ if (source != null && __getOwnPropSymbols$7)
782
+ for (var prop of __getOwnPropSymbols$7(source)) {
783
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
784
784
  target[prop] = source[prop];
785
785
  }
786
786
  return target;
@@ -809,7 +809,7 @@ const useCreateLabel = () => {
809
809
  const { client } = useShipEngine();
810
810
  return useMutation({
811
811
  mutationFn: (_a) => __async$j(void 0, null, function* () {
812
- var _b = _a, { rateId } = _b, options = __objRest$5(_b, ["rateId"]);
812
+ var _b = _a, { rateId } = _b, options = __objRest$6(_b, ["rateId"]);
813
813
  const result = yield client.labels.createByRateId(rateId, options);
814
814
  return result.data;
815
815
  }),
@@ -833,14 +833,30 @@ const useGetLabel = (labelId) => {
833
833
  });
834
834
  };
835
835
 
836
- const useListLabels = (params) => {
836
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
837
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
838
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
839
+ var __objRest$5 = (source, exclude) => {
840
+ var target = {};
841
+ for (var prop in source)
842
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
843
+ target[prop] = source[prop];
844
+ if (source != null && __getOwnPropSymbols$6)
845
+ for (var prop of __getOwnPropSymbols$6(source)) {
846
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
847
+ target[prop] = source[prop];
848
+ }
849
+ return target;
850
+ };
851
+ const useListLabels = (_params) => {
837
852
  const { client } = useShipEngine();
853
+ const _a = _params || {}, { enabled = true } = _a, params = __objRest$5(_a, ["enabled"]);
838
854
  return useQuery({
839
- enabled: params && Object.values(params).some((v) => v !== void 0),
855
+ enabled,
840
856
  onError,
841
857
  queryFn: () => client.labels.list(params),
842
858
  queryKey: ["useListLabels", params],
843
- select: (result) => result.data.labels
859
+ select: (result) => result.data
844
860
  });
845
861
  };
846
862
 
@@ -1609,6 +1625,19 @@ const useGetShippingRuleConditionsOptions = () => {
1609
1625
  });
1610
1626
  };
1611
1627
 
1628
+ const useGetShippingRuleById = (shippingRuleId) => {
1629
+ const { client } = useShipEngine();
1630
+ return useQuery({
1631
+ enabled: !!shippingRuleId,
1632
+ onError,
1633
+ queryFn: () => {
1634
+ return client.shippingRules.get(shippingRuleId);
1635
+ },
1636
+ queryKey: ["useGetShippingRuleById", shippingRuleId],
1637
+ select: (result) => result.data
1638
+ });
1639
+ };
1640
+
1612
1641
  var __async$3 = (__this, __arguments, generator) => {
1613
1642
  return new Promise((resolve, reject) => {
1614
1643
  var fulfilled = (value) => {
@@ -1775,4 +1804,4 @@ const useUpdateAccountBillingPlan = () => {
1775
1804
  });
1776
1805
  };
1777
1806
 
1778
- export { ShipEngine, ShipEngineContext, delay, logger, onError, retryUntil, useAddFunds, useCalculateRates, useConnectCarrier, useCreateAccountImage, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useDeleteAccountImage, useDeleteRateCard, useDeleteShippingRule, useDeleteWarehouse, useDownloadRateCard, useEditShippingRule, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountImages, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetFundingSourceTransactions, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetShippingRuleConditionsOptions, useGetWalletHistory, useGetZonesByCarrier, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListShippingRules, useListWarehouses, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountBillingPlan, useUpdateAccountImage, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUploadRateCard, useValidateAddresses, useVoidLabel };
1807
+ export { ShipEngine, ShipEngineContext, delay, logger, onError, retryUntil, useAddFunds, useCalculateRates, useConnectCarrier, useCreateAccountImage, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useDeleteAccountImage, useDeleteRateCard, useDeleteShippingRule, useDeleteWarehouse, useDownloadRateCard, useEditShippingRule, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountImages, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetFundingSourceTransactions, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetShippingRuleById, useGetShippingRuleConditionsOptions, useGetWalletHistory, useGetZonesByCarrier, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListShippingRules, useListWarehouses, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountBillingPlan, useUpdateAccountImage, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUploadRateCard, useValidateAddresses, useVoidLabel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/react-api",
3
- "version": "1.11.1",
3
+ "version": "1.11.3",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {