@shipengine/react-api 2.1.1 → 2.2.0

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.
package/hooks/index.d.ts CHANGED
@@ -17,3 +17,4 @@ export * from "./themes";
17
17
  export * from "./warehouses";
18
18
  export * from "./rate-cards";
19
19
  export * from "./account-billing-plan";
20
+ export * from "./service-points";
@@ -0,0 +1,2 @@
1
+ export * from "./use-list-service-points";
2
+ export * from "./use-get-service-point";
@@ -0,0 +1,7 @@
1
+ import { GetServicePointParams } from "@shipengine/js-api";
2
+ /**
3
+ * @category ShipEngine API Hooks
4
+ *
5
+ * @see [ShipEngine API Reference](https://shipengine.github.io/shipengine-openapi/#operation/service_points_get_by_id)
6
+ */
7
+ export declare const useGetServicePoint: ({ carrierCode, countryCode, id, }: Partial<GetServicePointParams>) => import("@tanstack/react-query").UseQueryResult<any, import("@shipengine/js-api").CodedError[]>;
@@ -0,0 +1,7 @@
1
+ import { ListServicePointsOptions } from "@shipengine/js-api";
2
+ /**
3
+ * @category ShipEngine API Hooks
4
+ *
5
+ * @see [ShipEngine API Reference](https://shipengine.github.io/shipengine-openapi/#operation/service_points_list)
6
+ */
7
+ export declare const useListServicePoints: (options: ListServicePointsOptions) => import("@tanstack/react-query").UseQueryResult<import("@shipengine/js-api").ServicePointsListResponse, import("@shipengine/js-api").CodedError[]>;
@@ -1,6 +1,6 @@
1
- import { ShippingRuleInput } from "@shipengine/js-api";
1
+ import { ShippingRuleCreateInput } from "@shipengine/js-api";
2
2
  /**
3
3
  * @category ShipEngine API Hooks
4
4
  *
5
5
  */
6
- export declare const useCreateShippingRule: () => import("@tanstack/react-query").UseMutationResult<import("@shipengine/js-api").ShippingRule, import("@shipengine/js-api").CodedError[], ShippingRuleInput, unknown>;
6
+ export declare const useCreateShippingRule: () => import("@tanstack/react-query").UseMutationResult<import("@shipengine/js-api").ShippingRule, import("@shipengine/js-api").CodedError[], ShippingRuleCreateInput, unknown>;
@@ -1,6 +1,6 @@
1
- import { ShippingRule } from "@shipengine/js-api";
1
+ import { ShippingRuleEditInput } from "@shipengine/js-api";
2
2
  /**
3
3
  * @category ShipEngine API Hooks
4
4
  *
5
5
  */
6
- export declare const useEditShippingRule: () => import("@tanstack/react-query").UseMutationResult<ShippingRule, import("@shipengine/js-api").CodedError[], ShippingRule, unknown>;
6
+ export declare const useEditShippingRule: () => import("@tanstack/react-query").UseMutationResult<import("@shipengine/js-api").ShippingRule, import("@shipengine/js-api").CodedError[], ShippingRuleEditInput, unknown>;
package/index.js CHANGED
@@ -1965,6 +1965,39 @@ const useUpdateAccountBillingPlan = () => {
1965
1965
  });
1966
1966
  };
1967
1967
 
1968
+ const useListServicePoints = (options) => {
1969
+ const { client } = useShipEngine();
1970
+ return reactQuery.useQuery({
1971
+ onError,
1972
+ queryFn: () => client.servicePoints.list(options),
1973
+ queryKey: ["useListServicePoints"],
1974
+ select: (result) => result.data
1975
+ });
1976
+ };
1977
+
1978
+ const useGetServicePoint = ({
1979
+ carrierCode,
1980
+ countryCode,
1981
+ id
1982
+ }) => {
1983
+ const { client } = useShipEngine();
1984
+ return reactQuery.useQuery({
1985
+ enabled: !!carrierCode && !!countryCode && !!id,
1986
+ onError,
1987
+ queryFn: () => {
1988
+ if (carrierCode === void 0)
1989
+ return Promise.reject(new Error("carrierCode required"));
1990
+ if (countryCode === void 0)
1991
+ return Promise.reject(new Error("countryCode required"));
1992
+ if (id === void 0)
1993
+ return Promise.reject(new Error("id required"));
1994
+ return client.servicePoints.get({ carrierCode, countryCode, id });
1995
+ },
1996
+ queryKey: ["useGetServicePoint", carrierCode, countryCode, id],
1997
+ select: (result) => result.data
1998
+ });
1999
+ };
2000
+
1968
2001
  exports.ShipEngine = ShipEngine;
