@nuskin/cs-product-lib 1.7.0-it-40382.1 → 1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/cs-product-lib",
3
- "version": "1.7.0-it-40382.1",
3
+ "version": "1.7.0",
4
4
  "description": "Library for pulling and parsing product content (and applying business logic) retrieved from Contentstack",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/csProduct.js CHANGED
@@ -307,6 +307,7 @@ const csProduct = (props) => {
307
307
  productBundle.scan_qualified_count = skuKit[0].scan_qualified_count
308
308
  productBundle.tax_class = skuKit[0].tax_class
309
309
  productBundle.unit_price = skuKit[0].unit_price
310
+ productBundle.shipping_restricted_countries = skuKit[0].shipping_restricted_countries
310
311
  productBundle.title = skuKit[0].title
311
312
  productBundle.uid = skuKit[0].uid
312
313
  productBundle.whlpricedis = discounts.wholesaleDiscount || skuKit[0].whlpricedis
package/src/formatKit.js CHANGED
@@ -218,6 +218,7 @@ const parseKit = (bundle, market, status) => {
218
218
  kits.foreignOrderLimit = properties?.foreignOrderLimit || properties?.foreign_limit
219
219
  kits.taxClass = properties?.taxClass
220
220
  kits.unitPrice = properties?.unitPrice ?? null
221
+ kits.shippingRestrictedCountries = properties?.shippingRestrictedCountries || []
221
222
  const kitProducts = []
222
223
  const type = properties?.type === 'bundle' ? 'bundle' : 'kit'
223
224
  kits.type = type
@@ -76,6 +76,7 @@ const formatVariant = (parent) => {
76
76
  ) > -1,
77
77
  shadeable: parent?.shadeable || false,
78
78
  restrictedMarkets: parent?.restricted_markets || [],
79
+ shippingRestrictedCountries: parent?.shipping_restricted_countries || [],
79
80
  productType: parent?.sap_data?.product_type,
80
81
  primaryBrand: parent.sap_data?.primary_brand,
81
82
  brandFamily: parent?.sap_data?.brand_family,
package/src/helpers.js CHANGED
@@ -1211,19 +1211,19 @@ function mapUnitPrice(unitPrice) {
1211
1211
  return null
1212
1212
  }
1213
1213
 
1214
- const unitQuantity = unitPrice.unit_quantity ?? unitPrice.unitQuantity
1215
- const unitOfMeasure = unitPrice.unit_of_measure ?? unitPrice.unitOfMeasure
1214
+ const unitQuantity = unitPrice.unit_quantity !== undefined ? unitPrice.unit_quantity : unitPrice.unitQuantity
1215
+ const unitOfMeasure = unitPrice.unit_of_measure !== undefined ? unitPrice.unit_of_measure : unitPrice.unitOfMeasure
1216
1216
 
1217
- if (!Number.isInteger(unitQuantity) || unitQuantity <= 0) {
1217
+ if (unitQuantity != null && (!Number.isFinite(unitQuantity) || unitQuantity <= 0)) {
1218
1218
  return null
1219
1219
  }
1220
- if (typeof unitOfMeasure !== 'string' || unitOfMeasure.trim().length === 0) {
1220
+ if (typeof unitOfMeasure !== 'string' || unitOfMeasure.trimEnd().length === 0) {
1221
1221
  return null
1222
1222
  }
1223
1223
 
1224
1224
  return {
1225
1225
  unitQuantity,
1226
- unitOfMeasure
1226
+ unitOfMeasure: unitOfMeasure.trimEnd()
1227
1227
  }
1228
1228
  }
1229
1229
 
@@ -51,6 +51,7 @@ const transformBundle = (parent, homeUrl) => ({
51
51
  },
52
52
  taxClass: parent?.tax_class,
53
53
  unitPrice: helpers?.mapUnitPrice(parent?.unit_price),
54
+ shippingRestrictedCountries: parent?.shipping_restricted_countries || [],
54
55
  isExclusive: parent?.is_exclusive,
55
56
  foreignOrderLimit: parent?.foreign_limit,
56
57
  scanQualifiedCount: parent?.scan_qualified_count,