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