rerobe-js-orm 4.1.5 → 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.
@@ -230,7 +230,7 @@ class ReRobeProductHelpers {
230
230
  }, '');
231
231
  }
232
232
  static autoCreateMetaDataTitle(productObj) {
233
- const { color, productType, productStyle, brand, size } = productObj;
233
+ const { color, productType, productStyle, brand, size, standardSize } = productObj;
234
234
  // Singularize the product type
235
235
  const singularProductType = (0, Utilities_1.singularizeProductType)(productType);
236
236
  // Function to build the title
@@ -250,7 +250,9 @@ class ReRobeProductHelpers {
250
250
  // For non-'Vintage' brands, append "by ${brand.trim()}"
251
251
  const titleWithBrand = !brand.includes('Vintage') ? `${baseTitle} by ${brand.trim()}` : baseTitle;
252
252
  // Add size to the end of the title if it's available
253
- return size && size.trim() !== '' ? `${titleWithBrand}, Size ${size.trim()}` : titleWithBrand;
253
+ return size && size.trim() !== ''
254
+ ? `${titleWithBrand}, Size ${standardSize ? standardSize.trim() : size.trim()}`
255
+ : titleWithBrand;
254
256
  };
255
257
  // Generate the result
256
258
  let result = buildTitle(true);
@@ -609,7 +611,7 @@ class ReRobeProductHelpers {
609
611
  }
610
612
  }
611
613
  static convertToGoogleMerchantCenterProduct(productObj, merchantObj) {
612
- const { primaryDomain, currency, industry } = merchantObj;
614
+ const { primaryDomain, currency } = merchantObj;
613
615
  const availabilityMapper = (status) => {
614
616
  if (!status)
615
617
  return 'out of stock';
@@ -675,13 +677,30 @@ class ReRobeProductHelpers {
675
677
  return 'unisex';
676
678
  }
677
679
  };
678
- return Object.assign(Object.assign(Object.assign({ id: productObj.handle, title: productObj.metaDataTitle || productObj.title, description: productObj.description || '', link: `${primaryDomain}/products/${productObj.handle}`, image_link: productObj.imageUrls && productObj.imageUrls.length > 0 ? productObj.imageUrls[0] : '', price: `${Number(productObj.price).toFixed(2)} ${currency}` }, (productObj.costPerItem && {
679
- cost_of_goods_sold: `${Number(productObj.costPerItem).toFixed(2)} ${currency}`,
680
- })), (productObj.isOnSale === 'yes' &&
680
+ const isOnSale = productObj.status === product_constants_1.PRODUCT_STATES.clearance &&
681
+ productObj.isOnSale === 'yes' &&
681
682
  productObj.salePrice &&
682
- productObj.clearanceTimestamp && {
683
- sale_price: `${Number(productObj.salePrice).toFixed(2)} ${currency}`,
684
- })), { brand: productObj.brand || 'Unknown', condition: conditionMapper(productObj.condition), availability: availabilityMapper(productObj.status), gender: genderMapper(productObj.gender), age_group: ageGroupMapper(productObj.primaryAgeCategory), color: productObj.color || 'various', size: productObj.standardSize || 'unknown', material: this.materialCompJoinedString(productObj.materialComposition) });
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
+ };
685
704
  }
686
705
  }
687
706
  exports.default = ReRobeProductHelpers;
@@ -363,9 +363,9 @@ type GoogleMerchantCenterProductObj = {
363
363
  color: string;
364
364
  size: string;
365
365
  material: string;
366
- style: string;
367
- weight: number;
368
- weight_unit: string;
366
+ style?: string;
367
+ weight?: number;
368
+ weight_unit?: string;
369
369
  mpn?: string;
370
370
  gtin?: string;
371
371
  item_group_id?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "4.1.5",
3
+ "version": "4.1.7",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",