@shipengine/elements 0.21.0 → 0.21.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.
Files changed (3) hide show
  1. package/index.cjs +7 -8
  2. package/index.js +7 -8
  3. package/package.json +3 -3
package/index.cjs CHANGED
@@ -13482,7 +13482,7 @@ var purchaseLabel = {
13482
13482
  fields: {
13483
13483
  addOns: "Add-Ons",
13484
13484
  contentDescription: "Contents Description",
13485
- confirmation: "Confirmation",
13485
+ confirmation: "Delivery Confirmation",
13486
13486
  dimensions: {
13487
13487
  length: "Length",
13488
13488
  width: "Width",
@@ -14740,8 +14740,12 @@ const usePendingShipment = ({
14740
14740
  } = reactApi.useCreateSalesOrderShipment();
14741
14741
  const pendingShipment = getPendingShipment(shipments);
14742
14742
  const defaultWarehouse = (_a = warehouses === null || warehouses === void 0 ? void 0 : warehouses.find(w => w.warehouseId === warehouseId)) !== null && _a !== void 0 ? _a : warehouses === null || warehouses === void 0 ? void 0 : warehouses[0];
14743
- // On page load, if no shipment exists, create a shipment.
14743
+ // On page load, check for a shipment and either call the onLoad callback or create a new shipment
14744
14744
  React.useEffect(() => {
14745
+ if (salesOrder && (shipments === null || shipments === void 0 ? void 0 : shipments.length)) {
14746
+ onLoad === null || onLoad === void 0 ? void 0 : onLoad(salesOrder, shipments, pendingShipment);
14747
+ return;
14748
+ }
14745
14749
  if (!salesOrder || !defaultWarehouse || !shipments || pendingShipment) return;
14746
14750
  if (isListShipmentsLoading || isListShipmentsValidating || isShipmentCreating) return;
14747
14751
  createShipment(Object.assign(Object.assign({
@@ -14760,12 +14764,7 @@ const usePendingShipment = ({
14760
14764
  }
14761
14765
  }]
14762
14766
  })).then(shipment => shipment && reloadShipments());
14763
- }, [createShipment, defaultWarehouse, isListShipmentsLoading, isListShipmentsValidating, isShipmentCreating, pendingShipment, reloadShipments, salesOrder, shipments, warehouseId]);
14764
- React.useEffect(() => {
14765
- if (salesOrder && shipments) {
14766
- onLoad === null || onLoad === void 0 ? void 0 : onLoad(salesOrder, shipments, pendingShipment);
14767
- }
14768
- }, [onLoad, pendingShipment, salesOrder, shipments]);
14767
+ }, [createShipment, defaultWarehouse, isListShipmentsLoading, isListShipmentsValidating, isShipmentCreating, onLoad, pendingShipment, reloadShipments, salesOrder, shipments, warehouseId]);
14769
14768
  const reloadPendingShipment = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
14770
14769
  const {
14771
14770
  data: shipments
package/index.js CHANGED
@@ -13449,7 +13449,7 @@ var purchaseLabel = {
13449
13449
  fields: {
13450
13450
  addOns: "Add-Ons",
13451
13451
  contentDescription: "Contents Description",
13452
- confirmation: "Confirmation",
13452
+ confirmation: "Delivery Confirmation",
13453
13453
  dimensions: {
13454
13454
  length: "Length",
13455
13455
  width: "Width",
@@ -14707,8 +14707,12 @@ const usePendingShipment = ({
14707
14707
  } = useCreateSalesOrderShipment();
14708
14708
  const pendingShipment = getPendingShipment(shipments);
14709
14709
  const defaultWarehouse = (_a = warehouses === null || warehouses === void 0 ? void 0 : warehouses.find(w => w.warehouseId === warehouseId)) !== null && _a !== void 0 ? _a : warehouses === null || warehouses === void 0 ? void 0 : warehouses[0];
14710
- // On page load, if no shipment exists, create a shipment.
14710
+ // On page load, check for a shipment and either call the onLoad callback or create a new shipment
14711
14711
  useEffect(() => {
14712
+ if (salesOrder && (shipments === null || shipments === void 0 ? void 0 : shipments.length)) {
14713
+ onLoad === null || onLoad === void 0 ? void 0 : onLoad(salesOrder, shipments, pendingShipment);
14714
+ return;
14715
+ }
14712
14716
  if (!salesOrder || !defaultWarehouse || !shipments || pendingShipment) return;
14713
14717
  if (isListShipmentsLoading || isListShipmentsValidating || isShipmentCreating) return;
14714
14718
  createShipment(Object.assign(Object.assign({
@@ -14727,12 +14731,7 @@ const usePendingShipment = ({
14727
14731
  }
14728
14732
  }]
14729
14733
  })).then(shipment => shipment && reloadShipments());
14730
- }, [createShipment, defaultWarehouse, isListShipmentsLoading, isListShipmentsValidating, isShipmentCreating, pendingShipment, reloadShipments, salesOrder, shipments, warehouseId]);
14731
- useEffect(() => {
14732
- if (salesOrder && shipments) {
14733
- onLoad === null || onLoad === void 0 ? void 0 : onLoad(salesOrder, shipments, pendingShipment);
14734
- }
14735
- }, [onLoad, pendingShipment, salesOrder, shipments]);
14734
+ }, [createShipment, defaultWarehouse, isListShipmentsLoading, isListShipmentsValidating, isShipmentCreating, onLoad, pendingShipment, reloadShipments, salesOrder, shipments, warehouseId]);
14736
14735
  const reloadPendingShipment = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
14737
14736
  const {
14738
14737
  data: shipments
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "typedoc": {
5
5
  "entryPoint": "./src/index.ts",
6
6
  "readmeFile": "../../README.md",
@@ -31,8 +31,8 @@
31
31
  "@hookform/resolvers": "2.9.1",
32
32
  "@packlink/brands": "3.24.0",
33
33
  "@packlink/giger-theme": "1.3.1",
34
- "@shipengine/js-api": "0.6.1",
35
- "@shipengine/react-api": "0.4.2",
34
+ "@shipengine/js-api": "0.6.2",
35
+ "@shipengine/react-api": "0.4.7",
36
36
  "@storybook/manager-api": "7.0.0-rc.1",
37
37
  "@storybook/theming": "7.0.0-rc.1",
38
38
  "axios": "0.26.1",