@shipengine/elements 0.21.0 → 0.21.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.
- package/index.cjs +6 -7
- package/index.js +6 -7
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -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,
|
|
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
|
@@ -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,
|
|
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.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"typedoc": {
|
|
5
5
|
"entryPoint": "./src/index.ts",
|
|
6
6
|
"readmeFile": "../../README.md",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@packlink/brands": "3.24.0",
|
|
33
33
|
"@packlink/giger-theme": "1.3.1",
|
|
34
34
|
"@shipengine/js-api": "0.6.1",
|
|
35
|
-
"@shipengine/react-api": "0.4.
|
|
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",
|