@azrico/webobject 1.5.46 → 1.5.48
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.
|
@@ -1501,7 +1501,6 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1501
1501
|
}
|
|
1502
1502
|
/* ----------------- maybe website sends the result as array ---------------- */
|
|
1503
1503
|
if (Array.isArray(result_object)) {
|
|
1504
|
-
if (depth > 0) return false; //avoid going too deep
|
|
1505
1504
|
var allResults = result_object.map(function (r) {
|
|
1506
1505
|
return Boolean(_this4.isResultValid(r, depth + 1));
|
|
1507
1506
|
});
|
|
@@ -1509,13 +1508,22 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1509
1508
|
return s === false;
|
|
1510
1509
|
}) == null;
|
|
1511
1510
|
}
|
|
1512
|
-
/* ----------------------------- check products ----------------------------- */
|
|
1513
|
-
|
|
1511
|
+
/* ----------------------------- check products/variations ----------------------------- */
|
|
1512
|
+
var varKeys = ["products", "variations"];
|
|
1513
|
+
for (var _i = 0, _varKeys = varKeys; _i < _varKeys.length; _i++) {
|
|
1514
|
+
var vk = _varKeys[_i];
|
|
1515
|
+
if (!(vk in result_object)) continue;
|
|
1514
1516
|
/**
|
|
1515
1517
|
* if one product is not valid the result is not valid
|
|
1516
1518
|
* but if all products are valid we still need to check the object itself
|
|
1517
1519
|
*/
|
|
1518
|
-
if (!this.isResultValid(result_object
|
|
1520
|
+
if (!this.isResultValid(result_object[vk], depth + 1)) return false;
|
|
1521
|
+
}
|
|
1522
|
+
if (result_object.order) {
|
|
1523
|
+
/**
|
|
1524
|
+
* if we get a order-products pair, checking the order is enough
|
|
1525
|
+
*/
|
|
1526
|
+
return this.isResultValid(result_object.order, depth + 1);
|
|
1519
1527
|
}
|
|
1520
1528
|
/* -------------------------- check if acknowledged ------------------------- */
|
|
1521
1529
|
if ((0, _object.object_isTrue)(result_object.acknowledged)) {
|