rerobe-js-orm 3.4.2 → 3.4.4
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/Product.js +36 -10
- package/package.json +1 -1
package/lib/models/Product.js
CHANGED
|
@@ -11,7 +11,7 @@ class Product extends Base_1.default {
|
|
|
11
11
|
title: (props === null || props === void 0 ? void 0 : props.title) || '',
|
|
12
12
|
description: (props === null || props === void 0 ? void 0 : props.description) || '',
|
|
13
13
|
coverPhotoUrl: (props === null || props === void 0 ? void 0 : props.coverPhotoUrl) || 'http://cdn.shopify.com/s/images/admin/no-image-compact.gif',
|
|
14
|
-
imageUrls: (props === null || props === void 0 ? void 0 : props.imageUrls)
|
|
14
|
+
imageUrls: this.utilities.sanitzeStringArr(props === null || props === void 0 ? void 0 : props.imageUrls),
|
|
15
15
|
price: (props === null || props === void 0 ? void 0 : props.price) || '',
|
|
16
16
|
shopifyId: (props === null || props === void 0 ? void 0 : props.shopifyId) || '',
|
|
17
17
|
handle: (props === null || props === void 0 ? void 0 : props.handle) || '',
|
|
@@ -50,14 +50,14 @@ class Product extends Base_1.default {
|
|
|
50
50
|
measurementCategory: (props === null || props === void 0 ? void 0 : props.measurementCategory) || '',
|
|
51
51
|
productCategory: (props === null || props === void 0 ? void 0 : props.productCategory) || '',
|
|
52
52
|
productType: (props === null || props === void 0 ? void 0 : props.productType) || '',
|
|
53
|
-
productStyle: (props === null || props === void 0 ? void 0 : props.productStyle) || [],
|
|
53
|
+
productStyle: this.utilities.sanitzeStringArr(props === null || props === void 0 ? void 0 : props.productStyle) || [],
|
|
54
54
|
materialComposition: (props === null || props === void 0 ? void 0 : props.materialComposition) || {},
|
|
55
55
|
priceRange: (props === null || props === void 0 ? void 0 : props.priceRange) || '',
|
|
56
56
|
condition: (props === null || props === void 0 ? void 0 : props.condition) || '',
|
|
57
57
|
measurements: (props === null || props === void 0 ? void 0 : props.measurements) || {},
|
|
58
|
-
featuredCollections: (props === null || props === void 0 ? void 0 : props.featuredCollections)
|
|
58
|
+
featuredCollections: this.utilities.sanitzeStringArr(props === null || props === void 0 ? void 0 : props.featuredCollections),
|
|
59
59
|
primaryAgeCategory: (props === null || props === void 0 ? void 0 : props.primaryAgeCategory) || '',
|
|
60
|
-
tags: (props === null || props === void 0 ? void 0 : props.tags) || [],
|
|
60
|
+
tags: this.utilities.sanitzeStringArr(props === null || props === void 0 ? void 0 : props.tags) || [],
|
|
61
61
|
};
|
|
62
62
|
this.consignmentAttributes = {
|
|
63
63
|
sellRequestImageUrls: (props === null || props === void 0 ? void 0 : props.sellRequestImageUrls) || [],
|
|
@@ -921,12 +921,38 @@ class Product extends Base_1.default {
|
|
|
921
921
|
const attributeKeys = Object.keys(this.attributes);
|
|
922
922
|
const filterAttributeKeys = Object.keys(this.filterAttributes);
|
|
923
923
|
const consignmentAttributeKeys = Object.keys(this.consignmentAttributes);
|
|
924
|
-
const timestampAttributeKeys = Object.keys(this.timestampAttributes);
|
|
925
|
-
const allKeys = [...attributeKeys, ...filterAttributeKeys, ...consignmentAttributeKeys
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
924
|
+
// const timestampAttributeKeys = Object.keys(this.timestampAttributes);
|
|
925
|
+
const allKeys = [...attributeKeys, ...filterAttributeKeys, ...consignmentAttributeKeys];
|
|
926
|
+
const restrictedKeys = ['documentId', 'merchantId', 'merchants'];
|
|
927
|
+
const systemManagedKeys = ['reservedBy', 'sellRequestId', 'rfidTag'];
|
|
928
|
+
const configurableAfterCreationKeys = ['editorAuthorizations', 'featuredCollections'];
|
|
929
|
+
const obsoleteKeys = ['clothingSize', 'jeanSize', 'shoeSize'];
|
|
930
|
+
const options = allKeys
|
|
931
|
+
.map((key) => {
|
|
932
|
+
if (key === 'reRobeCommission') {
|
|
933
|
+
return {
|
|
934
|
+
label: this.utilities.humanize('commission'),
|
|
935
|
+
value: key,
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
if (key === 'gender') {
|
|
939
|
+
return {
|
|
940
|
+
label: this.utilities.humanize('primarySegment'),
|
|
941
|
+
value: key,
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
if (key === 'compareAtPrice') {
|
|
945
|
+
return {
|
|
946
|
+
label: this.utilities.humanize('priceNew'),
|
|
947
|
+
value: key,
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
return {
|
|
951
|
+
label: this.utilities.humanize(key),
|
|
952
|
+
value: key,
|
|
953
|
+
};
|
|
954
|
+
})
|
|
955
|
+
.filter((obj) => ![...restrictedKeys, ...systemManagedKeys, ...configurableAfterCreationKeys, ...obsoleteKeys].includes(obj.value));
|
|
930
956
|
return options;
|
|
931
957
|
}
|
|
932
958
|
materialCompTagsArrayForShopify() {
|