@nuskin/cs-product-lib 1.0.7 → 1.0.8
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 +1 -1
- package/src/csProduct.js +6 -2
- package/src/formatKit.js +10 -6
package/package.json
CHANGED
package/src/csProduct.js
CHANGED
|
@@ -170,8 +170,12 @@ const csProduct = (props) => {
|
|
|
170
170
|
|
|
171
171
|
formattedBundle.requiredProducts = formattedBundle?.requiredProducts?.map(
|
|
172
172
|
({product, quantity}) => {
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
if (product) {
|
|
174
|
+
const [formattedProduct] = formatProductWithSchema([product])
|
|
175
|
+
return {product : formattedProduct, quantity}
|
|
176
|
+
} else {
|
|
177
|
+
return {}
|
|
178
|
+
}
|
|
175
179
|
}
|
|
176
180
|
)
|
|
177
181
|
|
package/src/formatKit.js
CHANGED
|
@@ -134,14 +134,18 @@ const parseKit = (product, market) => {
|
|
|
134
134
|
kits.type = 'bundle'
|
|
135
135
|
kits.availableQuantity = parseBundleAvailableQuantity(properties)
|
|
136
136
|
for (const kit of properties?.requiredProducts || []) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
if (kit.product) {
|
|
138
|
+
const kitProduct = formatKit(kit?.product, market)
|
|
139
|
+
kitProduct.id = kit.product.id
|
|
140
|
+
kitProducts.push({product: kitProduct, quantity: kit?.quantity || 0, isMandatory:true})
|
|
141
|
+
}
|
|
140
142
|
}
|
|
141
143
|
for (const kit of properties?.optionalProducts || []) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
if (kit.product) {
|
|
145
|
+
const kitProduct = formatKit(kit?.product, market)
|
|
146
|
+
kitProduct.id = kit.product.id
|
|
147
|
+
kitProducts.push({product: kitProduct, quantity: kit?.quantity || 0, isMandatory:false})
|
|
148
|
+
}
|
|
145
149
|
}
|
|
146
150
|
}
|
|
147
151
|
kits.kitProducts = kitProducts
|