@nuskin/cs-product-lib 1.5.2-nge1-1050.1 → 1.5.2
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/formatKit.js +0 -2
- package/src/formatVariant.js +1 -2
- package/src/helpers.js +0 -16
- package/src/transformBundle.js +5 -5
package/package.json
CHANGED
package/src/formatKit.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const { isNullOrEmpty, isTrue } = require('@nuskin/ns-common-lib');
|
|
2
2
|
const { formatDiscounts } = require('./helpers/formatDiscounts');
|
|
3
|
-
const { mapUnitPrice } = require('./helpers');
|
|
4
3
|
const moment = require('moment')
|
|
5
4
|
|
|
6
5
|
const parsePrice = (product = [], status = {}) => {
|
|
@@ -218,7 +217,6 @@ const parseKit = (bundle, market, status) => {
|
|
|
218
217
|
kits.scanQualifiedCount = properties?.scanQualifiedCount
|
|
219
218
|
kits.foreignOrderLimit = properties?.foreignOrderLimit || properties?.foreign_limit
|
|
220
219
|
kits.taxClass = properties?.taxClass
|
|
221
|
-
kits.unitPrice = mapUnitPrice(properties)
|
|
222
220
|
const kitProducts = []
|
|
223
221
|
const type = properties?.type === 'bundle' ? 'bundle' : 'kit'
|
|
224
222
|
kits.type = type
|
package/src/formatVariant.js
CHANGED
|
@@ -120,8 +120,7 @@ const formatVariant = (parent) => {
|
|
|
120
120
|
foreignOrderLimit: helpers?.getBestSkuData(parent)?.foreign_limit,
|
|
121
121
|
orderType: parent.sap_data?.order_type,
|
|
122
122
|
discontinuedSkuReplacement: helpers?.mapDiscontinuedSkuReplacement(parent)?.sku,
|
|
123
|
-
prysmData: helpers?.mapPrysmData(parent)
|
|
124
|
-
unitPrice: helpers?.mapUnitPrice(parent)
|
|
123
|
+
prysmData: helpers?.mapPrysmData(parent)
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
126
|
|
package/src/helpers.js
CHANGED
|
@@ -1167,21 +1167,6 @@ function mapFaqs(product) {
|
|
|
1167
1167
|
return []
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
1170
|
-
function mapUnitPrice(product) {
|
|
1171
|
-
if (product?.unit_price) {
|
|
1172
|
-
let jsonUnitPrice = JSON.stringify(product.unit_price);
|
|
1173
|
-
if (jsonUnitPrice.length < 10000) {
|
|
1174
|
-
return {
|
|
1175
|
-
unitQuantity: product.unit_price.unit_quantity ?? null,
|
|
1176
|
-
unitOfMeasure: product.unit_price.unit_of_measure ?? null
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
// unit price content exceeds character limit for products
|
|
1180
|
-
return null
|
|
1181
|
-
}
|
|
1182
|
-
return null
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
1170
|
function isTopCategory(category, allTopCategories){
|
|
1186
1171
|
return Array.isArray(allTopCategories) && allTopCategories.some(cat => cat.id === category.category_id);
|
|
1187
1172
|
}
|
|
@@ -1263,7 +1248,6 @@ module.exports = {
|
|
|
1263
1248
|
parseLocale,
|
|
1264
1249
|
reorderLocale,
|
|
1265
1250
|
mapFaqs,
|
|
1266
|
-
mapUnitPrice,
|
|
1267
1251
|
createMarkdownFromRTE,
|
|
1268
1252
|
benefitsToMarkdown,
|
|
1269
1253
|
mapActiveEventDisclaimer,
|
package/src/transformBundle.js
CHANGED
|
@@ -42,12 +42,12 @@ const transformBundle = (parent, homeUrl) => ({
|
|
|
42
42
|
id: subcategory.category_id
|
|
43
43
|
}))
|
|
44
44
|
})),
|
|
45
|
-
availableChannels: parent?.product_status
|
|
46
|
-
customerTypes: parent?.product_status
|
|
45
|
+
availableChannels: parent?.product_status?.display_channels,
|
|
46
|
+
customerTypes: parent?.product_status?.customer_types,
|
|
47
47
|
status: {
|
|
48
|
-
status: parent?.product_status
|
|
49
|
-
wholesale: parent?.product_status
|
|
50
|
-
retail: parent?.product_status
|
|
48
|
+
status: parent?.product_status?.status,
|
|
49
|
+
wholesale: parent?.product_status?.status,
|
|
50
|
+
retail: parent?.product_status?.status
|
|
51
51
|
},
|
|
52
52
|
taxClass: parent?.tax_class,
|
|
53
53
|
isExclusive: parent?.is_exclusive,
|