@nuskin/cs-product-lib 1.0.27-cx12-8656.2 → 1.0.27
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 +1 -5
- package/src/formatKit.js +130 -66
- package/src/formatVariant.js +102 -108
- package/src/productStatus.js +0 -1
package/package.json
CHANGED
package/src/csProduct.js
CHANGED
|
@@ -132,9 +132,6 @@ const csProduct = (props) => {
|
|
|
132
132
|
validVariants.push({
|
|
133
133
|
...variant,
|
|
134
134
|
status: varStatus,
|
|
135
|
-
backorderQuantity: varStatus?.backordered ? varStatus?.availableQuantity : 0,
|
|
136
|
-
availableQuantity: varStatus?.backordered ? 0 : varStatus?.availableQuantity,
|
|
137
|
-
backorderedAvailableDate: varStatus?.backorderedAvailableDate || null,
|
|
138
135
|
marketData
|
|
139
136
|
})
|
|
140
137
|
}
|
|
@@ -546,8 +543,7 @@ const csProduct = (props) => {
|
|
|
546
543
|
getProductTranslations,
|
|
547
544
|
getBundle,
|
|
548
545
|
getBundles,
|
|
549
|
-
getCategoryPageTranslations
|
|
550
|
-
formatProductWithSchema
|
|
546
|
+
getCategoryPageTranslations
|
|
551
547
|
}
|
|
552
548
|
}
|
|
553
549
|
|
package/src/formatKit.js
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
|
-
const { isNullOrEmpty } = require('@nuskin/ns-common-lib')
|
|
1
|
+
const { isNullOrEmpty, isTrue } = require('@nuskin/ns-common-lib')
|
|
2
2
|
const moment = require('moment')
|
|
3
3
|
|
|
4
|
+
const parseStatus = (variant) => {
|
|
5
|
+
const dateFormat = 'YYYY-MM-DD'
|
|
6
|
+
|
|
7
|
+
if (variant?.type !== 'bundle' && variant?.type !== 'kit') {
|
|
8
|
+
return {
|
|
9
|
+
status: variant?.status?.status,
|
|
10
|
+
isBackordered: variant?.status?.isBackordered,
|
|
11
|
+
backorderedAvailableDate: variant?.status?.backorderedAvailableDate
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let isBackordered = false
|
|
16
|
+
let backorderedAvailableDate = null
|
|
17
|
+
if (variant?.type === 'kit') {
|
|
18
|
+
try {
|
|
19
|
+
/* eslint-disable no-unsafe-optional-chaining */
|
|
20
|
+
const latestBODate = Math.max(
|
|
21
|
+
...variant?.requiredProducts?.flatMap((a) =>
|
|
22
|
+
a?.product?.variants?.map(
|
|
23
|
+
(s) =>
|
|
24
|
+
Number(
|
|
25
|
+
new Date(s?.status?.backorderedAvailableDate)
|
|
26
|
+
) || 0
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
if (latestBODate) {
|
|
31
|
+
isBackordered = true
|
|
32
|
+
backorderedAvailableDate = moment(
|
|
33
|
+
new Date(latestBODate)
|
|
34
|
+
).format(dateFormat)
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
backorderedAvailableDate = null
|
|
38
|
+
}
|
|
39
|
+
} else if (variant?.type === 'bundle') {
|
|
40
|
+
try {
|
|
41
|
+
const latestBODate = Math.max(
|
|
42
|
+
...variant?.requiredProducts?.flatMap(
|
|
43
|
+
(a) =>
|
|
44
|
+
Number(
|
|
45
|
+
new Date(
|
|
46
|
+
a?.product?.variants[0]?.status?.backorderedAvailableDate
|
|
47
|
+
)
|
|
48
|
+
) || 0
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
if (latestBODate) {
|
|
52
|
+
isBackordered = true
|
|
53
|
+
backorderedAvailableDate = moment(
|
|
54
|
+
new Date(latestBODate)
|
|
55
|
+
).format(dateFormat)
|
|
56
|
+
}
|
|
57
|
+
} catch {
|
|
58
|
+
backorderedAvailableDate = null
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
// changed
|
|
63
|
+
status: variant?.status?.status,
|
|
64
|
+
isBackordered: isBackordered,
|
|
65
|
+
backorderedAvailableDate: backorderedAvailableDate
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
4
69
|
const parsePrice = (product = []) => {
|
|
5
70
|
const requiredProducts = !isNullOrEmpty(product)
|
|
6
71
|
? product?.map((p) => p?.requiredProducts).flat()
|
|
@@ -89,49 +154,36 @@ const parsePrice = (product = []) => {
|
|
|
89
154
|
return sumOfPriceAndPoints
|
|
90
155
|
}
|
|
91
156
|
|
|
92
|
-
const
|
|
93
|
-
const dateFormat = 'YYYY-MM-DD'
|
|
94
|
-
let maxQty = null;
|
|
95
|
-
let backOrderedQty = null;
|
|
96
|
-
let availableQty = null;
|
|
97
|
-
let quantities = [];
|
|
98
|
-
let availableQuantities = [];
|
|
99
|
-
let prodQty = 0;
|
|
100
|
-
let dates = [];
|
|
101
|
-
let latestBackOrderedDate = null;
|
|
157
|
+
const parseKitAvailableQuantity = (kit) => {
|
|
102
158
|
try {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
} catch
|
|
123
|
-
console.
|
|
124
|
-
|
|
125
|
-
backOrderedQty = 0;
|
|
126
|
-
availableQty = 0;
|
|
127
|
-
latestBackOrderedDate = null;
|
|
159
|
+
return (
|
|
160
|
+
Math.min(
|
|
161
|
+
...kit.flatMap((a) =>
|
|
162
|
+
a?.sku?.map((s) => s?.inventoryProperties?.atpQty)
|
|
163
|
+
)
|
|
164
|
+
) || 0
|
|
165
|
+
)
|
|
166
|
+
} catch {
|
|
167
|
+
return 0
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const parseBundleAvailableQuantity = (product) => {
|
|
172
|
+
try {
|
|
173
|
+
const { requiredProducts = [] } = !isNullOrEmpty(product) ? product : {}
|
|
174
|
+
const quantities = requiredProducts?.map((p) =>
|
|
175
|
+
p?.product?.variants?.map((a) => a?.availableQuantity)
|
|
176
|
+
)
|
|
177
|
+
return Math.min(...quantities) || 0
|
|
178
|
+
} catch {
|
|
179
|
+
console.log('some error in availableQuantity')
|
|
180
|
+
return 0
|
|
128
181
|
}
|
|
129
|
-
return {status: bundle?.status?.status, maxQty, backOrderedQty, availableQty, latestBackOrderedDate}
|
|
130
182
|
}
|
|
131
183
|
|
|
132
|
-
const parseKit = (
|
|
184
|
+
const parseKit = (product, market) => {
|
|
133
185
|
const kits = {}
|
|
134
|
-
const [properties] = !isNullOrEmpty(
|
|
186
|
+
const [properties] = !isNullOrEmpty(product) ? product : []
|
|
135
187
|
kits.id = properties?.id
|
|
136
188
|
if (properties?.type === 'kit' && properties?.legacy_sku) {
|
|
137
189
|
kits.id = properties?.legacy_sku
|
|
@@ -140,13 +192,14 @@ const parseKit = (bundle, market) => {
|
|
|
140
192
|
kits.title = properties?.title
|
|
141
193
|
kits.description = properties?.description
|
|
142
194
|
kits.availableChannels = properties?.availableChannels
|
|
143
|
-
kits.chargeShipping = properties?.chargeShipping
|
|
195
|
+
kits.chargeShipping = isTrue(properties?.chargeShipping)
|
|
144
196
|
kits.customerTypes = properties?.customerTypes
|
|
145
|
-
kits.dangerousGoods = properties?.dangerousGoods
|
|
146
|
-
kits.excludeFromSearch = properties?.excludeFromSearch
|
|
147
|
-
kits.isExclusive = properties?.isExclusive
|
|
197
|
+
kits.dangerousGoods = isTrue(properties?.dangerousGoods)
|
|
198
|
+
kits.excludeFromSearch = isTrue(properties?.excludeFromSearch)
|
|
199
|
+
kits.isExclusive = isTrue(properties?.isExclusive)
|
|
148
200
|
kits.marketAttributes = properties?.marketAttributes
|
|
149
|
-
|
|
201
|
+
kits.maxQuantity = (product?.inventoryProperties || {}).atpQty
|
|
202
|
+
const priceData = parsePrice(product)
|
|
150
203
|
kits.points = priceData?.points
|
|
151
204
|
kits.price = priceData?.price
|
|
152
205
|
kits.purchaseTypes = {
|
|
@@ -161,20 +214,35 @@ const parseKit = (bundle, market) => {
|
|
|
161
214
|
kits.grpDiscount = properties?.grpDiscount
|
|
162
215
|
kits.scanQualifiedCount = properties?.scanQualifiedCount
|
|
163
216
|
kits.taxClass = properties?.taxClass
|
|
217
|
+
// newVariant.slug = undefined
|
|
218
|
+
kits.status = parseStatus(properties)
|
|
219
|
+
if ((kits?.status || {})?.status === 'active')
|
|
220
|
+
kits.status.status = 'sellable'
|
|
164
221
|
const kitProducts = []
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
222
|
+
if (properties?.type === 'kit' && product?.kit) {
|
|
223
|
+
kits.type = 'kit'
|
|
224
|
+
kits.availableQuantity = parseKitAvailableQuantity(product?.kit)
|
|
225
|
+
for (const kit of product?.kit || []) {
|
|
226
|
+
const kitProduct = formatKit(kit, market)
|
|
227
|
+
kitProduct.id = kit?.identifier
|
|
228
|
+
kitProducts.push({
|
|
229
|
+
product: kitProduct,
|
|
230
|
+
quantity: (kit?.properties || {})?.quantity || 0,
|
|
231
|
+
isMandatory: true
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
} else if (
|
|
235
|
+
properties?.type === 'bundle' ||
|
|
236
|
+
(properties?.type === 'kit' && properties?.requiredProducts)
|
|
237
|
+
) {
|
|
238
|
+
kits.type = properties?.type
|
|
239
|
+
kits.availableQuantity = parseBundleAvailableQuantity(properties)
|
|
174
240
|
for (const kit of properties?.requiredProducts || []) {
|
|
175
241
|
if (kit?.product) {
|
|
242
|
+
const kitProduct = formatKit(kit?.product, market)
|
|
243
|
+
kitProduct.id = kit?.product?.id
|
|
176
244
|
kitProducts?.push({
|
|
177
|
-
product:
|
|
245
|
+
product: kitProduct,
|
|
178
246
|
quantity: kit?.quantity || 0,
|
|
179
247
|
isMandatory: true
|
|
180
248
|
})
|
|
@@ -182,24 +250,17 @@ const parseKit = (bundle, market) => {
|
|
|
182
250
|
}
|
|
183
251
|
for (const kit of properties?.optionalProducts || []) {
|
|
184
252
|
if (kit?.product) {
|
|
253
|
+
const kitProduct = formatKit(kit?.product, market)
|
|
254
|
+
kitProduct.id = kit?.product?.id
|
|
185
255
|
kitProducts?.push({
|
|
186
|
-
product:
|
|
256
|
+
product: kitProduct,
|
|
187
257
|
quantity: kit?.quantity || 0,
|
|
188
258
|
isMandatory: false
|
|
189
259
|
})
|
|
190
260
|
}
|
|
191
261
|
}
|
|
192
|
-
} else if (type === 'kit') {
|
|
193
|
-
for (const kit of properties?.requiredProducts || []) {
|
|
194
|
-
kitProducts.push({
|
|
195
|
-
product: formatKit(kit?.product, market),
|
|
196
|
-
quantity: kit?.quantity || 0,
|
|
197
|
-
isMandatory: true
|
|
198
|
-
})
|
|
199
|
-
}
|
|
200
262
|
}
|
|
201
263
|
kits.kitProducts = kitProducts
|
|
202
|
-
if ((kits?.status || {})?.status === 'active') kits.status.status = 'sellable'
|
|
203
264
|
return kits
|
|
204
265
|
}
|
|
205
266
|
|
|
@@ -212,7 +273,6 @@ const formatKit = (product, market) => {
|
|
|
212
273
|
if (['kit', 'bundle'].includes(product?.type)) {
|
|
213
274
|
kit = parseKit(product?.bundle, market)
|
|
214
275
|
}
|
|
215
|
-
|
|
216
276
|
return {
|
|
217
277
|
...product,
|
|
218
278
|
bundle: kit
|
|
@@ -221,5 +281,9 @@ const formatKit = (product, market) => {
|
|
|
221
281
|
|
|
222
282
|
module.exports = {
|
|
223
283
|
formatKit,
|
|
224
|
-
parseKit
|
|
284
|
+
parseKit,
|
|
285
|
+
parseBundleAvailableQuantity,
|
|
286
|
+
parseKitAvailableQuantity,
|
|
287
|
+
parsePrice,
|
|
288
|
+
parseStatus
|
|
225
289
|
}
|
package/src/formatVariant.js
CHANGED
|
@@ -2,117 +2,111 @@ const helpers = require('./helpers')
|
|
|
2
2
|
const _ = require('lodash')
|
|
3
3
|
const entities = require('entities')
|
|
4
4
|
|
|
5
|
-
const formatVariant = (parent) => {
|
|
6
|
-
const isBackOrdered = _.get(parent, 'defaults.status.backordered', null);
|
|
7
|
-
const backOrderedDate = _.get(parent, 'defaults.status.backorderedAvailableDate', null);
|
|
8
|
-
const preliminaryAvailableQty = _.get(parent, 'defaults.status.availableQuantity', 0);
|
|
9
|
-
const availableQty = isBackOrdered ? 0 : preliminaryAvailableQty;
|
|
10
|
-
const backOrderedQty = isBackOrdered ? availableQty : 0;
|
|
11
|
-
|
|
5
|
+
const formatVariant = (parent) => ({
|
|
12
6
|
// Each value is a function with a parameter 'parent' that is the current instance of a Variant
|
|
13
7
|
// ContentStack references need to be queried separately
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
description
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
8
|
+
id: parent?.uid,
|
|
9
|
+
globalId: parent?.sap_data?.global_id,
|
|
10
|
+
sku: helpers?.getBestSkuData(parent)?.sku,
|
|
11
|
+
slug: parent?.slug,
|
|
12
|
+
size: parent?.size,
|
|
13
|
+
variantLabel: parent?.select_label,
|
|
14
|
+
variantColor: parent?.select_color,
|
|
15
|
+
title: parent?.name || parent?.defaults?.name,
|
|
16
|
+
salesLabel: parent?.sales_label,
|
|
17
|
+
salesText: parent?.sales_text,
|
|
18
|
+
description: entities?.decodeHTML(
|
|
19
|
+
parent?.short_description_override || parent?.defaults?.description || ''
|
|
20
|
+
),
|
|
21
|
+
salesDisclaimer: helpers?.mapSalesDisclaimer(parent?.sales_disclaimer),
|
|
22
|
+
nettoWeight: parent?.netto_weight,
|
|
23
|
+
productImages: helpers?.mapProductImages(parent),
|
|
24
|
+
isExclusive: parent?.is_exclusive,
|
|
25
|
+
pricingJson: JSON.stringify(parent?.defaults?.status?.pricing) || null,
|
|
26
|
+
price: helpers?.mapPrice(parent),
|
|
27
|
+
points: helpers?.mapPoints(parent),
|
|
28
|
+
availableQuantity: _.get(parent, 'defaults.status.availableQuantity', 0),
|
|
29
|
+
maxQuantity: _.get(parent, 'defaults.status.maxQuantity', 0),
|
|
30
|
+
status: {
|
|
31
|
+
status: _.get(parent, 'defaults.status.status.retail', null),
|
|
32
|
+
retail: _.get(parent, 'defaults.status.status.retail', null),
|
|
33
|
+
wholesale: _.get(parent, 'defaults.status.status.wholesale', null),
|
|
34
|
+
isBackordered: _.get(parent, 'defaults.status.backordered', null),
|
|
35
|
+
backorderedAvailableDate: _.get(
|
|
36
|
+
parent,
|
|
37
|
+
'defaults.status.backorderedAvailableDate',
|
|
38
|
+
''
|
|
39
|
+
)
|
|
40
|
+
},
|
|
41
|
+
csStatus: helpers?.mapCsStatus(parent),
|
|
42
|
+
purchaseTypes: helpers?.mapPurchaseTypes(parent),
|
|
43
|
+
features: helpers?.mapFeatures(parent),
|
|
44
|
+
productDetails: helpers?.mapProductDetails(parent),
|
|
45
|
+
ingredients: helpers?.mapIngredients(
|
|
46
|
+
parent.ingredients_override,
|
|
47
|
+
parent.legacy_ingredients
|
|
48
|
+
),
|
|
49
|
+
benefitsAndFeatures: helpers?.mapBenefitsAndFeatures(parent),
|
|
50
|
+
results: helpers?.mapResults(parent),
|
|
51
|
+
usage: helpers?.mapUsage(parent, parent.legacy_usage),
|
|
52
|
+
resources: helpers?.mapResources(parent),
|
|
53
|
+
faqs: helpers?.mapFaqs(parent),
|
|
54
|
+
disclaimers: parent?.disclaimers || [],
|
|
55
|
+
disclaimerWarnings: helpers?.mapDisclaimerWarnings(
|
|
56
|
+
parent.disclaimer_warnings
|
|
57
|
+
),
|
|
58
|
+
matchingVariant:
|
|
59
|
+
parent.sap_data?.sku_data?.findIndex((s) =>
|
|
60
|
+
parent.searchedSkus.includes(s.sku)
|
|
61
|
+
) > -1,
|
|
62
|
+
shadeable: parent?.shadeable || false,
|
|
63
|
+
restrictedMarkets: parent?.restricted_markets || [],
|
|
64
|
+
productType: parent?.sap_data?.product_type,
|
|
65
|
+
primaryBrand: parent.sap_data?.primary_brand,
|
|
66
|
+
brandFamily: parent?.sap_data?.brand_family,
|
|
67
|
+
marketAttributes: {
|
|
68
|
+
discount: _.get(
|
|
69
|
+
parent,
|
|
70
|
+
'defaults.status.marketAttributes.discount',
|
|
71
|
+
null
|
|
53
72
|
),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
updatedBy: parent.updated_by || '',
|
|
92
|
-
createdAt: parent.created_at || '',
|
|
93
|
-
createdBy: parent.created_by || '',
|
|
94
|
-
locale: parent.locale || ''
|
|
95
|
-
},
|
|
96
|
-
searchKeywords: parent?.search_keywords,
|
|
97
|
-
excludeFromSearch: parent?.exclude_from_search || helpers?.mapCsStatus(parent).status === 'discontinued' || _.get(parent, 'defaults.status.status.retail', null) === 'DISCONTINUED',
|
|
98
|
-
customerTypes: helpers?.getBestSkuData(parent)?.status_selections
|
|
99
|
-
?.customer_types,
|
|
100
|
-
availableChannels: helpers?.getBestSkuData(parent)?.status_selections
|
|
101
|
-
?.display_channels,
|
|
102
|
-
displayChannels: helpers?.getBestSkuData(parent)?.status_selections
|
|
103
|
-
?.display_channels,
|
|
104
|
-
scanQualifiedCount: helpers?.getBestSkuData(parent)?.status_selections
|
|
105
|
-
?.scan_qualify_count,
|
|
106
|
-
scanQualifyCount: helpers?.getBestSkuData(parent)?.status_selections
|
|
107
|
-
?.scan_qualify_count,
|
|
108
|
-
chargeShipping: helpers?.getBestSkuData(parent)?.charge_shipping,
|
|
109
|
-
dangerousGoods: helpers?.getBestSkuData(parent)?.dangerous_goods,
|
|
110
|
-
channels: helpers?.getBestSkuData(parent)?.channels,
|
|
111
|
-
foreignLimit: helpers?.getBestSkuData(parent)?.foreign_limit,
|
|
112
|
-
foreignOrderLimit: helpers?.getBestSkuData(parent)?.foreign_limit,
|
|
113
|
-
orderType: parent.sap_data?.order_type
|
|
114
|
-
}
|
|
115
|
-
}
|
|
73
|
+
redeem: _.get(parent, 'defaults.status.marketAttributes.redeem', null),
|
|
74
|
+
earn: _.get(parent, 'defaults.status.marketAttributes.earn', null)
|
|
75
|
+
},
|
|
76
|
+
legacyBenefits: parent.legacy_benefits,
|
|
77
|
+
legacyLongDescription: parent.legacy_long_description,
|
|
78
|
+
legacyResources: parent.legacy_resources,
|
|
79
|
+
legacyUsage: parent.legacy_usage,
|
|
80
|
+
legacyIngredients: parent.legacy_ingredients,
|
|
81
|
+
legacyImages: parent.legacy_images || [],
|
|
82
|
+
legacyYouTube: parent.legacy_youtube_video,
|
|
83
|
+
csAtts: {
|
|
84
|
+
version: parent._version || 0,
|
|
85
|
+
updatedAt: parent.updated_at || '',
|
|
86
|
+
updatedBy: parent.updated_by || '',
|
|
87
|
+
createdAt: parent.created_at || '',
|
|
88
|
+
createdBy: parent.created_by || '',
|
|
89
|
+
locale: parent.locale || ''
|
|
90
|
+
},
|
|
91
|
+
searchKeywords: parent?.search_keywords,
|
|
92
|
+
excludeFromSearch: parent?.exclude_from_search || helpers?.mapCsStatus(parent).status === 'discontinued' || _.get(parent, 'defaults.status.status.retail', null) === 'DISCONTINUED',
|
|
93
|
+
customerTypes: helpers?.getBestSkuData(parent)?.status_selections
|
|
94
|
+
?.customer_types,
|
|
95
|
+
availableChannels: helpers?.getBestSkuData(parent)?.status_selections
|
|
96
|
+
?.display_channels,
|
|
97
|
+
displayChannels: helpers?.getBestSkuData(parent)?.status_selections
|
|
98
|
+
?.display_channels,
|
|
99
|
+
scanQualifiedCount: helpers?.getBestSkuData(parent)?.status_selections
|
|
100
|
+
?.scan_qualify_count,
|
|
101
|
+
scanQualifyCount: helpers?.getBestSkuData(parent)?.status_selections
|
|
102
|
+
?.scan_qualify_count,
|
|
103
|
+
chargeShipping: helpers?.getBestSkuData(parent)?.charge_shipping,
|
|
104
|
+
dangerousGoods: helpers?.getBestSkuData(parent)?.dangerous_goods,
|
|
105
|
+
channels: helpers?.getBestSkuData(parent)?.channels,
|
|
106
|
+
foreignLimit: helpers?.getBestSkuData(parent)?.foreign_limit,
|
|
107
|
+
foreignOrderLimit: helpers?.getBestSkuData(parent)?.foreign_limit,
|
|
108
|
+
orderType: parent.sap_data?.order_type
|
|
109
|
+
})
|
|
116
110
|
|
|
117
111
|
module.exports = {
|
|
118
112
|
formatVariant
|
package/src/productStatus.js
CHANGED
|
@@ -45,7 +45,6 @@ async function getProductStatus(skus, locale, homeUrl, awsBase, clientId) {
|
|
|
45
45
|
const overrideMaxQuantity = marketConfig.skuMaxQty
|
|
46
46
|
? marketConfig.skuMaxQty[skus[i]]
|
|
47
47
|
: undefined
|
|
48
|
-
// @TODO - Update this code when we update our config for minimum availableQuantity in CS
|
|
49
48
|
const availableQuantity =
|
|
50
49
|
productStatus.availableQuantity < 999
|
|
51
50
|
? productStatus.availableQuantity
|