@shipengine/react-api 0.12.0 → 0.13.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
@@ -28,6 +28,7 @@ export * from "./use-list-order-sources";
28
28
  export * from "./use-list-rate-cards";
29
29
  export * from "./use-list-sales-order-shipments";
30
30
  export * from "./use-list-sales-orders";
31
+ export * from "./use-list-shipments";
31
32
  export * from "./use-list-warehouses";
32
33
  export * from "./use-notify-sales-order";
33
34
  export * from "./use-parse-address";
@@ -7,7 +7,4 @@ export type CreateShipmentData = {
7
7
  *
8
8
  * @see [ShipEngine Developer Docs](https://shipengine.github.io/shipengine-openapi/#operation/create_shipments)
9
9
  */
10
- export declare const useCreateShipment: () => import("react-query").UseMutationResult<{
11
- has_errors: boolean;
12
- shipments: SE.Shipment[];
13
- }, SE.CodedError[], CreateShipmentData, unknown>;
10
+ export declare const useCreateShipment: () => import("react-query").UseMutationResult<import("@shipengine/js-api").CreateShipmentResult, SE.CodedError[], CreateShipmentData, unknown>;
@@ -0,0 +1,7 @@
1
+ import { ListShipmentOptions } from "@shipengine/js-api";
2
+ /**
3
+ * @category ShipEngine API Hooks
4
+ */
5
+ export declare const useListShipments: (_params?: ListShipmentOptions & {
6
+ enabled?: boolean;
7
+ }) => import("react-query").UseQueryResult<import("@shipengine/js-api").ListShipmentResult, 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$6 = Object.getOwnPropertySymbols;
69
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
70
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
68
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
69
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
70
+ var __propIsEnum$7 = 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$6.call(b, prop))
74
+ if (__hasOwnProp$7.call(b, prop))
75
75
  __defNormalProp$1(a, prop, b[prop]);
76
- if (__getOwnPropSymbols$6)
77
- for (var prop of __getOwnPropSymbols$6(b)) {
78
- if (__propIsEnum$6.call(b, prop))
76
+ if (__getOwnPropSymbols$7)
77
+ for (var prop of __getOwnPropSymbols$7(b)) {
78
+ if (__propIsEnum$7.call(b, prop))
79
79
  __defNormalProp$1(a, prop, b[prop]);
80
80
  }
81
81
  return a;
@@ -242,17 +242,17 @@ const useCreateFundingSource = () => {
242
242
  });
243
243
  };
244
244
 
