@shipengine/react-api 1.11.0 → 1.11.2

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[]>;
@@ -2,3 +2,4 @@ export * from "./use-list-shipping-rules";
2
2
  export * from "./use-create-shipping-rule";
3
3
  export * from "./use-delete-shipping-rule";
4
4
  export * from "./use-edit-shipping-rule";
5
+ export * from "./use-get-shipping-rule-conditions-options";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @category ShipEngine API Hooks
3
+ *
4
+ */
5
+ export declare const useGetShippingRuleConditionsOptions: () => import("@tanstack/react-query").UseQueryResult<import("@shipengine/js-api").RuleConditionsOptions[], 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
 
@@ -1600,6 +1616,18 @@ const useEditShippingRule = () => {
1600
1616
  });
1601
1617
  };
1602
1618
 
1619
+ const useGetShippingRuleConditionsOptions = () => {
1620
+ const { client } = useShipEngine();
1621
+ return reactQuery.useQuery({
1622
+ onError,
1623
+ queryFn: () => {
1624
+ return client.shippingRules.getConditionOptions();
1625
+ },
1626
+ queryKey: ["useGetShippingRuleConditionsOptions"],
1627
+ select: (result) => result.data
1628
+ });
1629
+ };
1630
+
1603
1631
  var __async$3 = (__this, __arguments, generator) => {
1604
1632
  return new Promise((resolve, reject) => {
1605
1633
  var fulfilled = (value) => {
@@ -1809,6 +1837,7 @@ exports.useGetSalesOrderShipment = useGetSalesOrderShipment;
1809
1837
  exports.useGetServicesByCarrier = useGetServicesByCarrier;
1810
1838
  exports.useGetShipment = useGetShipment;
1811
1839
  exports.useGetShipmentRates = useGetShipmentRates;
1840
+ exports.useGetShippingRuleConditionsOptions = useGetShippingRuleConditionsOptions;
1812
1841
  exports.useGetWalletHistory = useGetWalletHistory;
1813
1842
  exports.useGetZonesByCarrier = useGetZonesByCarrier;
1814
1843
  exports.useListCarriers = useListCarriers;
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
 
@@ -1597,6 +1613,18 @@ const useEditShippingRule = () => {
1597
1613
  });
1598
1614
  };
1599
1615
 
1616
+ const useGetShippingRuleConditionsOptions = () => {
1617
+ const { client } = useShipEngine();
1618
+ return useQuery({
1619
+ onError,
1620
+ queryFn: () => {
1621
+ return client.shippingRules.getConditionOptions();
1622
+ },
1623
+ queryKey: ["useGetShippingRuleConditionsOptions"],
1624
+ select: (result) => result.data
1625
+ });
1626
+ };
1627
+
1600
1628
  var __async$3 = (__this, __arguments, generator) => {
1601
1629
  return new Promise((resolve, reject) => {
1602
1630
  var fulfilled = (value) => {
@@ -1763,4 +1791,4 @@ const useUpdateAccountBillingPlan = () => {
1763
1791
  });
1764
1792
  };
1765
1793
 
1766
- 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, 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 };
1794
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/react-api",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {