rerobe-js-orm 4.1.6 → 4.1.7
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.
|
@@ -611,7 +611,7 @@ class ReRobeProductHelpers {
|
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
613
|
static convertToGoogleMerchantCenterProduct(productObj, merchantObj) {
|
|
614
|
-
const { primaryDomain, currency
|
|
614
|
+
const { primaryDomain, currency } = merchantObj;
|
|
615
615
|
const availabilityMapper = (status) => {
|
|
616
616
|
if (!status)
|
|
617
617
|
return 'out of stock';
|
|
@@ -677,13 +677,30 @@ class ReRobeProductHelpers {
|
|
|
677
677
|
return 'unisex';
|
|
678
678
|
}
|
|
679
679
|
};
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
})), (productObj.isOnSale === 'yes' &&
|
|
680
|
+
const isOnSale = productObj.status === product_constants_1.PRODUCT_STATES.clearance &&
|
|
681
|
+
productObj.isOnSale === 'yes' &&
|
|
683
682
|
productObj.salePrice &&
|
|
684
|
-
productObj.clearanceTimestamp
|
|
685
|
-
|
|
686
|
-
|
|
683
|
+
productObj.clearanceTimestamp;
|
|
684
|
+
return {
|
|
685
|
+
id: productObj.documentId,
|
|
686
|
+
title: productObj.metaDataTitle || productObj.title,
|
|
687
|
+
description: productObj.description || '',
|
|
688
|
+
link: `${primaryDomain}/products/${productObj.handle}`,
|
|
689
|
+
image_link: productObj.imageUrls && productObj.imageUrls.length > 0 ? productObj.imageUrls[0] : '',
|
|
690
|
+
price: `${Number(productObj.price).toFixed(2)} ${currency}`,
|
|
691
|
+
cost_of_goods_sold: productObj.costPerItem
|
|
692
|
+
? `${Number(productObj.costPerItem).toFixed(2)} ${currency}`
|
|
693
|
+
: undefined,
|
|
694
|
+
sale_price: isOnSale ? `${Number(productObj.salePrice).toFixed(2)} ${currency}` : undefined,
|
|
695
|
+
brand: productObj.brand || 'Unknown',
|
|
696
|
+
condition: conditionMapper(productObj.condition),
|
|
697
|
+
availability: availabilityMapper(productObj.status),
|
|
698
|
+
gender: genderMapper(productObj.gender),
|
|
699
|
+
age_group: ageGroupMapper(productObj.primaryAgeCategory),
|
|
700
|
+
color: productObj.color || 'various',
|
|
701
|
+
size: productObj.standardSize || 'unknown',
|
|
702
|
+
material: this.materialCompJoinedString(productObj.materialComposition),
|
|
703
|
+
};
|
|
687
704
|
}
|
|
688
705
|
}
|
|
689
706
|
exports.default = ReRobeProductHelpers;
|
|
@@ -363,9 +363,9 @@ type GoogleMerchantCenterProductObj = {
|
|
|
363
363
|
color: string;
|
|
364
364
|
size: string;
|
|
365
365
|
material: string;
|
|
366
|
-
style
|
|
367
|
-
weight
|
|
368
|
-
weight_unit
|
|
366
|
+
style?: string;
|
|
367
|
+
weight?: number;
|
|
368
|
+
weight_unit?: string;
|
|
369
369
|
mpn?: string;
|
|
370
370
|
gtin?: string;
|
|
371
371
|
item_group_id?: string;
|