@nuskin/cs-product-lib 1.0.6-cx12-6632.2 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/cs-product-lib",
3
- "version": "1.0.6-cx12-6632.2",
3
+ "version": "1.0.7",
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
@@ -156,33 +156,33 @@ const csProduct = (props) => {
156
156
 
157
157
  const formatProductWithSchema = (products = []) => {
158
158
  return products?.map((product) => {
159
- const formatedProduct = formatProduct(product, homeUrl)
160
- formatedProduct.variants = formatedProduct?.variants?.map(
159
+ const formattedProduct = formatProduct(product, homeUrl)
160
+ formattedProduct.variants = formattedProduct?.variants?.map(
161
161
  (variant) => formatVariant(variant)
162
162
  )
163
- return formatedProduct
163
+ return formattedProduct
164
164
  })
165
165
  }
166
166
 
167
167
  const formatBundleWithSchema = (bundles = []) => {
168
168
  return bundles?.map((bundle) => {
169
- const formatedBundle = transformBundle(bundle, homeUrl)
169
+ const formattedBundle = transformBundle(bundle, homeUrl)
170
170
 
171
- formatedBundle.requiredProducts = formatedBundle?.requiredProducts?.map(
171
+ formattedBundle.requiredProducts = formattedBundle?.requiredProducts?.map(
172
172
  ({product, quantity}) => {
173
- const [formatedProduct] = formatProductWithSchema([product])
174
- return {product : formatedProduct, quantity}
173
+ const [formattedProduct] = formatProductWithSchema([product])
174
+ return {product : formattedProduct, quantity}
175
175
  }
176
176
  )
177
177
 
178
- formatedBundle.optionalProducts = formatedBundle?.optionalProducts?.map(
178
+ formattedBundle.optionalProducts = formattedBundle?.optionalProducts?.map(
179
179
  ({product, quantity}) => {
180
- const [formatedProduct] = formatProductWithSchema([product])
181
- return {product : formatedProduct, quantity}
180
+ const [formattedProduct] = formatProductWithSchema([product])
181
+ return {product : formattedProduct, quantity}
182
182
  }
183
183
  )
184
184
 
185
- return formatedBundle
185
+ return formattedBundle
186
186
  })
187
187
  }
188
188
 
@@ -419,10 +419,10 @@ const csProduct = (props) => {
419
419
 
420
420
  const getProductTranslations = async (locale) => {
421
421
  const translations = await getTranslations(locale)
422
- const formatedTranslations = translations.map((translate) =>
422
+ const formattedTranslations = translations.map((translate) =>
423
423
  formatTranslations(translate)
424
424
  )
425
- return formatedTranslations
425
+ return formattedTranslations
426
426
  }
427
427
 
428
428
  const publishedProducts = async ({ locale, skip = 0, limit = 50 } = {}) => {
package/src/formatKit.js CHANGED
@@ -91,6 +91,9 @@ const parseBundleAvailableQuantity = (product) => {
91
91
  const parseKit = (product, market) => {
92
92
  const kits = {}
93
93
  const [properties] = product || []
94
+ kits.id = properties?.id
95
+ kits.uid = properties?.uid
96
+ kits.title = properties?.title
94
97
  kits.description = properties?.description
95
98
  kits.availableChannels = properties.availableChannels
96
99
  kits.chargeShipping = properties.chargeShipping === 'true'
@@ -4,7 +4,7 @@ const { formatKit } = require('./formatKit')
4
4
 
5
5
  /* istanbul ignore next */
6
6
  const formatProduct = (parent, homeUrl) => {
7
- const formatedProduct = {
7
+ const formattedProduct = {
8
8
  // Each value is a function with a parameter 'parent' that is the current instance of a Product
9
9
  // ContentStack references need to be queried separately (ie: variants)
10
10
  id: parent.uid,
@@ -76,7 +76,7 @@ const formatProduct = (parent, homeUrl) => {
76
76
  upSellProductIds: helpers?.mapUpSellProductIds(parent),
77
77
  crossProductIds: helpers?.mapCrossProductIds(parent)
78
78
  }
79
- return formatKit(formatedProduct)
79
+ return formatKit(formattedProduct)
80
80
  }
81
81
 
82
82
  module.exports = {
@@ -4,7 +4,7 @@ const helpers = require('./helpers')
4
4
  const transformBundle = (parent, homeUrl) => ({
5
5
  id: parent.bundle_id,
6
6
  uid: parent.uid,
7
- title: parent.name,
7
+ title: parent.title,
8
8
  type: parent.type,
9
9
  requiredProducts: parent.required_products?.map((r) => ({
10
10
  product: r?.product?.[0],