@shipengine/react-api 1.14.0 → 2.0.1

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.
@@ -1,5 +1,9 @@
1
- import { SE } from "@shipengine/js-api";
1
+ import { CarrierAutoFundingSettings } from "@shipengine/js-api";
2
+ interface AutoFundingOptions extends CarrierAutoFundingSettings {
3
+ carrierId: string;
4
+ }
2
5
  /**
3
6
  * @category ShipEngine API Hooks
4
7
  */
5
- export declare const useUpdateAutoFunding: (carrierId: string) => import("@tanstack/react-query").UseMutationResult<SE.CarrierAutoFundingSettingsResponse, SE.CodedError[], SE.CarrierAutoFundingSettings, unknown>;
8
+ export declare const useUpdateAutoFunding: () => import("@tanstack/react-query").UseMutationResult<import("@shipengine/js-api").CarrierAutoFundingSettingsResponse, import("@shipengine/js-api").CodedError[], AutoFundingOptions, unknown>;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./use-get-carrier-connection-form";
2
+ export * from "./use-list-carriers";
@@ -0,0 +1,8 @@
1
+ import { GetCarrierConnectionFormParams } from "@shipengine/js-api";
2
+ /**
3
+ * @category ShipEngine API Hooks
4
+ */
5
+ export declare const useGetCarrierConnectionForm: (_params: GetCarrierConnectionFormParams & {
6
+ carrierName: string;
7
+ enabled?: boolean;
8
+ }) => import("@tanstack/react-query").UseQueryResult<import("@shipengine/js-api").GetCarrierConnectionFormResponse, import("@shipengine/js-api").CodedError[]>;
@@ -0,0 +1,7 @@
1
+ import { ListCarrierConnectionsParams } from "@shipengine/js-api";
2
+ /**
3
+ * @category ShipEngine API Hooks
4
+ */
5
+ export declare const useListCarrierConnections: (_params?: ListCarrierConnectionsParams & {
6
+ enabled?: boolean;
7
+ }) => import("@tanstack/react-query").UseQueryResult<import("@shipengine/js-api").ListCarrierConnectionsResponse, import("@shipengine/js-api").CodedError[]>;
@@ -4,4 +4,4 @@ import { PageableQuery, SortableQuery } from "@shipengine/js-api";
4
4
  */
5
5
  export declare const useGetFundingSourceTransactions: (fundingSourceId: string, params?: {
6
6
  category?: string;
7
- } & PageableQuery & SortableQuery<"amount" | "category">) => import("@tanstack/react-query").UseQueryResult<import("@shipengine/js-api").FundingSourceTransactionsResponse, unknown>;
7
+ } & PageableQuery & SortableQuery<"amount" | "category">) => import("@tanstack/react-query").UseQueryResult<import("@shipengine/js-api").FundingSourceTransactionsResponse, import("@shipengine/js-api").CodedError[]>;
package/hooks/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./account-settings";
2
2
  export * from "./addresses";
3
3
  export * from "./carriers";
4
+ export * from "./connections";
4
5
  export * from "./custom-packages";
5
6
  export * from "./funding-sources";
6
7
  export * from "./insurance";
