rerobe-js-orm 4.3.5 → 4.3.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.
@@ -16,7 +16,6 @@ export namespace ADMIN_DRIVEN_STATES {
16
16
  const pendingPublication: string;
17
17
  const listed: string;
18
18
  const availableInStore: string;
19
- const merchantDonated: string;
20
19
  }
21
20
  export namespace ADMIN_ACTION_DRIVEN_STATES {
22
21
  const accepted: string;
@@ -26,6 +25,7 @@ export namespace ADMIN_ACTION_DRIVEN_STATES {
26
25
  const soldSellerPaid: string;
27
26
  const liquidationReady: string;
28
27
  const sellerLiquidated: string;
28
+ const merchantDonated: string;
29
29
  }
30
30
  export namespace SYSTEM_DRIVEN_STATES {
31
31
  const sold: string;
@@ -19,8 +19,7 @@ exports.ADMIN_DRIVEN_STATES = {
19
19
  pendingPublication: 'PENDING_PUBLICATION',
20
20
  listed: 'LISTED',
21
21
  availableInStore: 'AVAILABLE_IN_STORE',
22
- merchantDonated: 'MERCHANT_DONATED',
23
- }; // 8
22
+ }; // 7
24
23
  exports.ADMIN_ACTION_DRIVEN_STATES = {
25
24
  accepted: 'ACCEPTED',
26
25
  rejected: 'REJECTED',
@@ -29,7 +28,8 @@ exports.ADMIN_ACTION_DRIVEN_STATES = {
29
28
  soldSellerPaid: 'SOLD_SELLER_PAID',
30
29
  liquidationReady: 'LIQUIDATION_READY',
31
30
  sellerLiquidated: 'SELLER_LIQUIDATED',
32
- }; // 7
31
+ merchantDonated: 'MERCHANT_DONATED',
32
+ }; // 8
33
33
  exports.SYSTEM_DRIVEN_STATES = {
34
34
  sold: 'SOLD',
35
35
  soldSellerSelfPay: 'SOLD_SELLER_SELF_PAY',
@@ -93,7 +93,7 @@ exports.PRODUCT_STATE_LABELS = {
93
93
  qualityControl: 'In quality control',
94
94
  pendingPublication: 'Pending publication',
95
95
  listed: 'Published for sale',
96
- hold: 'Published-on hold by merchant for a potential customer',
96
+ hold: 'Hold for now',
97
97
  clearance: 'On clearance',
98
98
  reserved: 'In a shopping cart',
99
99
  sold: 'Sold—return period open',
@@ -127,7 +127,7 @@ exports.PRODUCT_STATE_LABELS_ADMIN_VIEW = {
127
127
  qualityControl: 'In quality control',
128
128
  pendingPublication: 'Pending publication',
129
129
  listed: 'Published for sale',
130
- hold: 'Published-on hold by merchant for a potential customer',
130
+ hold: 'On hold',
131
131
  clearance: 'On clearance',
132
132
  reserved: 'In a shopping cart',
133
133
  sold: 'Sold—return period open',
@@ -29,6 +29,6 @@ export default class ReRobeProductHelpers {
29
29
  static mapToOldSizesToStandardSize(productObj: CompleteProduct): string;
30
30
  static buildLineItem(productObj: CompleteProduct, quantity?: number): ProductLineItem;
31
31
  static productStatusPretty(status: string): any;
32
- static convertToGoogleMerchantCenterProduct(productObj: CompleteProduct, merchantObj: MerchantObj): GoogleMerchantCenterProductObj;
33
- static convertToMetaCommerceProduct(productObj: CompleteProduct, merchantObj: MerchantObj): MetaCommerceProductObj;
32
+ static convertToGoogleMerchantCenterProduct(productObj: CompleteProduct, merchantObj: MerchantObj, targetMarketTaxRate?: number): GoogleMerchantCenterProductObj;
33
+ static convertToMetaCommerceProduct(productObj: CompleteProduct, merchantObj: MerchantObj, targetMarketTaxRate?: number): MetaCommerceProductObj;
34
34
  }
@@ -644,7 +644,7 @@ class ReRobeProductHelpers {
644
644
  return product_constants_1.PRODUCT_STATE_LABELS[toCamelCase(status)] || status;
645
645
  }
646
646
  }
647
- static convertToGoogleMerchantCenterProduct(productObj, merchantObj) {
647
+ static convertToGoogleMerchantCenterProduct(productObj, merchantObj, targetMarketTaxRate = 0) {
648
648
  const { primaryDomain, currency } = merchantObj;
649
649
  const availabilityMapper = (status) => {
650
650
  if (!status)
@@ -705,13 +705,17 @@ class ReRobeProductHelpers {
705
705
  productObj.isOnSale === 'yes' &&
706
706
  productObj.salePrice &&
707
707
  productObj.clearanceTimestamp;
708
+ let price = Number(productObj.price).toFixed(2);
709
+ if (targetMarketTaxRate && productObj.isTaxable === 'yes') {
710
+ price = (Number(productObj.price) * (1 + targetMarketTaxRate)).toFixed(2);
711
+ }
708
712
  return {
709
713
  id: productObj.documentId,
710
714
  title: productObj.metaDataTitle || productObj.title,
711
715
  description: productObj.description || '',
712
716
  link: `https://${primaryDomain}/products/${productObj.handle}`,
713
717
  image_link: productObj.imageUrls && productObj.imageUrls.length > 0 ? productObj.imageUrls[0] : '',
714
- price: `${Number(productObj.price).toFixed(2)} ${currency}`,
718
+ price: `${price} ${currency}`,
715
719
  cost_of_goods_sold: productObj.costPerItem
716
720
  ? `${Number(productObj.costPerItem).toFixed(2)} ${currency}`
717
721
  : undefined,
@@ -727,7 +731,7 @@ class ReRobeProductHelpers {
727
731
  identifier_exists: 'no',
728
732
  };
729
733
  }
730
- static convertToMetaCommerceProduct(productObj, merchantObj) {
734
+ static convertToMetaCommerceProduct(productObj, merchantObj, targetMarketTaxRate = 0) {
731
735
  const { primaryDomain, currency } = merchantObj;
732
736
  const availabilityMapper = (status) => {
733
737
  if (!status)
@@ -786,13 +790,17 @@ class ReRobeProductHelpers {
786
790
  productObj.isOnSale === 'yes' &&
787
791
  productObj.salePrice &&
788
792
  productObj.clearanceTimestamp;
793
+ let price = Number(productObj.price).toFixed(2);
794
+ if (targetMarketTaxRate && productObj.isTaxable === 'yes') {
795
+ price = (Number(productObj.price) * (1 + targetMarketTaxRate)).toFixed(2);
796
+ }
789
797
  return {
790
798
  id: productObj.documentId,
791
799
  title: productObj.metaDataTitle || productObj.title,
792
800
  description: productObj.metaDataDescription || this.autoCreateMetaDescription(productObj),
793
801
  availability: availabilityMapper(productObj.status),
794
802
  condition: 'used',
795
- price: `${Number(productObj.price).toFixed(2)} ${currency}`,
803
+ price: `${price} ${currency}`,
796
804
  link: `https://${primaryDomain}/products/${productObj.handle}`,
797
805
  image_link: productObj.imageUrls && productObj.imageUrls.length > 0 ? productObj.imageUrls[0] : '',
798
806
  sale_price: isOnSale ? `${Number(productObj.salePrice).toFixed(2)} ${currency}` : undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "4.3.5",
3
+ "version": "4.3.7",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",