1969
2002
  exports.ShipEngineContext = ShipEngineContext;
1970
2003
  exports.delay = delay;
@@ -2008,6 +2041,7 @@ exports.useGetPackageRatingGroupByCarrier = useGetPackageRatingGroupByCarrier;
2008
2041
  exports.useGetRateCardById = useGetRateCardById;
2009
2042
  exports.useGetSalesOrder = useGetSalesOrder;
2010
2043
  exports.useGetSalesOrderShipment = useGetSalesOrderShipment;
2044
+ exports.useGetServicePoint = useGetServicePoint;
2011
2045
  exports.useGetServicesByCarrier = useGetServicesByCarrier;
2012
2046
  exports.useGetShipment = useGetShipment;
2013
2047
  exports.useGetShipmentRates = useGetShipmentRates;
@@ -2024,6 +2058,7 @@ exports.useListOrderSources = useListOrderSources;
2024
2058
  exports.useListRateCards = useListRateCards;
2025
2059
  exports.useListSalesOrderShipments = useListSalesOrderShipments;
2026
2060
  exports.useListSalesOrders = useListSalesOrders;
2061
+ exports.useListServicePoints = useListServicePoints;
2027
2062
  exports.useListShipments = useListShipments;
2028
2063
  exports.useListShippingRules = useListShippingRules;
2029
2064
  exports.useListWarehouses = useListWarehouses;
package/index.mjs CHANGED
@@ -1962,4 +1962,37 @@ const useUpdateAccountBillingPlan = () => {
1962
1962
  });
1963
1963
  };
1964
1964
 
1965
- export { ShipEngine, ShipEngineContext, delay, logger, onError, retryUntil, useAddFunds, useAddInsuranceFunds, useCalculateRates, useConnectCarrier, useCreateAccountImage, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useDeactivateOrderSource, useDeleteAccountImage, useDeleteRateCard, useDeleteShippingRule, useDeleteWarehouse, useDownloadRateCard, useEditShippingRule, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountImages, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCarrierConnectionForm, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetFundingSourceTransactions, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetShippingRuleById, useGetShippingRuleConditionsOptions, useGetThemeById, useGetZonesByCarrier, useListCarrierConnections, 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 };
1965
+ const useListServicePoints = (options) => {
1966
+ const { client } = useShipEngine();
1967
+ return useQuery({
1968
+ onError,
1969
+ queryFn: () => client.servicePoints.list(options),
1970
+ queryKey: ["useListServicePoints"],
1971
+ select: (result) => result.data
1972
+ });
1973
+ };
1974
+
1975
+ const useGetServicePoint = ({
1976
+ carrierCode,
1977
+ countryCode,
1978
+ id
1979
+ }) => {
1980
+ const { client } = useShipEngine();
1981
+ return useQuery({
1982
+ enabled: !!carrierCode && !!countryCode && !!id,
1983
+ onError,
1984
+ queryFn: () => {
1985
+ if (carrierCode === void 0)
1986
+ return Promise.reject(new Error("carrierCode required"));
1987
+ if (countryCode === void 0)
1988
+ return Promise.reject(new Error("countryCode required"));
1989
+ if (id === void 0)
1990
+ return Promise.reject(new Error("id required"));
1991
+ return client.servicePoints.get({ carrierCode, countryCode, id });
1992
+ },
1993
+ queryKey: ["useGetServicePoint", carrierCode, countryCode, id],
1994
+ select: (result) => result.data
1995
+ });
1996
+ };
1997
+
1998
+ export { ShipEngine, ShipEngineContext, delay, logger, onError, retryUntil, useAddFunds, useAddInsuranceFunds, useCalculateRates, useConnectCarrier, useCreateAccountImage, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useDeactivateOrderSource, useDeleteAccountImage, useDeleteRateCard, useDeleteShippingRule, useDeleteWarehouse, useDownloadRateCard, useEditShippingRule, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountImages, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCarrierConnectionForm, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetFundingSourceTransactions, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicePoint, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetShippingRuleById, useGetShippingRuleConditionsOptions, useGetThemeById, useGetZonesByCarrier, useListCarrierConnections, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListServicePoints, 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": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {