rerobe-js-orm 4.6.9 → 4.7.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/lib/models/Order.js +23 -9
- package/package.json +1 -1
package/lib/models/Order.js
CHANGED
|
@@ -439,15 +439,29 @@ class Order extends Base_1.default {
|
|
|
439
439
|
return num.toFixed(2);
|
|
440
440
|
};
|
|
441
441
|
const lineItems = (this.lineItems || []).map((item) => {
|
|
442
|
-
var _a, _b;
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
(
|
|
447
|
-
item.
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
442
|
+
var _a, _b, _c, _d;
|
|
443
|
+
const shopifyVariantId = item.shopifyVariantId || ((_a = item.variant) === null || _a === void 0 ? void 0 : _a.shopifyId) || item.shopifyProductId || ((_b = item.variant) === null || _b === void 0 ? void 0 : _b.id);
|
|
444
|
+
if (shopifyVariantId)
|
|
445
|
+
return {
|
|
446
|
+
quantity: Number(item.quantity || 1),
|
|
447
|
+
variantId: item.shopifyVariantId ||
|
|
448
|
+
((_c = item.variant) === null || _c === void 0 ? void 0 : _c.shopifyId) ||
|
|
449
|
+
item.shopifyProductId ||
|
|
450
|
+
((_d = item.variant) === null || _d === void 0 ? void 0 : _d.id) ||
|
|
451
|
+
'',
|
|
452
|
+
};
|
|
453
|
+
else
|
|
454
|
+
return {
|
|
455
|
+
title: item.title,
|
|
456
|
+
originalUnitPriceWithCurrency: item.originalUnitPrice,
|
|
457
|
+
quantity: item.quantity,
|
|
458
|
+
weight: item.variant
|
|
459
|
+
? {
|
|
460
|
+
value: item.variant.weight,
|
|
461
|
+
unit: 'GRAMS',
|
|
462
|
+
}
|
|
463
|
+
: undefined,
|
|
464
|
+
};
|
|
451
465
|
});
|
|
452
466
|
const tagsArray = Array.isArray(this.tags)
|
|
453
467
|
? this.tags
|