245
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
246
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
247
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
248
- var __objRest$4 = (source, exclude) => {
245
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
246
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
247
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
248
+ var __objRest$5 = (source, exclude) => {
249
249
  var target = {};
250
250
  for (var prop in source)
251
- if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
251
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
252
252
  target[prop] = source[prop];
253
- if (source != null && __getOwnPropSymbols$5)
254
- for (var prop of __getOwnPropSymbols$5(source)) {
255
- if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
253
+ if (source != null && __getOwnPropSymbols$6)
254
+ for (var prop of __getOwnPropSymbols$6(source)) {
255
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
256
256
  target[prop] = source[prop];
257
257
  }
258
258
  return target;
@@ -281,7 +281,7 @@ const useCreateLabel = () => {
281
281
  const { client } = useShipEngine();
282
282
  return reactQuery.useMutation({
283
283
  mutationFn: (_a) => __async$g(void 0, null, function* () {
284
- var _b = _a, { rateId } = _b, options = __objRest$4(_b, ["rateId"]);
284
+ var _b = _a, { rateId } = _b, options = __objRest$5(_b, ["rateId"]);
285
285
  const result = yield client.labels.createByRateId(rateId, options);
286
286
  return result.data;
287
287
  }),
@@ -322,17 +322,17 @@ const useCreateRateCard = () => {
322
322
  });
323
323
  };
324
324
 
325
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
326
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
327
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
328
- var __objRest$3 = (source, exclude) => {
325
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
326
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
327
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
328
+ var __objRest$4 = (source, exclude) => {
329
329
  var target = {};
330
330
  for (var prop in source)
331
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
331
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
332
332
  target[prop] = source[prop];
333
- if (source != null && __getOwnPropSymbols$4)
334
- for (var prop of __getOwnPropSymbols$4(source)) {
335
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
333
+ if (source != null && __getOwnPropSymbols$5)
334
+ for (var prop of __getOwnPropSymbols$5(source)) {
335
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
336
336
  target[prop] = source[prop];
337
337
  }
338
338
  return target;
@@ -361,7 +361,7 @@ const useCreateSalesOrderShipment = () => {
361
361
  const { client } = useShipEngine();
362
362
  return reactQuery.useMutation({
363
363
  mutationFn: (_a) => __async$e(void 0, null, function* () {
364
- var _b = _a, { salesOrderId } = _b, shipment = __objRest$3(_b, ["salesOrderId"]);
364
+ var _b = _a, { salesOrderId } = _b, shipment = __objRest$4(_b, ["salesOrderId"]);
365
365
  const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
366
366
  return result.data;
367
367
  }),
@@ -373,17 +373,17 @@ const useCreateSalesOrderShipment = () => {
373
373
  var __defProp = Object.defineProperty;
374
374
  var __defProps = Object.defineProperties;
375
375
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
376
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
377
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
378
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
376
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
377
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
378
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
379
379
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
380
380
  var __spreadValues = (a, b) => {
381
381
  for (var prop in b || (b = {}))
382
- if (__hasOwnProp$3.call(b, prop))
382
+ if (__hasOwnProp$4.call(b, prop))
383
383
  __defNormalProp(a, prop, b[prop]);
384
- if (__getOwnPropSymbols$3)
385
- for (var prop of __getOwnPropSymbols$3(b)) {
386
- if (__propIsEnum$3.call(b, prop))
384
+ if (__getOwnPropSymbols$4)
385
+ for (var prop of __getOwnPropSymbols$4(b)) {
386
+ if (__propIsEnum$4.call(b, prop))
387
387
  __defNormalProp(a, prop, b[prop]);
388
388
  }
389
389
  return a;
@@ -769,6 +769,33 @@ const useListSalesOrders = (params = {}) => {
769
769
  });
770
770
  };
771
771
 
772
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
773
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
774
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
775
+ var __objRest$3 = (source, exclude) => {
776
+ var target = {};
777
+ for (var prop in source)
778
+ if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
779
+ target[prop] = source[prop];
780
+ if (source != null && __getOwnPropSymbols$3)
781
+ for (var prop of __getOwnPropSymbols$3(source)) {
782
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
783
+ target[prop] = source[prop];
784
+ }
785
+ return target;
786
+ };
787
+ const useListShipments = (_params) => {
788
+ const _a = _params || {}, { enabled = true } = _a, params = __objRest$3(_a, ["enabled"]);
789
+ const { client } = useShipEngine();
790
+ return reactQuery.useQuery({
791
+ enabled,
792
+ onError,
793
+ queryFn: () => client.shipments.list(params),
794
+ queryKey: ["useListShipments", params],
795
+ select: (result) => result.data
796
+ });
797
+ };
798
+
772
799
  const useListWarehouses = (options) => {
773
800
  var _a;
774
801
  const { client } = useShipEngine();
@@ -1264,6 +1291,7 @@ exports.useListOrderSources = useListOrderSources;
1264
1291
  exports.useListRateCards = useListRateCards;
1265
1292
  exports.useListSalesOrderShipments = useListSalesOrderShipments;
1266
1293
  exports.useListSalesOrders = useListSalesOrders;
1294
+ exports.useListShipments = useListShipments;
1267
1295
  exports.useListWarehouses = useListWarehouses;
1268
1296
  exports.useNotifySalesOrderShipped = useNotifySalesOrderShipped;
1269
1297
  exports.useParseAddress = useParseAddress;
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$6 = Object.getOwnPropertySymbols;
66
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
67
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
65
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
66
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
67
+ var __propIsEnum$7 = 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$6.call(b, prop))
71
+ if (__hasOwnProp$7.call(b, prop))
72
72
  __defNormalProp$1(a, prop, b[prop]);
73
- if (__getOwnPropSymbols$6)
74
- for (var prop of __getOwnPropSymbols$6(b)) {
75
- if (__propIsEnum$6.call(b, prop))
73
+ if (__getOwnPropSymbols$7)
74
+ for (var prop of __getOwnPropSymbols$7(b)) {
75
+ if (__propIsEnum$7.call(b, prop))
76
76
  __defNormalProp$1(a, prop, b[prop]);
77
77
  }
78
78
  return a;
@@ -239,17 +239,17 @@ const useCreateFundingSource = () => {
239
239
  });
240
240
  };
241
241
 
242
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
243
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
244
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
245
- var __objRest$4 = (source, exclude) => {
242
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
243
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
244
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
245
+ var __objRest$5 = (source, exclude) => {
246
246
  var target = {};
247
247
  for (var prop in source)
248
- if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
248
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
249
249
  target[prop] = source[prop];
250
- if (source != null && __getOwnPropSymbols$5)
251
- for (var prop of __getOwnPropSymbols$5(source)) {
252
- if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
250
+ if (source != null && __getOwnPropSymbols$6)
251
+ for (var prop of __getOwnPropSymbols$6(source)) {
252
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
253
253
  target[prop] = source[prop];
254
254
  }
255
255
  return target;
@@ -278,7 +278,7 @@ const useCreateLabel = () => {
278
278
  const { client } = useShipEngine();
279
279
  return useMutation({
280
280
  mutationFn: (_a) => __async$g(void 0, null, function* () {
281
- var _b = _a, { rateId } = _b, options = __objRest$4(_b, ["rateId"]);
281
+ var _b = _a, { rateId } = _b, options = __objRest$5(_b, ["rateId"]);
282
282
  const result = yield client.labels.createByRateId(rateId, options);
283
283
  return result.data;
284
284
  }),
@@ -319,17 +319,17 @@ const useCreateRateCard = () => {
319
319
  });
320
320
  };
321
321
 
322
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
323
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
324
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
325
- var __objRest$3 = (source, exclude) => {
322
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
323
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
324
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
325
+ var __objRest$4 = (source, exclude) => {
326
326
  var target = {};
327
327
  for (var prop in source)
328
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
328
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
329
329
  target[prop] = source[prop];
330
- if (source != null && __getOwnPropSymbols$4)
331
- for (var prop of __getOwnPropSymbols$4(source)) {
332
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
330
+ if (source != null && __getOwnPropSymbols$5)
331
+ for (var prop of __getOwnPropSymbols$5(source)) {
332
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
333
333
  target[prop] = source[prop];
334
334
  }
335
335
  return target;
@@ -358,7 +358,7 @@ const useCreateSalesOrderShipment = () => {
358
358
  const { client } = useShipEngine();
359
359
  return useMutation({
360
360
  mutationFn: (_a) => __async$e(void 0, null, function* () {
361
- var _b = _a, { salesOrderId } = _b, shipment = __objRest$3(_b, ["salesOrderId"]);
361
+ var _b = _a, { salesOrderId } = _b, shipment = __objRest$4(_b, ["salesOrderId"]);
362
362
  const result = yield client.salesOrderShipments.create(salesOrderId, shipment);
363
363
  return result.data;
364
364
  }),
@@ -370,17 +370,17 @@ const useCreateSalesOrderShipment = () => {
370
370
  var __defProp = Object.defineProperty;
371
371
  var __defProps = Object.defineProperties;
372
372
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
373
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
374
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
375
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
373
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
374
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
375
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
376
376
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
377
377
  var __spreadValues = (a, b) => {
378
378
  for (var prop in b || (b = {}))
379
- if (__hasOwnProp$3.call(b, prop))
379
+ if (__hasOwnProp$4.call(b, prop))
380
380
  __defNormalProp(a, prop, b[prop]);
381
- if (__getOwnPropSymbols$3)
382
- for (var prop of __getOwnPropSymbols$3(b)) {
383
- if (__propIsEnum$3.call(b, prop))
381
+ if (__getOwnPropSymbols$4)
382
+ for (var prop of __getOwnPropSymbols$4(b)) {
383
+ if (__propIsEnum$4.call(b, prop))
384
384
  __defNormalProp(a, prop, b[prop]);
385
385
  }
386
386
  return a;
@@ -766,6 +766,33 @@ const useListSalesOrders = (params = {}) => {
766
766
  });
767
767
  };
768
768
 
769
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
770
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
771
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
772
+ var __objRest$3 = (source, exclude) => {
773
+ var target = {};
774
+ for (var prop in source)
775
+ if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
776
+ target[prop] = source[prop];
777
+ if (source != null && __getOwnPropSymbols$3)
778
+ for (var prop of __getOwnPropSymbols$3(source)) {
779
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
780
+ target[prop] = source[prop];
781
+ }
782
+ return target;
783
+ };
784
+ const useListShipments = (_params) => {
785
+ const _a = _params || {}, { enabled = true } = _a, params = __objRest$3(_a, ["enabled"]);
786
+ const { client } = useShipEngine();
787
+ return useQuery({
788
+ enabled,
789
+ onError,
790
+ queryFn: () => client.shipments.list(params),
791
+ queryKey: ["useListShipments", params],
792
+ select: (result) => result.data
793
+ });
794
+ };
795
+
769
796
  const useListWarehouses = (options) => {
770
797
  var _a;
771
798
  const { client } = useShipEngine();
@@ -1224,4 +1251,4 @@ const useVoidLabel = () => {
1224
1251
  });
1225
1252
  };
1226
1253
 
1227
- export { ShipEngine, ShipEngineContext, delay, logger, onError, retryUntil, useAddFunds, useCalculateRates, useConnectCarrier, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateWarehouse, useDeleteWarehouse, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetInsuranceAccount, useGetLabel, useGetSalesOrder, useGetSalesOrderShipment, useGetShipment, useGetShipmentRates, useGetWalletHistory, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListWarehouses, useNotifySalesOrderShipped, useParseAddress, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateSalesOrderShipment, useUpdateWarehouse, useValidateAddresses, useVoidLabel };
1254
+ export { ShipEngine, ShipEngineContext, delay, logger, onError, retryUntil, useAddFunds, useCalculateRates, useConnectCarrier, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateWarehouse, useDeleteWarehouse, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetInsuranceAccount, useGetLabel, useGetSalesOrder, useGetSalesOrderShipment, useGetShipment, useGetShipmentRates, useGetWalletHistory, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListWarehouses, useNotifySalesOrderShipped, useParseAddress, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateSalesOrderShipment, useUpdateWarehouse, useValidateAddresses, useVoidLabel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/react-api",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {