@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 +1 -1
- package/src/formatKit.js +4 -0
- package/src/formatVariant.js +4 -6
package/package.json
CHANGED
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)
|
package/src/formatVariant.js
CHANGED
|
@@ -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
|
-
|
|
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),
|