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