@nuskin/product-components 3.17.6 → 3.17.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/docs/CHANGELOG.md +1 -1
- package/package.json +1 -1
- package/services/EQPromotionService.js +32 -5
package/docs/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
## [3.17.
|
|
1
|
+
## [3.17.7](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.17.6...v3.17.7) (2024-08-05)
|
package/package.json
CHANGED
|
@@ -55,18 +55,45 @@ const buildPayload = product => {
|
|
|
55
55
|
const skus = [];
|
|
56
56
|
if (product && product.childSkus) {
|
|
57
57
|
product.childSkus.forEach(childSku => {
|
|
58
|
-
if (
|
|
58
|
+
if (
|
|
59
|
+
childSku.type === "MANDATORY" &&
|
|
60
|
+
!skus.some(sku => sku.productId === childSku.productId)
|
|
61
|
+
) {
|
|
59
62
|
skus.push({
|
|
60
|
-
skuId:
|
|
61
|
-
selectedVariants !== null && selectedVariants[childSku.productId]
|
|
62
|
-
? selectedVariants[childSku.productId]
|
|
63
|
-
: childSku.skuId,
|
|
63
|
+
skuId: childSku.skuId,
|
|
64
64
|
productId: childSku.productId,
|
|
65
65
|
type: "bundle",
|
|
66
66
|
quantity: childSku.skuQuantity
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
+
|
|
71
|
+
if (selectedVariants !== null) {
|
|
72
|
+
for (const productId in selectedVariants) {
|
|
73
|
+
let isOptionalProduct = true;
|
|
74
|
+
skus.forEach(finalSku => {
|
|
75
|
+
if (finalSku.productId === productId) {
|
|
76
|
+
isOptionalProduct = false;
|
|
77
|
+
finalSku.skuId = selectedVariants[productId];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
if (isOptionalProduct) {
|
|
82
|
+
// this means this is optional product
|
|
83
|
+
const optionalProduct = product.childSkus.filter(
|
|
84
|
+
childSku => childSku.productId === productId
|
|
85
|
+
)[0];
|
|
86
|
+
if (optionalProduct) {
|
|
87
|
+
skus.push({
|
|
88
|
+
skuId: selectedVariants[productId],
|
|
89
|
+
productId: optionalProduct.productId,
|
|
90
|
+
type: "bundle",
|
|
91
|
+
quantity: optionalProduct.skuQuantity
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
70
97
|
}
|
|
71
98
|
|
|
72
99
|
payload.skus = skus;
|