package/index.js CHANGED
@@ -79,17 +79,17 @@ var o={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},l={};function a(e){r
79
79
  var __defProp$1 = Object.defineProperty;
80
80
  var __defProps$1 = Object.defineProperties;
81
81
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
82
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
83
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
84
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
82
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
83
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
84
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
85
85
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
86
86
  var __spreadValues$1 = (a, b) => {
87
87
  for (var prop in b || (b = {}))
88
- if (__hasOwnProp$8.call(b, prop))
88
+ if (__hasOwnProp$b.call(b, prop))
89
89
  __defNormalProp$1(a, prop, b[prop]);
90
- if (__getOwnPropSymbols$8)
91
- for (var prop of __getOwnPropSymbols$8(b)) {
92
- if (__propIsEnum$8.call(b, prop))
90
+ if (__getOwnPropSymbols$b)
91
+ for (var prop of __getOwnPropSymbols$b(b)) {
92
+ if (__propIsEnum$b.call(b, prop))
93
93
  __defNormalProp$1(a, prop, b[prop]);
94
94
  }
95
95
  return a;
@@ -514,6 +514,21 @@ const useListCarriers = () => {
514
514
  });
515
515
  };
516
516
 
517
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
518
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
519
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
520
+ var __objRest$9 = (source, exclude) => {
521
+ var target = {};
522
+ for (var prop in source)
523
+ if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
524
+ target[prop] = source[prop];
525
+ if (source != null && __getOwnPropSymbols$a)
526
+ for (var prop of __getOwnPropSymbols$a(source)) {
527
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
528
+ target[prop] = source[prop];
529
+ }
530
+ return target;
531
+ };
517
532
  var __async$p = (__this, __arguments, generator) => {
518
533
  return new Promise((resolve, reject) => {
519
534
  var fulfilled = (value) => {
@@ -534,18 +549,19 @@ var __async$p = (__this, __arguments, generator) => {
534
549
  step((generator = generator.apply(__this, __arguments)).next());
535
550
  });
536
551
  };
537
- const useUpdateAutoFunding = (carrierId) => {
552
+ const useUpdateAutoFunding = () => {
538
553
  const { client } = useShipEngine();
539
554
  const queryClient = reactQuery.useQueryClient();
540
555
  return reactQuery.useMutation({
541
- mutationFn: (options) => __async$p(void 0, null, function* () {
556
+ mutationFn: (_a) => __async$p(void 0, null, function* () {
557
+ var _b = _a, { carrierId } = _b, options = __objRest$9(_b, ["carrierId"]);
542
558
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
543
559
  return result.data;
544
560
  }),
545
561
  mutationKey: ["useUpdateAutoFunding"],
546
562
  onError,
547
- onSuccess: (_) => {
548
- queryClient.invalidateQueries(["useGetAutoFunding", carrierId], { exact: true });
563
+ onSuccess: () => {
564
+ queryClient.invalidateQueries(["useGetAutoFunding"]);
549
565
  }
550
566
  });
551
567
  };
@@ -567,6 +583,60 @@ const useGetZonesByCarrier = (carrierId) => {
567
583
  });
568
584
  };
569
585
 
586
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
587
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
588
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
589
+ var __objRest$8 = (source, exclude) => {
590
+ var target = {};
591
+ for (var prop in source)
592
+ if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
593
+ target[prop] = source[prop];
594
+ if (source != null && __getOwnPropSymbols$9)
595
+ for (var prop of __getOwnPropSymbols$9(source)) {
596
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
597
+ target[prop] = source[prop];
598
+ }
599
+ return target;
600
+ };
601
+ const useGetCarrierConnectionForm = (_params) => {
602
+ const { client } = useShipEngine();
603
+ const _a = _params || {}, { carrierName, enabled = true } = _a, params = __objRest$8(_a, ["carrierName", "enabled"]);
604
+ return reactQuery.useQuery({
605
+ enabled,
606
+ onError,
607
+ queryFn: () => client.connections.getCarrierConnectionForm(carrierName, params),
608
+ queryKey: ["useGetCarrierConnectionForm", params],
609
+ select: (result) => result.data
610
+ });
611
+ };
612
+
613
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
614
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
615
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
616
+ var __objRest$7 = (source, exclude) => {
617
+ var target = {};
618
+ for (var prop in source)
619
+ if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
620
+ target[prop] = source[prop];
621
+ if (source != null && __getOwnPropSymbols$8)
622
+ for (var prop of __getOwnPropSymbols$8(source)) {
623
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
624
+ target[prop] = source[prop];
625
+ }
626
+ return target;
627
+ };
628
+ const useListCarrierConnections = (_params) => {
629
+ const { client } = useShipEngine();
630
+ const _a = _params || {}, { enabled = true } = _a, params = __objRest$7(_a, ["enabled"]);
631
+ return reactQuery.useQuery({
632
+ enabled,
633
+ onError,
634
+ queryFn: () => client.connections.listCarriers(params),
635
+ queryKey: ["useListCarrierConnections", params],
636
+ select: (result) => result.data
637
+ });
638
+ };
639
+
570
640
  const useListCustomPackageTypes = () => {
571
641
  const { client } = useShipEngine();
572
642
  return reactQuery.useQuery({
@@ -748,6 +818,7 @@ const useGetFundingSourceTransactions = (fundingSourceId, params) => {
748
818
  return reactQuery.useQuery({
749
819
  enabled: !!fundingSourceId,
750
820
  keepPreviousData: true,
821
+ onError,
751
822
  queryFn: () => client.fundingSources.transactions(fundingSourceId, params),
752
823
  queryKey: ["useGetFundingSourceTransactions", fundingSourceId, params],
753
824
  select: (result) => result.data
@@ -1880,6 +1951,7 @@ exports.useGetAccountImages = useGetAccountImages;
1880
1951
  exports.useGetAccountSettings = useGetAccountSettings;
1881
1952
  exports.useGetAutoFundingConfiguration = useGetAutoFundingConfiguration;
1882
1953
  exports.useGetCarrierById = useGetCarrierById;
1954
+ exports.useGetCarrierConnectionForm = useGetCarrierConnectionForm;
1883
1955
  exports.useGetCountriesByCarrier = useGetCountriesByCarrier;
1884
1956
  exports.useGetCurrenciesByCarrier = useGetCurrenciesByCarrier;
1885
1957
  exports.useGetFundingSourceById = useGetFundingSourceById;
@@ -1898,6 +1970,7 @@ exports.useGetShippingRuleById = useGetShippingRuleById;
1898
1970
  exports.useGetShippingRuleConditionsOptions = useGetShippingRuleConditionsOptions;
1899
1971
  exports.useGetThemeById = useGetThemeById;
1900
1972
  exports.useGetZonesByCarrier = useGetZonesByCarrier;
1973
+ exports.useListCarrierConnections = useListCarrierConnections;
1901
1974
  exports.useListCarriers = useListCarriers;
1902
1975
  exports.useListCustomPackageTypes = useListCustomPackageTypes;
1903
1976
  exports.useListFundingSources = useListFundingSources;
package/index.mjs CHANGED
@@ -76,17 +76,17 @@ var o={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},l={};function a(e){r
76
76
  var __defProp$1 = Object.defineProperty;
77
77
  var __defProps$1 = Object.defineProperties;
78
78
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
79
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
80
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
81
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
79
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
80
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
81
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
82
82
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
83
83
  var __spreadValues$1 = (a, b) => {
84
84
  for (var prop in b || (b = {}))
85
- if (__hasOwnProp$8.call(b, prop))
85
+ if (__hasOwnProp$b.call(b, prop))
86
86
  __defNormalProp$1(a, prop, b[prop]);
87
- if (__getOwnPropSymbols$8)
88
- for (var prop of __getOwnPropSymbols$8(b)) {
89
- if (__propIsEnum$8.call(b, prop))
87
+ if (__getOwnPropSymbols$b)
88
+ for (var prop of __getOwnPropSymbols$b(b)) {
89
+ if (__propIsEnum$b.call(b, prop))
90
90
  __defNormalProp$1(a, prop, b[prop]);
91
91
  }
92
92
  return a;
@@ -511,6 +511,21 @@ const useListCarriers = () => {
511
511
  });
512
512
  };
513
513
 
514
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
515
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
516
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
517
+ var __objRest$9 = (source, exclude) => {
518
+ var target = {};
519
+ for (var prop in source)
520
+ if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
521
+ target[prop] = source[prop];
522
+ if (source != null && __getOwnPropSymbols$a)
523
+ for (var prop of __getOwnPropSymbols$a(source)) {
524
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
525
+ target[prop] = source[prop];
526
+ }
527
+ return target;
528
+ };
514
529
  var __async$p = (__this, __arguments, generator) => {
515
530
  return new Promise((resolve, reject) => {
516
531
  var fulfilled = (value) => {
@@ -531,18 +546,19 @@ var __async$p = (__this, __arguments, generator) => {
531
546
  step((generator = generator.apply(__this, __arguments)).next());
532
547
  });
533
548
  };
534
- const useUpdateAutoFunding = (carrierId) => {
549
+ const useUpdateAutoFunding = () => {
535
550
  const { client } = useShipEngine();
536
551
  const queryClient = useQueryClient();
537
552
  return useMutation({
538
- mutationFn: (options) => __async$p(void 0, null, function* () {
553
+ mutationFn: (_a) => __async$p(void 0, null, function* () {
554
+ var _b = _a, { carrierId } = _b, options = __objRest$9(_b, ["carrierId"]);
539
555
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
540
556
  return result.data;
541
557
  }),
542
558
  mutationKey: ["useUpdateAutoFunding"],
543
559
  onError,
544
- onSuccess: (_) => {
545
- queryClient.invalidateQueries(["useGetAutoFunding", carrierId], { exact: true });
560
+ onSuccess: () => {
561
+ queryClient.invalidateQueries(["useGetAutoFunding"]);
546
562
  }
547
563
  });
548
564
  };
@@ -564,6 +580,60 @@ const useGetZonesByCarrier = (carrierId) => {
564
580
  });
565
581
  };
566
582
 
583
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
584
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
585
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
586
+ var __objRest$8 = (source, exclude) => {
587
+ var target = {};
588
+ for (var prop in source)
589
+ if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
590
+ target[prop] = source[prop];
591
+ if (source != null && __getOwnPropSymbols$9)
592
+ for (var prop of __getOwnPropSymbols$9(source)) {
593
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
594
+ target[prop] = source[prop];
595
+ }
596
+ return target;
597
+ };
598
+ const useGetCarrierConnectionForm = (_params) => {
599
+ const { client } = useShipEngine();
600
+ const _a = _params || {}, { carrierName, enabled = true } = _a, params = __objRest$8(_a, ["carrierName", "enabled"]);
601
+ return useQuery({
602
+ enabled,
603
+ onError,
604
+ queryFn: () => client.connections.getCarrierConnectionForm(carrierName, params),
605
+ queryKey: ["useGetCarrierConnectionForm", params],
606
+ select: (result) => result.data
607
+ });
608
+ };
609
+
610
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
611
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
612
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
613
+ var __objRest$7 = (source, exclude) => {
614
+ var target = {};
615
+ for (var prop in source)
616
+ if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
617
+ target[prop] = source[prop];
618
+ if (source != null && __getOwnPropSymbols$8)
619
+ for (var prop of __getOwnPropSymbols$8(source)) {
620
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
621
+ target[prop] = source[prop];
622
+ }
623
+ return target;
624
+ };
625
+ const useListCarrierConnections = (_params) => {
626
+ const { client } = useShipEngine();
627
+ const _a = _params || {}, { enabled = true } = _a, params = __objRest$7(_a, ["enabled"]);
628
+ return useQuery({
629
+ enabled,
630
+ onError,
631
+ queryFn: () => client.connections.listCarriers(params),
632
+ queryKey: ["useListCarrierConnections", params],
633
+ select: (result) => result.data
634
+ });
635
+ };
636
+
567
637
  const useListCustomPackageTypes = () => {
568
638
  const { client } = useShipEngine();
569
639
  return useQuery({
@@ -745,6 +815,7 @@ const useGetFundingSourceTransactions = (fundingSourceId, params) => {
745
815
  return useQuery({
746
816
  enabled: !!fundingSourceId,
747
817
  keepPreviousData: true,
818
+ onError,
748
819
  queryFn: () => client.fundingSources.transactions(fundingSourceId, params),
749
820
  queryKey: ["useGetFundingSourceTransactions", fundingSourceId, params],
750
821
  select: (result) => result.data
@@ -1847,4 +1918,4 @@ const useUpdateAccountBillingPlan = () => {
1847
1918
  });
1848
1919
  };
1849
1920
 
1850
- export { ShipEngine, ShipEngineContext, delay, logger, onError, retryUntil, useAddFunds, useCalculateRates, useConnectCarrier, useCreateAccountImage, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useDeactivateOrderSource, 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, useGetThemeById, 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 };
1921
+ export { ShipEngine, ShipEngineContext, delay, logger, onError, retryUntil, useAddFunds, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/react-api",
3
- "version": "1.14.0",
3
+ "version": "2.0.1",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {