@nuskin/cs-product-lib 1.0.21 → 1.0.22-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,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/cs-product-lib",
3
- "version": "1.0.21",
3
+ "version": "1.0.22-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": {
package/src/formatKit.js CHANGED
@@ -154,6 +154,8 @@ const parseKit = (product, market) => {
154
154
  if (properties?.type === 'kit' && product?.kit) {
155
155
  kits.type = 'kit'
156
156
  kits.availableQuantity = parseKitAvailableQuantity(product?.kit)
157
+ // kits.backorderQuantity = @TODO
158
+ // kits.backorderedAvailableDate = @TODO
157
159
  for (const kit of product?.kit || []) {
158
160
  const kitProduct = formatKit(kit, market)
159
161
  kitProduct.id = kit?.identifier
@@ -162,6 +164,8 @@ const parseKit = (product, market) => {
162
164
  } else if (properties?.type === 'bundle' || (properties?.type === 'kit' && properties?.requiredProducts)) {
163
165
  kits.type = properties?.type
164
166
  kits.availableQuantity = parseBundleAvailableQuantity(properties)
167
+ // kits.backorderQuantity = @TODO
168
+ // kits.backorderedAvailableDate = @TODO
165
169
  for (const kit of properties?.requiredProducts || []) {
166
170
  if (kit?.product) {
167
171
  const kitProduct = formatKit(kit?.product, market)
@@ -25,18 +25,16 @@ const formatVariant = (parent) => ({
25
25
  pricingJson: JSON.stringify(parent?.defaults?.status?.pricing) || null,
26
26
  price: helpers?.mapPrice(parent),
27
27
  points: helpers?.mapPoints(parent),
28
- availableQuantity: _.get(parent, 'defaults.status.availableQuantity', 0),
28
+ backorderedAvailableDate: _.get(parent, 'defaults.status.backorderedAvailableDate', null),
29
+ backorderQuantity: _.get(parent, 'defaults.status.backordered', null) ? _.get(parent, 'defaults.status.availableQuantity', 0) : 0,
30
+ availableQuantity: _.get(parent, 'defaults.status.backordered', null) ? 0 : _.get(parent, 'defaults.status.availableQuantity', 0),
29
31
  maxQuantity: _.get(parent, 'defaults.status.maxQuantity', 0),
30
32
  status: {
31
33
  status: _.get(parent, 'defaults.status.status.retail', null),
32
34
  retail: _.get(parent, 'defaults.status.status.retail', null),
33
35
  wholesale: _.get(parent, 'defaults.status.status.wholesale', null),
34
36
  isBackordered: _.get(parent, 'defaults.status.backordered', null),
35
- backorderedAvailableDate: _.get(
36
- parent,
37
- 'defaults.status.backorderedAvailableDate',
38
- ''
39
- )
37
+ backorderedAvailableDate: _.get(parent, 'defaults.status.backorderedAvailableDate', null)
40
38
  },
41
39
  csStatus: helpers?.mapCsStatus(parent),
42
40
  purchaseTypes: helpers?.mapPurchaseTypes(parent),